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) {
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 =
"";
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
451 #define SECTION_MAX_NB_LEVELS 10
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"}},
505 if (!prev &&
ctx->writer &&
ctx->writer->priv_class &&
ctx->priv)
525 if ((*wctx)->writer->uninit)
526 (*wctx)->writer->uninit(*wctx);
529 if ((*wctx)->writer->priv_class)
540 for (
i = 0;
i < ubuf_size;
i++)
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);
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;
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)
868 for (
i = 0;
i < l;
i++) {
882 #define MAX_REGISTERED_WRITERS_NB 64
888 static int next_registered_writer_idx = 0;
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++)
963 if (parent_section &&
998 printf(
"%s\n",
value);
1007 printf(
"%lld\n",
value);
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)];
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",
1170 if (!compact->
nokey)
1182 if (!compact->
nokey)
1184 printf(
"%lld",
value);
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;
1309 if (!parent_section)
1313 if (
flat->hierarchical ||
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)
1408 if (!parent_section) {
1409 printf(
"# ffprobe output\n\n");
1429 printf(
"[%s]\n", buf->str);
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, ' ')
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, ' ')
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) {
1748 printf(
"<%s key=\"%s\"",
1754 printf(
" value=\"%s\"/>\n", buf.str);
1761 printf(
"%s=\"%s\"",
key, buf.str);
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++) {
2206 print_int (
"start_display_time",
sub->start_display_time);
2257 print_q(
"sample_aspect_ratio", sar,
':');
2311 uint32_t *
tc = (uint32_t*)sd->
data;
2314 for (
int j = 1; j <= m ; j++) {
2374 int ret = 0, got_frame = 0;
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;
2470 "Could not seek to relative position since current "
2471 "timestamp is not defined\n");
2475 target = *cur_ts + interval->
start;
2477 target = interval->
start;
2518 end = start + interval->
end;
2523 if (frame_count >= interval->
end)
2525 }
else if (has_end && *cur_ts !=
AV_NOPTS_VALUE && *cur_ts >= end) {
2618 char profile_num[12];
2645 print_q(
"sample_aspect_ratio", sar,
':');
2650 print_q(
"display_aspect_ratio", dar,
':');
2667 print_str(
"field_order",
"progressive");
2717 if (opt->
flags)
continue;
2755 #define PRINT_DISPOSITION(flagname, name) do { \
2756 print_int(name, !!(stream->disposition & AV_DISPOSITION_##flagname)); \
2798 for (
i = 0;
i <
ifile->nb_streams;
i++)
2921 const char *errbuf_ptr = errbuf;
2933 const char *print_filename)
2938 int scan_all_pmts_set = 0;
2948 scan_all_pmts_set = 1;
2955 if (print_filename) {
2960 if (scan_all_pmts_set)
2971 for (
i = 0;
i < orig_nb_streams;
i++)
2984 sizeof(*
ifile->streams));
2985 if (!
ifile->streams)
2999 "Failed to probe codec for input stream %d\n",
3007 "Unsupported codec with id %d for input stream %d\n",
3055 for (
i = 0;
i <
ifile->nb_streams;
i++)
3060 ifile->nb_streams = 0;
3066 const char *print_filename)
3079 #define CHECK_END if (ret < 0) goto end
3086 for (
i = 0;
i <
ifile.fmt_ctx->nb_streams;
i++) {
3089 ifile.fmt_ctx->streams[
i],
3160 print_fmt(
"copyright",
"Copyright (c) %d-%d the FFmpeg developers",
3169 #define SHOW_LIB_VERSION(libname, LIBNAME) \
3171 if (CONFIG_##LIBNAME) { \
3172 unsigned int version = libname##_version(); \
3173 writer_print_section_header(w, SECTION_ID_LIBRARY_VERSION); \
3174 print_str("name", "lib" #libname); \
3175 print_int("major", LIB##LIBNAME##_VERSION_MAJOR); \
3176 print_int("minor", LIB##LIBNAME##_VERSION_MINOR); \
3177 print_int("micro", LIB##LIBNAME##_VERSION_MICRO); \
3178 print_int("version", version); \
3179 print_str("ident", LIB##LIBNAME##_IDENT); \
3180 writer_print_section_footer(w); \
3198 #define PRINT_PIX_FMT_FLAG(flagname, name) \
3200 print_int(name, !!(pixdesc->flags & AV_PIX_FMT_FLAG_##flagname)); \
3284 "'%s' matches section with unique name '%s'\n", section_name,
3295 const char *p =
arg;
3303 if (!section_name) {
3305 "Missing section name for option '%s'\n", opt);
3311 while (*p && *p !=
':') {
3316 "Adding '%s' to the entries to show in section '%s'\n",
3317 entry, section_name);
3352 "Option '%s' is deprecated, use '-show_entries format=%s' instead\n",
3363 "Argument '%s' provided as input filename, but '%s' was already specified.\n",
3367 if (!strcmp(
arg,
"-"))
3404 char *next, *p, *spec =
av_strdup(interval_spec);
3415 next = strchr(spec,
'%');
3457 lli = strtoll(p, &tail, 10);
3458 if (*tail || lli < 0) {
3460 "Invalid or negative value '%s' for duration number of frames\n", p);
3463 interval->
end = lli;
3485 char *p, *spec =
av_strdup(intervals_spec);
3490 for (n = 0, p = spec; *p; p++)
3504 for (
i = 0; p;
i++) {
3508 next = strchr(p,
',');
3563 printf(
"Sections:\n"
3564 "W.. = Section is a wrapper (contains other sections, no local entries)\n"
3565 ".A. = Section contains an array of elements of the same type\n"
3566 "..V = Section may contain a variable number of fields with variable keys\n"
3567 "FLAGS NAME/UNIQUE_NAME\n"
3580 #define DEFINE_OPT_SHOW_SECTION(section, target_section_id) \
3581 static int opt_show_##section(void *optctx, const char *opt, const char *arg) \
3583 mark_section_show_entries(SECTION_ID_##target_section_id, 1, NULL); \
3604 "use binary prefixes for byte units" },
3606 "use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" },
3608 "prettify the format of displayed values, make it more human readable" },
3610 "set the output printing format (available formats are: default, compact, csv, flat, ini, json, xml)",
"format" },
3613 {
"sections",
OPT_EXIT, {.func_arg =
opt_sections},
"print sections structure and section information, and exit" },
3616 {
"show_error", 0, { .func_arg = &opt_show_error },
"show probing error" },
3617 {
"show_format", 0, { .func_arg = &opt_show_format },
"show format/container info" },
3618 {
"show_frames", 0, { .func_arg = &opt_show_frames },
"show frames info" },
3620 "show a particular entry from the format/container info",
"entry" },
3622 "show a set of specified entries",
"entry_list" },
3626 {
"show_packets", 0, { .func_arg = &opt_show_packets },
"show packets info" },
3627 {
"show_programs", 0, { .func_arg = &opt_show_programs },
"show programs info" },
3628 {
"show_streams", 0, { .func_arg = &opt_show_streams },
"show streams info" },
3629 {
"show_chapters", 0, { .func_arg = &opt_show_chapters },
"show chapters info" },
3632 {
"show_program_version", 0, { .func_arg = &opt_show_program_version },
"show ffprobe version" },
3633 {
"show_library_versions", 0, { .func_arg = &opt_show_library_versions },
"show library versions" },
3634 {
"show_versions", 0, { .func_arg = &
opt_show_versions },
"show program and library versions" },
3635 {
"show_pixel_formats", 0, { .func_arg = &opt_show_pixel_formats },
"show pixel format descriptions" },
3644 "read and decode the streams to fill missing information with heuristics" },
3660 #define SET_DO_SHOW(id, varname) do { \
3661 if (check_section_show_entries(SECTION_ID_##id)) \
3662 do_show_##varname = 1; \
3670 char *w_name =
NULL, *w_args =
NULL;
3706 SET_DO_SHOW(PIXEL_FORMAT_FLAGS, pixel_format_flags);
3707 SET_DO_SHOW(PIXEL_FORMAT_COMPONENTS, pixel_format_components);
3711 SET_DO_SHOW(STREAM_DISPOSITION, stream_disposition);
3712 SET_DO_SHOW(PROGRAM_STREAM_DISPOSITION, stream_disposition);
3724 "-bitexact and -show_program_version or -show_library_versions "
3725 "options are incompatible\n");
3741 "No name specified for the output format\n");
3752 "Unknown hash algorithm '%s'\nKnown algorithms:",
static double val(void *priv, double ch)
static const char *const format[]
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Libavcodec external API header.
#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS
#define FF_PROFILE_UNKNOWN
Main libavdevice API header.
int64_t avio_size(AVIOContext *s)
Get the filesize.
int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict)
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, buffer_size_t *size)
static av_cold int init(AVCodecContext *avctx)
char * av_asprintf(const char *fmt,...)
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
void av_bprintf(AVBPrint *buf, const char *fmt,...)
void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_chars, enum AVEscapeMode mode, int flags)
Escape the content in src and append it to dstbuf.
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
Append data to a print buffer.
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
#define AV_BPRINT_SIZE_UNLIMITED
#define AV_BPRINT_SIZE_AUTOMATIC
#define flags(name, subs,...)
#define us(width, name, range_min, range_max, subs,...)
void exit_program(int ret)
Wraps exit with a program-specific cleanup routine.
void show_help_children(const AVClass *class, int flags)
Show help for all options with given flags in class and all its children.
void init_dynload(void)
Initialize dynamic library loading.
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.
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.
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...
AVDictionary ** setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *codec_opts)
Setup AVCodecContext options for avformat_find_stream_info().
AVDictionary * filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id, AVFormatContext *s, AVStream *st, const AVCodec *codec)
Filter out options for given codec.
void parse_loglevel(int argc, char **argv, const OptionDef *options)
Find the '-loglevel' option in the command line args and apply it.
void parse_options(void *optctx, int argc, char **argv, const OptionDef *options, void(*parse_arg_function)(void *, const char *))
void log_callback_help(void *ptr, int level, const char *fmt, va_list vl)
Trivial log callback.
AVDictionary * format_opts
void show_banner(int argc, char **argv, const OptionDef *options)
Print the program banner to stderr.
void register_exit(void(*cb)(int ret))
Register a program-specific cleanup routine.
AVDictionary * codec_opts
void uninit_opts(void)
Uninitialize the cmdutils option system, in particular free the *_opts contexts and their contents.
void init_opts(void)
Initialize the cmdutils option system, in particular allocate the *_opts contexts.
#define CMDUTILS_COMMON_OPTIONS
#define FFMPEG_CONFIGURATION
static AVFormatContext * fmt_ctx
static float sub(float src0, float src1)
static void show_usage(void)
const char program_name[]
program name, defined by the program for show_version().
static int writer_open(WriterContext **wctx, const Writer *writer, const char *args, const struct section *sections, int nb_sections)
static char * stream_specifier
static void log_callback(void *ptr, int level, const char *fmt, va_list vl)
@ SECTION_ID_FRAME_SIDE_DATA
@ SECTION_ID_PROGRAM_STREAM
@ SECTION_ID_PROGRAM_VERSION
@ SECTION_ID_PIXEL_FORMAT_FLAGS
@ SECTION_ID_PROGRAM_TAGS
@ SECTION_ID_PIXEL_FORMATS
@ SECTION_ID_LIBRARY_VERSION
@ SECTION_ID_STREAM_SIDE_DATA
@ SECTION_ID_PACKETS_AND_FRAMES
@ SECTION_ID_PACKET_SIDE_DATA_LIST
@ SECTION_ID_PROGRAM_STREAM_DISPOSITION
@ SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST
@ SECTION_ID_LIBRARY_VERSIONS
@ SECTION_ID_STREAM_SIDE_DATA_LIST
@ SECTION_ID_PROGRAM_STREAM_TAGS
@ SECTION_ID_FRAME_SIDE_DATA_TIMECODE
@ SECTION_ID_PIXEL_FORMAT_COMPONENTS
@ SECTION_ID_PIXEL_FORMAT_COMPONENT
@ SECTION_ID_PIXEL_FORMAT
@ SECTION_ID_FRAME_SIDE_DATA_LIST
@ SECTION_ID_CHAPTER_TAGS
@ SECTION_ID_PACKET_SIDE_DATA
@ SECTION_ID_STREAM_DISPOSITION
@ SECTION_ID_PROGRAM_STREAMS
#define WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS
static void ini_print_str(WriterContext *wctx, const char *key, const char *value)
static const AVOption ini_options[]
static int use_byte_value_binary_prefix
static int do_show_frame_tags
static int do_show_pixel_format_flags
static void ini_print_int(WriterContext *wctx, const char *key, long long int value)
static void bprint_bytes(AVBPrint *bp, const uint8_t *ubuf, size_t ubuf_size)
#define SHOW_LIB_VERSION(libname, LIBNAME)
static const OptionDef real_options[]
static ReadInterval * read_intervals
static const char * print_input_filename
#define CHECK_COMPLIANCE(opt, opt_name)
static av_cold int json_init(WriterContext *wctx)
static int do_show_chapter_tags
static char * show_data_hash
static void show_subtitle(WriterContext *w, AVSubtitle *sub, AVStream *stream, AVFormatContext *fmt_ctx)
#define WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER
static const char * json_escape_str(AVBPrint *dst, const char *src, void *log_ctx)
static const char unit_second_str[]
static int read_packets(WriterContext *w, InputFile *ifile)
#define SECTION_FLAG_IS_WRAPPER
the section only contains other sections, but has no data at its own level
static const char unit_byte_str[]
static int show_program(WriterContext *w, InputFile *ifile, AVProgram *program)
static void print_primaries(WriterContext *w, enum AVColorPrimaries color_primaries)
static void ffprobe_show_library_versions(WriterContext *w)
static const Writer flat_writer
static LogBuffer * log_buffer
static void default_print_section_header(WriterContext *wctx)
static int read_interval_packets(WriterContext *w, InputFile *ifile, const ReadInterval *interval, int64_t *cur_ts)
static void json_print_section_footer(WriterContext *wctx)
#define SECTION_MAX_NB_LEVELS
static int opt_format(void *optctx, const char *opt, const char *arg)
static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, AVFormatContext *fmt_ctx)
static int show_value_unit
static int opt_read_intervals(void *optctx, const char *opt, const char *arg)
#define SECTION_MAX_NB_CHILDREN
#define SECTION_FLAG_IS_ARRAY
the section contains an array of elements of the same type
static const AVOption default_options[]
static int find_stream_info
static int validate_string(WriterContext *wctx, char **dstp, const char *src)
static void print_color_range(WriterContext *w, enum AVColorRange color_range)
#define pthread_mutex_lock(a)
int main(int argc, char **argv)
static struct section sections[]
static av_always_inline int process_frame(WriterContext *w, InputFile *ifile, AVFrame *frame, AVPacket *pkt, int *packet_new)
static const Writer * registered_writers[MAX_REGISTERED_WRITERS_NB+1]
static void flat_print_int(WriterContext *wctx, const char *key, long long int value)
static char * value_string(char *buf, int buf_size, struct unit_value uv)
static int do_show_frames
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 uint64_t * nb_streams_packets
static void compact_print_section_footer(WriterContext *wctx)
static const AVOption xml_options[]
static int do_show_program_tags
static int do_show_format
static int parse_read_interval(const char *interval_spec, ReadInterval *interval)
Parse interval specification, according to the format: INTERVAL ::= [START|+START_OFFSET][%[END|+END_...
static void writer_print_section_footer(WriterContext *wctx)
static const AVOption csv_options[]
static const Writer compact_writer
static av_cold int xml_init(WriterContext *wctx)
static int do_show_packets
static const char unit_hertz_str[]
static const char * none_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
static void print_color_space(WriterContext *w, enum AVColorSpace color_space)
static int show_streams(WriterContext *w, InputFile *ifile)
#define print_section_header(s)
static void show_error(WriterContext *w, int err)
static char * upcase_string(char *dst, size_t dst_size, const char *src)
static int opt_pretty(void *optctx, const char *opt, const char *arg)
#define print_str_validate(k, v)
static const char * input_filename
static int probe_file(WriterContext *wctx, const char *filename, const char *print_filename)
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 json_print_item_str(WriterContext *wctx, const char *key, const char *value)
#define SECTION_FLAG_HAS_VARIABLE_FIELDS
the section may contain a variable number of fields with variable keys.
static void compact_print_section_header(WriterContext *wctx)
static void print_chroma_location(WriterContext *w, enum AVChromaLocation chroma_location)
static const AVOption compact_options[]
static int do_count_packets
static void ini_print_section_header(WriterContext *wctx)
static void json_print_int(WriterContext *wctx, const char *key, long long int value)
static void flat_print_section_header(WriterContext *wctx)
static const char unit_bit_per_second_str[]
@ WRITER_STRING_VALIDATION_NB
@ WRITER_STRING_VALIDATION_REPLACE
@ WRITER_STRING_VALIDATION_IGNORE
@ WRITER_STRING_VALIDATION_FAIL
static int opt_show_format_entry(void *optctx, const char *opt, const char *arg)
#define print_duration_ts(k, v)
static void writer_print_data(WriterContext *wctx, const char *name, uint8_t *data, int size)
static av_cold int flat_init(WriterContext *wctx)
static void writer_print_integer(WriterContext *wctx, const char *key, long long int val)
static void xml_print_section_footer(WriterContext *wctx)
#define DEFINE_WRITER_CLASS(name)
static int do_count_frames
static const Writer csv_writer
static void xml_print_str(WriterContext *wctx, const char *key, const char *value)
static void compact_print_int(WriterContext *wctx, const char *key, long long int value)
#define MAX_REGISTERED_WRITERS_NB
static const char * csv_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
Quote fields containing special characters, check RFC4180.
void show_help_default(const char *opt, const char *arg)
Per-fftool specific help handler.
#define print_str_opt(k, v)
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)
static uint64_t * nb_streams_frames
static int do_show_pixel_format_components
static void default_print_int(WriterContext *wctx, const char *key, long long int value)
static const struct @4 si_prefixes[]
static void default_print_section_footer(WriterContext *wctx)
static void ffprobe_cleanup(int ret)
#define print_val(k, v, u)
static void xml_print_section_header(WriterContext *wctx)
static int show_format(WriterContext *w, InputFile *ifile)
static int writer_print_string(WriterContext *wctx, const char *key, const char *val, int flags)
static int do_show_packet_tags
static void default_print_str(WriterContext *wctx, const char *key, const char *value)
#define DEFINE_OPT_SHOW_SECTION(section, target_section_id)
static int read_intervals_nb
static void log_read_interval(const ReadInterval *interval, void *log_ctx, int log_level)
static int check_section_show_entries(int section_id)
static void flat_print_str(WriterContext *wctx, const char *key, const char *value)
static const AVOption writer_options[]
#define SET_DO_SHOW(id, varname)
static int show_log(WriterContext *w, int section_ids, int section_id, int log_level)
static const Writer ini_writer
static void writer_register_all(void)
static void print_color_trc(WriterContext *w, enum AVColorTransferCharacteristic color_trc)
static int match_section(const char *section_name, int show_all_entries, AVDictionary *entries)
static int opt_show_entries(void *optctx, const char *opt, const char *arg)
static void writer_print_rational(WriterContext *wctx, const char *key, AVRational q, char sep)
static void * writer_child_next(void *obj, void *prev)
static void writer_close(WriterContext **wctx)
static int do_show_programs
static void close_input_file(InputFile *ifile)
static void print_section(SectionID id, int level)
#define pthread_mutex_unlock(a)
static int do_show_library_versions
static int do_show_stream_tags
static void ffprobe_show_program_version(WriterContext *w)
static void writer_print_data_hash(WriterContext *wctx, const char *name, uint8_t *data, int size)
static int do_show_program_version
static int do_read_packets
static const char * flat_escape_value_str(AVBPrint *dst, const char *src)
static void json_print_str(WriterContext *wctx, const char *key, const char *value)
static int show_tags(WriterContext *w, AVDictionary *tags, int section_id)
static int opt_print_filename(void *optctx, const char *opt, const char *arg)
static const Writer json_writer
static av_cold int compact_init(WriterContext *wctx)
static int use_value_prefix
static const char * flat_escape_key_str(AVBPrint *dst, const char *src, const char sep)
static int opt_input_file_i(void *optctx, const char *opt, const char *arg)
static AVInputFormat * iformat
static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_idx, InputStream *ist, int in_program)
static int * selected_streams
#define print_duration_time(k, v, tb)
static void opt_input_file(void *optctx, const char *arg)
static const Writer * writer_get_by_name(const char *name)
static const OptionDef * options
static char * print_format
static int do_show_streams
static const AVOption json_options[]
static const AVOption flat_options[]
static int do_show_chapters
static int show_private_data
static void xml_print_int(WriterContext *wctx, const char *key, long long int value)
static void ffprobe_show_pixel_formats(WriterContext *w)
static int do_show_pixel_formats
static char * ini_escape_str(AVBPrint *dst, const char *src)
#define print_section_footer(s)
static void writer_print_section_header(WriterContext *wctx, int section_id)
static int do_show_stream_disposition
static const char * writer_get_name(void *p)
static int show_programs(WriterContext *w, InputFile *ifile)
const int program_birth_year
program birth year, defined by the program for show_banner()
static int log_buffer_size
static struct AVHashContext * hash
static int open_input_file(InputFile *ifile, const char *filename, const char *print_filename)
static void writer_print_time(WriterContext *wctx, const char *key, int64_t ts, const AVRational *time_base, int is_duration)
static void mark_section_show_entries(SectionID section_id, int show_all_entries, AVDictionary *entries)
#define PRINT_STRING_VALIDATE
static void json_print_section_header(WriterContext *wctx)
static int writer_register(const Writer *writer)
#define print_time(k, v, tb)
static int use_value_sexagesimal_format
static int do_read_frames
static int opt_sections(void *optctx, const char *opt, const char *arg)
static const Writer default_writer
#define REALLOCZ_ARRAY_STREAM(ptr, cur_n, new_n)
#define PRINT_DISPOSITION(flagname, name)
static const AVClass writer_class
static void clear_log(int need_lock)
static void writer_print_ts(WriterContext *wctx, const char *key, int64_t ts, int is_duration)
static int parse_read_intervals(const char *intervals_spec)
#define PRINT_PIX_FMT_FLAG(flagname, name)
static int do_show_format_tags
static int show_chapters(WriterContext *w, InputFile *ifile)
static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int packet_idx)
static int opt_show_versions(void *optctx, const char *opt, const char *arg)
static void compact_print_str(WriterContext *wctx, const char *key, const char *value)
#define print_fmt(k, f,...)
static void print_dynamic_hdr10_plus(WriterContext *w, const AVDynamicHDRPlus *metadata)
static AVCodecContext * dec_ctx
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
const AVOption * av_opt_next(const void *obj, const AVOption *last)
Iterate over all AVOptions belonging to obj.
void av_opt_free(void *obj)
Free all allocated objects in obj.
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
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.
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
void avsubtitle_free(AVSubtitle *sub)
Free all allocated data in the given subtitle struct.
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
Fill the codec context based on the values from the supplied codec parameters.
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
const AVClass * avcodec_get_class(void)
Get the AVClass for AVCodecContext.
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
@ AV_CODEC_ID_PROBE
codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Return decoded output data from a decoder.
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt)
Decode a subtitle message.
int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
Supply raw packet data as input to a decoder.
@ AVDISCARD_ALL
discard all
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
const char * avcodec_profile_name(enum AVCodecID codec_id, int profile)
Return a name for the specified profile, if available.
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
#define AV_PKT_FLAG_DISCARD
Flag is used to discard packets which are required to maintain valid decoder state but are not requir...
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
const char * av_packet_side_data_name(enum AVPacketSideDataType type)
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
@ AV_PKT_DATA_STRINGS_METADATA
A list of zero terminated key/value strings.
@ AV_PKT_DATA_SKIP_SAMPLES
Recommmends skipping the specified number of samples.
@ AV_PKT_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata (based on SMPTE-2086:2014).
@ AV_PKT_DATA_SPHERICAL
This side data should be associated with a video stream and corresponds to the AVSphericalMapping str...
@ AV_PKT_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
@ AV_PKT_DATA_STEREO3D
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
@ AV_PKT_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
@ AV_PKT_DATA_DOVI_CONF
DOVI configuration ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2....
void avdevice_register_all(void)
Initialize libavdevice and register all the input and output devices.
int avformat_network_deinit(void)
Undo the initialization done by avformat_network_init.
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
int avformat_network_init(void)
Do global initialization of network libraries.
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
ff_const59 AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
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.
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
int avformat_open_input(AVFormatContext **ps, const char *url, ff_const59 AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
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.
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_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,...
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key,...
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define AV_DICT_DONT_OVERWRITE
Don't overwrite existing entries.
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.
#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_DICT_MATCH_CASE
Only get an entry with exact-case key match.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
Put a description of the AVERROR code errnum in errbuf.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AVERROR_EOF
End of file.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define AVERROR_OPTION_NOT_FOUND
Option not found.
const char * av_frame_side_data_name(enum AVFrameSideDataType type)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
@ AV_FRAME_DATA_GOP_TIMECODE
The GOP timecode in 25 bit timecode format.
@ AV_FRAME_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
@ AV_FRAME_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
@ AV_FRAME_DATA_DYNAMIC_HDR_PLUS
HDR dynamic metadata associated with a video frame.
@ AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata associated with a video frame.
@ AV_FRAME_DATA_ICC_PROFILE
The data contains an ICC profile as an opaque octet buffer following the format described by ISO 1507...
@ AV_FRAME_DATA_S12M_TIMECODE
Timecode which conforms to SMPTE ST 12-1.
void av_hash_freep(AVHashContext **ctx)
Free hash context and set hash context pointer to NULL.
const char * av_hash_names(int i)
Get the names of available hash algorithms.
void av_hash_final_hex(struct AVHashContext *ctx, uint8_t *dst, int size)
Finalize a hash context and store the hexadecimal representation of the actual hash value as a string...
void av_hash_init(AVHashContext *ctx)
Initialize or reset a hash context.
void av_hash_update(AVHashContext *ctx, const uint8_t *src, int len)
Update a hash context with additional data.
int av_hash_alloc(AVHashContext **ctx, const char *name)
Allocate a hash context for the algorithm specified by name.
#define AV_HASH_MAX_SIZE
Maximum value that av_hash_get_size() will currently return.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
Set the logging callback.
void av_log_default_callback(void *ptr, int level, const char *fmt, va_list vl)
Default logging callback.
#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...
void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl, char *line, int line_size, int *print_prefix)
Format a line of log the same way as the default callback.
void av_log_set_flags(int arg)
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
char * av_strdup(const char *s)
Duplicate a string.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate, or free an array.
void * av_mallocz_array(size_t nmemb, size_t size)
Allocate a memory block for an array with av_mallocz().
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
#define av_fourcc2str(fourcc)
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.
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
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.
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().
#define AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES
Within AV_ESCAPE_MODE_XML, additionally escape double quotes for double quoted attributes.
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...
static av_const int av_toupper(int c)
Locale-independent conversion of ASCII characters to uppercase.
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...
#define AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES
exclude control codes not accepted by XML
@ AV_ESCAPE_MODE_XML
Use XML non-markup character data escaping.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
#define LIBAVUTIL_VERSION_INT
double av_display_rotation_get(const int32_t matrix[9])
Extract the rotation component of the transformation matrix.
const char * av_spherical_projection_name(enum AVSphericalProjection projection)
Provide a human-readable name of a given AVSphericalProjection.
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.
@ AV_SPHERICAL_EQUIRECTANGULAR_TILE
Video represents a portion of a sphere mapped on a flat surface using equirectangular projection.
@ AV_SPHERICAL_CUBEMAP
Video frame is split into 6 faces of a cube, and arranged on a 3x2 layout.
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
const char * av_stereo3d_type_name(unsigned int type)
Provide a human-readable name of a given stereo3d type.
int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
const char * av_hash_get_name(const AVHashContext *ctx)
static const struct ColorPrimaries color_primaries[AVCOL_PRI_NB]
Replacements for frequently missing libm functions.
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
Parse timestr and return in *time a corresponding number of microseconds.
const AVPixFmtDescriptor * av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
Iterate over all pixel format descriptors known to libavutil.
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
const char * av_chroma_location_name(enum AVChromaLocation location)
const char * av_color_range_name(enum AVColorRange range)
const char * av_color_space_name(enum AVColorSpace space)
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
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.
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
AVChromaLocation
Location of chroma samples.
@ AVCHROMA_LOC_UNSPECIFIED
AVColorRange
Visual content value range.
@ AVCOL_RANGE_UNSPECIFIED
AVColorPrimaries
Chromaticity coordinates of the source primaries.
AVColorTransferCharacteristic
Color Transfer Characteristic.
AVColorSpace
YUV colorspace type.
typedef void(RENAME(mix_any_func_type))
#define FF_ARRAY_ELEMS(a)
int id
unique ID to identify the chapter
int64_t end
chapter start/end time in time_base units
AVRational time_base
time base in which the start/end timestamps are specified
Describe the class of an AVClass context structure.
AVClassCategory(* get_category)(void *ctx)
Callback to return the category.
AVClassCategory category
Category used for visualization (like color) This is only set if the category is equal for all object...
int parent_log_context_offset
Offset in the structure where a pointer to the parent context for logging is stored.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
const char *(* item_name)(void *ctx)
A pointer to a function which returns the name of a context instance ctx associated with the class.
main external API structure.
AVRational pkt_timebase
Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
const struct AVCodec * codec
unsigned properties
Properties of the stream that gets decoded.
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
int refs
number of reference frames
int64_t rc_max_rate
maximum bitrate
int coded_width
Bitstream width / height, may be different from width/height e.g.
This struct describes the properties of a single codec described by an AVCodecID.
const char * long_name
A more descriptive name for this codec.
const char * name
Name of the codec described by this descriptor.
This struct describes the properties of an encoded stream.
enum AVColorSpace color_space
int extradata_size
Size of the extradata content in bytes.
enum AVFieldOrder field_order
Video only.
uint64_t channel_layout
Audio only.
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
enum AVMediaType codec_type
General type of the encoded data.
int profile
Codec-specific bitstream restrictions that the stream conforms to.
int video_delay
Video only.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
enum AVColorPrimaries color_primaries
int sample_rate
Audio only.
enum AVColorTransferCharacteristic color_trc
enum AVChromaLocation chroma_location
enum AVColorRange color_range
Video only.
const AVClass * priv_class
AVClass for the private context.
int depth
Number of bits in the component.
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
unsigned MaxFALL
Max average light level per frame (cd/m^2).
unsigned MaxCLL
Max content light level (cd/m^2).
uint8_t dv_bl_signal_compatibility_id
This struct represents dynamic metadata for color volume transform - application 4 of SMPTE 2094-40:2...
uint8_t targeted_system_display_actual_peak_luminance_flag
This flag shall be equal to 0 in bit streams conforming to this version of this Specification.
uint8_t num_cols_targeted_system_display_actual_peak_luminance
The number of columns in the targeted_system_display_actual_peak_luminance array.
AVRational targeted_system_display_maximum_luminance
The nominal maximum display luminance of the targeted system display, in units of 0....
uint8_t mastering_display_actual_peak_luminance_flag
This flag shall be equal to 0 in bitstreams conforming to this version of this Specification.
AVHDRPlusColorTransformParams params[3]
The color transform parameters for every processing window.
uint8_t num_rows_targeted_system_display_actual_peak_luminance
The number of rows in the targeted system_display_actual_peak_luminance array.
uint8_t application_version
Application version in the application defining document in ST-2094 suite.
AVRational targeted_system_display_actual_peak_luminance[25][25]
The normalized actual peak luminance of the targeted system display.
uint8_t num_cols_mastering_display_actual_peak_luminance
The number of columns in the mastering_display_actual_peak_luminance array.
AVRational mastering_display_actual_peak_luminance[25][25]
The normalized actual peak luminance of the mastering display used for mastering the image essence.
uint8_t num_windows
The number of processing windows.
uint8_t num_rows_mastering_display_actual_peak_luminance
The number of rows in the mastering_display_actual_peak_luminance array.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
AVIOContext * pb
I/O context.
int64_t start_time
Position of the first frame of the component, in AV_TIME_BASE fractional seconds.
AVDictionary * metadata
Metadata that applies to the whole file.
ff_const59 struct AVInputFormat * iformat
The input container format.
char * url
input or output URL.
int probe_score
format probing score.
unsigned int nb_chapters
Number of chapters in AVChapter array.
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
AVStream ** streams
A list of all streams in the file.
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
Structure to hold side data for an AVFrame.
enum AVFrameSideDataType type
This structure describes decoded (raw) audio or video data.
int coded_picture_number
picture number in bitstream order
int nb_samples
number of audio samples (per channel) described by this frame
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
int64_t best_effort_timestamp
frame timestamp estimated using various heuristics, in stream time base
int display_picture_number
picture number in display order
enum AVChromaLocation chroma_location
int key_frame
1 -> keyframe, 0-> not
int64_t pkt_duration
duration of the corresponding packet, expressed in AVStream->time_base units, 0 if unknown.
int64_t pkt_pos
reordered pos from the last AVPacket that has been input into the decoder
int pkt_size
size of the corresponding packet containing the compressed frame.
AVFrameSideData ** side_data
int channels
number of audio channels, only used for audio.
enum AVColorPrimaries color_primaries
AVDictionary * metadata
metadata.
uint64_t channel_layout
Channel layout of the audio data.
int top_field_first
If the content is interlaced, is top field displayed first.
int interlaced_frame
The content of the picture is interlaced.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
enum AVColorSpace colorspace
YUV colorspace type.
int64_t pkt_dts
DTS copied from the AVPacket that triggered returning this frame.
enum AVColorTransferCharacteristic color_trc
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
int repeat_pict
When decoding, this signals how much the picture must be delayed.
enum AVPictureType pict_type
Picture type of the frame.
AVRational percentile
The linearized maxRGB value at a specific percentile in the processing window in the scene.
uint8_t percentage
The percentage value corresponding to a specific percentile linearized RGB value in the processing wi...
enum AVPacketSideDataType type
This structure stores compressed data.
int flags
A combination of AV_PKT_FLAG values.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
int64_t pos
byte position in stream, -1 if unknown
AVPacketSideData * side_data
Additional packet data that can be provided by the container.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
uint8_t nb_components
The number of components each pixel has, (1-4)
New fields can be added to the end with minor version bumps.
unsigned int nb_stream_indexes
unsigned int * stream_index
Rational number (pair of numerator and denominator).
This structure describes how to handle spherical videos, outlining information about projection,...
enum AVSphericalProjection projection
Projection type.
int32_t pitch
Rotation around the right vector [-90, 90].
int32_t roll
Rotation around the forward vector [-180, 180].
int32_t yaw
Rotation around the up vector [-180, 180].
uint32_t padding
Number of pixels to pad from the edge of each cube face.
Stereo 3D type: this structure describes how two videos are packed within a single video surface,...
enum AVStereo3DType type
How views are packed within the video.
int flags
Additional information about the frame packing.
AVPacketSideData * side_data
An array of side data that applies to the whole stream (i.e.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int64_t nb_frames
number of frames in this stream if known or 0
int64_t duration
Decoding: duration of the stream, in stream time base.
int id
Format-specific stream ID.
int index
stream index in AVFormatContext
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
AVRational avg_frame_rate
Average framerate.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
int nb_side_data
The number of elements in the AVStream.side_data array.
AVRational r_frame_rate
Real base framerate of the stream.
int terminate_line[SECTION_MAX_NB_LEVELS]
int has_nested_elems[SECTION_MAX_NB_LEVELS]
int nested_section[SECTION_MAX_NB_LEVELS]
const char *(* escape_str)(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
int nested_section[SECTION_MAX_NB_LEVELS]
const char * item_start_end
AVClassCategory parent_category
int64_t end
start, end in second/AV_TIME_BASE units
unsigned int nb_section_frame
number of the frame section in case we are in "packets_and_frames" section
unsigned int nb_item[SECTION_MAX_NB_LEVELS]
number of the item printed in the given section, starting from 0
const struct section * section[SECTION_MAX_NB_LEVELS]
section per each level
char * string_validation_replacement
char * name
name of this writer instance
void * priv
private data for use by the filter
AVBPrint section_pbuf[SECTION_MAX_NB_LEVELS]
generic print buffer dedicated to each section, used by various writers
unsigned int nb_section_packet_frame
nb_section_packet or nb_section_frame according if is_packets_and_frames
int level
current level, starting from 0
unsigned int nb_section_packet
number of the packet section in case we are in "packets_and_frames" section
int nb_sections
number of sections
const struct section * sections
array containing all sections
unsigned int string_validation_utf8_flags
const Writer * writer
the Writer of which this is an instance
void(* print_string)(WriterContext *wctx, const char *, const char *)
int flags
a combination or WRITER_FLAG_*
int priv_size
private size for the writer context
const AVClass * priv_class
private class of the writer, if any
void(* print_integer)(WriterContext *wctx, const char *, long long int)
void(* print_rational)(WriterContext *wctx, AVRational *q, char *sep)
int(* init)(WriterContext *wctx)
void(* print_section_header)(WriterContext *wctx)
void(* print_section_footer)(WriterContext *wctx)
void(* uninit)(WriterContext *wctx)
AVDictionary * entries_to_show
const char * element_name
name of the contained element, if provided
int id
unique id identifying a section
int flags
For these sections the element_name field is mandatory.
const char * unique_name
unique section name, in case the name is ambiguous
int children_ids[SECTION_MAX_NB_CHILDREN+1]
list of children section IDS, terminated by -1
libswresample public header
static int swscale(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
#define av_malloc_array(a, b)
static void error(const char *err)
static void ERROR(const char *str)
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).
char * av_timecode_make_smpte_tc_string2(char *buf, AVRational rate, uint32_t tcsmpte, int prevent_df, int skip_field)
Get the timecode string from the SMPTE timecode format.
#define AV_TIMECODE_STR_SIZE
timestamp utils, mostly useful for debugging/logging purposes
#define av_ts2timestr(ts, tb)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define va_copy(dst, src)
static const uint8_t offset[127][2]