On date Wednesday 2011-05-25 16:27:33 +0200, Anton Khirnov encoded:
> ---
> libavdevice/libdc1394.c | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c
> index f0a7d25..4cbed6e 100644
> --- a/libavdevice/libdc1394.c
> +++ b/libavdevice/libdc1394.c
> @@ -24,6 +24,7 @@
> #include "libavformat/avformat.h"
> #include "libavutil/log.h"
> #include "libavutil/opt.h"
> +#include "libavutil/pixdesc.h"
>
> #if HAVE_LIBDC1394_2
> #include <dc1394/dc1394.h>
> @@ -61,6 +62,7 @@ typedef struct dc1394_data {
> int fps;
>
> int width, height;
> + char *pix_fmt;
>
> AVPacket packet;
> } dc1394_data;
> @@ -99,14 +101,18 @@ 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 */
> int frame_rate = !ap->time_base.num ? 30000 : av_rescale(1000,
> ap->time_base.den, ap->time_base.num);
> + enum PixelFormat pix_fmt = av_get_pix_fmt(dc1394->pix_fmt);
Possibly a check should be done in case pix_fmt is invalid.
> + av_freep(&dc1394->pix_fmt);
Note: maybe a function for freeing the private context may be useful.
> #if FF_API_FORMAT_PARAMETERS
> if (ap->width > 0)
> dc1394->width = ap->width;
> if (ap->height > 0)
> dc1394->height = ap->height;
> + if (ap->pix_fmt)
> + pix_fmt = ap->pix_fmt;
> #endif
>
> for (fmt = dc1394_frame_formats; fmt->width; fmt++)
> @@ -258,6 +264,7 @@ static const AVOption options[] = {
> #endif
> { "width", "", offsetof(dc1394_data, width), FF_OPT_TYPE_INT, {.dbl
> = 320}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
> { "height", "", offsetof(dc1394_data, height), FF_OPT_TYPE_INT, {.dbl
> = 240}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
> + { "pixel_format", "", offsetof(dc1394_data, pix_fmt),
> FF_OPT_TYPE_STRING, {.str = "UYVY422" }, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
> { NULL },
> };
>
> --
> 1.7.5.1
>
> _______________________________________________
> libav-devel mailing list
> [email protected]
> https://lists.libav.org/mailman/listinfo/libav-devel
--
Brogan's Constant:
People tend to congregate in the back of the church and the
front of the bus.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel