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
|
b
|
static int v4l2_set_parameters(AVFormatContext *s1)
|
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | /* get standard */ |
| 684 | | if (v4l2_ioctl(s->fd, VIDIOC_G_STD, &s->std_id) == 0) { |
| | 684 | if (v4l2_ioctl(s->fd, VIDIOC_G_STD, &s->std_id) == 0 && s->std_id) { |
| 685 | 685 | tpf = &standard.frameperiod; |
| 686 | 686 | for (i = 0; ; i++) { |
| 687 | 687 | standard.index = i; |