64 static char *
value_string(
char *buf,
int buf_size,
double val,
const char *unit)
70 mins = (int)secs / 60;
71 secs = secs - mins * 60;
74 snprintf(buf, buf_size,
"%d:%02d:%09.6f", hours, mins, secs);
76 const char *prefix_string;
80 index = (int) (log(val)/log(2)) / 10;
82 val /= pow(2, index * 10);
85 index = (int) (log10(val)) / 3;
87 val /= pow(10, index * 3);
91 snprintf(buf, buf_size,
"%.3f %s%s", val, prefix_string,
104 snprintf(buf, buf_size,
"N/A");
115 snprintf(buf, buf_size,
"N/A");
117 snprintf(buf, buf_size,
"%"PRId64, ts);
125 switch (media_type) {
131 default:
return "unknown";
184 if ((dec_ctx = stream->
codec)) {
185 if ((dec = dec_ctx->
codec)) {
189 printf(
"codec_name=unknown\n");
193 printf(
"codec_time_base=%d/%d\n",
198 printf(
"codec_tag_string=%s\n", val_str);
207 printf(
"sample_aspect_ratio=%d:%d\n",
214 printf(
"display_aspect_ratio=%d:%d\n",
215 display_aspect_ratio.
num, display_aspect_ratio.
den);
228 printf(
"bits_per_sample=%d\n",
233 printf(
"codec_type=unknown\n");
238 printf(
"r_frame_rate=%d/%d\n",
240 printf(
"avg_frame_rate=%d/%d\n",
242 printf(
"time_base=%d/%d\n",
324 "Unsupported codec with id %d for input stream %d\n",
327 fprintf(stderr,
"Error while opening codec for input stream %d\n",
332 *fmt_ctx_ptr = fmt_ctx;
360 printf(
"Simple multimedia streams analyzer\n");
369 fprintf(stderr,
"Unknown input format: %s\n", arg);
379 "Argument '%s' provided as input filename, but '%s' was already specified.\n",
383 if (!strcmp(arg,
"-"))
409 "show unit of the displayed values" },
411 "use SI prefixes for the displayed values" },
413 "use binary prefixes for byte units" },
415 "use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" },
417 "prettify the format of displayed values, make it more human readable" },
422 "generic catch all option",
"" },
426 int main(
int argc,
char **argv)
443 fprintf(stderr,
"You have to specify one input file.\n");
445 "Use -h to get full help or, even better, run 'man %s'.\n",