On Mon, 16 Jun 2003, hermann pitton wrote:
> with the cvs of today (20030615) it starts working here and I can say it
> looks pretty well :)
>
> The device must be unmuted first with "v4lctl -c /dev/video0 volume mute
> off".
Alternatively, you can patch mplayer/mencoder to do it correctly by
itself. (patch attached)
The problem is that the v4l1 emulation layer of v4l2 doesn't do volume
settings correctly -- so the "fix" for now is to make mplayer use the v4l2
API for audio stuff (still uses V4L1 emulation for video stuff - that
works).
LLaP
bero
--
Ark Linux - Linux for the masses
http://www.arklinux.org/
Redistribution and processing of this message is subject to
http://www.arklinux.org/terms.php
--- mplayer/libmpdemux/tvi_v4l.c.ark 2003-05-29 20:17:31.000000000 +0200
+++ mplayer/libmpdemux/tvi_v4l.c 2003-05-29 20:48:22.000000000 +0200
@@ -12,6 +12,9 @@
Mjpeg hardware encoding support by
Iván Szántó <szivan@xxxxxxxxxxx>
+ Basic video4linux2 support by
+ Bernhard Rosenkraenzer <bero@xxxxxxxxxxxx>
+
CODE IS UNDER DEVELOPMENT, NO FEATURE REQUESTS PLEASE!
*/
@@ -433,6 +436,15 @@
mp_msg(MSGT_TV, MSGL_ERR, "ioctl get capabilites failed: %s\n", strerror(errno));
goto err;
}
+#ifdef V4L2_CID_AUDIO_MUTE
+ /* V4L2's compat layer fails to report the correct number of audio devices */
+ struct v4l2_input input;
+ int index;
+ ioctl(priv->video_fd, VIDIOC_G_INPUT, &index);
+ input.index = index;
+ ioctl(priv->video_fd, VIDIOC_ENUMINPUT, &input);
+ priv->capability.audios = input.audioset;
+#endif
fcntl(priv->video_fd, F_SETFD, FD_CLOEXEC);
@@ -670,6 +682,14 @@
priv->audio[priv->audio_id].flags |= VIDEO_AUDIO_MUTE;
ioctl(priv->video_fd, VIDIOCSAUDIO, &priv->audio[priv->audio_id]);
}
+
+#ifdef V4L2_CID_AUDIO_MUTE
+ /* v4l2's v4l1 emulation doesn't get audio right --> work around it */
+ struct v4l2_control ctrl;
+ ctrl.id = V4L2_CID_AUDIO_MUTE;
+ ctrl.value = 1;
+ ioctl(priv->video_fd, VIDIOC_S_CTRL, &ctrl);
+#endif
if ( tv_param_mjpeg )
{
@@ -922,6 +942,36 @@
mp_msg(MSGT_TV, MSGL_V, " chan=%d\n", priv->audio_channels[priv->audio_id]);
ioctl(priv->video_fd, VIDIOCSAUDIO, &priv->audio[priv->audio_id]);
}
+#ifdef V4L2_CID_AUDIO_MUTE
+ /* v4l2's v4l1 emulation doesn't get audio right --> work around it */
+ struct v4l2_control ctrl;
+ ctrl.id = V4L2_CID_AUDIO_MUTE;
+ ctrl.value = 0;
+ ioctl(priv->video_fd, VIDIOC_S_CTRL, &ctrl);
+ if(tv_param_volume >= 0) {
+ ctrl.id = V4L2_CID_AUDIO_VOLUME;
+ ctrl.value = tv_param_volume;
+ ioctl(priv->video_fd, VIDIOC_S_CTRL, &ctrl);
+ }
+
+ if(tv_param_bass >= 0) {
+ ctrl.id = V4L2_CID_AUDIO_BASS;
+ ctrl.value = tv_param_bass;
+ ioctl(priv->video_fd, VIDIOC_S_CTRL, &ctrl);
+ }
+
+ if(tv_param_treble >= 0) {
+ ctrl.id = V4L2_CID_AUDIO_TREBLE;
+ ctrl.value = tv_param_treble;
+ ioctl(priv->video_fd, VIDIOC_S_CTRL, &ctrl);
+ }
+
+ if(tv_param_balance >= 0) {
+ ctrl.id = V4L2_CID_AUDIO_BALANCE;
+ ctrl.value = tv_param_balance;
+ ioctl(priv->video_fd, VIDIOC_S_CTRL, &ctrl);
+ }
+#endif
/* launch capture threads */
priv->shutdown = 0;
--- mplayer/cfg-common.h.ark 2003-05-29 20:44:34.000000000 +0200
+++ mplayer/cfg-common.h 2003-05-29 20:44:54.000000000 +0200
@@ -277,7 +277,7 @@
#ifdef USE_TV
struct config tvopts_conf[]={
{"on", "-tv on is deprecated, use tv:// instead\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
-#ifdef HAVE_TV_BSDBT848
+#if defined(HAVE_TV_BSDBT848) || defined(HAVE_TV_V4L)
{"immediatemode", &tv_param_immediate, CONF_TYPE_FLAG, 0, 0, 0, NULL},
#endif
{"noaudio", &tv_param_noaudio, CONF_TYPE_FLAG, 0, 0, 1, NULL},