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[]
static const AVOption default_options[]
static const char * writer_get_name(void *p)
const char * av_hash_get_name(const AVHashContext *ctx)
static av_always_inline int process_frame(WriterContext *w, InputFile *ifile, AVFrame *frame, AVPacket *pkt, int *packet_new)
attribute_deprecated int64_t convergence_duration
static void print_chroma_location(WriterContext *w, enum AVChromaLocation chroma_location)
int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
Put a description of the AVERROR code errnum in errbuf.
void(* uninit)(WriterContext *wctx)
if it could not because there are no more frames
#define SECTION_FLAG_HAS_VARIABLE_FIELDS
the section may contain a variable number of fields with variable keys.
static const Writer json_writer
int refs
number of reference frames
#define AVERROR_OPTION_NOT_FOUND
Option not found.
#define AV_BPRINT_SIZE_AUTOMATIC
static void default_print_int(WriterContext *wctx, const char *key, long long int value)
static av_cold int json_init(WriterContext *wctx)
void show_help_default(const char *opt, const char *arg)
Per-fftool specific help handler.
static const char * c_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
Apply C-language-like string escaping.
#define us(width, name, range_min, range_max, subs,...)
static void ini_print_section_header(WriterContext *wctx)
@ AV_PKT_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
static int show_log(WriterContext *w, int section_ids, int section_id, int log_level)
int64_t duration
Decoding: duration of the stream, in stream time base.
static const char * input_filename
#define print_duration_ts(k, v)
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
static void json_print_section_header(WriterContext *wctx)
int avformat_network_init(void)
Do global initialization of network libraries.
static int do_read_packets
static int opt_read_intervals(void *optctx, const char *opt, const char *arg)
void avsubtitle_free(AVSubtitle *sub)
Free all allocated data in the given subtitle struct.
static void close_input_file(InputFile *ifile)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
@ AV_PKT_DATA_STRINGS_METADATA
A list of zero terminated key/value strings.
static int parse_read_intervals(const char *intervals_spec)
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
enum AVColorTransferCharacteristic color_trc
static void json_print_item_str(WriterContext *wctx, const char *key, const char *value)
const char * av_packet_side_data_name(enum AVPacketSideDataType type)
static const Writer default_writer
static void writer_print_time(WriterContext *wctx, const char *key, int64_t ts, const AVRational *time_base, int is_duration)
static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, AVFormatContext *fmt_ctx)
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.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionary * metadata
Metadata that applies to the whole file.
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,...
static uint64_t * nb_streams_frames
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
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(* print_rational)(WriterContext *wctx, AVRational *q, char *sep)
AVDictionary * filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id, AVFormatContext *s, AVStream *st, AVCodec *codec)
Filter out options for given codec.
static void writer_print_data_hash(WriterContext *wctx, const char *name, uint8_t *data, int size)
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
static int do_count_frames
int64_t end
chapter start/end time in time_base units
static void * writer_child_next(void *obj, void *prev)
#define print_section_footer(s)
int64_t end
start, end in second/AV_TIME_BASE units
This struct describes the properties of a single codec described by an AVCodecID.
static void log_read_interval(const ReadInterval *interval, void *log_ctx, int log_level)
@ AV_PKT_DATA_STEREO3D
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
static const char unit_bit_per_second_str[]
static int show_program(WriterContext *w, InputFile *ifile, AVProgram *program)
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
@ AV_PKT_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata (based on SMPTE-2086:2014).
static const AVOption xml_options[]
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
static double av_q2d(AVRational a)
Convert an AVRational to a double.
int av_hash_alloc(AVHashContext **ctx, const char *name)
Allocate a hash context for the algorithm specified by name.
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.
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 print_fmt(k, f,...)
int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Return decoded output data from a decoder.
#define FF_PROFILE_UNKNOWN
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static void xml_print_str(WriterContext *wctx, const char *key, const char *value)
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
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 void flat_print_str(WriterContext *wctx, const char *key, const char *value)
static int probe_file(WriterContext *wctx, const char *filename)
static void ffprobe_show_program_version(WriterContext *w)
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
int64_t pts
Same as packet pts, in AV_TIME_BASE.
static int do_show_chapter_tags
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
static int do_show_pixel_format_components
void parse_options(void *optctx, int argc, char **argv, const OptionDef *options, void(*parse_arg_function)(void *, const char *))
int nested_section[SECTION_MAX_NB_LEVELS]
static const Writer flat_writer
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
static const char * flat_escape_value_str(AVBPrint *dst, const char *src)
static int do_show_chapters
int probe_score
format probing score.
static int show_chapters(WriterContext *w, InputFile *ifile)
static int find_stream_info
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
int flags
Additional information about the frame packing.
static int do_show_pixel_format_flags
static void compact_print_section_header(WriterContext *wctx)
#define SECTION_FLAG_IS_WRAPPER
the section only contains other sections, but has no data at its own level
static void writer_print_data(WriterContext *wctx, const char *name, uint8_t *data, int size)
const char * av_color_range_name(enum AVColorRange range)
@ AVDISCARD_ALL
discard all
void init_dynload(void)
Initialize dynamic library loading.
static ReadInterval * read_intervals
AVCodecParameters * codecpar
Codec parameters associated with this stream.
static void opt_input_file(void *optctx, const char *arg)
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
const AVClass * avcodec_get_class(void)
Get the AVClass for AVCodecContext.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
int children_ids[SECTION_MAX_NB_CHILDREN+1]
list of children section IDS, terminated by -1
static void compact_print_str(WriterContext *wctx, const char *key, const char *value)
const char * av_hash_names(int i)
Get the names of available hash algorithms.
#define SET_DO_SHOW(id, varname)
static void print_color_range(WriterContext *w, enum AVColorRange color_range)
const char program_name[]
program name, defined by the program for show_version().
static const Writer compact_writer
uint8_t nb_components
The number of components each pixel has, (1-4)
void av_hash_init(AVHashContext *ctx)
Initialize or reset a hash context.
static AVFormatContext * fmt_ctx
static void compact_print_int(WriterContext *wctx, const char *key, long long int value)
static void ERROR(const char *str)
static int do_read_frames
@ SECTION_ID_LIBRARY_VERSION
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
static struct AVHashContext * hash
Rational number (pair of numerator and denominator).
enum AVPacketSideDataType type
AVIOContext * pb
I/O context.
void av_log_set_flags(int arg)
@ AV_FRAME_DATA_ICC_PROFILE
The data contains an ICC profile as an opaque octet buffer following the format described by ISO 1507...
void init_opts(void)
Initialize the cmdutils option system, in particular allocate the *_opts contexts.
char * name
name of this writer instance
@ AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata associated with a video frame.
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
void av_opt_free(void *obj)
Free all allocated objects in obj.
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
Parse timestr and return in *time a corresponding number of microseconds.
#define AV_DICT_DONT_OVERWRITE
Don't overwrite existing entries.
int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
static av_cold int xml_init(WriterContext *wctx)
const struct section * sections
array containing all sections
static const Writer csv_writer
static void print_color_trc(WriterContext *w, enum AVColorTransferCharacteristic color_trc)
void(* print_integer)(WriterContext *wctx, const char *, long long int)
static int do_show_programs
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
static int read_interval_packets(WriterContext *w, InputFile *ifile, const ReadInterval *interval, int64_t *cur_ts)
static const OptionDef real_options[]
@ AVCOL_RANGE_UNSPECIFIED
#define WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER
#define WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static const char unit_byte_str[]
const int program_birth_year
program birth year, defined by the program for show_banner()
int sample_rate
Audio only.
#define pthread_mutex_unlock(a)
void av_hash_freep(AVHashContext **ctx)
Free hash context and set hash context pointer to NULL.
static void error(const char *err)
static int show_format(WriterContext *w, InputFile *ifile)
int64_t nb_frames
number of frames in this stream if known or 0
#define print_duration_time(k, v, tb)
int extradata_size
Size of the extradata content in bytes.
static int show_value_unit
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
AVDictionary * codec_opts
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
static const char * csv_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
Quote fields containing special characters, check RFC4180.
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
@ WRITER_STRING_VALIDATION_IGNORE
const char * av_spherical_projection_name(enum AVSphericalProjection projection)
Provide a human-readable name of a given AVSphericalProjection.
@ AV_SPHERICAL_CUBEMAP
Video frame is split into 6 faces of a cube, and arranged on a 3x2 layout.
#define av_ts2timestr(ts, tb)
Convenience macro, the return value should be used only directly in function arguments but never stan...
unsigned int string_validation_utf8_flags
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
Set the logging callback.
static int do_show_packet_tags
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.
@ SECTION_ID_STREAM_DISPOSITION
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
#define PRINT_PIX_FMT_FLAG(flagname, name)
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
AVClassCategory category
Category used for visualization (like color) This is only set if the category is equal for all object...
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
char * url
input or output URL.
static const struct @26 si_prefixes[]
#define SECTION_FLAG_IS_ARRAY
the section contains an array of elements of the same type
AVRational pkt_timebase
Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
#define REALLOCZ_ARRAY_STREAM(ptr, cur_n, new_n)
void uninit_opts(void)
Uninitialize the cmdutils option system, in particular free the *_opts contexts and their contents.
AVClassCategory(* get_category)(void *ctx)
Callback to return the category.
@ SECTION_ID_CHAPTER_TAGS
static int show_private_data
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.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static void xml_print_int(WriterContext *wctx, const char *key, long long int value)
int profile
Codec-specific bitstream restrictions that the stream conforms to.
AVDictionary ** setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *codec_opts)
Setup AVCodecContext options for avformat_find_stream_info().
@ AVCHROMA_LOC_UNSPECIFIED
static int swscale(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
static void ffprobe_show_library_versions(WriterContext *w)
printf("static const uint8_t my_array[100] = {\n")
@ SECTION_ID_PACKETS_AND_FRAMES
static int use_value_prefix
int nested_section[SECTION_MAX_NB_LEVELS]
uint32_t end_display_time
static void flat_print_int(WriterContext *wctx, const char *key, long long int value)
const char const char void * val
static void show_error(WriterContext *w, int err)
int flags
a combination or WRITER_FLAG_*
static void ini_print_str(WriterContext *wctx, const char *key, const char *value)
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
uint32_t padding
Number of pixels to pad from the edge of each cube face.
unsigned int nb_section_frame
number of the frame section in case we are in "packets_and_frames" section
@ SECTION_ID_FRAME_SIDE_DATA_LIST
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
@ AV_PKT_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
int flags
A combination of AV_PKT_FLAG values.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
static int do_show_format
int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict)
Unpack a dictionary from side_data.
#define va_copy(dst, src)
static int writer_print_string(WriterContext *wctx, const char *key, const char *val, int flags)
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
AVDictionary * entries_to_show
static int do_show_stream_disposition
#define AV_LOG_INFO
Standard information.
static void xml_print_section_header(WriterContext *wctx)
int priv_size
private size for the writer context
AVPacketSideData * side_data
An array of side data that applies to the whole stream (i.e.
AVChromaLocation
Location of chroma samples.
static const Writer * registered_writers[MAX_REGISTERED_WRITERS_NB+1]
void show_banner(int argc, char **argv, const OptionDef *options)
Print the program banner to stderr.
static int do_count_packets
static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
static struct section sections[]
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
void register_exit(void(*cb)(int ret))
Register a program-specific cleanup routine.
@ SECTION_ID_PROGRAM_STREAM_TAGS
int flags
For these sections the element_name field is mandatory.
int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
Supply raw packet data as input to a decoder.
ff_const59 AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
attribute_deprecated int64_t timecode_frame_start
@ AV_FRAME_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
int32_t roll
Rotation around the forward vector [-180, 180].
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
int avformat_open_input(AVFormatContext **ps, const char *url, ff_const59 AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
static void print_color_space(WriterContext *w, enum AVColorSpace color_space)
static void ffprobe_show_pixel_formats(WriterContext *w)
@ WRITER_STRING_VALIDATION_NB
static void show_usage(void)
unsigned int nb_item[SECTION_MAX_NB_LEVELS]
number of the item printed in the given section, starting from 0
static const AVOption csv_options[]
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
static void show_subtitle(WriterContext *w, AVSubtitle *sub, AVStream *stream, AVFormatContext *fmt_ctx)
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
Fill the codec context based on the values from the supplied codec parameters.
#define av_malloc_array(a, b)
AVColorSpace
YUV colorspace type.
static void writer_print_ts(WriterContext *wctx, const char *key, int64_t ts, int is_duration)
static int opt_show_entries(void *optctx, const char *opt, const char *arg)
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 value
static av_const int av_toupper(int c)
Locale-independent conversion of ASCII characters to uppercase.
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
@ SECTION_ID_FRAME_SIDE_DATA
const char AVS_Value args
static int opt_sections(void *optctx, const char *opt, const char *arg)
const char *(* escape_str)(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
void * priv
private data for use by the filter
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
New fields can be added to the end with minor version bumps.
@ AV_PKT_DATA_SKIP_SAMPLES
Recommmends skipping the specified number of samples.
enum AVColorRange color_range
Video only.
static char * upcase_string(char *dst, size_t dst_size, const char *src)
@ SECTION_ID_PACKET_SIDE_DATA
const AVOption * av_opt_next(const void *obj, const AVOption *last)
Iterate over all AVOptions belonging to obj.
static int use_value_sexagesimal_format
@ SECTION_ID_LIBRARY_VERSIONS
@ SECTION_ID_FRAME_SIDE_DATA_TIMECODE
enum AVFieldOrder field_order
Video only.
@ SECTION_ID_PROGRAM_VERSION
static const char * none_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
static const Writer ini_writer
void parse_loglevel(int argc, char **argv, const OptionDef *options)
Find the '-loglevel' option in the command line args and apply it.
static void json_print_str(WriterContext *wctx, const char *key, const char *value)
static void ini_print_int(WriterContext *wctx, const char *key, long long int value)
char * string_validation_replacement
int id
Format-specific stream ID.
@ AV_FRAME_DATA_GOP_TIMECODE
The GOP timecode in 25 bit timecode format.
static LogBuffer * log_buffer
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
int32_t pitch
Rotation around the right vector [-90, 90].
void log_callback_help(void *ptr, int level, const char *fmt, va_list vl)
Trivial log callback.
int nb_side_data
The number of elements in the AVStream.side_data array.
enum AVStereo3DType type
How views are packed within the video.
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 AVInputFormat * iformat
void av_bprintf(AVBPrint *buf, const char *fmt,...)
AVPacketSideData * side_data
Additional packet data that can be provided by the container.
static av_cold int flat_init(WriterContext *wctx)
#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...
#define AV_DICT_MATCH_CASE
Only get an entry with exact-case key match.
#define FF_ARRAY_ELEMS(a)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
static int log_buffer_size
enum AVChromaLocation chroma_location
int avformat_network_deinit(void)
Undo the initialization done by avformat_network_init.
const Writer * writer
the Writer of which this is an instance
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.
main external API structure.
int index
stream index in AVFormatContext
#define CMDUTILS_COMMON_OPTIONS
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).
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
static uint64_t * nb_streams_packets
static int do_show_program_version
#define DEFINE_OPT_SHOW_SECTION(section, target_section_id)
#define PRINT_STRING_VALIDATE
@ SECTION_ID_PIXEL_FORMATS
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 print_str_validate(k, v)
enum AVFrameSideDataType type
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
static const AVOption ini_options[]
AVRational r_frame_rate
Real base framerate of the stream.
#define CHECK_COMPLIANCE(opt, opt_name)
static const OptionDef * options
static int do_show_pixel_formats
@ AV_CODEC_ID_PROBE
codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
#define DEFINE_WRITER_CLASS(name)
void av_hash_update(AVHashContext *ctx, const uint8_t *src, int len)
Update a hash context with additional data.
int coded_width
Bitstream width / height, may be different from width/height e.g.
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.
char * av_strdup(const char *s)
Duplicate a string.
static int do_show_program_tags
@ WRITER_STRING_VALIDATION_REPLACE
void av_log_default_callback(void *ptr, int level, const char *fmt, va_list vl)
Default logging callback.
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...
int video_delay
Video only.
const char * item_start_end
Structure to hold side data for an AVFrame.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
static void ffprobe_cleanup(int ret)
@ SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST
@ WRITER_STRING_VALIDATION_FAIL
static const AVOption compact_options[]
int has_nested_elems[SECTION_MAX_NB_LEVELS]
static void default_print_section_header(WriterContext *wctx)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
unsigned MaxFALL
Max average light level per frame (cd/m^2).
int nb_sections
number of sections
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
int64_t pos
byte position in stream, -1 if unknown
const char * av_frame_side_data_name(enum AVFrameSideDataType type)
uint64_t channel_layout
Audio only.
#define SHOW_LIB_VERSION(libname, LIBNAME)
static void writer_print_rational(WriterContext *wctx, const char *key, AVRational q, char sep)
#define flags(name, subs,...)
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
int64_t start_time
Position of the first frame of the component, in AV_TIME_BASE fractional seconds.
static void writer_print_section_footer(WriterContext *wctx)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
@ SECTION_ID_PROGRAM_STREAMS
const char * av_stereo3d_type_name(unsigned int type)
Provide a human-readable name of a given stereo3d type.
static void flat_print_section_header(WriterContext *wctx)
int parent_log_context_offset
Offset in the structure where a pointer to the parent context for logging is stored.
AVClassCategory parent_category
@ SECTION_ID_PROGRAM_STREAM_DISPOSITION
Stereo 3D type: this structure describes how two videos are packed within a single video surface,...
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
static char * show_data_hash
const char *(* item_name)(void *ctx)
A pointer to a function which returns the name of a context instance ctx associated with the class.
static void print_primaries(WriterContext *w, enum AVColorPrimaries color_primaries)
void show_help_options(const OptionDef *options, const char *msg, int req_flags, int rej_flags, int alt_flags)
Print help for all options matching specified flags.
static int do_show_streams
AVColorRange
MPEG vs JPEG YUV range.
AVRational time_base
time base in which the start/end timestamps are specified
static char * stream_specifier
static void writer_print_integers(WriterContext *wctx, const char *name, uint8_t *data, int size, const char *format, int columns, int bytes, int offset_add)
static void log_callback(void *ptr, int level, const char *fmt, va_list vl)
static const struct ColorPrimaries color_primaries[AVCOL_PRI_NB]
#define print_time(k, v, tb)
static void default_print_str(WriterContext *wctx, const char *key, const char *value)
This structure describes how to handle spherical videos, outlining information about projection,...
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
#define print_str_opt(k, v)
unsigned int nb_section_packet
number of the packet section in case we are in "packets_and_frames" section
uint32_t start_display_time
int terminate_line[SECTION_MAX_NB_LEVELS]
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
static void default_print_section_footer(WriterContext *wctx)
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
@ SECTION_ID_PIXEL_FORMAT_COMPONENT
int32_t yaw
Rotation around the up vector [-180, 180].
#define AV_DICT_DONT_STRDUP_KEY
Take ownership of a key that's been allocated with av_malloc() or another memory allocation function.
static const char unit_second_str[]
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
static AVCodecContext * dec_ctx
double av_display_rotation_get(const int32_t matrix[9])
Extract the rotation component of the transformation matrix.
static const AVClass writer_class
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.
static int do_show_packets
static int show_programs(WriterContext *w, InputFile *ifile)
#define av_fourcc2str(fourcc)
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values.
#define pthread_mutex_lock(a)
static void bprint_bytes(AVBPrint *bp, const uint8_t *ubuf, size_t ubuf_size)
void avdevice_register_all(void)
Initialize libavdevice and register all the input and output devices.
void(* print_section_header)(WriterContext *wctx)
static int writer_register(const Writer *writer)