On date Wednesday 2011-05-25 16:27:24 +0200, Anton Khirnov encoded:
> ---
> libavdevice/libdc1394.c | 15 +++++++++++----
> 1 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c
> index 96e9e9b..514087d 100644
> --- a/libavdevice/libdc1394.c
> +++ b/libavdevice/libdc1394.c
> @@ -60,6 +60,8 @@ typedef struct dc1394_data {
> int current_frame;
> int fps;
>
> + int width, height;
> +
> AVPacket packet;
> } dc1394_data;
>
> @@ -98,12 +100,15 @@ static inline int dc1394_read_common(AVFormatContext *c,
> AVFormatParameters *ap,
> 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 width = !ap->width ? 320 : ap->width;
> - int height = !ap->height ? 240 : ap->height;
> int frame_rate = !ap->time_base.num ? 30000 : av_rescale(1000,
> ap->time_base.den, ap->time_base.num);
>
> + if (ap->width > 0)
> + dc1394->width = ap->width;
> + if (ap->height > 0)
> + dc1394->height = ap->height;
> +
> for (fmt = dc1394_frame_formats; fmt->width; fmt++)
> - if (fmt->pix_fmt == pix_fmt && fmt->width == width && fmt->height
> == height)
> + if (fmt->pix_fmt == pix_fmt && fmt->width == dc1394->width &&
> fmt->height == dc1394->height)
> break;
>
> for (fps = dc1394_frame_rates; fps->frame_rate; fps++)
> @@ -112,7 +117,7 @@ static inline int dc1394_read_common(AVFormatContext *c,
> AVFormatParameters *ap,
>
> if (!fps->frame_rate || !fmt->width) {
> av_log(c, AV_LOG_ERROR, "Can't find matching camera format for %s,
> %dx%d@%d:1000fps\n", avcodec_get_pix_fmt_name(pix_fmt),
> -
> width, height, frame_rate);
> +
> dc1394->width, dc1394->height, frame_rate);
Nit+++: split overlong line
> goto out;
> }
>
> @@ -249,6 +254,8 @@ static const AVOption options[] = {
> #if HAVE_LIBDC1394_1
> { "channel", "", offsetof(dc1394_data, channel), FF_OPT_TYPE_INT, {.dbl
> = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
> #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 },
> { NULL },
Nit: maybe you can define a macro OFFSET for readability/robustness.
Same widht/height/size considerations already done.
--
Sturgeon's Law:
90% of everything is crud.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel