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_alsa1x.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_alsa1x.c')
-rw-r--r-- | stream/ai_alsa1x.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/stream/ai_alsa1x.c b/stream/ai_alsa1x.c index 880817a94e..8360c88100 100644 --- a/stream/ai_alsa1x.c +++ b/stream/ai_alsa1x.c @@ -40,27 +40,27 @@ int ai_alsa_setup(audio_in_t *ai) err = snd_pcm_hw_params_any(ai->alsa.handle, params); if (err < 0) { - mp_msg(MSGT_TV, MSGL_ERR, "Broken configuration for this PCM: no configurations available.\n"); + MP_ERR(ai, "Broken configuration for this PCM: no configurations available.\n"); return -1; } err = snd_pcm_hw_params_set_access(ai->alsa.handle, params, SND_PCM_ACCESS_RW_INTERLEAVED); if (err < 0) { - mp_msg(MSGT_TV, MSGL_ERR, "Access type not available.\n"); + MP_ERR(ai, "Access type not available.\n"); return -1; } err = snd_pcm_hw_params_set_format(ai->alsa.handle, params, SND_PCM_FORMAT_S16_LE); if (err < 0) { - mp_msg(MSGT_TV, MSGL_ERR, "Sample format not available.\n"); + MP_ERR(ai, "Sample format not available.\n"); return -1; } err = snd_pcm_hw_params_set_channels(ai->alsa.handle, params, ai->req_channels); if (err < 0) { snd_pcm_hw_params_get_channels(params, &ai->channels); - mp_msg(MSGT_TV, MSGL_ERR, "Channel count not available - reverting to default: %d\n", + MP_ERR(ai, "Channel count not available - reverting to default: %d\n", ai->channels); } else { ai->channels = ai->req_channels; @@ -70,7 +70,7 @@ int ai_alsa_setup(audio_in_t *ai) rate = ai->req_samplerate; err = snd_pcm_hw_params_set_rate_near(ai->alsa.handle, params, &rate, &dir); if (err < 0) { - mp_msg(MSGT_TV, MSGL_ERR, "Cannot set samplerate.\n"); + MP_ERR(ai, "Cannot set samplerate.\n"); } ai->samplerate = rate; @@ -79,7 +79,7 @@ int ai_alsa_setup(audio_in_t *ai) err = snd_pcm_hw_params_set_buffer_time_near(ai->alsa.handle, params, &ai->alsa.buffer_time, &dir); if (err < 0) { - mp_msg(MSGT_TV, MSGL_ERR, "Cannot set buffer time.\n"); + MP_ERR(ai, "Cannot set buffer time.\n"); } dir = 0; @@ -87,12 +87,12 @@ int ai_alsa_setup(audio_in_t *ai) err = snd_pcm_hw_params_set_period_time_near(ai->alsa.handle, params, &ai->alsa.period_time, &dir); if (err < 0) { - mp_msg(MSGT_TV, MSGL_ERR, "Cannot set period time.\n"); + MP_ERR(ai, "Cannot set period time.\n"); } err = snd_pcm_hw_params(ai->alsa.handle, params); if (err < 0) { - mp_msg(MSGT_TV, MSGL_ERR, "Unable to install hardware parameters: %s", snd_strerror(err)); + MP_ERR(ai, "Unable to install hardware parameters: %s", snd_strerror(err)); snd_pcm_hw_params_dump(params, ai->alsa.log); return -1; } @@ -102,7 +102,7 @@ int ai_alsa_setup(audio_in_t *ai) snd_pcm_hw_params_get_buffer_size(params, &buffer_size); ai->alsa.chunk_size = period_size; if (period_size == buffer_size) { - mp_msg(MSGT_TV, MSGL_ERR, "Can't use period equal to buffer size (%u == %lu)\n", ai->alsa.chunk_size, (long)buffer_size); + MP_ERR(ai, "Can't use period equal to buffer size (%u == %lu)\n", ai->alsa.chunk_size, (long)buffer_size); return -1; } @@ -113,12 +113,12 @@ int ai_alsa_setup(audio_in_t *ai) err = snd_pcm_sw_params_set_stop_threshold(ai->alsa.handle, swparams, buffer_size); if (snd_pcm_sw_params(ai->alsa.handle, swparams) < 0) { - mp_msg(MSGT_TV, MSGL_ERR, "Unable to install software parameters:\n"); + MP_ERR(ai, "Unable to install software parameters:\n"); snd_pcm_sw_params_dump(swparams, ai->alsa.log); return -1; } - if (mp_msg_test(MSGT_TV, MSGL_V)) { + if (mp_msg_test_log(ai->log, MSGL_V)) { snd_pcm_dump(ai->alsa.handle, ai->alsa.log); } @@ -137,7 +137,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: %s\n", snd_strerror(err)); + MP_ERR(ai, "Error opening audio: %s\n", snd_strerror(err)); return -1; } @@ -171,7 +171,7 @@ int ai_alsa_xrun(audio_in_t *ai) snd_pcm_status_alloca(&status); if ((res = snd_pcm_status(ai->alsa.handle, status))<0) { - mp_msg(MSGT_TV, MSGL_ERR, "ALSA status error: %s", snd_strerror(res)); + MP_ERR(ai, "ALSA status error: %s", snd_strerror(res)); return -1; } if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) { @@ -179,18 +179,18 @@ int ai_alsa_xrun(audio_in_t *ai) gettimeofday(&now, 0); snd_pcm_status_get_trigger_tstamp(status, &tstamp); timersub(&now, &tstamp, &diff); - mp_msg(MSGT_TV, MSGL_ERR, "ALSA xrun!!! (at least %.3f ms long)\n", + MP_ERR(ai, "ALSA xrun!!! (at least %.3f ms long)\n", diff.tv_sec * 1000 + diff.tv_usec / 1000.0); - if (mp_msg_test(MSGT_TV, MSGL_V)) { - mp_msg(MSGT_TV, MSGL_ERR, "ALSA Status:\n"); + if (mp_msg_test_log(ai->log, MSGL_V)) { + MP_ERR(ai, "ALSA Status:\n"); snd_pcm_status_dump(status, ai->alsa.log); } if ((res = snd_pcm_prepare(ai->alsa.handle))<0) { - mp_msg(MSGT_TV, MSGL_ERR, "ALSA xrun: prepare error: %s", snd_strerror(res)); + MP_ERR(ai, "ALSA xrun: prepare error: %s", snd_strerror(res)); return -1; } return 0; /* ok, data should be accepted again */ } - mp_msg(MSGT_TV, MSGL_ERR, "ALSA read/write error"); + MP_ERR(ai, "ALSA read/write error"); return -1; } |