---
 libavdevice/v4l.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavdevice/v4l.c b/libavdevice/v4l.c
index 54d0394..f88885c 100644
--- a/libavdevice/v4l.c
+++ b/libavdevice/v4l.c
@@ -89,8 +89,10 @@ static int grab_read_header(AVFormatContext *s1, 
AVFormatParameters *ap)
     }
     s->time_base = ap->time_base;
 
-    s->video_win.width = ap->width;
-    s->video_win.height = ap->height;
+    if (ap->width > 0)
+        s->video_win.width = ap->width;
+    if (ap->height > 0)
+        s->video_win.height = ap->height;
 
     st = av_new_stream(s1, 0);
     if (!st)
@@ -347,6 +349,8 @@ static const AVOption options[] = {
     { "PAL",   "", 0, FF_OPT_TYPE_CONST, {.dbl = VIDEO_MODE_PAL},   0, 0, 
AV_OPT_FLAG_DECODING_PARAM, "standard" },
     { "SECAM", "", 0, FF_OPT_TYPE_CONST, {.dbl = VIDEO_MODE_SECAM}, 0, 0, 
AV_OPT_FLAG_DECODING_PARAM, "standard" },
     { "NTSC",  "", 0, FF_OPT_TYPE_CONST, {.dbl = VIDEO_MODE_NTSC},  0, 0, 
AV_OPT_FLAG_DECODING_PARAM, "standard" },
+    { "width",    "", offsetof(VideoData, video_win.width),  FF_OPT_TYPE_INT, 
{.dbl = 640}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+    { "height",   "", offsetof(VideoData, video_win.height), FF_OPT_TYPE_INT, 
{.dbl = 480}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
     { NULL },
 };
 
-- 
1.7.5.1

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to