On date Friday 2011-05-27 09:49:15 -0400, Ronald S. Bultje encoded:
> Hi (also to Stefano),
> 
> On Fri, May 27, 2011 at 1:43 AM, Anton Khirnov <[email protected]> wrote:
> > ---
> >  libavdevice/libdc1394.c |   14 +++++++++++++-
> >  1 files changed, 13 insertions(+), 1 deletions(-)
> >
> > diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c
> > index 4462262..3692ee8 100644
> > --- a/libavdevice/libdc1394.c
> > +++ b/libavdevice/libdc1394.c
> > @@ -25,6 +25,7 @@
> >  #include "libavutil/log.h"
> >  #include "libavutil/opt.h"
> >  #include "libavutil/parseutils.h"
> > +#include "libavutil/pixdesc.h"
> >
> >  #if HAVE_LIBDC1394_2
> >  #include <dc1394/dc1394.h>
> > @@ -61,6 +62,7 @@ typedef struct dc1394_data {
> >     int current_frame;
> >     int fps;
> >     char *video_size;       /**< String describing video size, set by a 
> > private option. */
> > +    char *pixel_format;     /**< Set by a private option. */
> >
> >     AVPacket packet;
> >  } dc1394_data;
> > @@ -99,6 +101,7 @@ static const AVOption options[] = {
> >     { "channel", "", offsetof(dc1394_data, channel), FF_OPT_TYPE_INT, {.dbl 
> > = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
> >  #endif
> >     { "video_size", "A string describing frame size, such as 640x480 or 
> > hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = "qvga"}, 0, 0, DEC 
> > },
> > +    { "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str 
> > = "UYVY422"}, 0, 0, DEC },
> >     { NULL },
> >  };
> >
> 
> I'm not against this if this is easiest, but using our current options
> system is it possible to create dynamic enum types? Basically what I'm
> thinking of is something that takes av_get_pix_fmt()-style strings for
> a list of given PIX_FMTs generated for each known-supported pixfmt in
> v4l2/bktr/dc1394/etc.

The idea is interesting but doesn't look implementable with the
current system, where the list of accepted constants is fixed and
statically defined compilation-time. Also pix_fmt parsing is a little
complex since it takes into account native endianess which is managed
by the av_get_pix_fmt() function, it would be rather complex to expose
such functionality from the AVOption system.

> I know this sounds a little complex, but it allows us using the global
> pix_fmt enums everywhere if people know them, as well as listing which
> pixfmts are (at least by api) supported.
-- 
I can't understand why a person will take a year or two to write a
novel when he can easily buy one for a few dollars.
                -- Fred Allen
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to