Go to the documentation of this file.
27 #include "libavutil/ffversion.h"
58 # ifdef pthread_mutex_lock
59 # undef pthread_mutex_lock
61 # define pthread_mutex_lock(a) do{}while(0)
62 # ifdef pthread_mutex_unlock
63 # undef pthread_mutex_unlock
65 # define pthread_mutex_unlock(a) do{}while(0)
137 #define SECTION_MAX_NB_CHILDREN 10
143 #define SECTION_FLAG_IS_WRAPPER 1
144 #define SECTION_FLAG_IS_ARRAY 2
145 #define SECTION_FLAG_HAS_VARIABLE_FIELDS 4
261 static const struct {
267 { 1.0, 1.0,
"",
"" },
268 { 1.024e3, 1e3,
"Ki",
"K" },
269 { 1.048576e6, 1e6,
"Mi",
"M" },
270 { 1.073741824e9, 1e9,
"Gi",
"G" },
271 { 1.099511627776e12, 1e12,
"Ti",
"T" },
272 { 1.125899906842624e15, 1e15,
"Pi",
"P" },
305 static int print_prefix = 1;
306 void *new_log_buffer;
317 if (new_log_buffer) {
330 for (
i=strlen(msg) - 1;
i>=0 && msg[
i] ==
'\n';
i--) {
336 if (parent && *parent) {
339 (*parent)->get_category ? (*parent)->get_category(parent) :(*parent)->category;
361 union {
double d;
long long int i; }
val;
375 vald = vali = uv.
val.
i;
382 mins = (
int)secs / 60;
383 secs = secs - mins * 60;
386 snprintf(
buf, buf_size,
"%d:%02d:%09.6f", hours, mins, secs);
388 const char *prefix_string =
"";
399 index = (
long long int) (log10(vald)) / 3;
422 #define WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS 1
423 #define WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER 2
448 #define SECTION_MAX_NB_LEVELS 10
484 #define OFFSET(x) offsetof(WriterContext, x)
487 {
"string_validation",
"set string validation mode",
489 {
"sv",
"set string validation mode",
494 {
"string_validation_replacement",
"set string validation replacement string",
OFFSET(string_validation_replacement),
AV_OPT_TYPE_STRING, {.str=
""}},
495 {
"svr",
"set string validation replacement string",
OFFSET(string_validation_replacement),
AV_OPT_TYPE_STRING, {.str=
"\xEF\xBF\xBD"}},
502 if (!prev &&
ctx->writer &&
ctx->writer->priv_class &&
ctx->priv)
522 if ((*wctx)->writer->uninit)
523 (*wctx)->writer->uninit(*wctx);
526 if ((*wctx)->writer->priv_class)
537 for (
i = 0;
i < ubuf_size;
i++)
558 (*wctx)->writer = writer;
561 (*wctx)->nb_sections = nb_sections;
566 void *priv_ctx = (*wctx)->priv;
584 av_log(*wctx,
AV_LOG_ERROR,
"Failed to set option '%s' with value '%s' provided to writer context\n",
596 const uint8_t *p = (*wctx)->string_validation_replacement;
597 const uint8_t *endp = p + strlen(p);
607 "Invalid UTF8 sequence %s found in string validation replace '%s'\n",
608 bp.str, (*wctx)->string_validation_replacement);
617 if ((*wctx)->writer->init)
618 ret = (*wctx)->writer->init(*wctx);
632 int parent_section_id;
635 parent_section_id = wctx->
level ?
656 int parent_section_id = wctx->
level ?
671 const char *
key,
long long int val)
685 int invalid_chars_nb = 0,
ret = 0;
700 "Invalid UTF-8 sequence %s found in string '%s'\n", bp.str,
src);
710 "Invalid UTF-8 sequence found in string '%s'\n",
src);
727 "%d invalid UTF-8 sequence(s) found in string '%s', replaced with '%s'\n",
736 #define PRINT_STRING_OPT 1
737 #define PRINT_STRING_VALIDATE 2
760 "Invalid key=value string combination %s=%s in section %s\n",
785 int64_t ts,
const AVRational *time_base,
int is_duration)
789 if ((!is_duration && ts ==
AV_NOPTS_VALUE) || (is_duration && ts == 0)) {
792 double d = ts *
av_q2d(*time_base);
803 if ((!is_duration && ts ==
AV_NOPTS_VALUE) || (is_duration && ts == 0)) {
821 for (
i = 0;
i < l;
i++) {
827 for (
i = 0;
i < l;
i++)
855 int columns,
int bytes,
int offset_add)
865 for (
i = 0;
i < l;
i++) {
879 #define MAX_REGISTERED_WRITERS_NB 64
885 static int next_registered_writer_idx = 0;
908 #define DEFINE_WRITER_CLASS(name) \
909 static const char *name##_get_name(void *ctx) \
913 static const AVClass name##_class = { \
914 .class_name = #name, \
915 .item_name = name##_get_name, \
916 .option = name##_options \
929 #define OFFSET(x) offsetof(DefaultContext, x)
932 {
"noprint_wrappers",
"do not print headers and footers",
OFFSET(noprint_wrappers),
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
945 for (
i = 0;
src[
i] &&
i < dst_size-1;
i++)
960 if (parent_section &&
1015 .priv_class = &default_class,
1023 static const char *
c_escape_str(AVBPrint *dst,
const char *
src,
const char sep,
void *log_ctx)
1027 for (p =
src; *p; p++) {
1029 case '\b':
av_bprintf(dst,
"%s",
"\\b");
break;
1030 case '\f':
av_bprintf(dst,
"%s",
"\\f");
break;
1031 case '\n':
av_bprintf(dst,
"%s",
"\\n");
break;
1032 case '\r':
av_bprintf(dst,
"%s",
"\\r");
break;
1033 case '\\':
av_bprintf(dst,
"%s",
"\\\\");
break;
1048 char meta_chars[] = { sep,
'"',
'\n',
'\r',
'\0' };
1049 int needs_quoting = !!
src[strcspn(
src, meta_chars)];
1076 const char * (*escape_str)(AVBPrint *dst,
const char *
src,
const char sep,
void *log_ctx);
1083 #define OFFSET(x) offsetof(CompactContext, x)
1104 av_log(wctx,
AV_LOG_ERROR,
"Item separator '%s' specified, but must contain a single character\n",
1167 if (!compact->
nokey)
1179 if (!compact->
nokey)
1193 .priv_class = &compact_class,
1199 #define OFFSET(x) offsetof(CompactContext, x)
1224 .priv_class = &csv_class,
1237 #define OFFSET(x) offsetof(FlatContext, x)
1242 {
"hierarchical",
"specify if the section specification should be hierarchical",
OFFSET(hierarchical),
AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1243 {
"h",
"specify if the section specification should be hierarchical",
OFFSET(hierarchical),
AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1253 if (strlen(
flat->sep_str) != 1) {
1254 av_log(wctx,
AV_LOG_ERROR,
"Item separator '%s' specified, but must contain a single character\n",
1267 for (p =
src; *p; p++) {
1268 if (!((*p >=
'0' && *p <=
'9') ||
1269 (*p >=
'a' && *p <=
'z') ||
1270 (*p >=
'A' && *p <=
'Z')))
1282 for (p =
src; *p; p++) {
1284 case '\n':
av_bprintf(dst,
"%s",
"\\n");
break;
1285 case '\r':
av_bprintf(dst,
"%s",
"\\r");
break;
1286 case '\\':
av_bprintf(dst,
"%s",
"\\\\");
break;
1287 case '"':
av_bprintf(dst,
"%s",
"\\\"");
break;
1288 case '`':
av_bprintf(dst,
"%s",
"\\`");
break;
1289 case '$':
av_bprintf(dst,
"%s",
"\\$");
break;
1306 if (!parent_section)
1310 if (
flat->hierarchical ||
1348 .priv_class = &flat_class,
1359 #define OFFSET(x) offsetof(INIContext, x)
1362 {
"hierarchical",
"specify if the section specification should be hierarchical",
OFFSET(hierarchical),
AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1363 {
"h",
"specify if the section specification should be hierarchical",
OFFSET(hierarchical),
AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1374 while (
c =
src[
i++]) {
1376 case '\b':
av_bprintf(dst,
"%s",
"\\b");
break;
1377 case '\f':
av_bprintf(dst,
"%s",
"\\f");
break;
1378 case '\n':
av_bprintf(dst,
"%s",
"\\n");
break;
1379 case '\r':
av_bprintf(dst,
"%s",
"\\r");
break;
1380 case '\t':
av_bprintf(dst,
"%s",
"\\t");
break;
1386 if ((
unsigned char)
c < 32)
1405 if (!parent_section) {
1406 printf(
"# ffprobe output\n\n");
1452 .priv_class = &ini_class,
1465 #define OFFSET(x) offsetof(JSONContext, x)
1487 static const char json_escape[] = {
'"',
'\\',
'\b',
'\f',
'\n',
'\r',
'\t', 0};
1488 static const char json_subst[] = {
'"',
'\\',
'b',
'f',
'n',
'r',
't', 0};
1491 for (p =
src; *p; p++) {
1492 char *
s = strchr(json_escape, *p);
1496 }
else if ((
unsigned char)*p < 32) {
1505 #define JSON_INDENT() printf("%*c", json->indent_level * 4, ' ')
1550 if (wctx->
level == 0) {
1568 const char *
key,
const char *
value)
1614 .priv_class = &json_class,
1628 #define OFFSET(x) offsetof(XMLContext, x)
1631 {
"fully_qualified",
"specify if the output should be fully qualified",
OFFSET(fully_qualified),
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1632 {
"q",
"specify if the output should be fully qualified",
OFFSET(fully_qualified),
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1633 {
"xsd_strict",
"ensure that the output is XSD compliant",
OFFSET(xsd_strict),
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1646 #define CHECK_COMPLIANCE(opt, opt_name) \
1648 av_log(wctx, AV_LOG_ERROR, \
1649 "XSD-compliant output selected but option '%s' was selected, XML output may be non-compliant.\n" \
1650 "You need to disable such option with '-no%s'\n", opt_name, opt_name); \
1651 return AVERROR(EINVAL); \
1659 "Interleaved frames and packets are not allowed in XSD. "
1660 "Select only one between the -show_frames and the -show_packets options.\n");
1672 for (p =
src; *p; p++) {
1674 case '&' :
av_bprintf(dst,
"%s",
"&");
break;
1675 case '<' :
av_bprintf(dst,
"%s",
"<");
break;
1676 case '>' :
av_bprintf(dst,
"%s",
">");
break;
1677 case '"' :
av_bprintf(dst,
"%s",
""");
break;
1678 case '\'':
av_bprintf(dst,
"%s",
"'");
break;
1686 #define XML_INDENT() printf("%*c", xml->indent_level * 4, ' ')
1695 if (wctx->
level == 0) {
1696 const char *qual =
" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' "
1697 "xmlns:ffprobe='http://www.ffmpeg.org/schema/ffprobe' "
1698 "xsi:schemaLocation='http://www.ffmpeg.org/schema/ffprobe ffprobe.xsd'";
1700 printf(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
1701 printf(
"<%sffprobe%s>\n",
1733 if (wctx->
level == 0) {
1786 .priv_class = &xml_class,
1806 #define print_fmt(k, f, ...) do { \
1807 av_bprint_clear(&pbuf); \
1808 av_bprintf(&pbuf, f, __VA_ARGS__); \
1809 writer_print_string(w, k, pbuf.str, 0); \
1812 #define print_int(k, v) writer_print_integer(w, k, v)
1813 #define print_q(k, v, s) writer_print_rational(w, k, v, s)
1814 #define print_str(k, v) writer_print_string(w, k, v, 0)
1815 #define print_str_opt(k, v) writer_print_string(w, k, v, PRINT_STRING_OPT)
1816 #define print_str_validate(k, v) writer_print_string(w, k, v, PRINT_STRING_VALIDATE)
1817 #define print_time(k, v, tb) writer_print_time(w, k, v, tb, 0)
1818 #define print_ts(k, v) writer_print_ts(w, k, v, 0)
1819 #define print_duration_time(k, v, tb) writer_print_time(w, k, v, tb, 1)
1820 #define print_duration_ts(k, v) writer_print_ts(w, k, v, 1)
1821 #define print_val(k, v, u) do { \
1822 struct unit_value uv; \
1825 writer_print_string(w, k, value_string(val_str, sizeof(val_str), uv), 0); \
1828 #define print_section_header(s) writer_print_section_header(w, s)
1829 #define print_section_footer(s) writer_print_section_footer(w, s)
1831 #define REALLOCZ_ARRAY_STREAM(ptr, cur_n, new_n) \
1833 ret = av_reallocp_array(&(ptr), (new_n), sizeof(*(ptr))); \
1836 memset( (ptr) + (cur_n), 0, ((new_n) - (cur_n)) * sizeof(*(ptr)) ); \
1867 for (
i = 0;
i < nb_side_data;
i++) {
2133 print_ts (
"best_effort_timestamp",
frame->best_effort_timestamp);
2153 print_q(
"sample_aspect_ratio", sar,
':');
2159 print_int(
"display_picture_number",
frame->display_picture_number);
2177 if (
frame->channel_layout) {
2180 frame->channel_layout);
2190 if (
frame->nb_side_data) {
2192 for (
i = 0;
i <
frame->nb_side_data;
i++) {
2207 uint32_t *
tc = (uint32_t*)sd->
data;
2210 for (
int j = 1; j <= m ; j++) {
2267 int ret = 0, got_frame = 0;
2318 return got_frame || *packet_new;
2323 av_log(log_ctx, log_level,
"id:%d", interval->
id);
2329 av_log(log_ctx, log_level,
" start:N/A");
2335 av_log(log_ctx, log_level,
"#%"PRId64, interval->
end);
2339 av_log(log_ctx, log_level,
" end:N/A");
2342 av_log(log_ctx, log_level,
"\n");
2351 int ret = 0,
i = 0, frame_count = 0;
2365 "Could not seek to relative position since current "
2366 "timestamp is not defined\n");
2370 target = *cur_ts + interval->
start;
2372 target = interval->
start;
2413 if (frame_count >= interval->
end)
2507 char profile_num[12];
2517 #if FF_API_LAVF_AVCTX
2530 #if FF_API_LAVF_AVCTX
2539 print_q(
"sample_aspect_ratio", sar,
':');
2544 print_q(
"display_aspect_ratio", dar,
':');
2561 print_str(
"field_order",
"progressive");
2573 #if FF_API_PRIVATE_OPT
2620 if (opt->
flags)
continue;
2639 #if FF_API_LAVF_AVCTX
2658 #define PRINT_DISPOSITION(flagname, name) do { \
2659 print_int(name, !!(stream->disposition & AV_DISPOSITION_##flagname)); \
2701 for (
i = 0;
i <
ifile->nb_streams;
i++)
2733 for (
i = 0;
i <
program->nb_stream_indexes;
i++) {
2824 const char *errbuf_ptr = errbuf;
2840 int scan_all_pmts_set = 0;
2850 scan_all_pmts_set = 1;
2858 if (scan_all_pmts_set)
2871 for (
i = 0;
i < orig_nb_streams;
i++)
2884 sizeof(*
ifile->streams));
2885 if (!
ifile->streams)
2899 "Failed to probe codec for input stream %d\n",
2907 "Unsupported codec with id %d for input stream %d\n",
2932 #if FF_API_LAVF_AVCTX
2960 for (
i = 0;
i <
ifile->nb_streams;
i++)
2965 ifile->nb_streams = 0;
2983 #define CHECK_END if (ret < 0) goto end
2990 for (
i = 0;
i <
ifile.fmt_ctx->nb_streams;
i++) {
2993 ifile.fmt_ctx->streams[
i],
3064 print_fmt(
"copyright",
"Copyright (c) %d-%d the FFmpeg developers",
3067 print_str(
"configuration", FFMPEG_CONFIGURATION);
3073 #define SHOW_LIB_VERSION(libname, LIBNAME) \
3075 if (CONFIG_##LIBNAME) { \
3076 unsigned int version = libname##_version(); \
3077 writer_print_section_header(w, SECTION_ID_LIBRARY_VERSION); \
3078 print_str("name", "lib" #libname); \
3079 print_int("major", LIB##LIBNAME##_VERSION_MAJOR); \
3080 print_int("minor", LIB##LIBNAME##_VERSION_MINOR); \
3081 print_int("micro", LIB##LIBNAME##_VERSION_MICRO); \
3082 print_int("version", version); \
3083 print_str("ident", LIB##LIBNAME##_IDENT); \
3084 writer_print_section_footer(w); \
3102 #define PRINT_PIX_FMT_FLAG(flagname, name) \
3104 print_int(name, !!(pixdesc->flags & AV_PIX_FMT_FLAG_##flagname)); \
3135 #if FF_API_PSEUDOPAL
3191 "'%s' matches section with unique name '%s'\n", section_name,
3202 const char *p =
arg;
3210 if (!section_name) {
3212 "Missing section name for option '%s'\n", opt);
3218 while (*p && *p !=
':') {
3223 "Adding '%s' to the entries to show in section '%s'\n",
3224 entry, section_name);
3259 "Option '%s' is deprecated, use '-show_entries format=%s' instead\n",
3270 "Argument '%s' provided as input filename, but '%s' was already specified.\n",
3274 if (!strcmp(
arg,
"-"))
3305 char *next, *p, *spec =
av_strdup(interval_spec);
3316 next = strchr(spec,
'%');
3358 lli = strtoll(p, &tail, 10);
3359 if (*tail || lli < 0) {
3361 "Invalid or negative value '%s' for duration number of frames\n", p);
3364 interval->
end = lli;
3386 char *p, *spec =
av_strdup(intervals_spec);
3391 for (
n = 0, p = spec; *p; p++)
3405 for (
i = 0; p;
i++) {
3409 next = strchr(p,
',');
3465 "W.. = Section is a wrapper (contains other sections, no local entries)\n"
3466 ".A. = Section contains an array of elements of the same type\n"
3467 "..V = Section may contain a variable number of fields with variable keys\n"
3468 "FLAGS NAME/UNIQUE_NAME\n"
3481 #define DEFINE_OPT_SHOW_SECTION(section, target_section_id) \
3482 static int opt_show_##section(const char *opt, const char *arg) \
3484 mark_section_show_entries(SECTION_ID_##target_section_id, 1, NULL); \
3505 "use binary prefixes for byte units" },
3507 "use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" },
3509 "prettify the format of displayed values, make it more human readable" },
3511 "set the output printing format (available formats are: default, compact, csv, flat, ini, json, xml)",
"format" },
3514 {
"sections",
OPT_EXIT, {.func_arg =
opt_sections},
"print sections structure and section information, and exit" },
3517 {
"show_error", 0, {(
void*)&opt_show_error},
"show probing error" },
3518 {
"show_format", 0, {(
void*)&opt_show_format},
"show format/container info" },
3519 {
"show_frames", 0, {(
void*)&opt_show_frames},
"show frames info" },
3521 "show a particular entry from the format/container info",
"entry" },
3523 "show a set of specified entries",
"entry_list" },
3527 {
"show_packets", 0, {(
void*)&opt_show_packets},
"show packets info" },
3528 {
"show_programs", 0, {(
void*)&opt_show_programs},
"show programs info" },
3529 {
"show_streams", 0, {(
void*)&opt_show_streams},
"show streams info" },
3530 {
"show_chapters", 0, {(
void*)&opt_show_chapters},
"show chapters info" },
3533 {
"show_program_version", 0, {(
void*)&opt_show_program_version},
"show ffprobe version" },
3534 {
"show_library_versions", 0, {(
void*)&opt_show_library_versions},
"show library versions" },
3535 {
"show_versions", 0, {(
void*)&
opt_show_versions},
"show program and library versions" },
3536 {
"show_pixel_formats", 0, {(
void*)&opt_show_pixel_formats},
"show pixel format descriptions" },
3544 "read and decode the streams to fill missing information with heuristics" },
3560 #define SET_DO_SHOW(id, varname) do { \
3561 if (check_section_show_entries(SECTION_ID_##id)) \
3562 do_show_##varname = 1; \
3570 char *w_name =
NULL, *w_args =
NULL;
3606 SET_DO_SHOW(PIXEL_FORMAT_FLAGS, pixel_format_flags);
3607 SET_DO_SHOW(PIXEL_FORMAT_COMPONENTS, pixel_format_components);
3611 SET_DO_SHOW(STREAM_DISPOSITION, stream_disposition);
3612 SET_DO_SHOW(PROGRAM_STREAM_DISPOSITION, stream_disposition);
3624 "-bitexact and -show_program_version or -show_library_versions "
3625 "options are incompatible\n");
3641 "No name specified for the output format\n");
3652 "Unknown hash algorithm '%s'\nKnown algorithms:",
static const char * flat_escape_key_str(AVBPrint *dst, const char *src, const char sep)
int main(int argc, char **argv)
@ SECTION_ID_STREAM_SIDE_DATA_LIST
static int opt_format(void *optctx, const char *opt, const char *arg)
static void clear_log(int need_lock)
static void mark_section_show_entries(SectionID section_id, int show_all_entries, AVDictionary *entries)
int id
unique ID to identify the chapter
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
static const Writer * writer_get_by_name(const char *name)
int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end, unsigned int flags)
Read and decode a single UTF-8 code point (character) from the buffer in *buf, and update *buf to poi...
static const AVOption flat_options[]
AVBPrint section_pbuf[SECTION_MAX_NB_LEVELS]
generic print buffer dedicated to each section, used by various writers
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_BPRINT_SIZE_UNLIMITED
#define AV_TIMECODE_STR_SIZE
static int use_byte_value_binary_prefix
static int open_input_file(InputFile *ifile, const char *filename)
int level
current level, starting from 0
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
#define MAX_REGISTERED_WRITERS_NB
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C program
#define SECTION_MAX_NB_LEVELS
static void writer_close(WriterContext **wctx)
static const char * xml_escape_str(AVBPrint *dst, const char *src, void *log_ctx)
@ SECTION_ID_STREAM_SIDE_DATA
static av_cold int init(AVCodecContext *avctx)
static int do_show_frame_tags
union unit_value::@27 val
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 they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static int read_intervals_nb
enum AVMediaType codec_type
General type of the encoded data.
enum AVSphericalProjection projection
Projection type.
char * av_timecode_make_smpte_tc_string(char *buf, uint32_t tcsmpte, int prevent_df)
Get the timecode string from the SMPTE timecode format.
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
AVColorTransferCharacteristic
Color Transfer Characteristic.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
static int show_streams(WriterContext *w, InputFile *ifile)
static void writer_print_section_header(WriterContext *wctx, int section_id)
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
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...
#define AV_HASH_MAX_SIZE
Maximum value that av_hash_get_size() will currently return.
#define print_val(k, v, u)
static void compact_print_section_footer(WriterContext *wctx)
@ SECTION_ID_PACKET_SIDE_DATA_LIST
unsigned int nb_chapters
Number of chapters in AVChapter array.
This struct describes the properties of an encoded stream.
const AVClass * priv_class
AVClass for the private context.
static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_idx, InputStream *ist, int in_program)
enum AVColorSpace color_space
int(* init)(WriterContext *wctx)
static char * value_string(char *buf, int buf_size, struct unit_value uv)
#define AVERROR_EOF
End of file.
static int read_packets(WriterContext *w, InputFile *ifile)
static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
const char * long_name
A more descriptive name for this codec.
static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int packet_idx)
#define AV_PKT_FLAG_DISCARD
Flag is used to discard packets which are required to maintain valid decoder state but are not requir...
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
void(* print_section_footer)(WriterContext *wctx)
const char * name
Name of the codec described by this descriptor.
static int writer_open(WriterContext **wctx, const Writer *writer, const char *args, const struct section *sections, int nb_sections)
static int * selected_streams
@ SECTION_ID_PROGRAM_TAGS
char * av_asprintf(const char *fmt,...)
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
@ AV_FRAME_DATA_S12M_TIMECODE
Timecode which conforms to SMPTE ST 12-1.
const AVClass * priv_class
private class of the writer, if any
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
unsigned MaxCLL
Max content light level (cd/m^2).
static av_cold int end(AVCodecContext *avctx)
const struct section * section[SECTION_MAX_NB_LEVELS]
section per each level
static const char * json_escape_str(AVBPrint *dst, const char *src, void *log_ctx)
static int opt_input_file_i(void *optctx, const char *opt, const char *arg)
unsigned int nb_section_packet_frame
nb_section_packet or nb_section_frame according if is_packets_and_frames
This structure describes decoded (raw) audio or video data.
AVStream ** streams
A list of all streams in the file.
static int validate_string(WriterContext *wctx, char **dstp, const char *src)
static int opt_show_format_entry(void *optctx, const char *opt, const char *arg)
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt)
Decode a subtitle message.
@ SECTION_ID_PIXEL_FORMAT_COMPONENTS
int depth
Number of bits in the component.
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.
const char * element_name
name of the contained element, if provided
@ SECTION_ID_PIXEL_FORMAT_FLAGS
AVRational avg_frame_rate
Average framerate.
const AVPixFmtDescriptor * av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
Iterate over all pixel format descriptors known to libavutil.
AVDictionary * format_opts
static void writer_print_integer(WriterContext *wctx, const char *key, long long int val)
#define PRINT_DISPOSITION(flagname, name)
#define SECTION_MAX_NB_CHILDREN
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key,...
static int do_show_stream_tags
static char * ini_escape_str(AVBPrint *dst, const char *src)
#define print_section_header(s)
@ SECTION_ID_PIXEL_FORMAT
void * av_mallocz_array(size_t nmemb, size_t size)
#define AV_LOG_VERBOSE
Detailed information.
@ SECTION_ID_PROGRAM_STREAM
static char * print_format
void show_help_children(const AVClass *class, int flags)
Show help for all options with given flags in class and all its children.
const char * avcodec_profile_name(enum AVCodecID codec_id, int profile)
Return a name for the specified profile, if available.
@ AV_FRAME_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
@ AV_SPHERICAL_EQUIRECTANGULAR_TILE
Video represents a portion of a sphere mapped on a flat surface using equirectangular projection.
static int check_section_show_entries(int section_id)
static void print_section(SectionID id, int level)
int id
unique id identifying a section
static const AVOption writer_options[]
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
Append data to a print buffer.
AVColorPrimaries
Chromaticity coordinates of the source primaries.
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
static void writer_register_all(void)
@ AV_PKT_DATA_SPHERICAL
This side data should be associated with a video stream and corresponds to the AVSphericalMapping str...
static int show_tags(WriterContext *w, AVDictionary *tags, int section_id)
int64_t avio_size(AVIOContext *s)
Get the filesize.
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static int do_show_format_tags
const char * av_chroma_location_name(enum AVChromaLocation location)
const char * unique_name
unique section name, in case the name is ambiguous
void(* print_string)(WriterContext *wctx, const char *, const char *)
static int do_show_frames
static void json_print_int(WriterContext *wctx, const char *key, long long int value)
static av_cold int compact_init(WriterContext *wctx)
static void xml_print_section_footer(WriterContext *wctx)
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
static int opt_show_versions(const char *opt, const char *arg)
static int do_show_library_versions
void exit_program(int ret)
Wraps exit with a program-specific cleanup routine.
enum AVColorPrimaries color_primaries
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
static int match_section(const char *section_name, int show_all_entries, AVDictionary *entries)
static const char unit_hertz_str[]
#define AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES
exclude control codes not accepted by XML
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...
ff_const59 struct AVInputFormat * iformat
The input container format.
static void json_print_section_footer(WriterContext *wctx)
const char * av_color_space_name(enum AVColorSpace space)
static int opt_pretty(void *optctx, const char *opt, const char *arg)
const struct AVCodec * codec
static const AVOption json_options[]