From 58794a90a38c018ff4ab06e7f0937318dfd80ca9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net>
Date: Thu, 1 Sep 2011 20:21:31 +0300
Subject: [PATCH] Select V4L2 input before standard as per specification

---
 modules/access/v4l2.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/modules/access/v4l2.c b/modules/access/v4l2.c
index 3e87d6c6d6da..a896887b5725 100644
--- a/modules/access/v4l2.c
+++ b/modules/access/v4l2.c
@@ -1552,6 +1552,14 @@ static int OpenVideoDev( vlc_object_t *p_obj, demux_sys_t *p_sys, bool b_demux )
     }
 #endif
 
+    /* Select input */
+    if( v4l2_ioctl( i_fd, VIDIOC_S_INPUT, &p_sys->i_selected_input ) < 0 )
+    {
+        msg_Err( p_obj, "cannot set input %u: %m", p_sys->i_selected_input );
+        goto error;
+    }
+    msg_Dbg( p_obj, "input set to %u", p_sys->i_selected_input );
+
     /* Select standard */
     bool bottom_first;
     const char *stdname = p_sys->psz_standard;
@@ -1626,15 +1634,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 input */
-
-    if( v4l2_ioctl( i_fd, VIDIOC_S_INPUT, &p_sys->i_selected_input ) < 0 )
-    {
-        msg_Err( p_obj, "cannot set input %u: %m", p_sys->i_selected_input );
-        goto error;
-    }
-    msg_Dbg( p_obj, "input set to %u", p_sys->i_selected_input );
-
     /* Set audio input */
 
     if( p_sys->i_audio > 0 )
-- 
GitLab