Go to the documentation of this file.
27 #include "libavutil/ffversion.h"
59 # ifdef pthread_mutex_lock
60 # undef pthread_mutex_lock
62 # define pthread_mutex_lock(a) do{}while(0)
63 # ifdef pthread_mutex_unlock
64 # undef pthread_mutex_unlock
66 # define pthread_mutex_unlock(a) do{}while(0)
138 #define SECTION_MAX_NB_CHILDREN 10
144 #define SECTION_FLAG_IS_WRAPPER 1
145 #define SECTION_FLAG_IS_ARRAY 2
146 #define SECTION_FLAG_HAS_VARIABLE_FIELDS 4
263 static const struct {
269 { 1.0, 1.0,
"",
"" },
270 { 1.024e3, 1e3,
"Ki",
"K" },
271 { 1.048576e6, 1e6,
"Mi",
"M" },
272 { 1.073741824e9, 1e9,
"Gi",
"G" },
273 { 1.099511627776e12, 1e12,
"Ti",
"T" },
274 { 1.125899906842624e15, 1e15,
"Pi",
"P" },
307 static int print_prefix = 1;
308 void *new_log_buffer;
319 if (new_log_buffer) {
332 for (
i=strlen(msg) - 1;
i>=0 && msg[
i] ==
'\n';
i--) {
338 if (parent && *parent) {
341 (*parent)->get_category ? (*parent)->get_category(parent) :(*parent)->category;
363 union {
double d;
long long int i; }
val;
377 vald = vali = uv.
val.
i;
384 mins = (
int)secs / 60;
385 secs = secs - mins * 60;
388 snprintf(buf, buf_size,
"%d:%02d:%09.6f", hours, mins, secs);
390 const char *prefix_string =
"";
401 index = (
long long int) (log10(vald)) / 3;
410 snprintf(buf, buf_size,
"%f", vald);
412 snprintf(buf, buf_size,
"%lld", vali);
424 #define WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS 1
425 #define WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER 2
450 #define SECTION_MAX_NB_LEVELS 10
486 #define OFFSET(x) offsetof(WriterContext, x)
489 {
"string_validation",
"set string validation mode",
491 {
"sv",
"set string validation mode",
496 {
"string_validation_replacement",
"set string validation replacement string",
OFFSET(string_validation_replacement),
AV_OPT_TYPE_STRING, {.str=
""}},
497 {
"svr",
"set string validation replacement string",
OFFSET(string_validation_replacement),
AV_OPT_TYPE_STRING, {.str=
"\xEF\xBF\xBD"}},
504 if (!prev &&
ctx->writer &&
ctx->writer->priv_class &&
ctx->priv)
524 if ((*wctx)->writer->uninit)
525 (*wctx)->writer->uninit(*wctx);
528 if ((*wctx)->writer->priv_class)
539 for (
i = 0;
i < ubuf_size;
i++)
560 (*wctx)->writer = writer;
563 (*wctx)->nb_sections = nb_sections;
568 void *priv_ctx = (*wctx)->priv;
579 av_log(*wctx,
AV_LOG_ERROR,
"Failed to parse option string '%s' provided to writer context\n", args);
586 av_log(*wctx,
AV_LOG_ERROR,
"Failed to set option '%s' with value '%s' provided to writer context\n",
598 const uint8_t *p = (*wctx)->string_validation_replacement;
599 const uint8_t *endp = p + strlen(p);
609 "Invalid UTF8 sequence %s found in string validation replace '%s'\n",
610 bp.str, (*wctx)->string_validation_replacement);
619 if ((*wctx)->writer->init)
620 ret = (*wctx)->writer->init(*wctx);
634 int parent_section_id;
637 parent_section_id = wctx->
level ?
658 int parent_section_id = wctx->
level ?
673 const char *
key,
long long int val)
687 int invalid_chars_nb = 0,
ret = 0;
702 "Invalid UTF-8 sequence %s found in string '%s'\n", bp.str,
src);
712 "Invalid UTF-8 sequence found in string '%s'\n",
src);
729 "%d invalid UTF-8 sequence(s) found in string '%s', replaced with '%s'\n",
738 #define PRINT_STRING_OPT 1
739 #define PRINT_STRING_VALIDATE 2
762 "Invalid key=value string combination %s=%s in section %s\n",
787 int64_t ts,
const AVRational *time_base,
int is_duration)
791 if ((!is_duration && ts ==
AV_NOPTS_VALUE) || (is_duration && ts == 0)) {
794 double d = ts *
av_q2d(*time_base);
805 if ((!is_duration && ts ==
AV_NOPTS_VALUE) || (is_duration && ts == 0)) {
823 for (
i = 0;
i < l;
i++) {
829 for (
i = 0;
i < l;
i++)
850 p = buf + strlen(buf);
857 int columns,
int bytes,
int offset_add)
867 for (
i = 0;
i < l;
i++) {
881 #define MAX_REGISTERED_WRITERS_NB 64
887 static int next_registered_writer_idx = 0;
910 #define DEFINE_WRITER_CLASS(name) \
911 static const char *name##_get_name(void *ctx) \
915 static const AVClass name##_class = { \
916 .class_name = #name, \
917 .item_name = name##_get_name, \
918 .option = name##_options \
931 #define OFFSET(x) offsetof(DefaultContext, x)
934 {
"noprint_wrappers",
"do not print headers and footers",
OFFSET(noprint_wrappers),
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
947 for (
i = 0;
src[
i] &&
i < dst_size-1;
i++)
962 if (parent_section &&
1017 .priv_class = &default_class,
1025 static const char *
c_escape_str(AVBPrint *dst,
const char *
src,
const char sep,
void *log_ctx)
1029 for (p =
src; *p; p++) {
1031 case '\b':
av_bprintf(dst,
"%s",
"\\b");
break;
1032 case '\f':
av_bprintf(dst,
"%s",
"\\f");
break;
1033 case '\n':
av_bprintf(dst,
"%s",
"\\n");
break;
1034 case '\r':
av_bprintf(dst,
"%s",
"\\r");
break;
1035 case '\\':
av_bprintf(dst,
"%s",
"\\\\");
break;
1050 char meta_chars[] = { sep,
'"',
'\n',
'\r',
'\0' };
1051 int needs_quoting = !!
src[strcspn(
src, meta_chars)];
1078 const char * (*escape_str)(AVBPrint *dst,
const char *
src,
const char sep,
void *log_ctx);
1085 #define OFFSET(x) offsetof(CompactContext, x)
1106 av_log(wctx,
AV_LOG_ERROR,
"Item separator '%s' specified, but must contain a single character\n",
1169 if (!compact->
nokey)
1181 if (!compact->
nokey)
1195 .priv_class = &compact_class,
1201 #define OFFSET(x) offsetof(CompactContext, x)
1226 .priv_class = &csv_class,
1239 #define OFFSET(x) offsetof(FlatContext, x)
1244 {
"hierarchical",
"specify if the section specification should be hierarchical",
OFFSET(hierarchical),
AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1245 {
"h",
"specify if the section specification should be hierarchical",
OFFSET(hierarchical),
AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1255 if (strlen(
flat->sep_str) != 1) {
1256 av_log(wctx,
AV_LOG_ERROR,
"Item separator '%s' specified, but must contain a single character\n",
1269 for (p =
src; *p; p++) {
1270 if (!((*p >=
'0' && *p <=
'9') ||
1271 (*p >=
'a' && *p <=
'z') ||
1272 (*p >=
'A' && *p <=
'Z')))
1284 for (p =
src; *p; p++) {
1286 case '\n':
av_bprintf(dst,
"%s",
"\\n");
break;
1287 case '\r':
av_bprintf(dst,
"%s",
"\\r");
break;
1288 case '\\':
av_bprintf(dst,
"%s",
"\\\\");
break;
1289 case '"':
av_bprintf(dst,
"%s",
"\\\"");
break;
1290 case '`':
av_bprintf(dst,
"%s",
"\\`");
break;
1291 case '$':
av_bprintf(dst,
"%s",
"\\$");
break;
1308 if (!parent_section)
1312 if (
flat->hierarchical ||
1350 .priv_class = &flat_class,
1361 #define OFFSET(x) offsetof(INIContext, x)
1364 {
"hierarchical",
"specify if the section specification should be hierarchical",
OFFSET(hierarchical),
AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1365 {
"h",
"specify if the section specification should be hierarchical",
OFFSET(hierarchical),
AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1376 while (
c =
src[
i++]) {
1378 case '\b':
av_bprintf(dst,
"%s",
"\\b");
break;
1379 case '\f':
av_bprintf(dst,
"%s",
"\\f");
break;
1380 case '\n':
av_bprintf(dst,
"%s",
"\\n");
break;
1381 case '\r':
av_bprintf(dst,
"%s",
"\\r");
break;
1382 case '\t':
av_bprintf(dst,
"%s",
"\\t");
break;
1388 if ((
unsigned char)
c < 32)
1407 if (!parent_section) {
1408 printf(
"# ffprobe output\n\n");
1428 printf(
"[%s]\n", buf->str);
1454 .priv_class = &ini_class,
1467 #define OFFSET(x) offsetof(JSONContext, x)
1489 static const char json_escape[] = {
'"',
'\\',
'\b',
'\f',
'\n',
'\r',
'\t', 0};
1490 static const char json_subst[] = {
'"',
'\\',
'b',
'f',
'n',
'r',
't', 0};
1493 for (p =
src; *p; p++) {
1494 char *
s = strchr(json_escape, *p);
1498 }
else if ((
unsigned char)*p < 32) {
1507 #define JSON_INDENT() printf("%*c", json->indent_level * 4, ' ')
1530 printf(
"\"%s\": [\n", buf.str);
1552 if (wctx->
level == 0) {
1570 const char *
key,
const char *
value)
1620 .priv_class = &json_class,
1634 #define OFFSET(x) offsetof(XMLContext, x)
1637 {
"fully_qualified",
"specify if the output should be fully qualified",
OFFSET(fully_qualified),
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1638 {
"q",
"specify if the output should be fully qualified",
OFFSET(fully_qualified),
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1639 {
"xsd_strict",
"ensure that the output is XSD compliant",
OFFSET(xsd_strict),
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1652 #define CHECK_COMPLIANCE(opt, opt_name) \
1654 av_log(wctx, AV_LOG_ERROR, \
1655 "XSD-compliant output selected but option '%s' was selected, XML output may be non-compliant.\n" \
1656 "You need to disable such option with '-no%s'\n", opt_name, opt_name); \
1657 return AVERROR(EINVAL); \
1665 "Interleaved frames and packets are not allowed in XSD. "
1666 "Select only one between the -show_frames and the -show_packets options.\n");
1678 for (p =
src; *p; p++) {
1680 case '&' :
av_bprintf(dst,
"%s",
"&");
break;
1681 case '<' :
av_bprintf(dst,
"%s",
"<");
break;
1682 case '>' :
av_bprintf(dst,
"%s",
">");
break;
1683 case '"' :
av_bprintf(dst,
"%s",
""");
break;
1684 case '\'':
av_bprintf(dst,
"%s",
"'");
break;
1692 #define XML_INDENT() printf("%*c", xml->indent_level * 4, ' ')
1701 if (wctx->
level == 0) {
1702 const char *qual =
" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' "
1703 "xmlns:ffprobe='http://www.ffmpeg.org/schema/ffprobe' "
1704 "xsi:schemaLocation='http://www.ffmpeg.org/schema/ffprobe ffprobe.xsd'";
1706 printf(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
1707 printf(
"<%sffprobe%s>\n",
1739 if (wctx->
level == 0) {
1792 .priv_class = &xml_class,
1812 #define print_fmt(k, f, ...) do { \
1813 av_bprint_clear(&pbuf); \
1814 av_bprintf(&pbuf, f, __VA_ARGS__); \
1815 writer_print_string(w, k, pbuf.str, 0); \
1818 #define print_int(k, v) writer_print_integer(w, k, v)
1819 #define print_q(k, v, s) writer_print_rational(w, k, v, s)
1820 #define print_str(k, v) writer_print_string(w, k, v, 0)
1821 #define print_str_opt(k, v) writer_print_string(w, k, v, PRINT_STRING_OPT)
1822 #define print_str_validate(k, v) writer_print_string(w, k, v, PRINT_STRING_VALIDATE)
1823 #define print_time(k, v, tb) writer_print_time(w, k, v, tb, 0)
1824 #define print_ts(k, v) writer_print_ts(w, k, v, 0)
1825 #define print_duration_time(k, v, tb) writer_print_time(w, k, v, tb, 1)
1826 #define print_duration_ts(k, v) writer_print_ts(w, k, v, 1)
1827 #define print_val(k, v, u) do { \
1828 struct unit_value uv; \
1831 writer_print_string(w, k, value_string(val_str, sizeof(val_str), uv), 0); \
1834 #define print_section_header(s) writer_print_section_header(w, s)
1835 #define print_section_footer(s) writer_print_section_footer(w, s)
1837 #define REALLOCZ_ARRAY_STREAM(ptr, cur_n, new_n) \
1839 ret = av_reallocp_array(&(ptr), (new_n), sizeof(*(ptr))); \
1842 memset( (ptr) + (cur_n), 0, ((new_n) - (cur_n)) * sizeof(*(ptr)) ); \
1873 for (
i = 0;
i < nb_side_data;
i++) {
2149 print_ts (
"best_effort_timestamp",
frame->best_effort_timestamp);
2169 print_q(
"sample_aspect_ratio", sar,
':');
2175 print_int(
"display_picture_number",
frame->display_picture_number);
2193 if (
frame->channel_layout) {
2196 frame->channel_layout);
2206 if (
frame->nb_side_data) {
2208 for (
i = 0;
i <
frame->nb_side_data;
i++) {
2223 uint32_t *
tc = (uint32_t*)sd->
data;
2226 for (
int j = 1; j <= m ; j++) {
2283 int ret = 0, got_frame = 0;
2334 return got_frame || *packet_new;
2339 av_log(log_ctx, log_level,
"id:%d", interval->
id);
2345 av_log(log_ctx, log_level,
" start:N/A");
2351 av_log(log_ctx, log_level,
"#%"PRId64, interval->
end);
2355 av_log(log_ctx, log_level,
" end:N/A");
2358 av_log(log_ctx, log_level,
"\n");
2367 int ret = 0,
i = 0, frame_count = 0;
2368 int64_t start = -INT64_MAX,
end = interval->
end;
2381 "Could not seek to relative position since current "
2382 "timestamp is not defined\n");
2386 target = *cur_ts + interval->
start;
2388 target = interval->
start;
2424 end = start + interval->
end;
2429 if (frame_count >= interval->
end)
2523 char profile_num[12];
2533 #if FF_API_LAVF_AVCTX
2546 #if FF_API_LAVF_AVCTX
2556 print_q(
"sample_aspect_ratio", sar,
':');
2561 print_q(
"display_aspect_ratio", dar,
':');
2578 print_str(
"field_order",
"progressive");
2590 #if FF_API_PRIVATE_OPT
2637 if (opt->
flags)
continue;
2656 #if FF_API_LAVF_AVCTX
2675 #define PRINT_DISPOSITION(flagname, name) do { \
2676 print_int(name, !!(stream->disposition & AV_DISPOSITION_##flagname)); \
2718 for (
i = 0;
i <
ifile->nb_streams;
i++)
2750 for (
i = 0;
i <
program->nb_stream_indexes;
i++) {
2841 const char *errbuf_ptr = errbuf;
2853 const char *print_filename)
2858 int scan_all_pmts_set = 0;
2868 scan_all_pmts_set = 1;
2875 if (print_filename) {
2880 if (scan_all_pmts_set)
2893 for (
i = 0;
i < orig_nb_streams;
i++)
2906 sizeof(*
ifile->streams));
2907 if (!
ifile->streams)
2921 "Failed to probe codec for input stream %d\n",
2929 "Unsupported codec with id %d for input stream %d\n",
2954 #if FF_API_LAVF_AVCTX
2983 for (
i = 0;
i <
ifile->nb_streams;
i++)
2988 ifile->nb_streams = 0;
2994 const char *print_filename)
3007 #define CHECK_END if (ret < 0) goto end
3014 for (
i = 0;
i <
ifile.fmt_ctx->nb_streams;
i++) {
3017 ifile.fmt_ctx->streams[
i],
3088 print_fmt(
"copyright",
"Copyright (c) %d-%d the FFmpeg developers",
3091 print_str(
"configuration", FFMPEG_CONFIGURATION);
3097 #define SHOW_LIB_VERSION(libname, LIBNAME) \
3099 if (CONFIG_##LIBNAME) { \
3100 unsigned int version = libname##_version(); \
3101 writer_print_section_header(w, SECTION_ID_LIBRARY_VERSION); \
3102 print_str("name", "lib" #libname); \
3103 print_int("major", LIB##LIBNAME##_VERSION_MAJOR); \
3104 print_int("minor", LIB##LIBNAME##_VERSION_MINOR); \
3105 print_int("micro", LIB##LIBNAME##_VERSION_MICRO); \
3106 print_int("version", version); \
3107 print_str("ident", LIB##LIBNAME##_IDENT); \
3108 writer_print_section_footer(w); \
3126 #define PRINT_PIX_FMT_FLAG(flagname, name) \
3128 print_int(name, !!(pixdesc->flags & AV_PIX_FMT_FLAG_##flagname)); \
3159 #if FF_API_PSEUDOPAL
3215 "'%s' matches section with unique name '%s'\n", section_name,
3226 const char *p =
arg;
3234 if (!section_name) {
3236 "Missing section name for option '%s'\n", opt);
3242 while (*p && *p !=
':') {
3247 "Adding '%s' to the entries to show in section '%s'\n",
3248 entry, section_name);
3283 "Option '%s' is deprecated, use '-show_entries format=%s' instead\n",
3294 "Argument '%s' provided as input filename, but '%s' was already specified.\n",
3298 if (!strcmp(
arg,
"-"))
3335 char *next, *p, *spec =
av_strdup(interval_spec);
3346 next = strchr(spec,
'%');
3388 lli = strtoll(p, &tail, 10);
3389 if (*tail || lli < 0) {
3391 "Invalid or negative value '%s' for duration number of frames\n", p);
3394 interval->
end = lli;
3416 char *p, *spec =
av_strdup(intervals_spec);
3421 for (n = 0, p = spec; *p; p++)
3435 for (
i = 0; p;
i++) {
3439 next = strchr(p,
',');
3495 "W.. = Section is a wrapper (contains other sections, no local entries)\n"
3496 ".A. = Section contains an array of elements of the same type\n"
3497 "..V = Section may contain a variable number of fields with variable keys\n"
3498 "FLAGS NAME/UNIQUE_NAME\n"
3511 #define DEFINE_OPT_SHOW_SECTION(section, target_section_id) \
3512 static int opt_show_##section(void *optctx, const char *opt, const char *arg) \
3514 mark_section_show_entries(SECTION_ID_##target_section_id, 1, NULL); \
3535 "use binary prefixes for byte units" },
3537 "use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" },
3539 "prettify the format of displayed values, make it more human readable" },
3541 "set the output printing format (available formats are: default, compact, csv, flat, ini, json, xml)",
"format" },
3544 {
"sections",
OPT_EXIT, {.func_arg =
opt_sections},
"print sections structure and section information, and exit" },
3547 {
"show_error", 0, { .func_arg = &opt_show_error },
"show probing error" },
3548 {
"show_format", 0, { .func_arg = &opt_show_format },
"show format/container info" },
3549 {
"show_frames", 0, { .func_arg = &opt_show_frames },
"show frames info" },
3551 "show a particular entry from the format/container info",
"entry" },
3553 "show a set of specified entries",
"entry_list" },
3557 {
"show_packets", 0, { .func_arg = &opt_show_packets },
"show packets info" },
3558 {
"show_programs", 0, { .func_arg = &opt_show_programs },
"show programs info" },
3559 {
"show_streams", 0, { .func_arg = &opt_show_streams },
"show streams info" },
3560 {
"show_chapters", 0, { .func_arg = &opt_show_chapters },
"show chapters info" },
3563 {
"show_program_version", 0, { .func_arg = &opt_show_program_version },
"show ffprobe version" },
3564 {
"show_library_versions", 0, { .func_arg = &opt_show_library_versions },
"show library versions" },
3565 {
"show_versions", 0, { .func_arg = &
opt_show_versions },
"show program and library versions" },
3566 {
"show_pixel_formats", 0, { .func_arg = &opt_show_pixel_formats },
"show pixel format descriptions" },
3575 "read and decode the streams to fill missing information with heuristics" },
3591 #define SET_DO_SHOW(id, varname) do { \
3592 if (check_section_show_entries(SECTION_ID_##id)) \
3593 do_show_##varname = 1; \
3601 char *w_name =
NULL, *w_args =
NULL;
3637 SET_DO_SHOW(PIXEL_FORMAT_FLAGS, pixel_format_flags);
3638 SET_DO_SHOW(PIXEL_FORMAT_COMPONENTS, pixel_format_components);
3642 SET_DO_SHOW(STREAM_DISPOSITION, stream_disposition);
3643 SET_DO_SHOW(PROGRAM_STREAM_DISPOSITION, stream_disposition);
3655 "-bitexact and -show_program_version or -show_library_versions "
3656 "options are incompatible\n");
3672 "No name specified for the output format\n");
3683 "Unknown hash algorithm '%s'\nKnown algorithms:",
static void error(const char *err)
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
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
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 default minimum maximum flags name is the option name
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
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 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[]
static const AVOption default_options[]