[MPlayer-dev-eng] v4l2 audioset change

Jesse Allen the3dfxdude at gmail.com
Tue Feb 14 07:13:35 CET 2006


Hi, 

A change was made in 2.6.15-rc5 to the bttv driver.  audioset, part of the 
returned v4l2_input struct defaults to zero now.

http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=bbf7871e1cd58b89f77b1152f457250c6e94b61

According to the v4l2 API docs:

http://v4l2spec.bytesex.org/spec/x263.htm
"The relation of video and audio connectors is defined in the audioset field 
of the respective struct v4l2_input or struct v4l2_output, where each bit 
represents the index number, starting at zero, of one audio input or output."

However:
"A connector on a TV card to loop back the received audio signal to a sound 
card is not considered an audio output."

My card certainly doesn't have any audio input or outputs, but it does support
loopback.  So likely, audioset should default to zero, except in the few
cases it doesn't?  (very few...bttv certainly doesn't use it)

The problem is mplayer depends on the audioset value to test for audio
capabilities.  This seems to be wrong, based on the API docs.  If not, and
this is a driver bug, it will still be problematic based on the description.

Attached is a patch to fix the problem in mplayer.  Please consider applying.

Changes:
Don't test the v4l2_input audioset field for audio capabilities but still try
changing the mute setting.


--- mplayer-orig/libmpdemux/tvi_v4l2.c	2006-02-13 15:52:29.000000000 -0700
+++ mplayer/libmpdemux/tvi_v4l2.c	2006-02-13 22:23:10.000000000 -0700
@@ -687,10 +687,8 @@ static int control(priv_t *priv, int cmd
 	return TVI_CONTROL_TRUE;
     case TVI_CONTROL_TUN_SET_FREQ:
 #if 0
-	if (priv->input.audioset) {
-	    set_mute(priv, 1);
-	    usleep(100000); // wait to supress noise during switching
-	}
+	set_mute(priv, 1);
+	usleep(100000); // wait to supress noise during switching
 #endif
 	frequency.tuner = 0;
 	frequency.type  = V4L2_TUNER_ANALOG_TV;
@@ -701,10 +699,8 @@ static int control(priv_t *priv, int cmd
 	    return TVI_CONTROL_FALSE;
 	}
 #if 0
-	if (priv->input.audioset) {
-	    usleep(100000); // wait to supress noise during switching
-	    set_mute(priv, 0);
-	}
+	usleep(100000); // wait to supress noise during switching
+	set_mute(priv, 0);
 #endif
 	return TVI_CONTROL_TRUE;
     case TVI_CONTROL_TUN_GET_TUNER:
@@ -901,9 +897,7 @@ static int uninit(priv_t *priv)
 	pthread_mutex_destroy(&priv->audio_mutex);
     }
 
-    if (priv->input.audioset) {
-	set_mute(priv, 1);
-    }
+    set_mute(priv, 1);
 
     /* free memory and close device */
     free(priv->map);		priv->map = NULL;
@@ -1312,9 +1306,7 @@ static int start(priv_t *priv)
     priv->audio_skew = 0;
     priv->first = 1;
 
-    if (priv->input.audioset) {
-	set_mute(priv, 0);
-    }
+    set_mute(priv, 0);
     
     return 1;
 }




More information about the MPlayer-dev-eng mailing list