105 void (*print_integer) (
const char *key, int64_t value);
106 void (*print_string) (
const char *key,
const char *value);
111 #define AVP_INDENT() avio_printf(probe_out, "%*c", octx.level * 2, ' ')
141 case '\r':
avio_printf(probe_out,
"%s",
"\\r");
break;
142 case '\n':
avio_printf(probe_out,
"%s",
"\\n");
break;
143 case '\f':
avio_printf(probe_out,
"%s",
"\\f");
break;
144 case '\b':
avio_printf(probe_out,
"%s",
"\\b");
break;
145 case '\t':
avio_printf(probe_out,
"%s",
"\\t");
break;
149 case ':' :
avio_w8(probe_out,
'\\');
151 if ((
unsigned char)c < 32)
176 for (i = 1; i < octx.
level; i++) {
255 avio_printf(probe_out,
"\"%s\" : %"PRId64
"", key, value);
265 case '\r':
avio_printf(probe_out,
"%s",
"\\r");
break;
266 case '\n':
avio_printf(probe_out,
"%s",
"\\n");
break;
267 case '\f':
avio_printf(probe_out,
"%s",
"\\f");
break;
268 case '\b':
avio_printf(probe_out,
"%s",
"\\b");
break;
269 case '\t':
avio_printf(probe_out,
"%s",
"\\t");
break;
271 case '"' :
avio_w8(probe_out,
'\\');
273 if ((
unsigned char)c < 32)
301 if (!strcmp(name,
"tags"))
318 if (!strcmp(name,
"tags"))
367 if (!octx.
prefix || !name) {
368 fprintf(stderr,
"Out of memory\n");
438 static void probe_str(
const char *key,
const char *value)
456 static char *
value_string(
char *buf,
int buf_size,
double val,
const char *unit)
462 mins = (int)secs / 60;
463 secs = secs - mins * 60;
466 snprintf(buf, buf_size,
"%d:%02d:%09.6f", hours, mins, secs);
468 const char *prefix_string;
472 index = (int)
log2(val) / 10;
474 val /= pow(2, index * 10);
477 index = (int) (log10(val)) / 3;
479 val /= pow(10, index * 3);
482 snprintf(buf, buf_size,
"%.*f%s%s",
497 snprintf(buf, buf_size,
"N/A");
508 snprintf(buf, buf_size,
"N/A");
510 snprintf(buf, buf_size,
"%"PRId64, ts);
519 snprintf(buf, buf_size,
"%d%s%d", rat->
num, sep, rat->
den);
525 snprintf(buf, buf_size,
"0x%04x", tag);
580 if ((dec_ctx = stream->
codec)) {
581 if ((dec = dec_ctx->
codec)) {
621 &display_aspect_ratio));
728 fprintf(stderr,
"Failed to probe codec for input stream %d\n",
732 "Unsupported codec with id %d for input stream %d\n",
735 fprintf(stderr,
"Error while opening codec for input stream %d\n",
740 *fmt_ctx_ptr = fmt_ctx;
785 printf(
"Simple multimedia streams analyzer\n");
786 printf(
"usage: %s [OPTIONS] [INPUT_FILE]\n",
program_name);
790 static int opt_format(
void *optctx,
const char *opt,
const char *arg)
794 fprintf(stderr,
"Unknown input format: %s\n", arg);
803 if (!strcmp(arg,
"json")) {
813 }
else if (!strcmp(arg,
"ini")) {
821 }
else if (!strcmp(arg,
"old")) {
855 "Argument '%s' provided as input filename, but '%s' was already specified.\n",
859 if (!strcmp(arg,
"-"))
873 static int opt_pretty(
void *optctx,
const char *opt,
const char *arg)
887 "show unit of the displayed values" },
889 "use SI prefixes for the displayed values" },
891 "use binary prefixes for byte units" },
893 "use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" },
895 "prettify the format of displayed values, make it more human readable" },
898 "show a particular entry from the format/container info",
"entry" },
902 "generic catch all option",
"" },
908 printf(
"%.*s", buf_size, buf);
912 #define AVP_BUFFSIZE 4096
914 int main(
int argc,
char **argv)
948 fprintf(stderr,
"You have to specify one input file.\n");
950 "Use -h to get full help or, even better, run 'man %s'.\n",