mirror of
https://github.com/mpv-player/mpv
synced 2024-12-23 15:22:09 +00:00
v4l capture update by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>
some silly bugs slipped through.. here is the fix git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7071 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
4ae1571dda
commit
177d2185e9
@ -319,8 +319,8 @@ Available options are:
|
||||
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.
|
||||
|
@ -105,7 +105,7 @@ int ai_alsa_init(audio_in_t *ai)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ int ai_alsa_init(audio_in_t *ai)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ int audio_in_set_device(audio_in_t *ai, char *device)
|
||||
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
|
||||
|
@ -298,7 +298,6 @@ static void init_v4l_audio(priv_t *priv)
|
||||
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 @@ static int init(priv_t *priv)
|
||||
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 @@ static int init(priv_t *priv)
|
||||
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 @@ static int start(priv_t *priv)
|
||||
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 */
|
||||
|
Loading…
Reference in New Issue
Block a user