[vlc-commits] V4L2: Set standard prior to tuner frequency.

Thierry Reding git at videolan.org
Tue Apr 19 07:11:47 CEST 2011


vlc | branch: master | Thierry Reding <thierry.reding at avionic-design.de> | Mon Apr 18 16:10:57 2011 +0200| [293ed14d65e5a8da3ebf75a584cc8f1be781fee3] | committer: Jean-Baptiste Kempf

V4L2: Set standard prior to tuner frequency.

Some V4L2 devices (e.g. Hauppauge EXETER boards) compute the tuner
frequency depending on the configured standard, so the standard needs to
be set first.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/access/v4l2.c |   52 ++++++++++++++++++++++++------------------------
 1 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/modules/access/v4l2.c b/modules/access/v4l2.c
index 0654e4a..bae9d0d 100644
--- a/modules/access/v4l2.c
+++ b/modules/access/v4l2.c
@@ -1851,6 +1851,32 @@ static int OpenVideoDev( vlc_object_t *p_obj, demux_sys_t *p_sys, bool b_demux )
     }
 #endif
 
+    /* Select standard */
+
+    if( p_sys->i_selected_standard_id != V4L2_STD_UNKNOWN )
+    {
+        if( v4l2_ioctl( i_fd, VIDIOC_S_STD, &p_sys->i_selected_standard_id ) < 0 )
+        {
+            msg_Err( p_obj, "cannot set standard (%m)" );
+            goto open_failed;
+        }
+        if( v4l2_ioctl( i_fd, VIDIOC_G_STD, &p_sys->i_selected_standard_id ) < 0 )
+        {
+            msg_Err( p_obj, "cannot get standard (%m). This should never happen!" );
+            goto open_failed;
+        }
+        msg_Dbg( p_obj, "Set standard to (0x%"PRIx64"):", p_sys->i_selected_standard_id );
+        int i_standard;
+        for( i_standard = 0; i_standard<p_sys->i_standard; i_standard++)
+        {
+            if( p_sys->p_standards[i_standard].id & p_sys->i_selected_standard_id )
+            {
+                msg_Dbg( p_obj, "  %s",
+                        p_sys->p_standards[i_standard].name );
+            }
+        }
+    }
+
     /* Tune the tuner */
     if( p_sys->i_frequency >= 0 )
     {
@@ -1892,32 +1918,6 @@ static int OpenVideoDev( vlc_object_t *p_obj, demux_sys_t *p_sys, bool b_demux )
         msg_Dbg( p_obj, "Tuner audio mode set" );
     }
 
-    /* Select standard */
-
-    if( p_sys->i_selected_standard_id != V4L2_STD_UNKNOWN )
-    {
-        if( v4l2_ioctl( i_fd, VIDIOC_S_STD, &p_sys->i_selected_standard_id ) < 0 )
-        {
-            msg_Err( p_obj, "cannot set standard (%m)" );
-            goto open_failed;
-        }
-        if( v4l2_ioctl( i_fd, VIDIOC_G_STD, &p_sys->i_selected_standard_id ) < 0 )
-        {
-            msg_Err( p_obj, "cannot get standard (%m). This should never happen!" );
-            goto open_failed;
-        }
-        msg_Dbg( p_obj, "Set standard to (0x%"PRIx64"):", p_sys->i_selected_standard_id );
-        int i_standard;
-        for( i_standard = 0; i_standard<p_sys->i_standard; i_standard++)
-        {
-            if( p_sys->p_standards[i_standard].id & p_sys->i_selected_standard_id )
-            {
-                msg_Dbg( p_obj, "  %s",
-                        p_sys->p_standards[i_standard].name );
-            }
-        }
-    }
-
     /* Select input */
 
     if( p_sys->i_selected_input >= p_sys->i_input )



More information about the vlc-commits mailing list