[FFmpeg-cvslog] lavd/v4l2: do not fail when VIDIOC_ENUMSTD returns EINVAL without a valid match

mrlika git at videolan.org
Thu Oct 24 11:59:21 CEST 2013


ffmpeg | branch: release/2.0 | mrlika <andriy.lysnevych at gmail.com> | Mon Sep  2 15:10:22 2013 +0300| [f581e25a69052481eb04fe45604036f685f133ae] | committer: Carl Eugen Hoyos

lavd/v4l2: do not fail when VIDIOC_ENUMSTD returns EINVAL without a valid match

With some (buggy) drivers, the VIDIOC_G_STD ioctl returns a std_id that cannot
be matched with any of the enumerated v4l2_standard structures (for example
std_id = 0 or std_id = 0xffffff). Do not fail when we reach the end of the
enumeration without a valid match.

Fixes ticket #2370

Note: This commit message has been modified by Giorgio Vazzana, the original
commit message was:

"Fixed regression for mandatory VIDIOC_ENUMSTD support by v4l2"

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit ed72542539fb61dc3a6d6280d8a6a956ac04a071)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f581e25a69052481eb04fe45604036f685f133ae
---

 libavdevice/v4l2.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index b1dc7d1..3e91170 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -685,6 +685,10 @@ static int v4l2_set_parameters(AVFormatContext *s1)
             standard.index = i;
             if (v4l2_ioctl(s->fd, VIDIOC_ENUMSTD, &standard) < 0) {
                 ret = AVERROR(errno);
+                if (ret == AVERROR(EINVAL)) {
+                    tpf = &streamparm.parm.capture.timeperframe;
+                    break;
+                }
                 av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_ENUMSTD): %s\n", av_err2str(ret));
                 return ret;
             }



More information about the ffmpeg-cvslog mailing list