27 #include "libavutil/ffversion.h"
104 #define SECTION_MAX_NB_CHILDREN 10
110 #define SECTION_FLAG_IS_WRAPPER 1
111 #define SECTION_FLAG_IS_ARRAY 2
112 #define SECTION_FLAG_HAS_VARIABLE_FIELDS 4
239 union {
double d;
long long int i; }
val;
253 vald = vali = uv.
val.
i;
260 mins = (int)secs / 60;
261 secs = secs - mins * 60;
264 snprintf(buf, buf_size,
"%d:%02d:%09.6f", hours, mins, secs);
266 const char *prefix_string =
"";
272 index = (
long long int) (
log2(vald)) / 10;
274 vald /=
exp2(index * 10);
277 index = (
long long int) (log10(vald)) / 3;
279 vald /= pow(10, index * 3);
286 snprintf(buf, buf_size,
"%f", vald);
288 snprintf(buf, buf_size,
"%lld", vali);
300 #define WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS 1
301 #define WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER 2
326 #define SECTION_MAX_NB_LEVELS 10
362 #define OFFSET(x) offsetof(WriterContext, x)
365 {
"string_validation",
"set string validation mode",
367 {
"sv",
"set string validation mode",
372 {
"string_validation_replacement",
"set string validation replacement string",
OFFSET(string_validation_replacement),
AV_OPT_TYPE_STRING, {.str=
""}},
373 {
"svr",
"set string validation replacement string",
OFFSET(string_validation_replacement),
AV_OPT_TYPE_STRING, {.str=
"\xEF\xBF\xBD"}},
400 if ((*wctx)->writer->uninit)
401 (*wctx)->writer->uninit(*wctx);
404 if ((*wctx)->writer->priv_class)
415 for (i = 0; i < ubuf_size; i++)
421 const struct section *sections,
int nb_sections)
436 (*wctx)->writer = writer;
439 (*wctx)->nb_sections = nb_sections;
444 void *priv_ctx = (*wctx)->priv;
455 av_log(*wctx,
AV_LOG_ERROR,
"Failed to parse option string '%s' provided to writer context\n", args);
462 av_log(*wctx,
AV_LOG_ERROR,
"Failed to set option '%s' with value '%s' provided to writer context\n",
474 const uint8_t *p = (*wctx)->string_validation_replacement;
475 const uint8_t *endp = p + strlen(p);
479 ret =
av_utf8_decode(&code, &p, endp, (*wctx)->string_validation_utf8_flags);
485 "Invalid UTF8 sequence %s found in string validation replace '%s'\n",
486 bp.str, (*wctx)->string_validation_replacement);
495 if ((*wctx)->writer->init)
496 ret = (*wctx)->writer->init(*wctx);
510 int parent_section_id;
513 parent_section_id = wctx->
level ?
534 int parent_section_id = wctx->
level ?
549 const char *key,
long long int val)
563 int invalid_chars_nb = 0,
ret = 0;
567 endp = src + strlen(src);
568 for (p = (
uint8_t *)src; *p;) {
578 "Invalid UTF-8 sequence %s found in string '%s'\n", bp.str, src);
588 "Invalid UTF-8 sequence found in string '%s'\n", src);
605 "%d invalid UTF-8 sequence(s) found in string '%s', replaced with '%s'\n",
614 #define PRINT_STRING_OPT 1
615 #define PRINT_STRING_VALIDATE 2
618 const char *key,
const char *
val,
int flags)
631 if (ret < 0)
goto end;
633 if (ret < 0)
goto end;
638 "Invalid key=value string combination %s=%s in section %s\n",
663 int64_t ts,
const AVRational *time_base,
int is_duration)
667 if ((!is_duration && ts ==
AV_NOPTS_VALUE) || (is_duration && ts == 0)) {
670 double d = ts *
av_q2d(*time_base);
681 if ((!is_duration && ts ==
AV_NOPTS_VALUE) || (is_duration && ts == 0)) {
699 for (i = 0; i < l; i++) {
705 for (i = 0; i < l; i++)
726 p = buf + strlen(buf);
733 int columns,
int bytes,
int offset_add)
742 l =
FFMIN(size, columns);
743 for (i = 0; i < l; i++) {
744 if (bytes == 1)
av_bprintf(&bp, format, *data);
751 offset += offset_add;
757 #define MAX_REGISTERED_WRITERS_NB 64
763 static int next_registered_writer_idx = 0;
768 registered_writers[next_registered_writer_idx++] = writer;
776 for (i = 0; registered_writers[
i]; i++)
777 if (!strcmp(registered_writers[i]->name, name))
778 return registered_writers[
i];
786 #define DEFINE_WRITER_CLASS(name) \
787 static const char *name##_get_name(void *ctx) \
791 static const AVClass name##_class = { \
792 .class_name = #name, \
793 .item_name = name##_get_name, \
794 .option = name##_options \
807 #define OFFSET(x) offsetof(DefaultContext, x)
810 {
"noprint_wrappers",
"do not print headers and footers",
OFFSET(noprint_wrappers),
AV_OPT_TYPE_INT, {.i64=0}, 0, 1 },
811 {
"nw",
"do not print headers and footers",
OFFSET(noprint_wrappers),
AV_OPT_TYPE_INT, {.i64=0}, 0, 1 },
823 for (i = 0; src[i] && i < dst_size-1; i++)
834 const struct section *parent_section = wctx->
level ?
838 if (parent_section &&
873 printf(
"%s\n", value);
882 printf(
"%lld\n", value);
893 .priv_class = &default_class,
901 static const char *
c_escape_str(AVBPrint *dst,
const char *
src,
const char sep,
void *log_ctx)
905 for (p = src; *p; p++) {
907 case '\b':
av_bprintf(dst,
"%s",
"\\b");
break;
908 case '\f':
av_bprintf(dst,
"%s",
"\\f");
break;
909 case '\n':
av_bprintf(dst,
"%s",
"\\n");
break;
910 case '\r':
av_bprintf(dst,
"%s",
"\\r");
break;
911 case '\\':
av_bprintf(dst,
"%s",
"\\\\");
break;
924 static const char *
csv_escape_str(AVBPrint *dst,
const char *
src,
const char sep,
void *log_ctx)
926 char meta_chars[] = { sep,
'"',
'\n',
'\r',
'\0' };
927 int needs_quoting = !!src[strcspn(src, meta_chars)];
932 for (; *
src; src++) {
954 const char * (*escape_str)(AVBPrint *dst,
const char *
src,
const char sep,
void *log_ctx);
961 #define OFFSET(x) offsetof(CompactContext, x)
982 av_log(wctx,
AV_LOG_ERROR,
"Item separator '%s' specified, but must contain a single character\n",
1003 const struct section *parent_section = wctx->
level ?
1045 if (!compact->
nokey)
1057 if (!compact->
nokey)
1059 printf(
"%lld", value);
1071 .priv_class = &compact_class,
1077 #define OFFSET(x) offsetof(CompactContext, x)
1102 .priv_class = &csv_class,
1115 #define OFFSET(x) offsetof(FlatContext, x)
1120 {
"hierarchical",
"specify if the section specification should be hierarchical",
OFFSET(hierarchical),
AV_OPT_TYPE_INT, {.i64=1}, 0, 1 },
1121 {
"h",
"specify if the section specification should be hierarchical",
OFFSET(hierarchical),
AV_OPT_TYPE_INT, {.i64=1}, 0, 1 },
1131 if (strlen(flat->
sep_str) != 1) {
1132 av_log(wctx,
AV_LOG_ERROR,
"Item separator '%s' specified, but must contain a single character\n",
1145 for (p = src; *p; p++) {
1146 if (!((*p >=
'0' && *p <=
'9') ||
1147 (*p >=
'a' && *p <=
'z') ||
1148 (*p >=
'A' && *p <=
'Z')))
1160 for (p = src; *p; p++) {
1162 case '\n':
av_bprintf(dst,
"%s",
"\\n");
break;
1163 case '\r':
av_bprintf(dst,
"%s",
"\\r");
break;
1164 case '\\':
av_bprintf(dst,
"%s",
"\\\\");
break;
1165 case '"':
av_bprintf(dst,
"%s",
"\\\"");
break;
1166 case '`':
av_bprintf(dst,
"%s",
"\\`");
break;
1167 case '$':
av_bprintf(dst,
"%s",
"\\$");
break;
1179 const struct section *parent_section = wctx->
level ?
1184 if (!parent_section)
1226 .priv_class = &flat_class,
1237 #define OFFSET(x) offsetof(INIContext, x)
1240 {
"hierarchical",
"specify if the section specification should be hierarchical",
OFFSET(hierarchical),
AV_OPT_TYPE_INT, {.i64=1}, 0, 1 },
1241 {
"h",
"specify if the section specification should be hierarchical",
OFFSET(hierarchical),
AV_OPT_TYPE_INT, {.i64=1}, 0, 1 },
1252 while (c = src[i++]) {
1254 case '\b':
av_bprintf(dst,
"%s",
"\\b");
break;
1255 case '\f':
av_bprintf(dst,
"%s",
"\\f");
break;
1256 case '\n':
av_bprintf(dst,
"%s",
"\\n");
break;
1257 case '\r':
av_bprintf(dst,
"%s",
"\\r");
break;
1258 case '\t':
av_bprintf(dst,
"%s",
"\\t");
break;
1264 if ((
unsigned char)c < 32)
1279 const struct section *parent_section = wctx->
level ?
1283 if (!parent_section) {
1284 printf(
"# ffprobe output\n\n");
1304 printf(
"[%s]\n", buf->str);
1320 printf(
"%s=%lld\n", key, value);
1330 .priv_class = &ini_class,
1343 #define OFFSET(x) offsetof(JSONContext, x)
1365 static const char json_escape[] = {
'"',
'\\',
'\b',
'\f',
'\n',
'\r',
'\t', 0};
1366 static const char json_subst[] = {
'"',
'\\',
'b',
'f',
'n',
'r',
't', 0};
1369 for (p = src; *p; p++) {
1370 char *
s = strchr(json_escape, *p);
1374 }
else if ((
unsigned char)*p < 32) {
1383 #define JSON_INDENT() printf("%*c", json->indent_level * 4, ' ')
1390 const struct section *parent_section = wctx->
level ?
1406 printf(
"\"%s\": [\n", buf.str);
1416 printf(
"\"type\": \"%s\"%s", section->
name, json->
item_sep);
1428 if (wctx->
level == 0) {
1446 const char *key,
const char *
value)
1492 .priv_class = &json_class,
1506 #define OFFSET(x) offsetof(XMLContext, x)
1509 {
"fully_qualified",
"specify if the output should be fully qualified",
OFFSET(fully_qualified),
AV_OPT_TYPE_INT, {.i64=0}, 0, 1 },
1510 {
"q",
"specify if the output should be fully qualified",
OFFSET(fully_qualified),
AV_OPT_TYPE_INT, {.i64=0}, 0, 1 },
1511 {
"xsd_strict",
"ensure that the output is XSD compliant",
OFFSET(xsd_strict),
AV_OPT_TYPE_INT, {.i64=0}, 0, 1 },
1512 {
"x",
"ensure that the output is XSD compliant",
OFFSET(xsd_strict),
AV_OPT_TYPE_INT, {.i64=0}, 0, 1 },
1524 #define CHECK_COMPLIANCE(opt, opt_name) \
1526 av_log(wctx, AV_LOG_ERROR, \
1527 "XSD-compliant output selected but option '%s' was selected, XML output may be non-compliant.\n" \
1528 "You need to disable such option with '-no%s'\n", opt_name, opt_name); \
1529 return AVERROR(EINVAL); \
1537 "Interleaved frames and packets are not allowed in XSD. "
1538 "Select only one between the -show_frames and the -show_packets options.\n");
1550 for (p = src; *p; p++) {
1552 case '&' :
av_bprintf(dst,
"%s",
"&");
break;
1553 case '<' :
av_bprintf(dst,
"%s",
"<");
break;
1554 case '>' :
av_bprintf(dst,
"%s",
">");
break;
1555 case '"' :
av_bprintf(dst,
"%s",
""");
break;
1556 case '\'':
av_bprintf(dst,
"%s",
"'");
break;
1564 #define XML_INDENT() printf("%*c", xml->indent_level * 4, ' ')
1570 const struct section *parent_section = wctx->
level ?
1573 if (wctx->
level == 0) {
1574 const char *qual =
" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' "
1575 "xmlns:ffprobe='http://www.ffmpeg.org/schema/ffprobe' "
1576 "xsi:schemaLocation='http://www.ffmpeg.org/schema/ffprobe ffprobe.xsd'";
1578 printf(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
1579 printf(
"<%sffprobe%s>\n",
1611 if (wctx->
level == 0) {
1635 printf(
"<%s key=\"%s\"",
1652 printf(
"%s=\"%lld\"", key, value);
1664 .priv_class = &xml_class,
1669 static int initialized;
1684 #define print_fmt(k, f, ...) do { \
1685 av_bprint_clear(&pbuf); \
1686 av_bprintf(&pbuf, f, __VA_ARGS__); \
1687 writer_print_string(w, k, pbuf.str, 0); \
1690 #define print_int(k, v) writer_print_integer(w, k, v)
1691 #define print_q(k, v, s) writer_print_rational(w, k, v, s)
1692 #define print_str(k, v) writer_print_string(w, k, v, 0)
1693 #define print_str_opt(k, v) writer_print_string(w, k, v, PRINT_STRING_OPT)
1694 #define print_str_validate(k, v) writer_print_string(w, k, v, PRINT_STRING_VALIDATE)
1695 #define print_time(k, v, tb) writer_print_time(w, k, v, tb, 0)
1696 #define print_ts(k, v) writer_print_ts(w, k, v, 0)
1697 #define print_duration_time(k, v, tb) writer_print_time(w, k, v, tb, 1)
1698 #define print_duration_ts(k, v) writer_print_ts(w, k, v, 1)
1699 #define print_val(k, v, u) do { \
1700 struct unit_value uv; \
1703 writer_print_string(w, k, value_string(val_str, sizeof(val_str), uv), 0); \
1706 #define print_section_header(s) writer_print_section_header(w, s)
1707 #define print_section_footer(s) writer_print_section_footer(w, s)
1709 #define REALLOCZ_ARRAY_STREAM(ptr, cur_n, new_n) \
1711 ret = av_reallocp_array(&(ptr), (new_n), sizeof(*(ptr))); \
1714 memset( (ptr) + (cur_n), 0, ((new_n) - (cur_n)) * sizeof(*(ptr)) ); \
1770 print_str(
"side_data_type", name ? name :
"unknown");
1853 print_q(
"sample_aspect_ratio", sar,
':');
1890 print_str(
"side_data_type", name ? name :
"unknown");
1914 int ret = 0, got_frame = 0;
1916 if (dec_ctx->
codec) {
1953 av_log(log_ctx, log_level,
"id:%d", interval->
id);
1959 av_log(log_ctx, log_level,
" start:N/A");
1965 av_log(log_ctx, log_level,
"#%"PRId64, interval->
end);
1969 av_log(log_ctx, log_level,
" end:N/A");
1972 av_log(log_ctx, log_level,
"\n");
1980 int ret = 0, i = 0, frame_count = 0;
1994 "Could not seek to relative position since current "
1995 "timestamp is not defined\n");
1999 target = *cur_ts + interval->
start;
2001 target = interval->
start;
2037 end = start + interval->
end;
2042 if (frame_count >= interval->
end)
2044 }
else if (has_end && *cur_ts !=
AV_NOPTS_VALUE && *cur_ts >= end) {
2117 if ((dec_ctx = stream->
codec)) {
2119 dec = dec_ctx->
codec;
2163 print_q(
"sample_aspect_ratio", sar,
':');
2168 print_q(
"display_aspect_ratio", dar,
':');
2246 if (opt->
flags)
continue;
2282 #define PRINT_DISPOSITION(flagname, name) do { \
2283 print_int(name, !!(stream->disposition & AV_DISPOSITION_##flagname)); \
2313 print_str(
"side_data_type", name ? name :
"unknown");
2455 const char *errbuf_ptr = errbuf;
2468 int err, i, orig_nb_streams;
2472 int scan_all_pmts_set = 0;
2476 scan_all_pmts_set = 1;
2484 if (scan_all_pmts_set)
2497 for (i = 0; i < orig_nb_streams; i++)
2515 "Failed to probe codec for input stream %d\n",
2519 "Unsupported codec with id %d for input stream %d\n",
2523 fmt_ctx, stream, codec);
2566 #define CHECK_END if (ret < 0) goto end
2645 print_fmt(
"copyright",
"Copyright (c) %d-%d the FFmpeg developers",
2648 print_str(
"configuration", FFMPEG_CONFIGURATION);
2654 #define SHOW_LIB_VERSION(libname, LIBNAME) \
2656 if (CONFIG_##LIBNAME) { \
2657 unsigned int version = libname##_version(); \
2658 writer_print_section_header(w, SECTION_ID_LIBRARY_VERSION); \
2659 print_str("name", "lib" #libname); \
2660 print_int("major", LIB##LIBNAME##_VERSION_MAJOR); \
2661 print_int("minor", LIB##LIBNAME##_VERSION_MINOR); \
2662 print_int("micro", LIB##LIBNAME##_VERSION_MICRO); \
2663 print_int("version", version); \
2664 print_str("ident", LIB##LIBNAME##_IDENT); \
2665 writer_print_section_footer(w); \
2683 #define PRINT_PIX_FMT_FLAG(flagname, name) \
2685 print_int(name, !!(pixdesc->flags & AV_PIX_FMT_FLAG_##flagname)); \
2751 if (show_all_entries) {
2767 if (!strcmp(section_name, section->
name) ||
2770 "'%s' matches section with unique name '%s'\n", section_name,
2781 const char *p =
arg;
2789 if (!section_name) {
2791 "Missing section name for option '%s'\n", opt);
2797 while (*p && *p !=
':') {
2802 "Adding '%s' to the entries to show in section '%s'\n",
2803 entry, section_name);
2809 show_all_entries = 1;
2812 ret =
match_section(section_name, show_all_entries, entries);
2835 "Option '%s' is deprecated, use '-show_entries format=%s' instead\n",
2846 "Argument '%s' provided as input filename, but '%s' was already specified.\n",
2850 if (!strcmp(arg,
"-"))
2880 char *next, *p, *spec =
av_strdup(interval_spec);
2891 next = strchr(spec,
'%');
2933 lli = strtoll(p, &tail, 10);
2934 if (*tail || lli < 0) {
2936 "Invalid or negative value '%s' for duration number of frames\n", p);
2939 interval->
end = lli;
2960 char *p, *spec =
av_strdup(intervals_spec);
2965 for (n = 0, p = spec; *p; p++)
2971 if (!read_intervals) {
2979 for (i = 0; p; i++) {
2983 next = strchr(p,
',');
2987 read_intervals[i].
id = i;
3027 printf(
"%*c %s", level * 4,
' ', section->
name);
3038 printf(
"Sections:\n"
3039 "W.. = Section is a wrapper (contains other sections, no local entries)\n"
3040 ".A. = Section contains an array of elements of the same type\n"
3041 "..V = Section may contain a variable number of fields with variable keys\n"
3042 "FLAGS NAME/UNIQUE_NAME\n"
3055 #define DEFINE_OPT_SHOW_SECTION(section, target_section_id) \
3056 static int opt_show_##section(const char *opt, const char *arg) \
3058 mark_section_show_entries(SECTION_ID_##target_section_id, 1, NULL); \
3079 "use binary prefixes for byte units" },
3081 "use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" },
3083 "prettify the format of displayed values, make it more human readable" },
3085 "set the output printing format (available formats are: default, compact, csv, flat, ini, json, xml)",
"format" },
3088 {
"sections",
OPT_EXIT, {.func_arg =
opt_sections},
"print sections structure and section information, and exit" },
3091 {
"show_error", 0, {(
void*)&opt_show_error},
"show probing error" },
3092 {
"show_format", 0, {(
void*)&opt_show_format},
"show format/container info" },
3093 {
"show_frames", 0, {(
void*)&opt_show_frames},
"show frames info" },
3095 "show a particular entry from the format/container info",
"entry" },
3097 "show a set of specified entries",
"entry_list" },
3098 {
"show_packets", 0, {(
void*)&opt_show_packets},
"show packets info" },
3099 {
"show_programs", 0, {(
void*)&opt_show_programs},
"show programs info" },
3100 {
"show_streams", 0, {(
void*)&opt_show_streams},
"show streams info" },
3101 {
"show_chapters", 0, {(
void*)&opt_show_chapters},
"show chapters info" },
3104 {
"show_program_version", 0, {(
void*)&opt_show_program_version},
"show ffprobe version" },
3105 {
"show_library_versions", 0, {(
void*)&opt_show_library_versions},
"show library versions" },
3106 {
"show_versions", 0, {(
void*)&
opt_show_versions},
"show program and library versions" },
3107 {
"show_pixel_formats", 0, {(
void*)&opt_show_pixel_formats},
"show pixel format descriptions" },
3129 #define SET_DO_SHOW(id, varname) do { \
3130 if (check_section_show_entries(SECTION_ID_##id)) \
3131 do_show_##varname = 1; \
3139 char *w_name =
NULL, *w_args =
NULL;
3165 SET_DO_SHOW(PIXEL_FORMAT_FLAGS, pixel_format_flags);
3166 SET_DO_SHOW(PIXEL_FORMAT_COMPONENTS, pixel_format_components);
3170 SET_DO_SHOW(STREAM_DISPOSITION, stream_disposition);
3171 SET_DO_SHOW(PROGRAM_STREAM_DISPOSITION, stream_disposition);
3181 "-bitexact and -show_program_version or -show_library_versions "
3182 "options are incompatible\n");
3203 "Unknown hash algorithm '%s'\nKnown algorithms:",
3222 if (w == &xml_writer)
unsigned int nb_chapters
Number of chapters in AVChapter array.
int(* init)(WriterContext *wctx)
codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it ...
const struct section * section[SECTION_MAX_NB_LEVELS]
section per each level
const struct AVCodec * codec
const char const char void * val
static char * value_string(char *buf, int buf_size, struct unit_value uv)
static int do_show_program_tags
unsigned int nb_item[SECTION_MAX_NB_LEVELS]
number of the item printed in the given section, starting from 0
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int show_tags(WriterContext *w, AVDictionary *tags, int section_id)
int64_t avio_size(AVIOContext *s)
Get the filesize.
void av_bprintf(AVBPrint *buf, const char *fmt,...)
int64_t av_frame_get_pkt_duration(const AVFrame *frame)
int nested_section[SECTION_MAX_NB_LEVELS]
int av_frame_get_pkt_size(const AVFrame *frame)
void av_free_packet(AVPacket *pkt)
Free a packet.
This structure describes decoded (raw) audio or video data.
static void json_print_int(WriterContext *wctx, const char *key, long long int value)
static void default_print_section_header(WriterContext *wctx)
static int writer_register(const Writer *writer)
ptrdiff_t const GLvoid * data
static int opt_input_file_i(void *optctx, const char *opt, const char *arg)
static int opt_format(void *optctx, const char *opt, const char *arg)
#define SHOW_LIB_VERSION(libname, LIBNAME)
int coded_width
Bitstream width / height, may be different from width/height e.g.
static void writer_print_rational(WriterContext *wctx, const char *key, AVRational q, char sep)
void(* print_string)(WriterContext *wctx, const char *, const char *)
static int opt_show_format_entry(void *optctx, const char *opt, const char *arg)
static const char unit_hertz_str[]
#define AV_LOG_WARNING
Something somehow does not look correct.
static const char *const decimal_unit_prefixes[]
#define LIBAVUTIL_VERSION_INT
int64_t pos
byte position in stream, -1 if unknown
int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
static const char * xml_escape_str(AVBPrint *dst, const char *src, void *log_ctx)
#define AV_DICT_DONT_OVERWRITE
Don't overwrite existing entries.
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
Parse timestr and return in *time a corresponding number of microseconds.
static void json_print_section_footer(WriterContext *wctx)
static void writer_close(WriterContext **wctx)
static av_cold int init(AVCodecContext *avctx)
static int read_intervals_nb
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
static void writer_print_integer(WriterContext *wctx, const char *key, long long int val)
static int do_show_stream_tags
static char * ini_escape_str(AVBPrint *dst, const char *src)
AVRational av_guess_sample_aspect_ratio(AVFormatContext *format, AVStream *stream, AVFrame *frame)
Guess the sample aspect ratio of a frame, based on both the stream and the frame aspect ratio...
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
static AVFormatContext * fmt_ctx
static char * print_format
enum AVColorRange color_range
MPEG vs JPEG YUV range.
static const Writer json_writer
int repeat_pict
When decoding, this signals how much the picture must be delayed.
int index
stream index in AVFormatContext
static const AVOption writer_options[]
static void writer_print_integers(WriterContext *wctx, const char *name, uint8_t *data, int size, const char *format, int columns, int bytes, int offset_add)
#define print_str_opt(k, v)
void(* print_integer)(WriterContext *wctx, const char *, long long int)
static void close_input_file(AVFormatContext **ctx_ptr)
void show_banner(int argc, char **argv, const OptionDef *options)
Print the program banner to stderr.
char * av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit)
Get the timecode string from the 25-bit timecode format (MPEG GOP format).
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static const AVClass writer_class
static int do_show_packets
static int do_show_format_tags
static int show_program(WriterContext *w, AVFormatContext *fmt_ctx, AVProgram *program)
static int writer_open(WriterContext **wctx, const Writer *writer, const char *args, const struct section *sections, int nb_sections)
void(* uninit)(WriterContext *wctx)
void avdevice_register_all(void)
Initialize libavdevice and register all the input and output devices.
static void bprint_bytes(AVBPrint *bp, const uint8_t *ubuf, size_t ubuf_size)
size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag)
Put a string representing the codec tag codec_tag in buf.
#define FF_ARRAY_ELEMS(a)
static void json_print_item_str(WriterContext *wctx, const char *key, const char *value)
static const Writer default_writer
AVPacketSideData * side_data
An array of side data that applies to the whole stream (i.e.
static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, AVFormatContext *fmt_ctx)
static const char * json_escape_str(AVBPrint *dst, const char *src, void *log_ctx)
static void xml_print_section_footer(WriterContext *wctx)
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
static void mark_section_show_entries(SectionID section_id, int show_all_entries, AVDictionary *entries)
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt)
Decode a subtitle message.
static uint64_t * nb_streams_frames
int has_nested_elems[SECTION_MAX_NB_LEVELS]
static int validate_string(WriterContext *wctx, char **dstp, const char *src)
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
AVDictionary * filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id, AVFormatContext *s, AVStream *st, AVCodec *codec)
Filter out options for given codec.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
static int do_count_frames
#define SECTION_MAX_NB_LEVELS
static void * writer_child_next(void *obj, void *prev)
static const AVOption default_options[]
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
#define AV_DICT_DONT_STRDUP_KEY
Take ownership of a key that's been allocated with av_malloc() or another memory allocation function...
const char *(* escape_str)(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
unsigned int nb_stream_indexes
const char * element_name
name of the contained element, if provided
static void writer_print_section_header(WriterContext *wctx, int section_id)
static void compact_print_section_footer(WriterContext *wctx)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
unsigned int nb_section_packet
number of the packet section in case we are in "packets_and_frames" section
static void ini_print_section_header(WriterContext *wctx)
#define print_duration_ts(k, v)
void register_exit(void(*cb)(int ret))
Register a program-specific cleanup routine.
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
enum AVSampleFormat sample_fmt
audio sample format
void log_callback_help(void *ptr, int level, const char *fmt, va_list vl)
Trivial log callback.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
static int do_read_packets
int opt_default(void *optctx, const char *opt, const char *arg)
Fallback for options that are not explicitly handled, these will be parsed through AVOptions...
static int opt_read_intervals(void *optctx, const char *opt, const char *arg)
#define AV_HASH_MAX_SIZE
Maximum value that av_hash_get_size will currently return.
static int do_show_pixel_format_components
static int * selected_streams
timestamp utils, mostly useful for debugging/logging purposes
static const char * flat_escape_value_str(AVBPrint *dst, const char *src)
static void writer_print_time(WriterContext *wctx, const char *key, int64_t ts, const AVRational *time_base, int is_duration)
const char * av_color_range_name(enum AVColorRange range)
static av_cold int end(AVCodecContext *avctx)
int id
unique ID to identify the chapter
static av_cold int compact_init(WriterContext *wctx)
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
int id
Format-specific stream ID.
static int do_show_library_versions
static void compact_print_section_header(WriterContext *wctx)
void av_hash_init(AVHashContext *ctx)
Initialize or reset a hash context.
int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the stream st contained in s is matched by the stream specifier spec.
int nb_side_data
The number of elements in the AVStream.side_data array.
static int match_section(const char *section_name, int show_all_entries, AVDictionary *entries)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
void init_opts(void)
Initialize the cmdutils option system, in particular allocate the *_opts contexts.
AVStream ** streams
A list of all streams in the file.
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
Append data to a print buffer.
static void writer_print_data_hash(WriterContext *wctx, const char *name, uint8_t *data, int size)
Structure to hold side data for an AVFrame.
static const AVOption json_options[]
static void log_read_interval(const ReadInterval *interval, void *log_ctx, int log_level)
static double av_q2d(AVRational a)
Convert rational to double.
static const char *const binary_unit_prefixes[]
static const char * writer_get_name(void *p)
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
#define PRINT_DISPOSITION(flagname, name)
void parse_options(void *optctx, int argc, char **argv, const OptionDef *options, void(*parse_arg_function)(void *, const char *))
#define SECTION_MAX_NB_CHILDREN
int avformat_network_init(void)
Do global initialization of network components.
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
const AVClass * priv_class
private class of the writer, if any
#define AV_LOG_VERBOSE
Detailed information.
static int check_section_show_entries(int section_id)
int interlaced_frame
The content of the picture is interlaced.
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
static void print_section(SectionID id, int level)
void parse_loglevel(int argc, char **argv, const OptionDef *options)
Find the '-loglevel' option in the command line args and apply it.
void(* print_section_footer)(WriterContext *wctx)
int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame)
Accessors for some AVFrame fields.
void show_help_default(const char *opt, const char *arg)
Per-fftool specific help handler.
void show_help_options(const OptionDef *options, const char *msg, int req_flags, int rej_flags, int alt_flags)
Print help for all options matching specified flags.
static const char * c_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
Apply C-language-like string escaping.
static void writer_register_all(void)
static void xml_print_str(WriterContext *wctx, const char *key, const char *value)
int children_ids[SECTION_MAX_NB_CHILDREN+1]
list of children section IDS, terminated by -1
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
void av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
static const char * input_filename
unsigned int * stream_index
static void json_print_section_header(WriterContext *wctx)
AVFrameSideData ** side_data
static void ffprobe_show_program_version(WriterContext *w)
static int read_packets(WriterContext *w, AVFormatContext *fmt_ctx)
static int do_show_chapter_tags
AVDictionary ** setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *codec_opts)
Setup AVCodecContext options for avformat_find_stream_info().
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
AVDictionary * format_opts
static int do_show_frames
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
static int show_chapters(WriterContext *w, AVFormatContext *fmt_ctx)
void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output)
Print detailed information about the input or output format, such as duration, bitrate, streams, container, programs, metadata, side data, codec and time base.
Main libavdevice API header.
static int do_show_chapters
int avcodec_close(AVCodecContext *avctx)
Close a given AVCodecContext and free all the data associated with it (but not the AVCodecContext its...
char * string_validation_replacement
libswresample public header
static int opt_show_versions(const char *opt, const char *arg)
const char * av_chroma_location_name(enum AVChromaLocation location)
static const char unit_byte_str[]
uint16_t depth_minus1
Number of bits in the component minus 1.
const int program_birth_year
program birth year, defined by the program for show_banner()
int level
current level, starting from 0
int width
width and height of the video frame
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionary * entries_to_show
static int do_show_pixel_format_flags
#define AV_DICT_MATCH_CASE
Only get an entry with exact-case key match.
AVDictionary * metadata
Metadata that applies to the whole file.
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
int has_b_frames
Size of the frame reordering buffer in the decoder.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, const AVPacket *avpkt)
Decode the video frame of size avpkt->size from avpkt->data into picture.
#define AV_BPRINT_SIZE_UNLIMITED
int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end, unsigned int flags)
Read and decode a single UTF-8 code point (character) from the buffer in *buf, and update *buf to poi...
static void opt_input_file(void *optctx, const char *arg)
static int opt_pretty(void *optctx, const char *opt, const char *arg)
#define SET_DO_SHOW(id, varname)
int priv_size
private size for the writer context
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define av_ts2timestr(ts, tb)
Convenience macro, the return value should be used only directly in function arguments but never stan...
static const AVOption xml_options[]
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define SECTION_FLAG_HAS_VARIABLE_FIELDS
the section may contain a variable number of fields with variable keys.
int64_t convergence_duration
Time difference in AVStream->time_base units from the pts of this packet to the point at which the ou...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
int nested_section[SECTION_MAX_NB_LEVELS]
static void default_print_int(WriterContext *wctx, const char *key, long long int value)
#define AV_LOG_SKIP_REPEATED
Skip repeated messages, this requires the user app to use av_log() instead of (f)printf as the 2 woul...
static av_cold int json_init(WriterContext *wctx)
int rc_max_rate
maximum bitrate
simple assert() macros that are a bit more flexible than ISO C assert().
enum AVPacketSideDataType type
const char * name
Name of the codec implementation.
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
static void flat_print_str(WriterContext *wctx, const char *key, const char *value)
int id
unique id identifying a section
const char * long_name
A more descriptive name for this codec.
static const uint8_t offset[127][2]
AVRational avg_frame_rate
Average framerate.
New fields can be added to the end with minor version bumps.
Libavcodec external API header.
static int parse_read_intervals(const char *intervals_spec)
char * av_get_token(const char **buf, const char *term)
Unescape the given string until a non escaped terminating char, and return the token corresponding to...
int flags
A combination of AV_PKT_FLAG values.
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
void * priv
private data for use by the filter
uint64_t channel_layout
Audio channel layout.
uint32_t end_display_time
char * name
name of this writer instance
int64_t pts
Same as packet pts, in AV_TIME_BASE.
AVCodecContext * codec
Codec context associated with this stream.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
char * av_asprintf(const char *fmt,...)
#define SECTION_FLAG_IS_WRAPPER
the section only contains other sections, but has no data at its own level
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
static void writer_print_data(WriterContext *wctx, const char *name, uint8_t *data, int size)
int refs
number of reference frames
static ReadInterval * read_intervals
AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
uint8_t nb_components
The number of components each pixel has, (1-4)
AVBPrint section_pbuf[SECTION_MAX_NB_LEVELS]
generic print buffer dedicated to each section, used by various writers
const AVOption * av_opt_next(FF_CONST_AVUTIL55 void *obj, const AVOption *last)
Iterate over all AVOptions belonging to obj.
int bit_rate
the average bitrate
#define print_section_footer(s)
int64_t timecode_frame_start
GOP timecode frame start number.
static const char * csv_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
Quote fields containing special characters, check RFC4180.
enum AVPictureType pict_type
Picture type of the frame.
char filename[1024]
input or output filename
static const char unit_bit_per_second_str[]
static const Writer * registered_writers[MAX_REGISTERED_WRITERS_NB+1]
#define AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES
exclude control codes not accepted by XML
int display_picture_number
picture number in display order
static struct section sections[]
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
Set the logging callback.
int av_hash_alloc(AVHashContext **ctx, const char *name)
Allocate a hash context for the algorithm specified by name.
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
static int do_read_frames
int width
picture width / height.
#define PRINT_PIX_FMT_FLAG(flagname, name)
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
GLsizei GLboolean const GLfloat * value
#define print_fmt(k, f,...)
static void ffprobe_show_pixel_formats(WriterContext *w)
static void show_usage(void)
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
const char * av_hash_get_name(const AVHashContext *ctx)
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
static int show_private_data
static int probe_file(WriterContext *wctx, const char *filename)
static int show_programs(WriterContext *w, AVFormatContext *fmt_ctx)
static av_cold int xml_init(WriterContext *wctx)
int nb_sections
number of sections
int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, const AVPacket *avpkt)
Decode the audio frame of size avpkt->size from avpkt->data into frame.
const struct section * sections
array containing all sections
static const Writer flat_writer
void av_hash_freep(AVHashContext **ctx)
Free hash context.
static void flat_print_int(WriterContext *wctx, const char *key, long long int value)
static int opt_sections(void *optctx, const char *opt, const char *arg)
static int do_show_programs
static const OptionDef real_options[]
#define WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS
const char * av_get_colorspace_name(enum AVColorSpace val)
Get the name of a colorspace.
static int do_show_format
const char * item_start_end
static const Writer ini_writer
void exit_program(int ret)
Wraps exit with a program-specific cleanup routine.
static void compact_print_str(WriterContext *wctx, const char *key, const char *value)
void av_bprint_channel_layout(struct AVBPrint *bp, int nb_channels, uint64_t channel_layout)
Append a description of a channel layout to a bprint buffer.
const char program_name[]
program name, defined by the program for show_version().
static const Writer compact_writer
static void compact_print_int(WriterContext *wctx, const char *key, long long int value)
int64_t end
chapter start/end time in time_base units
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
int av_dict_parse_string(AVDictionary **pm, const char *str, const char *key_val_sep, const char *pairs_sep, int flags)
Parse the key/value pairs list and add the parsed entries to a dictionary.
const char * av_get_profile_name(const AVCodec *codec, int profile)
Return a name for the specified profile, if available.
int avformat_network_deinit(void)
Undo the initialization done by avformat_network_init.
static struct AVHashContext * hash
const char * long_name
Descriptive name for the codec, meant to be more human readable than name.
int coded_picture_number
picture number in bitstream order
static AVInputFormat * iformat
#define AV_LOG_INFO
Standard information.
unsigned int nb_section_frame
number of the frame section in case we are in "packets_and_frames" section
#define AV_BPRINT_SIZE_AUTOMATIC
enum AVMediaType codec_type
const char * av_hash_names(int i)
Get the names of available hash algorithms.
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
char * av_strdup(const char *s)
Duplicate the string s.
int sample_rate
samples per second
AVIOContext * pb
I/O context.
static void xml_print_int(WriterContext *wctx, const char *key, long long int value)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
main external API structure.
AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
static const Writer csv_writer
static void show_error(WriterContext *w, int err)
void avsubtitle_free(AVSubtitle *sub)
Free all allocated data in the given subtitle struct.
static void ini_print_str(WriterContext *wctx, const char *key, const char *value)
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
#define WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER
unsigned int nb_section_packet_frame
nb_section_packet or nb_section_frame according if is_packets_and_frames
int terminate_line[SECTION_MAX_NB_LEVELS]
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
Replacements for frequently missing libm functions.
void av_hash_update(AVHashContext *ctx, const uint8_t *src, int len)
Update a hash context with additional data.
static int show_value_unit
static int use_value_sexagesimal_format
#define print_duration_time(k, v, tb)
AVDictionary * av_frame_get_metadata(const AVFrame *frame)
Describe the class of an AVClass context structure.
int av_frame_get_channels(const AVFrame *frame)
static av_const int av_toupper(int c)
Locale-independent conversion of ASCII characters to uppercase.
#define DEFINE_WRITER_CLASS(name)
enum AVColorSpace colorspace
YUV colorspace type.
rational number numerator/denominator
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
const char * name
Name of the codec described by this descriptor.
int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
static void ffprobe_cleanup(int ret)
#define SECTION_FLAG_IS_ARRAY
the section contains an array of elements of the same type
static const AVOption compact_options[]
#define REALLOCZ_ARRAY_STREAM(ptr, cur_n, new_n)
int64_t end
start, end in second/AV_TIME_BASE units
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
int64_t av_frame_get_channel_layout(const AVFrame *frame)
int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
Seek to timestamp ts.
const char * av_frame_side_data_name(enum AVFrameSideDataType type)
This struct describes the properties of a single codec described by an AVCodecID. ...
unsigned int string_validation_utf8_flags
int64_t pkt_pts
PTS copied from the AVPacket that was decoded to produce this frame.
static void writer_print_ts(WriterContext *wctx, const char *key, int64_t ts, int is_duration)
static uint64_t * nb_streams_packets
enum AVFrameSideDataType type
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
static void ffprobe_show_library_versions(WriterContext *w)
static int use_value_prefix
int64_t start_time
Position of the first frame of the component, in AV_TIME_BASE fractional seconds. ...
const AVClass * priv_class
AVClass for the private context.
static int swscale(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
static void flat_print_section_header(WriterContext *wctx)
int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
Put a description of the AVERROR code errnum in errbuf.
static char * upcase_string(char *dst, size_t dst_size, const char *src)
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
char * av_strtok(char *s, const char *delim, char **saveptr)
Split the string into several tokens which can be accessed by successive calls to av_strtok()...
int64_t duration
Decoding: duration of the stream, in stream time base.
static char * show_data_hash
static const OptionDef * options
static int do_show_pixel_formats
int64_t pkt_dts
DTS copied from the AVPacket that triggered returning this frame.
static int writer_print_string(WriterContext *wctx, const char *key, const char *val, int flags)
void print_error(const char *filename, int err)
Print an error message to stderr, indicating filename and a human readable description of the error c...
AVPacketSideData * side_data
Additional packet data that can be provided by the container.
void av_opt_free(void *obj)
Free all allocated objects in obj.
static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_idx, int in_program)
AVDictionary * codec_opts
static void xml_print_section_header(WriterContext *wctx)
static int do_show_stream_disposition
int flags
For these sections the element_name field is mandatory.
void(* print_section_header)(WriterContext *wctx)
static void default_print_str(WriterContext *wctx, const char *key, const char *value)
static int do_count_packets
static int show_format(WriterContext *w, AVFormatContext *fmt_ctx)
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base...
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
static const char unit_second_str[]
void av_hash_final_hex(struct AVHashContext *ctx, uint8_t *dst, int size)
Finalize a hash context and compute the actual hash value as a hex string.
static AVCodecContext * dec_ctx
static int parse_read_interval(const char *interval_spec, ReadInterval *interval)
Parse interval specification, according to the format: INTERVAL ::= [START|+START_OFFSET][%[END|+END_...
uint32_t start_display_time
union unit_value::@27 val
static av_cold int flat_init(WriterContext *wctx)
static void show_packet(WriterContext *w, AVFormatContext *fmt_ctx, AVPacket *pkt, int packet_idx)
AVRational time_base
time base in which the start/end timestamps are specified
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values.
int64_t nb_frames
number of frames in this stream if known or 0
void uninit_opts(void)
Uninitialize the cmdutils option system, in particular free the *_opts contexts and their contents...
static const AVOption csv_options[]
struct AVInputFormat * iformat
The input container format.
static void show_subtitle(WriterContext *w, AVSubtitle *sub, AVStream *stream, AVFormatContext *fmt_ctx)
double av_display_rotation_get(const int32_t matrix[9])
The display transformation matrix specifies an affine transformation that should be applied to video ...
static const char * flat_escape_key_str(AVBPrint *dst, const char *src, const char sep)
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
static int show_streams(WriterContext *w, AVFormatContext *fmt_ctx)
static int opt_show_entries(void *optctx, const char *opt, const char *arg)
static const AVOption flat_options[]
static int do_show_program_version
static int use_byte_value_binary_prefix
int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
#define AVERROR_OPTION_NOT_FOUND
Option not found.
#define PRINT_STRING_VALIDATE
int top_field_first
If the content is interlaced, is top field displayed first.
#define print_str_validate(k, v)
int channels
number of audio channels
static av_always_inline int process_frame(WriterContext *w, AVFormatContext *fmt_ctx, AVFrame *frame, AVPacket *pkt)
int64_t av_frame_get_pkt_pos(const AVFrame *frame)
static int do_show_frame_tags
static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename)
void(* print_rational)(WriterContext *wctx, AVRational *q, char *sep)
static const AVOption ini_options[]
void av_log_set_flags(int arg)
#define CHECK_COMPLIANCE(opt, opt_name)
int key_frame
1 -> keyframe, 0-> not
static const char * none_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
void show_help_children(const AVClass *class, int flags)
Show help for all options with given flags in class and all its children.
static void json_print_str(WriterContext *wctx, const char *key, const char *value)
static void ini_print_int(WriterContext *wctx, const char *key, long long int value)
#define print_val(k, v, u)
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
static char * stream_specifier
int bit_rate
Total stream bitrate in bit/s, 0 if not available.
const char * av_packet_side_data_name(enum AVPacketSideDataType type)
#define print_time(k, v, tb)
static int read_interval_packets(WriterContext *w, AVFormatContext *fmt_ctx, const ReadInterval *interval, int64_t *cur_ts)
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
static void default_print_section_footer(WriterContext *wctx)
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key, ignoring the suffix of the found key string.
#define av_malloc_array(a, b)
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
int main(int argc, char **argv)
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
const Writer * writer
the Writer of which this is an instance
AVRational r_frame_rate
Real base framerate of the stream.
static const Writer * writer_get_by_name(const char *name)
const char * unique_name
unique section name, in case the name is ambiguous
This structure stores compressed data.
void av_register_all(void)
Initialize libavformat and register all the muxers, demuxers and protocols.
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
#define DEFINE_OPT_SHOW_SECTION(section, target_section_id)
int nb_samples
number of audio samples (per channel) described by this frame
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
#define MAX_REGISTERED_WRITERS_NB
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
static void writer_print_section_footer(WriterContext *wctx)
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define AV_TIMECODE_STR_SIZE
const AVPixFmtDescriptor * av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
Iterate over all pixel format descriptors known to libavutil.
static int do_show_streams
#define print_section_header(s)
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
int flags
a combination or WRITER_FLAG_*