[vlc-devel] commit: v4l2: work around broken resolution detection (Pierre Ynard )

git version control git at videolan.org
Mon Sep 14 08:35:51 CEST 2009


vlc | branch: 1.0-bugfix | Pierre Ynard <linkfanel at yahoo.fr> | Mon Sep 14 08:32:38 2009 +0200| [7679ffc3d93ca3d7157b2a9e9417afc76a167be5] | committer: Pierre Ynard 

v4l2: work around broken resolution detection

This piece of code really ought to be fixed better than that
(cherry picked from commit ce484549f98a63a51168a2bcc5c1385b34597fb5)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7679ffc3d93ca3d7157b2a9e9417afc76a167be5
---

 modules/access/v4l2.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/modules/access/v4l2.c b/modules/access/v4l2.c
index 9a7e1cd..7b1f3c3 100644
--- a/modules/access/v4l2.c
+++ b/modules/access/v4l2.c
@@ -1989,12 +1989,22 @@ static int OpenVideoDev( vlc_object_t *p_obj, demux_sys_t *p_sys, bool b_demux )
                                                         fmt.fmt.pix.pixelformat );
                 msg_Dbg( p_demux, "Found maximum framerate of %f", p_sys->f_fps );
             }
+            uint32_t i_width, i_height;
             GetMaxDimensions( p_demux, i_fd,
                               fmt.fmt.pix.pixelformat, p_sys->f_fps,
-                              &fmt.fmt.pix.width, &fmt.fmt.pix.height );
-            msg_Dbg( p_demux, "Found optimal dimensions for framerate %f of %dx%d",
-                     p_sys->f_fps, fmt.fmt.pix.width, fmt.fmt.pix.height );
-            if( v4l2_ioctl( i_fd, VIDIOC_S_FMT, &fmt ) < 0 ) {;}
+                              &i_width, &i_height );
+            if( i_width || i_height )
+            {
+                msg_Dbg( p_demux, "Found optimal dimensions for framerate %f of %dx%d",
+                         p_sys->f_fps, i_width, i_height );
+                fmt.fmt.pix.width = i_width;
+                fmt.fmt.pix.height = i_height;
+                if( v4l2_ioctl( i_fd, VIDIOC_S_FMT, &fmt ) < 0 ) {;}
+            }
+            else
+            {
+                msg_Warn( p_obj, "Could not find optimal width and height." );
+            }
         }
 
         /* Reassign width, height and chroma incase driver override */




More information about the vlc-devel mailing list