diff options
author | wm4 <wm4@nowhere> | 2013-12-21 20:24:20 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-12-21 21:43:16 +0100 |
commit | 3dbc9007b080028f0aebbbf8b9ab1233cd70c45b (patch) | |
tree | e6e46e5dd238338c44d421ef4f9101c9898c3cbf /stream/ai_oss.c | |
parent | 9149e2af568d4cb251f8b105f360c3e6b9fd9d86 (diff) | |
download | mpv-3dbc9007b080028f0aebbbf8b9ab1233cd70c45b.tar.bz2 mpv-3dbc9007b080028f0aebbbf8b9ab1233cd70c45b.tar.xz |
demux: mp_msg conversions
The TV code pretends to be part of stream/, but it's actually demuxer
code too. The audio_in code is shared between the TV code and
stream_radio.c, so stream_radio.c needs a small hack until stream.c is
converted.
Diffstat (limited to 'stream/ai_oss.c')
-rw-r--r-- | stream/ai_oss.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/stream/ai_oss.c b/stream/ai_oss.c index bf57ec4198..8672d13fc0 100644 --- a/stream/ai_oss.c +++ b/stream/ai_oss.c @@ -57,10 +57,10 @@ int ai_oss_set_channels(audio_in_t *ai) if (ai->req_channels > 2) { ioctl_param = ai->req_channels; - mp_msg(MSGT_TV, MSGL_V, "ioctl dsp channels: %d\n", + MP_VERBOSE(ai, "ioctl dsp channels: %d\n", err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_CHANNELS, &ioctl_param)); if (err < 0) { - mp_msg(MSGT_TV, MSGL_ERR, "Unable to set channel count: %d\n", + MP_ERR(ai, "Unable to set channel count: %d\n", ai->req_channels); return -1; } @@ -69,11 +69,11 @@ int ai_oss_set_channels(audio_in_t *ai) else { ioctl_param = (ai->req_channels == 2); - mp_msg(MSGT_TV, MSGL_V, "ioctl dsp stereo: %d (req: %d)\n", + MP_VERBOSE(ai, "ioctl dsp stereo: %d (req: %d)\n", err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_STEREO, &ioctl_param), ioctl_param); if (err < 0) { - mp_msg(MSGT_TV, MSGL_ERR, "Unable to set stereo: %d\n", + MP_ERR(ai, "Unable to set stereo: %d\n", ai->req_channels == 2); return -1; } @@ -90,65 +90,65 @@ int ai_oss_init(audio_in_t *ai) ai->oss.audio_fd = open(ai->oss.device, O_RDONLY | O_CLOEXEC); if (ai->oss.audio_fd < 0) { - mp_msg(MSGT_TV, MSGL_ERR, "Unable to open '%s': %s\n", + MP_ERR(ai, "Unable to open '%s': %s\n", ai->oss.device, strerror(errno)); return -1; } ioctl_param = 0 ; - mp_msg(MSGT_TV, MSGL_V, "ioctl dsp getfmt: %d\n", + MP_VERBOSE(ai, "ioctl dsp getfmt: %d\n", ioctl(ai->oss.audio_fd, SNDCTL_DSP_GETFMTS, &ioctl_param)); - mp_msg(MSGT_TV, MSGL_V, "Supported formats: %x\n", ioctl_param); + MP_VERBOSE(ai, "Supported formats: %x\n", ioctl_param); if (!(ioctl_param & AFMT_S16_LE)) - mp_msg(MSGT_TV, MSGL_ERR, "unsupported format\n"); + MP_ERR(ai, "unsupported format\n"); ioctl_param = AFMT_S16_LE; - mp_msg(MSGT_TV, MSGL_V, "ioctl dsp setfmt: %d\n", + MP_VERBOSE(ai, "ioctl dsp setfmt: %d\n", err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_SETFMT, &ioctl_param)); if (err < 0) { - mp_msg(MSGT_TV, MSGL_ERR, "Unable to set audio format."); + MP_ERR(ai, "Unable to set audio format."); return -1; } if (ai_oss_set_channels(ai) < 0) return -1; ioctl_param = ai->req_samplerate; - mp_msg(MSGT_TV, MSGL_V, "ioctl dsp speed: %d\n", + MP_VERBOSE(ai, "ioctl dsp speed: %d\n", err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_SPEED, &ioctl_param)); if (err < 0) { - mp_msg(MSGT_TV, MSGL_ERR, "Unable to set samplerate: %d\n", + MP_ERR(ai, "Unable to set samplerate: %d\n", ai->req_samplerate); return -1; } ai->samplerate = ioctl_param; - mp_msg(MSGT_TV, MSGL_V, "ioctl dsp trigger: %d\n", + MP_VERBOSE(ai, "ioctl dsp trigger: %d\n", ioctl(ai->oss.audio_fd, SNDCTL_DSP_GETTRIGGER, &ioctl_param)); - mp_msg(MSGT_TV, MSGL_V, "trigger: %x\n", ioctl_param); + MP_VERBOSE(ai, "trigger: %x\n", ioctl_param); ioctl_param = PCM_ENABLE_INPUT; - mp_msg(MSGT_TV, MSGL_V, "ioctl dsp trigger: %d\n", + MP_VERBOSE(ai, "ioctl dsp trigger: %d\n", err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_SETTRIGGER, &ioctl_param)); if (err < 0) { - mp_msg(MSGT_TV, MSGL_ERR, "Unable to set trigger: %d\n", + MP_ERR(ai, "Unable to set trigger: %d\n", PCM_ENABLE_INPUT); } ai->blocksize = 0; - mp_msg(MSGT_TV, MSGL_V, "ioctl dsp getblocksize: %d\n", + MP_VERBOSE(ai, "ioctl dsp getblocksize: %d\n", err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_GETBLKSIZE, &ai->blocksize)); if (err < 0) { - mp_msg(MSGT_TV, MSGL_ERR, "Unable to get block size!\n"); + MP_ERR(ai, "Unable to get block size!\n"); } - mp_msg(MSGT_TV, MSGL_V, "blocksize: %d\n", ai->blocksize); + MP_VERBOSE(ai, "blocksize: %d\n", ai->blocksize); // correct the blocksize to a reasonable value if (ai->blocksize <= 0) { ai->blocksize = 4096*ai->channels*2; - mp_msg(MSGT_TV, MSGL_ERR, "Audio block size is zero, setting to %d!\n", ai->blocksize); + MP_ERR(ai, "Audio block size is zero, setting to %d!\n", ai->blocksize); } else if (ai->blocksize < 4096*ai->channels*2) { ai->blocksize *= 4096*ai->channels*2/ai->blocksize; - mp_msg(MSGT_TV, MSGL_ERR, "Audio block size too low, setting to %d!\n", ai->blocksize); + MP_ERR(ai, "Audio block size too low, setting to %d!\n", ai->blocksize); } ai->samplesize = 16; |