On date Friday 2011-05-27 07:43:09 +0200, Anton Khirnov encoded:
> ---
>  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 },

Maybe pix_fmt (for consistency with the current -pix_fmt option).

>      { NULL },
>  };
>  
> @@ -117,11 +120,17 @@ static inline int dc1394_read_common(AVFormatContext 
> *c, AVFormatParameters *ap,
>      AVStream* vst;
>      struct dc1394_frame_format *fmt;
>      struct dc1394_frame_rate *fps;
> -    enum PixelFormat pix_fmt = ap->pix_fmt == PIX_FMT_NONE ? PIX_FMT_UYVY422 
> : ap->pix_fmt; /* defaults */
> +    enum PixelFormat pix_fmt;
>      int width, height;
>      int frame_rate           = !ap->time_base.num ? 30000 : av_rescale(1000, 
> ap->time_base.den, ap->time_base.num);
>      int ret = 0;
>  
> +    if (!(pix_fmt = av_get_pix_fmt(dc1394->pixel_format))) {
> +        av_log(c, AV_LOG_ERROR, "No such pixel format: %s.\n", 
> dc1394->pixel_format);

Nit: '%s' helps to spot weird character sequences.
Also I don't like very much the MSG: VAL style, but I'd rather prefer: 
"Unknown pixel format '%s' specified.\n"
or
"The specified pixel format '%s' is unknown.\n"

Looks good otherwise.
[...]
-- 
It's currently a problem of access to gigabits through punybaud.
                -- J. C. R. Licklider
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to