[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.
Michael Niedermayer
michaelni
Sun Nov 7 19:08:28 CET 2010
On Sun, Nov 07, 2010 at 02:47:47PM +0100, Stefano Sabatini wrote:
> 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
well you can print one, you can print the other or both.
iam not sure i like the nb_components renaming though
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101107/0ff37581/attachment.pgp>
More information about the ffmpeg-devel
mailing list