On date Wednesday 2011-05-25 16:27:26 +0200, Anton Khirnov encoded:
> ---
> libavdevice/v4l2.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
> index 566ee92..d7aebe2 100644
> --- a/libavdevice/v4l2.c
> +++ b/libavdevice/v4l2.c
> @@ -587,8 +587,10 @@ static int v4l2_read_header(AVFormatContext *s1,
> AVFormatParameters *ap)
> }
> av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
>
> - s->width = ap->width;
> - s->height = ap->height;
> + if (ap->width > 0)
> + s->width = ap->width;
> + if (ap->height > 0)
> + s->height = ap->height;
>
> capabilities = 0;
> s->fd = device_open(s1, &capabilities);
> @@ -699,6 +701,8 @@ static int v4l2_read_close(AVFormatContext *s1)
> static const AVOption options[] = {
> { "standard", "", offsetof(struct video_data, standard),
> FF_OPT_TYPE_STRING, {.str = "NTSC" }, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
> { "channel", "", offsetof(struct video_data, channel),
> FF_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
> + { "width", "", offsetof(struct video_data, width),
> FF_OPT_TYPE_INT, {.dbl = 640}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
> + { "height", "", offsetof(struct video_data, height),
> FF_OPT_TYPE_INT, {.dbl = 480}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
In case of unspecified w/h (that is if w=0 h=0) V4L2 tries to
autodetect it, so maybe 0/0 are a better default (don't remember if
V4L does the same).
Usual w/h vs. s consideration.
--
Where you stand depends on where you sit.
-- Rufus Miles, HEW
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel