[FFmpeg-devel] [PATCH 2/6] ffprobe: factorize tag printing.
Stefano Sabatini
stefano.sabatini-lala at poste.it
Wed Aug 17 23:21:12 CEST 2011
On date Wednesday 2011-08-17 20:32:03 +0200, Clément Bœsch encoded:
> ---
> ffprobe.c | 21 +++++++++++----------
> 1 files changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/ffprobe.c b/ffprobe.c
> index 7146ea2..5eebd45 100644
> --- a/ffprobe.c
> +++ b/ffprobe.c
> @@ -188,13 +188,21 @@ static void show_packets(AVFormatContext *fmt_ctx)
> show_packet(fmt_ctx, &pkt);
> }
>
> +static void show_avdict(AVDictionary *dict)
Nit: s/show_avdict/show_tags/, more specific.
> +{
> + AVDictionaryEntry *tag = NULL;
> + while ((tag = av_dict_get(dict, "", tag, AV_DICT_IGNORE_SUFFIX))) {
> + printf("TAG:");
> + print_info_item_str(tag->key, tag->value);
> + }
> +}
> +
> static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
> {
> AVStream *stream = fmt_ctx->streams[stream_idx];
> AVCodecContext *dec_ctx;
> AVCodec *dec;
> char val_str[128];
> - AVDictionaryEntry *tag = NULL;
> AVRational display_aspect_ratio;
>
> print_info_header("STREAM");
> @@ -258,10 +266,7 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
> if (stream->nb_frames)
> print_info_item_fmt("nb_frames", "%"PRId64, stream->nb_frames);
>
> - while ((tag = av_dict_get(stream->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
> - printf("TAG:");
> - print_info_item_str(tag->key, tag->value);
> - }
> + show_avdict(stream->metadata);
>
> print_info_footer("STREAM");
> fflush(stdout);
> @@ -269,7 +274,6 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
>
> static void show_format(AVFormatContext *fmt_ctx)
> {
> - AVDictionaryEntry *tag = NULL;
> char val_str[128];
>
> print_info_header("FORMAT");
> @@ -283,10 +287,7 @@ static void show_format(AVFormatContext *fmt_ctx)
> print_info_item_str("size", value_string(val_str, sizeof(val_str), fmt_ctx->file_size, unit_byte_str));
> print_info_item_str("bit_rate", value_string(val_str, sizeof(val_str), fmt_ctx->bit_rate, unit_bit_per_second_str));
>
> - while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
> - printf("TAG:");
> - print_info_item_str(tag->key, tag->value);
> - }
> + show_avdict(fmt_ctx->metadata);
Looks good otherwise.
--
FFmpeg = Friendly Fascinating Magic Pacific Efficient Gadget
More information about the ffmpeg-devel
mailing list