[vlc-commits] v4l2: fail on unknowm/unitialized format (fixes #8086)

Rémi Denis-Courmont git at videolan.org
Sat Jan 26 20:27:41 CET 2013


vlc/vlc-2.0 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jan 26 21:26:15 2013 +0200| [3c835b43d338a6f907663c25daf1f1c7f07e3a65] | committer: Rémi Denis-Courmont

v4l2: fail on unknowm/unitialized format (fixes #8086)

This bug is already fixed differently in the main line.

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=3c835b43d338a6f907663c25daf1f1c7f07e3a65
---

 modules/access/v4l2/video.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/modules/access/v4l2/video.c b/modules/access/v4l2/video.c
index 6337386..5b9e564 100644
--- a/modules/access/v4l2/video.c
+++ b/modules/access/v4l2/video.c
@@ -1265,7 +1265,12 @@ static int InitVideo( vlc_object_t *p_obj, int i_fd, demux_sys_t *p_sys,
     width = fmt.fmt.pix.width;
     height = fmt.fmt.pix.height;
 
-    if( v4l2_ioctl( i_fd, VIDIOC_G_FMT, &fmt ) < 0 ) {;}
+    if( v4l2_ioctl( i_fd, VIDIOC_G_FMT, &fmt ) < 0 )
+    {
+        msg_Err( p_obj, "Could not get selected video format: %m" );
+        goto error;
+    }
+
     /* Print extra info */
     msg_Dbg( p_obj, "Driver requires at most %d bytes to store a complete image", fmt.fmt.pix.sizeimage );
     /* Check interlacing */
@@ -1325,6 +1330,11 @@ static int InitVideo( vlc_object_t *p_obj, int i_fd, demux_sys_t *p_sys,
             break;
         }
     }
+    if( !p_sys->i_fourcc )
+    {
+        msg_Err( p_obj, "Could not match pixel format" );
+        goto error;
+    }
 
     /* Buggy driver paranoia */
     i_min = fmt.fmt.pix.width * 2;



More information about the vlc-commits mailing list