From 1f75e650e04dd5d8bb2aa19dd64c82717eae60df Mon Sep 17 00:00:00 2001
From: Giorgio Vazzana <mywing81@gmail.com>
Date: Sun, 8 Sep 2013 10:41:21 +0200
Subject: [PATCH 2/2] lavd/v4l2: make sure VIDIOC_G_STD does not return std_id
 = 0 before trying to enum standards

With some drivers, the VIDIOC_G_STD ioctl does not fail, but returns std_id = 0,
which means the device does not support any standard. Add a check to handle this
situation.
---
 libavdevice/v4l2.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 1199f4b..44f29d2 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -681,7 +681,7 @@ static int v4l2_set_parameters(AVFormatContext *s1)
     }
 
     /* get standard */
-    if (v4l2_ioctl(s->fd, VIDIOC_G_STD, &s->std_id) == 0) {
+    if (v4l2_ioctl(s->fd, VIDIOC_G_STD, &s->std_id) == 0 && s->std_id) {
         tpf = &standard.frameperiod;
         for (i = 0; ; i++) {
             standard.index = i;
-- 
1.7.9.5

