27 #include "libavutil/ffversion.h" 60 # ifdef pthread_mutex_lock 61 # undef pthread_mutex_lock 63 # define pthread_mutex_lock(a) do{}while(0) 64 # ifdef pthread_mutex_unlock 65 # undef pthread_mutex_unlock 67 # define pthread_mutex_unlock(a) do{}while(0) 139 #define SECTION_MAX_NB_CHILDREN 10 145 #define SECTION_FLAG_IS_WRAPPER 1 146 #define SECTION_FLAG_IS_ARRAY 2
147 #define SECTION_FLAG_HAS_VARIABLE_FIELDS 4
264 static const struct {
270 { 1.0, 1.0,
"",
"" },
271 { 1.024e3, 1e3,
"Ki",
"K" },
272 { 1.048576e6, 1e6,
"Mi",
"M" },
273 { 1.073741824e9, 1e9,
"Gi",
"G" },
274 { 1.099511627776e12, 1e12,
"Ti",
"T" },
275 { 1.125899906842624e15, 1e15,
"Pi",
"P" },
308 static int print_prefix = 1;
309 void *new_log_buffer;
320 if (new_log_buffer) {
324 log_buffer = new_log_buffer;
325 memset(&log_buffer[
log_buffer_size], 0,
sizeof(log_buffer[log_buffer_size]));
333 for (i=strlen(msg) - 1; i>=0 && msg[
i] ==
'\n'; i--) {
339 if (parent && *parent) {
342 (*parent)->get_category ? (*parent)->get_category(parent) :(*parent)->category;
364 union {
double d;
long long int i; }
val;
378 vald = vali = uv.
val.
i;
385 mins = (
int)secs / 60;
386 secs = secs - mins * 60;
389 snprintf(buf, buf_size,
"%d:%02d:%09.6f", hours, mins, secs);
391 const char *prefix_string =
"";
397 index = (
long long int) (
log2(vald)) / 10;
402 index = (
long long int) (log10(vald)) / 3;
411 snprintf(buf, buf_size,
"%f", vald);
413 snprintf(buf, buf_size,
"%lld", vali);
425 #define WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS 1 426 #define WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER 2 445 void (*print_integer) (WriterContext *wctx,
const char *,
long long int);
447 void (*print_string) (WriterContext *wctx,
const char *,
const char *);
451 #define SECTION_MAX_NB_LEVELS 10 453 struct WriterContext {
483 WriterContext *wctx = p;
487 #define OFFSET(x) offsetof(WriterContext, x) 490 {
"string_validation",
"set string validation mode",
492 {
"sv",
"set string validation mode",
497 {
"string_validation_replacement",
"set string validation replacement string",
OFFSET(string_validation_replacement),
AV_OPT_TYPE_STRING, {.str=
""}},
498 {
"svr",
"set string validation replacement string",
OFFSET(string_validation_replacement),
AV_OPT_TYPE_STRING, {.str=
"\xEF\xBF\xBD"}},
504 WriterContext *
ctx = obj;
525 if ((*wctx)->writer->uninit)
526 (*wctx)->writer->uninit(*wctx);
529 if ((*wctx)->writer->priv_class)
540 for (i = 0; i < ubuf_size; i++)
546 const struct section *sections,
int nb_sections)
550 if (!(*wctx =
av_mallocz(
sizeof(WriterContext)))) {
561 (*wctx)->writer = writer;
564 (*wctx)->nb_sections = nb_sections;
569 void *priv_ctx = (*wctx)->priv;
580 av_log(*wctx,
AV_LOG_ERROR,
"Failed to parse option string '%s' provided to writer context\n", args);
587 av_log(*wctx,
AV_LOG_ERROR,
"Failed to set option '%s' with value '%s' provided to writer context\n",
599 const uint8_t *p = (*wctx)->string_validation_replacement;
600 const uint8_t *endp = p + strlen(p);
604 ret =
av_utf8_decode(&code, &p, endp, (*wctx)->string_validation_utf8_flags);
610 "Invalid UTF8 sequence %s found in string validation replace '%s'\n",
611 bp.str, (*wctx)->string_validation_replacement);
620 if ((*wctx)->writer->init)
621 ret = (*wctx)->writer->init(*wctx);
635 int parent_section_id;
638 parent_section_id = wctx->
level ?
659 int parent_section_id = wctx->
level ?
674 const char *
key,
long long int val)
688 int invalid_chars_nb = 0,
ret = 0;
692 endp = src + strlen(src);
693 for (p = (
uint8_t *)src; *p;) {
703 "Invalid UTF-8 sequence %s found in string '%s'\n", bp.str, src);
713 "Invalid UTF-8 sequence found in string '%s'\n", src);
730 "%d invalid UTF-8 sequence(s) found in string '%s', replaced with '%s'\n",
739 #define PRINT_STRING_OPT 1 740 #define PRINT_STRING_VALIDATE 2 756 if (ret < 0)
goto end;
758 if (ret < 0)
goto end;
763 "Invalid key=value string combination %s=%s in section %s\n",
788 int64_t ts,
const AVRational *time_base,
int is_duration)
792 if ((!is_duration && ts ==
AV_NOPTS_VALUE) || (is_duration && ts == 0)) {
795 double d = ts *
av_q2d(*time_base);
806 if ((!is_duration && ts ==
AV_NOPTS_VALUE) || (is_duration && ts == 0)) {
824 for (i = 0; i < l; i++) {
830 for (i = 0; i < l; i++)
851 p = buf + strlen(buf);
858 int columns,
int bytes,
int offset_add)
867 l =
FFMIN(size, columns);
868 for (i = 0; i < l; i++) {
869 if (bytes == 1)
av_bprintf(&bp, format, *data);
876 offset += offset_add;
882 #define MAX_REGISTERED_WRITERS_NB 64 888 static int next_registered_writer_idx = 0;
893 registered_writers[next_registered_writer_idx++] = writer;
901 for (i = 0; registered_writers[
i]; i++)
902 if (!strcmp(registered_writers[i]->name, name))
903 return registered_writers[
i];
911 #define DEFINE_WRITER_CLASS(name) \ 912 static const char *name##_get_name(void *ctx) \ 916 static const AVClass name##_class = { \ 917 .class_name = #name, \ 918 .item_name = name##_get_name, \ 919 .option = name##_options \ 932 #define OFFSET(x) offsetof(DefaultContext, x) 935 {
"noprint_wrappers",
"do not print headers and footers",
OFFSET(noprint_wrappers),
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
948 for (i = 0; src[
i] && i < dst_size-1; i++)
959 const struct section *parent_section = wctx->
level ?
963 if (parent_section &&
1018 .priv_class = &default_class,
1026 static const char *
c_escape_str(AVBPrint *dst,
const char *
src,
const char sep,
void *log_ctx)
1030 for (p = src; *p; p++) {
1032 case '\b':
av_bprintf(dst,
"%s",
"\\b");
break;
1033 case '\f':
av_bprintf(dst,
"%s",
"\\f");
break;
1034 case '\n':
av_bprintf(dst,
"%s",
"\\n");
break;
1035 case '\r':
av_bprintf(dst,
"%s",
"\\r");
break;
1036 case '\\':
av_bprintf(dst,
"%s",
"\\\\");
break;
1051 char meta_chars[] = { sep,
'"',
'\n',
'\r',
'\0' };
1052 int needs_quoting = !!src[strcspn(src, meta_chars)];
1057 for (; *
src; src++) {
1079 const char * (*escape_str)(AVBPrint *dst,
const char *
src,
const char sep,
void *log_ctx);
1086 #define OFFSET(x) offsetof(CompactContext, x) 1107 av_log(wctx,
AV_LOG_ERROR,
"Item separator '%s' specified, but must contain a single character\n",
1128 const struct section *parent_section = wctx->
level ?
1170 if (!compact->
nokey)
1182 if (!compact->
nokey)
1196 .priv_class = &compact_class,
1202 #define OFFSET(x) offsetof(CompactContext, x) 1227 .priv_class = &csv_class,
1240 #define OFFSET(x) offsetof(FlatContext, x) 1245 {
"hierarchical",
"specify if the section specification should be hierarchical",
OFFSET(hierarchical),
AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1246 {
"h",
"specify if the section specification should be hierarchical",
OFFSET(hierarchical),
AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1256 if (strlen(flat->
sep_str) != 1) {
1257 av_log(wctx,
AV_LOG_ERROR,
"Item separator '%s' specified, but must contain a single character\n",
1270 for (p = src; *p; p++) {
1271 if (!((*p >=
'0' && *p <=
'9') ||
1272 (*p >=
'a' && *p <=
'z') ||
1273 (*p >=
'A' && *p <=
'Z')))
1285 for (p = src; *p; p++) {
1287 case '\n':
av_bprintf(dst,
"%s",
"\\n");
break;
1288 case '\r':
av_bprintf(dst,
"%s",
"\\r");
break;
1289 case '\\':
av_bprintf(dst,
"%s",
"\\\\");
break;
1290 case '"':
av_bprintf(dst,
"%s",
"\\\"");
break;
1291 case '`':
av_bprintf(dst,
"%s",
"\\`");
break;
1292 case '$':
av_bprintf(dst,
"%s",
"\\$");
break;
1304 const struct section *parent_section = wctx->
level ?
1309 if (!parent_section)
1351 .priv_class = &flat_class,
1362 #define OFFSET(x) offsetof(INIContext, x) 1365 {
"hierarchical",
"specify if the section specification should be hierarchical",
OFFSET(hierarchical),
AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1366 {
"h",
"specify if the section specification should be hierarchical",
OFFSET(hierarchical),
AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1377 while (c = src[i++]) {
1379 case '\b':
av_bprintf(dst,
"%s",
"\\b");
break;
1380 case '\f':
av_bprintf(dst,
"%s",
"\\f");
break;
1381 case '\n':
av_bprintf(dst,
"%s",
"\\n");
break;
1382 case '\r':
av_bprintf(dst,
"%s",
"\\r");
break;
1383 case '\t':
av_bprintf(dst,
"%s",
"\\t");
break;
1389 if ((
unsigned char)c < 32)
1404 const struct section *parent_section = wctx->
level ?
1408 if (!parent_section) {
1409 printf(
"# ffprobe output\n\n");
1429 printf(
"[%s]\n", buf->str);
1445 printf(
"%s=%lld\n", key, value);
1455 .priv_class = &ini_class,
1468 #define OFFSET(x) offsetof(JSONContext, x) 1490 static const char json_escape[] = {
'"',
'\\',
'\b',
'\f',
'\n',
'\r',
'\t', 0};
1491 static const char json_subst[] = {
'"',
'\\',
'b',
'f',
'n',
'r',
't', 0};
1494 for (p = src; *p; p++) {
1495 char *
s = strchr(json_escape, *p);
1499 }
else if ((
unsigned char)*p < 32) {
1508 #define JSON_INDENT() printf("%*c", json->indent_level * 4, ' ') 1515 const struct section *parent_section = wctx->
level ?
1531 printf(
"\"%s\": [\n", buf.str);
1553 if (wctx->
level == 0) {
1571 const char *
key,
const char *
value)
1621 .priv_class = &json_class,
1635 #define OFFSET(x) offsetof(XMLContext, x) 1638 {
"fully_qualified",
"specify if the output should be fully qualified",
OFFSET(fully_qualified),
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1639 {
"q",
"specify if the output should be fully qualified",
OFFSET(fully_qualified),
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1640 {
"xsd_strict",
"ensure that the output is XSD compliant",
OFFSET(xsd_strict),
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1653 #define CHECK_COMPLIANCE(opt, opt_name) \ 1655 av_log(wctx, AV_LOG_ERROR, \ 1656 "XSD-compliant output selected but option '%s' was selected, XML output may be non-compliant.\n" \ 1657 "You need to disable such option with '-no%s'\n", opt_name, opt_name); \ 1658 return AVERROR(EINVAL); \ 1666 "Interleaved frames and packets are not allowed in XSD. " 1667 "Select only one between the -show_frames and the -show_packets options.\n");
1675 #define XML_INDENT() printf("%*c", xml->indent_level * 4, ' ') 1681 const struct section *parent_section = wctx->
level ?
1684 if (wctx->
level == 0) {
1685 const char *qual =
" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " 1686 "xmlns:ffprobe='http://www.ffmpeg.org/schema/ffprobe' " 1687 "xsi:schemaLocation='http://www.ffmpeg.org/schema/ffprobe ffprobe.xsd'";
1689 printf(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
1690 printf(
"<%sffprobe%s>\n",
1722 if (wctx->
level == 0) {
1754 printf(
" value=\"%s\"/>\n", buf.str);
1761 printf(
"%s=\"%s\"", key, buf.str);
1771 printf(
"%s=\"%lld\"", key, value);
1783 .priv_class = &xml_class,
1803 #define print_fmt(k, f, ...) do { \ 1804 av_bprint_clear(&pbuf); \ 1805 av_bprintf(&pbuf, f, __VA_ARGS__); \ 1806 writer_print_string(w, k, pbuf.str, 0); \ 1809 #define print_int(k, v) writer_print_integer(w, k, v) 1810 #define print_q(k, v, s) writer_print_rational(w, k, v, s) 1811 #define print_str(k, v) writer_print_string(w, k, v, 0) 1812 #define print_str_opt(k, v) writer_print_string(w, k, v, PRINT_STRING_OPT) 1813 #define print_str_validate(k, v) writer_print_string(w, k, v, PRINT_STRING_VALIDATE) 1814 #define print_time(k, v, tb) writer_print_time(w, k, v, tb, 0) 1815 #define print_ts(k, v) writer_print_ts(w, k, v, 0) 1816 #define print_duration_time(k, v, tb) writer_print_time(w, k, v, tb, 1) 1817 #define print_duration_ts(k, v) writer_print_ts(w, k, v, 1) 1818 #define print_val(k, v, u) do { \ 1819 struct unit_value uv; \ 1822 writer_print_string(w, k, value_string(val_str, sizeof(val_str), uv), 0); \ 1825 #define print_section_header(s) writer_print_section_header(w, s) 1826 #define print_section_footer(s) writer_print_section_footer(w, s) 1828 #define REALLOCZ_ARRAY_STREAM(ptr, cur_n, new_n) \ 1830 ret = av_reallocp_array(&(ptr), (new_n), sizeof(*(ptr))); \ 1833 memset( (ptr) + (cur_n), 0, ((new_n) - (cur_n)) * sizeof(*(ptr)) ); \ 1862 print_q(
"window_upper_left_corner_x",
1864 print_q(
"window_upper_left_corner_y",
1866 print_q(
"window_lower_right_corner_x",
1868 print_q(
"window_lower_right_corner_y",
1870 print_q(
"window_upper_left_corner_x",
1872 print_q(
"window_upper_left_corner_y",
1880 print_int(
"semimajor_axis_internal_ellipse",
1882 print_int(
"semimajor_axis_external_ellipse",
1884 print_int(
"semiminor_axis_external_ellipse",
1889 print_q(
"targeted_system_display_maximum_luminance",
1892 print_int(
"num_rows_targeted_system_display_actual_peak_luminance",
1894 print_int(
"num_cols_targeted_system_display_actual_peak_luminance",
1898 print_q(
"targeted_system_display_actual_peak_luminance",
1905 for (
int i = 0;
i < 3;
i++) {
1910 print_int(
"num_distribution_maxrgb_percentiles",
1913 print_int(
"distribution_maxrgb_percentage",
1915 print_q(
"distribution_maxrgb_percentile",
1918 print_q(
"fraction_bright_pixels",
1922 print_int(
"num_rows_mastering_display_actual_peak_luminance",
1924 print_int(
"num_cols_mastering_display_actual_peak_luminance",
1928 print_q(
"mastering_display_actual_peak_luminance",
1942 print_q(
"bezier_curve_anchors",
1947 print_q(
"color_saturation_weight",
1963 for (i = 0; i < nb_side_data; i++) {
1968 print_str(
"side_data_type", name ? name :
"unknown");
2096 av_freep(&log_buffer[i].context_name);
2097 av_freep(&log_buffer[i].parent_name);
2098 av_freep(&log_buffer[i].log_message);
2100 log_buffer_size = 0;
2105 static int show_log(WriterContext *
w,
int section_ids,
int section_id,
int log_level)
2116 if (log_buffer[i].log_level <= log_level) {
2118 print_str(
"context", log_buffer[i].context_name);
2119 print_int(
"level", log_buffer[i].log_level);
2121 if (log_buffer[i].parent_name) {
2122 print_str(
"parent_context", log_buffer[i].parent_name);
2123 print_int(
"parent_category", log_buffer[i].parent_category);
2128 print_str(
"message", log_buffer[i].log_message);
2257 print_q(
"sample_aspect_ratio", sar,
':');
2302 print_str(
"side_data_type", name ? name :
"unknown");
2311 uint32_t *
tc = (uint32_t*)sd->
data;
2312 int m =
FFMIN(tc[0],3);
2314 for (
int j = 1; j <= m ; j++) {
2374 int ret = 0, got_frame = 0;
2377 if (dec_ctx && dec_ctx->
codec) {
2425 return got_frame || *packet_new;
2430 av_log(log_ctx, log_level,
"id:%d", interval->
id);
2436 av_log(log_ctx, log_level,
" start:N/A");
2442 av_log(log_ctx, log_level,
"#%"PRId64, interval->
end);
2446 av_log(log_ctx, log_level,
" end:N/A");
2449 av_log(log_ctx, log_level,
"\n");
2458 int ret = 0,
i = 0, frame_count = 0;
2459 int64_t
start = -INT64_MAX, end = interval->
end;
2472 "Could not seek to relative position since current " 2473 "timestamp is not defined\n");
2477 target = *cur_ts + interval->
start;
2479 target = interval->
start;
2515 end = start + interval->
end;
2520 if (frame_count >= interval->
end)
2522 }
else if (has_end && *cur_ts !=
AV_NOPTS_VALUE && *cur_ts >= end) {
2534 while (
process_frame(w, ifile, frame, &pkt, &packet_new) > 0);
2544 while (
process_frame(w, ifile, frame, &pkt, &(
int){1}) > 0);
2614 char profile_num[12];
2641 print_q(
"sample_aspect_ratio", sar,
':');
2646 print_q(
"display_aspect_ratio", dar,
':');
2663 print_str(
"field_order",
"progressive");
2713 if (opt->
flags)
continue;
2751 #define PRINT_DISPOSITION(flagname, name) do { \ 2752 print_int(name, !!(stream->disposition & AV_DISPOSITION_##flagname)); \ 2917 const char *errbuf_ptr = errbuf;
2929 const char *print_filename)
2934 int scan_all_pmts_set = 0;
2944 scan_all_pmts_set = 1;
2951 if (print_filename) {
2956 if (scan_all_pmts_set)
2967 for (i = 0; i < orig_nb_streams; i++)
2995 "Failed to probe codec for input stream %d\n",
3003 "Unsupported codec with id %d for input stream %d\n",
3009 fmt_ctx, stream, codec);
3062 const char *print_filename)
3075 #define CHECK_END if (ret < 0) goto end 3156 print_fmt(
"copyright",
"Copyright (c) %d-%d the FFmpeg developers",
3159 print_str(
"configuration", FFMPEG_CONFIGURATION);
3165 #define SHOW_LIB_VERSION(libname, LIBNAME) \ 3167 if (CONFIG_##LIBNAME) { \ 3168 unsigned int version = libname##_version(); \ 3169 writer_print_section_header(w, SECTION_ID_LIBRARY_VERSION); \ 3170 print_str("name", "lib" #libname); \ 3171 print_int("major", LIB##LIBNAME##_VERSION_MAJOR); \ 3172 print_int("minor", LIB##LIBNAME##_VERSION_MINOR); \ 3173 print_int("micro", LIB##LIBNAME##_VERSION_MICRO); \ 3174 print_int("version", version); \ 3175 print_str("ident", LIB##LIBNAME##_IDENT); \ 3176 writer_print_section_footer(w); \ 3194 #define PRINT_PIX_FMT_FLAG(flagname, name) \ 3196 print_int(name, !!(pixdesc->flags & AV_PIX_FMT_FLAG_##flagname)); \ 3261 if (show_all_entries) {
3277 if (!strcmp(section_name, section->
name) ||
3280 "'%s' matches section with unique name '%s'\n", section_name,
3291 const char *p =
arg;
3299 if (!section_name) {
3301 "Missing section name for option '%s'\n", opt);
3307 while (*p && *p !=
':') {
3312 "Adding '%s' to the entries to show in section '%s'\n",
3313 entry, section_name);
3319 show_all_entries = 1;
3322 ret =
match_section(section_name, show_all_entries, entries);
3348 "Option '%s' is deprecated, use '-show_entries format=%s' instead\n",
3359 "Argument '%s' provided as input filename, but '%s' was already specified.\n",
3363 if (!strcmp(arg,
"-"))
3400 char *next, *p, *spec =
av_strdup(interval_spec);
3411 next = strchr(spec,
'%');
3453 lli = strtoll(p, &tail, 10);
3454 if (*tail || lli < 0) {
3456 "Invalid or negative value '%s' for duration number of frames\n", p);
3459 interval->
end = lli;
3481 char *p, *spec =
av_strdup(intervals_spec);
3486 for (n = 0, p = spec; *p; p++)
3492 if (!read_intervals) {
3500 for (i = 0; p; i++) {
3504 next = strchr(p,
',');
3508 read_intervals[
i].
id =
i;
3548 printf(
"%*c %s", level * 4,
' ', section->
name);
3560 "W.. = Section is a wrapper (contains other sections, no local entries)\n" 3561 ".A. = Section contains an array of elements of the same type\n" 3562 "..V = Section may contain a variable number of fields with variable keys\n" 3563 "FLAGS NAME/UNIQUE_NAME\n" 3576 #define DEFINE_OPT_SHOW_SECTION(section, target_section_id) \ 3577 static int opt_show_##section(void *optctx, const char *opt, const char *arg) \ 3579 mark_section_show_entries(SECTION_ID_##target_section_id, 1, NULL); \ 3600 "use binary prefixes for byte units" },
3602 "use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" },
3604 "prettify the format of displayed values, make it more human readable" },
3606 "set the output printing format (available formats are: default, compact, csv, flat, ini, json, xml)",
"format" },
3609 {
"sections",
OPT_EXIT, {.func_arg =
opt_sections},
"print sections structure and section information, and exit" },
3612 {
"show_error", 0, { .func_arg = &opt_show_error },
"show probing error" },
3613 {
"show_format", 0, { .func_arg = &opt_show_format },
"show format/container info" },
3614 {
"show_frames", 0, { .func_arg = &opt_show_frames },
"show frames info" },
3616 "show a particular entry from the format/container info",
"entry" },
3618 "show a set of specified entries",
"entry_list" },
3622 {
"show_packets", 0, { .func_arg = &opt_show_packets },
"show packets info" },
3623 {
"show_programs", 0, { .func_arg = &opt_show_programs },
"show programs info" },
3624 {
"show_streams", 0, { .func_arg = &opt_show_streams },
"show streams info" },
3625 {
"show_chapters", 0, { .func_arg = &opt_show_chapters },
"show chapters info" },
3628 {
"show_program_version", 0, { .func_arg = &opt_show_program_version },
"show ffprobe version" },
3629 {
"show_library_versions", 0, { .func_arg = &opt_show_library_versions },
"show library versions" },
3630 {
"show_versions", 0, { .func_arg = &
opt_show_versions },
"show program and library versions" },
3631 {
"show_pixel_formats", 0, { .func_arg = &opt_show_pixel_formats },
"show pixel format descriptions" },
3640 "read and decode the streams to fill missing information with heuristics" },
3656 #define SET_DO_SHOW(id, varname) do { \ 3657 if (check_section_show_entries(SECTION_ID_##id)) \ 3658 do_show_##varname = 1; \ 3664 WriterContext *wctx;
3666 char *w_name =
NULL, *w_args =
NULL;
3702 SET_DO_SHOW(PIXEL_FORMAT_FLAGS, pixel_format_flags);
3703 SET_DO_SHOW(PIXEL_FORMAT_COMPONENTS, pixel_format_components);
3707 SET_DO_SHOW(STREAM_DISPOSITION, stream_disposition);
3708 SET_DO_SHOW(PROGRAM_STREAM_DISPOSITION, stream_disposition);
3720 "-bitexact and -show_program_version or -show_library_versions " 3721 "options are incompatible\n");
3737 "No name specified for the output format\n");
3748 "Unknown hash algorithm '%s'\nKnown algorithms:",
3767 if (w == &xml_writer)
unsigned int nb_chapters
Number of chapters in AVChapter array.
int32_t pitch
Rotation around the right vector [-90, 90].
uint8_t dv_bl_signal_compatibility_id
void init_dynload(void)
Initialize dynamic library loading.
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it ...
AVClassCategory parent_category
enum AVChromaLocation chroma_location
const struct section * section[SECTION_MAX_NB_LEVELS]
section per each level
static int opt_print_filename(void *optctx, const char *opt, const char *arg)
const struct AVCodec * codec
static char * value_string(char *buf, int buf_size, struct unit_value uv)
static int do_show_program_tags
enum AVFieldOrder field_order
Video only.
unsigned int nb_item[SECTION_MAX_NB_LEVELS]
number of the item printed in the given section, starting from 0
enum AVColorTransferCharacteristic color_trc
#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.
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...
void av_bprintf(AVBPrint *buf, const char *fmt,...)
void(* print_string)(WriterContext *wctx, const char *, const char *)
int nested_section[SECTION_MAX_NB_LEVELS]
static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
This structure describes decoded (raw) audio or video data.
#define pthread_mutex_lock(a)
static void json_print_int(WriterContext *wctx, const char *key, long long int value)
static void default_print_section_header(WriterContext *wctx)
unsigned MaxCLL
Max content light level (cd/m^2).
static int writer_register(const Writer *writer)
ptrdiff_t const GLvoid * data
This struct represents dynamic metadata for color volume transform - application 4 of SMPTE 2094-40:2...
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.
int64_t pkt_pos
reordered pos from the last AVPacket that has been input into the decoder
static void writer_print_rational(WriterContext *wctx, const char *key, AVRational q, char sep)
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.
#define LIBAVUTIL_VERSION_INT
int64_t pos
byte position in stream, -1 if unknown
#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)
static void print_chroma_location(WriterContext *w, enum AVChromaLocation chroma_location)
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...
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
static AVFormatContext * fmt_ctx
static int show_streams(WriterContext *w, InputFile *ifile)
static char * print_format
Video represents a portion of a sphere mapped on a flat surface using equirectangular projection...
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
static const Writer json_writer
Content light level (based on CTA-861.3).
Timecode which conforms to SMPTE ST 12-1.
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)
static void log_callback(void *ptr, int level, const char *fmt, va_list vl)
static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_idx, InputStream *ist, int in_program)
#define us(width, name, range_min, range_max, subs,...)
#define print_str_opt(k, v)
static int read_packets(WriterContext *w, InputFile *ifile)
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
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).
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
int avformat_open_input(AVFormatContext **ps, const char *url, ff_const59 AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
Mastering display metadata associated with a video frame.
static const AVClass writer_class
static int do_show_packets
static int do_show_format_tags
static int writer_open(WriterContext **wctx, const Writer *writer, const char *args, const struct section *sections, int nb_sections)
static void bprint_bytes(AVBPrint *bp, const uint8_t *ubuf, size_t ubuf_size)
#define FF_ARRAY_ELEMS(a)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
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)
static void error(const char *err)
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt)
Decode a subtitle message.
static uint64_t * nb_streams_frames
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample format(the sample packing is implied by the sample format) and sample rate.The lists are not just lists
int has_nested_elems[SECTION_MAX_NB_LEVELS]
static int validate_string(WriterContext *wctx, char **dstp, const char *src)
if it could not because there are no more frames
#define CMDUTILS_COMMON_OPTIONS
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
This struct describes the properties of an encoded stream.
AVColorTransferCharacteristic
Color Transfer Characteristic.
Use XML non-markup character data escaping.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
static int do_count_frames
#define SECTION_MAX_NB_LEVELS
enum AVColorSpace color_space
static void * writer_child_next(void *obj, void *prev)
const char * av_color_space_name(enum AVColorSpace space)
static const AVOption default_options[]
static av_always_inline int process_frame(WriterContext *w, InputFile *ifile, AVFrame *frame, AVPacket *pkt, int *packet_new)
Mastering display metadata (based on SMPTE-2086:2014).
#define AV_DICT_DONT_STRDUP_KEY
Take ownership of a key that's been allocated with av_malloc() or another memory allocation function...
#define AV_HASH_MAX_SIZE
Maximum value that av_hash_get_size() will currently return.
const AVClass * avcodec_get_class(void)
Get the AVClass for AVCodecContext.
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...
AVRational targeted_system_display_maximum_luminance
The nominal maximum display luminance of the targeted system display, in units of 0...
#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)
static int probe_file(WriterContext *wctx, const char *filename, const char *print_filename)
uint8_t mastering_display_actual_peak_luminance_flag
This flag shall be equal to 0 in bitstreams conforming to this version of this Specification.
#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.
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)
int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict)
Unpack a dictionary from side_data.
static av_cold int uninit(AVCodecContext *avctx)
static int do_show_pixel_format_components
static int * selected_streams
static void close_input_file(InputFile *ifile)
timestamp utils, mostly useful for debugging/logging purposes
Stereo 3D type: this structure describes how two videos are packed within a single video surface...
#define va_copy(dst, src)
AVColorSpace
YUV colorspace type.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
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 *(* item_name)(void *ctx)
A pointer to a function which returns the name of a context instance ctx associated with the class...
const char * av_color_range_name(enum AVColorRange range)
int id
unique ID to identify the chapter
static int show_chapters(WriterContext *w, InputFile *ifile)
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static av_cold int compact_init(WriterContext *wctx)
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
static int find_stream_info
int id
Format-specific stream ID.
static int do_show_library_versions
static void compact_print_section_header(WriterContext *wctx)
GLsizei GLboolean const GLfloat * value
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.
void av_spherical_tile_bounds(const AVSphericalMapping *map, size_t width, size_t height, size_t *left, size_t *top, size_t *right, size_t *bottom)
Convert the bounding fields from an AVSphericalVideo from 0.32 fixed point to pixels.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
int nb_side_data
The number of elements in the AVStream.side_data array.
uint8_t num_cols_targeted_system_display_actual_peak_luminance
The number of columns in the targeted_system_display_actual_peak_luminance array. ...
static int match_section(const char *section_name, int show_all_entries, AVDictionary *entries)
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.
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
Fill the codec context based on the values from the supplied codec parameters.
HDR dynamic metadata associated with a video frame.
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
Append data to a print buffer.
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
static void writer_print_data_hash(WriterContext *wctx, const char *name, uint8_t *data, int size)
uint8_t application_version
Application version in the application defining document in ST-2094 suite.
Structure to hold side data for an AVFrame.
const char * av_stereo3d_type_name(unsigned int type)
Provide a human-readable name of a given stereo3d type.
static const AVOption json_options[]
static void ERROR(const char *str)
static void log_read_interval(const ReadInterval *interval, void *log_ctx, int log_level)
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 *))
static double av_q2d(AVRational a)
Convert an AVRational to a double.
#define SECTION_MAX_NB_CHILDREN
static int show_program(WriterContext *w, InputFile *ifile, AVProgram *program)
int avformat_network_init(void)
Do global initialization of network libraries.
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 AVERROR_EOF
End of file.
#define AV_LOG_VERBOSE
Detailed information.
AVDictionary * metadata
metadata.
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.
AVColorRange
Visual content value range.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
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
AVColorPrimaries
Chromaticity coordinates of the source primaries.
static void print_pkt_side_data(WriterContext *w, AVCodecParameters *par, const AVPacketSideData *side_data, int nb_side_data, SectionID id_data_list, SectionID id_data)
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
static const char * input_filename
unsigned int * stream_index
static void json_print_section_header(WriterContext *wctx)
AVFrameSideData ** side_data
uint64_t channel_layout
Audio only.
void(* print_section_footer)(WriterContext *wctx)
static void ffprobe_show_program_version(WriterContext *w)
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().
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
#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.