104 void (*print_integer) (
const char *key, int64_t value);
105 void (*print_string) (
const char *key,
const char *value);
110 #define AVP_INDENT() avio_printf(probe_out, "%*c", octx.level * 2, ' ')
140 case '\r':
avio_printf(probe_out,
"%s",
"\\r");
break;
141 case '\n':
avio_printf(probe_out,
"%s",
"\\n");
break;
142 case '\f':
avio_printf(probe_out,
"%s",
"\\f");
break;
143 case '\b':
avio_printf(probe_out,
"%s",
"\\b");
break;
144 case '\t':
avio_printf(probe_out,
"%s",
"\\t");
break;
148 case ':' :
avio_w8(probe_out,
'\\');
150 if ((
unsigned char)c < 32)
175 for (i = 1; i < octx.
level; i++) {
254 avio_printf(probe_out,
"\"%s\" : %"PRId64
"", key, value);
264 case '\r':
avio_printf(probe_out,
"%s",
"\\r");
break;
265 case '\n':
avio_printf(probe_out,
"%s",
"\\n");
break;
266 case '\f':
avio_printf(probe_out,
"%s",
"\\f");
break;
267 case '\b':
avio_printf(probe_out,
"%s",
"\\b");
break;
268 case '\t':
avio_printf(probe_out,
"%s",
"\\t");
break;
270 case '"' :
avio_w8(probe_out,
'\\');
272 if ((
unsigned char)c < 32)
300 if (!strcmp(name,
"tags"))
317 if (!strcmp(name,
"tags"))
366 if (!octx.
prefix || !name) {
367 fprintf(stderr,
"Out of memory\n");
437 static void probe_str(
const char *key,
const char *value)
455 static char *
value_string(
char *buf,
int buf_size,
double val,
const char *unit)
461 mins = (int)secs / 60;
462 secs = secs - mins * 60;
465 snprintf(buf, buf_size,
"%d:%02d:%09.6f", hours, mins, secs);
467 const char *prefix_string;
471 index = (int)
log2(val) / 10;
473 val /= pow(2, index * 10);
476 index = (int) (log10(val)) / 3;
478 val /= pow(10, index * 3);
481 snprintf(buf, buf_size,
"%.*f%s%s",
496 snprintf(buf, buf_size,
"N/A");
507 snprintf(buf, buf_size,
"N/A");
509 snprintf(buf, buf_size,
"%"PRId64, ts);
518 snprintf(buf, buf_size,
"%d%s%d", rat->
num, sep, rat->
den);
524 snprintf(buf, buf_size,
"0x%04x", tag);
532 switch (media_type) {
538 default:
return "unknown";
593 if ((dec_ctx = stream->
codec)) {
594 if ((dec = dec_ctx->
codec)) {
634 &display_aspect_ratio));
741 fprintf(stderr,
"Failed to probe codec for input stream %d\n",
745 "Unsupported codec with id %d for input stream %d\n",
748 fprintf(stderr,
"Error while opening codec for input stream %d\n",
753 *fmt_ctx_ptr = fmt_ctx;
798 printf(
"Simple multimedia streams analyzer\n");
799 printf(
"usage: %s [OPTIONS] [INPUT_FILE]\n",
program_name);
803 static int opt_format(
void *optctx,
const char *opt,
const char *arg)
807 fprintf(stderr,
"Unknown input format: %s\n", arg);
816 if (!strcmp(arg,
"json")) {
826 }
else if (!strcmp(arg,
"ini")) {
834 }
else if (!strcmp(arg,
"old")) {
868 "Argument '%s' provided as input filename, but '%s' was already specified.\n",
872 if (!strcmp(arg,
"-"))
886 static int opt_pretty(
void *optctx,
const char *opt,
const char *arg)
900 "show unit of the displayed values" },
902 "use SI prefixes for the displayed values" },
904 "use binary prefixes for byte units" },
906 "use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" },
908 "prettify the format of displayed values, make it more human readable" },
911 "show a particular entry from the format/container info",
"entry" },
915 "generic catch all option",
"" },
921 printf(
"%.*s", buf_size, buf);
925 #define AVP_BUFFSIZE 4096
927 int main(
int argc,
char **argv)
961 fprintf(stderr,
"You have to specify one input file.\n");
963 "Use -h to get full help or, even better, run 'man %s'.\n",