[FFmpeg-devel] [PATCH] List supported pixel formats
Stefano Sabatini
stefano.sabatini-lala
Tue May 29 11:09:16 CEST 2007
On date Monday 2007-05-28 01:08:13 +0200, Michael Niedermayer encoded:
> Hi
>
> On Sat, May 26, 2007 at 03:36:49PM +0200, Stefano Sabatini wrote:
> > Hi.
> >
> > On date Friday 2007-05-25 19:45:43 +0200, Michael Niedermayer encoded:
> > > Hi
> > >
> > > On Fri, May 25, 2007 at 05:46:35PM +0200, Stefano Sabatini wrote:
> > > > Hi dear ffmpeg developers.
> > > >
> > > > This patch is based on a patch recently posted by Panagiotis (see
> > > > "List compiled in codecs"), and applies the same functionality and
> > > > interface to -pix_fmt.
> > > >
> > > > In order to get ffmpeg able to list the pixel formats the patch does what follows:
> > > >
> > > > * move the PixFmtInfo structure definition from
> > > > libavcodec/imgconvert.c to libavcodec/avcodec.h
> > > >
> > > > * declare as extern in avcodec.h the structure pix_fmt_info containing
> > > > all the pixel formats infos.
> > >
> > > rejected this struct array is unfit to be exported like that
> > > adding a field to the struct would break compatibility ...
> >
> > Got it.
> >
> > What about to define a list_pix_fmts() function in
> > libavcodec/imgconvert.c and export its interface in
> > libavcodec/avcodec.h?
>
> hmm, maybe outputing a string similar to avcodec_string() would
> be more flexible ...
The following patch creates a new function in libavcodec/imgconvert.c:
avcodec_pix_fmt_string (buf, buf_size, pix_fmt)
modeled after avcodec_string(...), and exported in
libavcodec/avcodec.h.
The resulting (admittedly rather ugly) ffmpeg -pix_fmt list output is:
sds at santefisi:~/src/ffmpeg-snapshot$ ./ffmpeg -pix_fmt list
FFmpeg version SVN-r9143, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --prefix=/home/sds --mandir=/home/sds/share/man --enable-gpl --enable-swscaler --enable-pp
libavutil version: 49.4.0
libavcodec version: 51.40.4
libavformat version: 51.12.1
built on May 28 2007 18:12:02, gcc: 4.1.2 20061028 (prerelease) (Debian 4.1.1-19)
name= yuv420p, nb_channels= 3, depth= 8, is_alpha=n
name= yuyv422, nb_channels= 1, depth= 8, is_alpha=n
name= rgb24, nb_channels= 3, depth= 8, is_alpha=n
name= bgr24, nb_channels= 3, depth= 8, is_alpha=n
name= yuv422p, nb_channels= 3, depth= 8, is_alpha=n
name= yuv444p, nb_channels= 3, depth= 8, is_alpha=n
name= rgb32, nb_channels= 4, depth= 8, is_alpha=y
name= yuv410p, nb_channels= 3, depth= 8, is_alpha=n
name= yuv411p, nb_channels= 3, depth= 8, is_alpha=n
name= rgb565, nb_channels= 3, depth= 5, is_alpha=n
name= rgb555, nb_channels= 3, depth= 5, is_alpha=n
name= gray, nb_channels= 1, depth= 8, is_alpha=n
name= monow, nb_channels= 1, depth= 1, is_alpha=n
name= monob, nb_channels= 1, depth= 1, is_alpha=n
name= pal8, nb_channels= 4, depth= 8, is_alpha=y
name= yuvj420p, nb_channels= 3, depth= 8, is_alpha=n
name= yuvj422p, nb_channels= 3, depth= 8, is_alpha=n
name= yuvj444p, nb_channels= 3, depth= 8, is_alpha=n
name= xvmcmc, nb_channels= 0, depth= 0, is_alpha=n
name= xvmcidct, nb_channels= 0, depth= 0, is_alpha=n
name= uyvy422, nb_channels= 1, depth= 8, is_alpha=n
name= uyyvyy411, nb_channels= 1, depth= 8, is_alpha=n
name= bgr32, nb_channels= 4, depth= 8, is_alpha=y
name= bgr565, nb_channels= 3, depth= 5, is_alpha=n
name= bgr555, nb_channels= 3, depth= 5, is_alpha=n
name= bgr8, nb_channels= 1, depth= 8, is_alpha=n
name= bgr4, nb_channels= 1, depth= 4, is_alpha=n
name= bgr4_byte, nb_channels= 1, depth= 8, is_alpha=n
name= rgb8, nb_channels= 1, depth= 8, is_alpha=n
name= rgb4, nb_channels= 1, depth= 4, is_alpha=n
name= rgb4_byte, nb_channels= 1, depth= 8, is_alpha=n
name= nv12, nb_channels= 2, depth= 8, is_alpha=n
name= nv12, nb_channels= 2, depth= 8, is_alpha=n
name= rgb32_1, nb_channels= 4, depth= 8, is_alpha=y
name= bgr32_1, nb_channels= 4, depth= 8, is_alpha=y
name= gray16be, nb_channels= 1, depth= 16, is_alpha=n
name= gray16le, nb_channels= 1, depth= 16, is_alpha=n
The corresponding format is defined in avcodec_pix_fmt_string as follows:
snprintf (buf, buf_size,
"name=%12s, nb_channels=%4d, depth=%4d, is_alpha=%c",
info.name,
info.nb_channels,
info.depth,
is_alpha_char
);
I'd like to add a similiar functionality for other options as well
(namely: sizes, sws_flags, protocols, codecs) so this format should
result somehow compatible with the other ones.
Any idea for improving this format?
Regards
--
Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: list-pix-fmt-01.patch
Type: text/x-diff
Size: 3973 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070529/4f4ed8a4/attachment.patch>
More information about the ffmpeg-devel
mailing list