changeset 7070:aaac9080b8a3

v4l capture update by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz> some silly bugs slipped through.. here is the fix
author arpi
date Thu, 22 Aug 2002 23:05:58 +0000
parents 21e1ab99cb21
children acc51ad47911
files DOCS/mplayer.1 libmpdemux/ai_alsa.c libmpdemux/ai_alsa1x.c libmpdemux/audio_in.c libmpdemux/tvi_v4l.c
diffstat 5 files changed, 15 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/mplayer.1	Thu Aug 22 23:03:51 2002 +0000
+++ b/DOCS/mplayer.1	Thu Aug 22 23:05:58 2002 +0000
@@ -319,8 +319,8 @@
                       has more of them
 .TP
 .I NOTE:
-Mplayer doesn't accept colons so type commas instead in the device ID,
-eg. hw,0,0 instead of hw:0:0)
+Mplayer doesn't accept colons so type dots instead in the device ID,
+eg. hw.0,0 instead of hw:0,0)
 
 Be advised that although you can select any samplerate when using ALSA,
 the LAME audio codec is able to encode only the "standard" samplerates.
--- a/libmpdemux/ai_alsa.c	Thu Aug 22 23:03:51 2002 +0000
+++ b/libmpdemux/ai_alsa.c	Thu Aug 22 23:05:58 2002 +0000
@@ -105,7 +105,7 @@
     
     err = snd_pcm_open(&ai->alsa.handle, ai->alsa.device, SND_PCM_STREAM_CAPTURE, 0);
     if (err < 0) {
-	mp_msg(MSGT_TV, MSGL_ERR, "Error opening audio");
+	mp_msg(MSGT_TV, MSGL_ERR, "Error opening audio: %s\n", snd_strerror(err));
 	return -1;
     }
     
--- a/libmpdemux/ai_alsa1x.c	Thu Aug 22 23:03:51 2002 +0000
+++ b/libmpdemux/ai_alsa1x.c	Thu Aug 22 23:05:58 2002 +0000
@@ -105,7 +105,7 @@
     
     err = snd_pcm_open(&ai->alsa.handle, ai->alsa.device, SND_PCM_STREAM_CAPTURE, 0);
     if (err < 0) {
-	mp_msg(MSGT_TV, MSGL_ERR, "Error opening audio");
+	mp_msg(MSGT_TV, MSGL_ERR, "Error opening audio: %s\n", snd_strerror(err));
 	return -1;
     }
     
--- a/libmpdemux/audio_in.c	Thu Aug 22 23:03:51 2002 +0000
+++ b/libmpdemux/audio_in.c	Thu Aug 22 23:05:58 2002 +0000
@@ -106,7 +106,7 @@
 	ai->alsa.device = strdup(device);
 	/* mplayer cannot handle colons in arguments */
 	for (i = 0; i < strlen(ai->alsa.device); i++) {
-	    if (ai->alsa.device[i] == ',') ai->alsa.device[i] = ':';
+	    if (ai->alsa.device[i] == '.') ai->alsa.device[i] = ':';
 	}
 	return 0;
 #endif
--- a/libmpdemux/tvi_v4l.c	Thu Aug 22 23:03:51 2002 +0000
+++ b/libmpdemux/tvi_v4l.c	Thu Aug 22 23:05:58 2002 +0000
@@ -298,7 +298,6 @@
 	    ioctl(priv->video_fd, VIDIOCSAUDIO, &priv->audio[i]);
 	}
 	
-	priv->audio[i].audio = i;
 	if (ioctl(priv->video_fd, VIDIOCGAUDIO, &priv->audio[i]) == -1)
 	{
 	    mp_msg(MSGT_TV, MSGL_ERR, "ioctl get audio failed: %s\n", strerror(errno));
@@ -338,13 +337,6 @@
     if (tv_param_immediate == 1)
 	tv_param_noaudio = 1;
     
-    if (!tv_param_noaudio) {
-    }
-
-    if (priv->audio_device) {
-	audio_in_set_device(&priv->audio_in, priv->audio_device);
-    }
-
     priv->video_ringbuffer = NULL;
     priv->video_timebuffer = NULL;
     priv->audio_ringbuffer = NULL;
@@ -477,6 +469,10 @@
 	audio_in_init(&priv->audio_in, AUDIO_IN_OSS);
 #endif
 
+	if (priv->audio_device) {
+	    audio_in_set_device(&priv->audio_in, priv->audio_device);
+	}
+
 	if (tv_param_audio_id < priv->capability.audios)
 	    priv->audio_id = tv_param_audio_id;
 	else
@@ -704,6 +700,12 @@
     if (priv->audio[priv->audio_id].volume <= 0)
 	priv->audio[priv->audio_id].volume = 100;
     priv->audio[priv->audio_id].flags &= ~VIDEO_AUDIO_MUTE;
+    mp_msg(MSGT_TV, MSGL_V, "Starting audio capture\n");
+    mp_msg(MSGT_TV, MSGL_V, "id=%d volume=%d bass=%d treble=%d balance=%d mode=%s\n",
+	   priv->audio_id,
+	   priv->audio[priv->audio_id].volume, priv->audio[priv->audio_id].bass, priv->audio[priv->audio_id].treble,
+	   priv->audio[priv->audio_id].balance, audio_mode2name[priv->audio[priv->audio_id].mode]);
+    mp_msg(MSGT_TV, MSGL_V, " channels: %d\n", priv->audio_channels[priv->audio_id]);
     ioctl(priv->video_fd, VIDIOCSAUDIO, &priv->audio[priv->audio_id]);
 	    
     /* launch capture threads */