[FFmpeg-devel] [PATCH 6/8] Make avcodec_pix_fmt_string() use the information in the pixel format descriptors for printing the number of planes. Also replace the term "nb_channels" with "nb_planes" which is more correct.

Stefano Sabatini stefano.sabatini-lala
Sun Nov 7 14:47:47 CET 2010


On date Friday 2010-11-05 12:01:38 +0100, Stefano Sabatini encoded:
> ---
>  libavcodec/imgconvert.c |   12 ++++++++----
>  1 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
> index e9477c4..0c30304 100644
> --- a/libavcodec/imgconvert.c
> +++ b/libavcodec/imgconvert.c
> @@ -434,15 +434,19 @@ void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt)
>      /* print header */
>      if (pix_fmt < 0)
>          snprintf (buf, buf_size,
> -                  "name      " " nb_channels" " depth"
> +                  "name      " " nb_planes" " depth"
>              );
>      else{
> -        PixFmtInfo info= pix_fmt_info[pix_fmt];
> +        const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
> +        int i, nb_planes = 0;
> +        for (i = 0; i < pixdesc->nb_components; i++)
> +            nb_planes = FFMAX(pixdesc->comp[i].plane, nb_planes);
> +        nb_planes++;
>  
>          snprintf (buf, buf_size,
> -                  "%-11s %5d %9d",
> +                  "%-11s %5d %7d",
>                    av_pix_fmt_descriptors[pix_fmt].name,
> -                  info.nb_channels,
> +                  nb_planes,
>                    av_get_bits_per_pixel(&av_pix_fmt_descriptors[pix_fmt])
>              );

nb_planes != nb_channels

Updated.
-- 
FFmpeg = Freak Fierce Murdering Peaceful Ecletic Governor



More information about the ffmpeg-devel mailing list