changeset 8703:c9c309ab9891

supress clicks/noise when changing channels
author henry
date Wed, 01 Jan 2003 20:21:45 +0000
parents e6713e5d2cf5
children c3975fb38cba
files libmpdemux/tvi_v4l.c
diffstat 1 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/tvi_v4l.c	Wed Jan 01 20:10:14 2003 +0000
+++ b/libmpdemux/tvi_v4l.c	Wed Jan 01 20:21:45 2003 +0000
@@ -562,10 +562,12 @@
     pthread_join(priv->video_grabber_thread, NULL);
     mp_msg(MSGT_TV, MSGL_V, "done\n");
 
-    priv->audio[priv->audio_id].volume = 0;
-    priv->audio[priv->audio_id].flags |= VIDEO_AUDIO_MUTE;
-    ioctl(priv->video_fd, VIDIOCSAUDIO, &priv->audio[priv->audio_id]);
-
+    if (priv->capability.audios) {
+	priv->audio[priv->audio_id].volume = 0;
+	priv->audio[priv->audio_id].flags |= VIDEO_AUDIO_MUTE;
+	ioctl(priv->video_fd, VIDIOCSAUDIO, &priv->audio[priv->audio_id]);
+    }
+    
     close(priv->video_fd);
 
     audio_in_uninit(&priv->audio_in);
@@ -941,6 +943,12 @@
 	    /* argument is in MHz ! */
 	    unsigned long freq = (unsigned long)*(void **)arg;
 	    
+	    if (priv->capability.audios) {
+		priv->audio[priv->audio_id].volume = 0;
+		priv->audio[priv->audio_id].flags |= VIDEO_AUDIO_MUTE;
+		ioctl(priv->video_fd, VIDIOCSAUDIO, &priv->audio[priv->audio_id]);
+	    }
+
 	    mp_msg(MSGT_TV, MSGL_V, "requested frequency: %.3f\n", (float)freq/16);
 	    
 	    /* tuner uses khz not mhz ! */
@@ -953,6 +961,13 @@
 		return(TVI_CONTROL_FALSE);
 	    }
 	    usleep(100000); // wait to supress noise during switching
+
+	    if (priv->capability.audios) {
+		priv->audio[priv->audio_id].volume = tv_param_volume;
+		priv->audio[priv->audio_id].flags &= ~VIDEO_AUDIO_MUTE;
+		ioctl(priv->video_fd, VIDIOCSAUDIO, &priv->audio[priv->audio_id]);
+	    }
+
 	    return(TVI_CONTROL_TRUE);
 	}
 	case TVI_CONTROL_TUN_GET_TUNER: