| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * FFprobe : Simple Media Prober based on the FFmpeg libraries | 2  * FFprobe : Simple Media Prober based on the FFmpeg libraries | 
| 3  * Copyright (c) 2007-2010 Stefano Sabatini | 3  * Copyright (c) 2007-2010 Stefano Sabatini | 
| 4  * | 4  * | 
| 5  * This file is part of FFmpeg. | 5  * This file is part of FFmpeg. | 
| 6  * | 6  * | 
| 7  * FFmpeg is free software; you can redistribute it and/or | 7  * FFmpeg is free software; you can redistribute it and/or | 
| 8  * modify it under the terms of the GNU Lesser General Public | 8  * modify it under the terms of the GNU Lesser General Public | 
| 9  * License as published by the Free Software Foundation; either | 9  * License as published by the Free Software Foundation; either | 
| 10  * version 2.1 of the License, or (at your option) any later version. | 10  * version 2.1 of the License, or (at your option) any later version. | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 28 #include "libavdevice/avdevice.h" | 28 #include "libavdevice/avdevice.h" | 
| 29 #include "cmdutils.h" | 29 #include "cmdutils.h" | 
| 30 | 30 | 
| 31 const char program_name[] = "FFprobe"; | 31 const char program_name[] = "FFprobe"; | 
| 32 const int program_birth_year = 2007; | 32 const int program_birth_year = 2007; | 
| 33 | 33 | 
| 34 static int do_show_format  = 0; | 34 static int do_show_format  = 0; | 
| 35 static int do_show_packets = 0; | 35 static int do_show_packets = 0; | 
| 36 static int do_show_streams = 0; | 36 static int do_show_streams = 0; | 
| 37 | 37 | 
| 38 static int convert_tags                 = 0; |  | 
| 39 static int show_value_unit              = 0; | 38 static int show_value_unit              = 0; | 
| 40 static int use_value_prefix             = 0; | 39 static int use_value_prefix             = 0; | 
| 41 static int use_byte_value_binary_prefix = 0; | 40 static int use_byte_value_binary_prefix = 0; | 
| 42 static int use_value_sexagesimal_format = 0; | 41 static int use_value_sexagesimal_format = 0; | 
| 43 | 42 | 
| 44 /* globals */ | 43 /* globals */ | 
| 45 static const OptionDef options[]; | 44 static const OptionDef options[]; | 
| 46 | 45 | 
| 47 /* FFprobe context */ | 46 /* FFprobe context */ | 
| 48 static const char *input_filename; | 47 static const char *input_filename; | 
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 213         } | 212         } | 
| 214     } else { | 213     } else { | 
| 215         printf("codec_type=unknown\n"); | 214         printf("codec_type=unknown\n"); | 
| 216     } | 215     } | 
| 217 | 216 | 
| 218     if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS) | 217     if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS) | 
| 219         printf("id=0x%x\n", stream->id); | 218         printf("id=0x%x\n", stream->id); | 
| 220     printf("r_frame_rate=%d/%d\n",         stream->r_frame_rate.num,   stream->r
     _frame_rate.den); | 219     printf("r_frame_rate=%d/%d\n",         stream->r_frame_rate.num,   stream->r
     _frame_rate.den); | 
| 221     printf("avg_frame_rate=%d/%d\n",       stream->avg_frame_rate.num, stream->a
     vg_frame_rate.den); | 220     printf("avg_frame_rate=%d/%d\n",       stream->avg_frame_rate.num, stream->a
     vg_frame_rate.den); | 
| 222     printf("time_base=%d/%d\n",            stream->time_base.num,      stream->t
     ime_base.den); | 221     printf("time_base=%d/%d\n",            stream->time_base.num,      stream->t
     ime_base.den); | 
| 223     if (stream->language[0]) |  | 
| 224         printf("language=%s\n",            stream->language); |  | 
| 225     printf("start_time=%s\n",   time_value_string(val_str, sizeof(val_str), stre
     am->start_time, | 222     printf("start_time=%s\n",   time_value_string(val_str, sizeof(val_str), stre
     am->start_time, | 
| 226                                                   &stream->time_base)); | 223                                                   &stream->time_base)); | 
| 227     printf("duration=%s\n",     time_value_string(val_str, sizeof(val_str), stre
     am->duration, | 224     printf("duration=%s\n",     time_value_string(val_str, sizeof(val_str), stre
     am->duration, | 
| 228                                                   &stream->time_base)); | 225                                                   &stream->time_base)); | 
| 229     if (stream->nb_frames) | 226     if (stream->nb_frames) | 
| 230         printf("nb_frames=%"PRId64"\n",    stream->nb_frames); | 227         printf("nb_frames=%"PRId64"\n",    stream->nb_frames); | 
| 231 | 228 | 
| 232     while ((tag = av_metadata_get(stream->metadata, "", tag, AV_METADATA_IGNORE_
     SUFFIX))) | 229     while ((tag = av_metadata_get(stream->metadata, "", tag, AV_METADATA_IGNORE_
     SUFFIX))) | 
| 233         printf("TAG:%s=%s\n", tag->key, tag->value); | 230         printf("TAG:%s=%s\n", tag->key, tag->value); | 
| 234 | 231 | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 248     printf("format_long_name=%s\n", fmt_ctx->iformat->long_name); | 245     printf("format_long_name=%s\n", fmt_ctx->iformat->long_name); | 
| 249     printf("start_time=%s\n",       time_value_string(val_str, sizeof(val_str), 
     fmt_ctx->start_time, | 246     printf("start_time=%s\n",       time_value_string(val_str, sizeof(val_str), 
     fmt_ctx->start_time, | 
| 250                                                       &AV_TIME_BASE_Q)); | 247                                                       &AV_TIME_BASE_Q)); | 
| 251     printf("duration=%s\n",         time_value_string(val_str, sizeof(val_str), 
     fmt_ctx->duration, | 248     printf("duration=%s\n",         time_value_string(val_str, sizeof(val_str), 
     fmt_ctx->duration, | 
| 252                                                       &AV_TIME_BASE_Q)); | 249                                                       &AV_TIME_BASE_Q)); | 
| 253     printf("size=%s\n",             value_string(val_str, sizeof(val_str), fmt_c
     tx->file_size, | 250     printf("size=%s\n",             value_string(val_str, sizeof(val_str), fmt_c
     tx->file_size, | 
| 254                                                  unit_byte_str)); | 251                                                  unit_byte_str)); | 
| 255     printf("bit_rate=%s\n",         value_string(val_str, sizeof(val_str), fmt_c
     tx->bit_rate, | 252     printf("bit_rate=%s\n",         value_string(val_str, sizeof(val_str), fmt_c
     tx->bit_rate, | 
| 256                                                  unit_bit_per_second_str)); | 253                                                  unit_bit_per_second_str)); | 
| 257 | 254 | 
| 258     if (convert_tags) |  | 
| 259         av_metadata_conv(fmt_ctx, NULL, fmt_ctx->iformat->metadata_conv); |  | 
| 260     while ((tag = av_metadata_get(fmt_ctx->metadata, "", tag, AV_METADATA_IGNORE
     _SUFFIX))) | 255     while ((tag = av_metadata_get(fmt_ctx->metadata, "", tag, AV_METADATA_IGNORE
     _SUFFIX))) | 
| 261         printf("TAG:%s=%s\n", tag->key, tag->value); | 256         printf("TAG:%s=%s\n", tag->key, tag->value); | 
| 262 | 257 | 
| 263     printf("[/FORMAT]\n"); | 258     printf("[/FORMAT]\n"); | 
| 264 } | 259 } | 
| 265 | 260 | 
| 266 static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename) | 261 static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename) | 
| 267 { | 262 { | 
| 268     int err, i; | 263     int err, i; | 
| 269     AVFormatContext *fmt_ctx; | 264     AVFormatContext *fmt_ctx; | 
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 365 static void opt_pretty(void) | 360 static void opt_pretty(void) | 
| 366 { | 361 { | 
| 367     show_value_unit              = 1; | 362     show_value_unit              = 1; | 
| 368     use_value_prefix             = 1; | 363     use_value_prefix             = 1; | 
| 369     use_byte_value_binary_prefix = 1; | 364     use_byte_value_binary_prefix = 1; | 
| 370     use_value_sexagesimal_format = 1; | 365     use_value_sexagesimal_format = 1; | 
| 371 } | 366 } | 
| 372 | 367 | 
| 373 static const OptionDef options[] = { | 368 static const OptionDef options[] = { | 
| 374 #include "cmdutils_common_opts.h" | 369 #include "cmdutils_common_opts.h" | 
| 375     { "convert_tags", OPT_BOOL, {(void*)&convert_tags}, "convert tag names to th
     e FFmpeg generic tag names" }, |  | 
| 376     { "f", HAS_ARG, {(void*)opt_format}, "force format", "format" }, | 370     { "f", HAS_ARG, {(void*)opt_format}, "force format", "format" }, | 
| 377     { "unit", OPT_BOOL, {(void*)&show_value_unit}, "show unit of the displayed v
     alues" }, | 371     { "unit", OPT_BOOL, {(void*)&show_value_unit}, "show unit of the displayed v
     alues" }, | 
| 378     { "prefix", OPT_BOOL, {(void*)&use_value_prefix}, "use SI prefixes for the d
     isplayed values" }, | 372     { "prefix", OPT_BOOL, {(void*)&use_value_prefix}, "use SI prefixes for the d
     isplayed values" }, | 
| 379     { "byte_binary_prefix", OPT_BOOL, {(void*)&use_byte_value_binary_prefix}, | 373     { "byte_binary_prefix", OPT_BOOL, {(void*)&use_byte_value_binary_prefix}, | 
| 380       "use binary prefixes for byte units" }, | 374       "use binary prefixes for byte units" }, | 
| 381     { "sexagesimal", OPT_BOOL,  {(void*)&use_value_sexagesimal_format}, | 375     { "sexagesimal", OPT_BOOL,  {(void*)&use_value_sexagesimal_format}, | 
| 382       "use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" }, | 376       "use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" }, | 
| 383     { "pretty", 0, {(void*)&opt_pretty}, | 377     { "pretty", 0, {(void*)&opt_pretty}, | 
| 384       "prettify the format of displayed values, make it more human readable" }, | 378       "prettify the format of displayed values, make it more human readable" }, | 
| 385     { "show_format",  OPT_BOOL, {(void*)&do_show_format} , "show format/containe
     r info" }, | 379     { "show_format",  OPT_BOOL, {(void*)&do_show_format} , "show format/containe
     r info" }, | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
| 409         fprintf(stderr, "Use -h to get full help or, even better, run 'man ffpro
     be'.\n"); | 403         fprintf(stderr, "Use -h to get full help or, even better, run 'man ffpro
     be'.\n"); | 
| 410         exit(1); | 404         exit(1); | 
| 411     } | 405     } | 
| 412 | 406 | 
| 413     ret = probe_file(input_filename); | 407     ret = probe_file(input_filename); | 
| 414 | 408 | 
| 415     av_free(avformat_opts); | 409     av_free(avformat_opts); | 
| 416 | 410 | 
| 417     return ret; | 411     return ret; | 
| 418 } | 412 } | 
| OLD | NEW | 
|---|