# HG changeset patch
# User Simon Farnsworth <simon.farnsworth@onelan.co.uk>
# Date 1217261859 -3600
# Node ID 917c6f1b8404a7528ffd251f821f430b19bf47d8
# Parent  d48b28d89d229458b2068e047f00cc56de4f4c2f
Only set the tuner if we're going to use it (fixes baseband video inputs)

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,8 @@ xine-lib (1.1.15) 2008-??-??
     others, there would be no problem.
   * V4L changes:
     - Delay preallocating video frames until we know how large they'll be
+    - Only try and set the tuner if we're going to use it. Setting the tuner
+      when using baseband video (CVBS, S-Video) breaks the input.
 
 xine-lib (1.1.14) 2008-06-29
   * DVB changes:
diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c
--- a/src/input/input_v4l.c
+++ b/src/input/input_v4l.c
@@ -549,6 +549,12 @@ static int set_frequency(v4l_input_plugi
     fd = this->radio_fd;
   
   if (frequency != 0) {
+    /* FIXME: Don't assume tuner 0 ? */
+    this->tuner = 0;
+    ret = ioctl(fd, VIDIOCSTUNER, &this->tuner);
+    lprintf("(%d) Response on set tuner to %d\n", ret, this->tuner);
+    this->video_tuner.tuner = this->tuner;
+
     if (this->video_tuner.flags & VIDEO_TUNER_LOW) {
       this->calc_frequency = frequency * 16;
     } else {
@@ -683,16 +689,6 @@ static int search_by_channel(v4l_input_p
         ret = ioctl(fd, VIDIOCSCHAN, &this->input);
     
     lprintf("(%d) Set channel to %d\n", ret, this->input);
-    
-    /* FIXME: Don't assume tuner 0 ? */
-    
-    this->tuner = 0;
-    
-    ret = ioctl(fd, VIDIOCSTUNER, &this->tuner);
-    
-    lprintf("(%d) Response on set tuner to %d\n", ret, this->tuner);
-    
-    this->video_tuner.tuner = this->tuner;
   } else {
     xprintf(this->stream->xine, XINE_VERBOSITY_LOG, 
             "input_v4l: Not setting video source. No source given\n");
