diff options
author | wm4 <wm4@nowhere> | 2014-04-13 18:00:51 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-04-13 18:03:01 +0200 |
commit | 78128bddda4bcea1f256fc13cc33fa2652ed277c (patch) | |
tree | 35bf6596cb8e2d7927618845833c3ee36534f890 /stream/ai_alsa1x.c | |
parent | 44f382cf98564c0fe08bdc78579c284362cd6f3c (diff) | |
download | mpv-78128bddda4bcea1f256fc13cc33fa2652ed277c.tar.bz2 mpv-78128bddda4bcea1f256fc13cc33fa2652ed277c.tar.xz |
Kill all tabs
I hate tabs.
This replaces all tabs in all source files with spaces. The only
exception is old-makefile. The replacement was made by running the
GNU coreutils "expand" command on every file. Since the replacement was
automatic, it's possible that some formatting was destroyed (but perhaps
only if it was assuming that the end of a tab does not correspond to
aligning the end to multiples of 8 spaces).
Diffstat (limited to 'stream/ai_alsa1x.c')
-rw-r--r-- | stream/ai_alsa1x.c | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/stream/ai_alsa1x.c b/stream/ai_alsa1x.c index c1a7199c71..bf36443dfe 100644 --- a/stream/ai_alsa1x.c +++ b/stream/ai_alsa1x.c @@ -40,61 +40,61 @@ int ai_alsa_setup(audio_in_t *ai) err = snd_pcm_hw_params_any(ai->alsa.handle, params); if (err < 0) { - MP_ERR(ai, "Broken configuration for this PCM: no configurations available.\n"); - return -1; + 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); + SND_PCM_ACCESS_RW_INTERLEAVED); if (err < 0) { - MP_ERR(ai, "Access type not available.\n"); - return -1; + 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_ERR(ai, "Sample format not available.\n"); - return -1; + 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_ERR(ai, "Channel count not available - reverting to default: %d\n", - ai->channels); + snd_pcm_hw_params_get_channels(params, &ai->channels); + MP_ERR(ai, "Channel count not available - reverting to default: %d\n", + ai->channels); } else { - ai->channels = ai->req_channels; + ai->channels = ai->req_channels; } dir = 0; rate = ai->req_samplerate; err = snd_pcm_hw_params_set_rate_near(ai->alsa.handle, params, &rate, &dir); if (err < 0) { - MP_ERR(ai, "Cannot set samplerate.\n"); + MP_ERR(ai, "Cannot set samplerate.\n"); } ai->samplerate = rate; dir = 0; ai->alsa.buffer_time = 1000000; err = snd_pcm_hw_params_set_buffer_time_near(ai->alsa.handle, params, - &ai->alsa.buffer_time, &dir); + &ai->alsa.buffer_time, &dir); if (err < 0) { - MP_ERR(ai, "Cannot set buffer time.\n"); + MP_ERR(ai, "Cannot set buffer time.\n"); } dir = 0; ai->alsa.period_time = ai->alsa.buffer_time / 4; err = snd_pcm_hw_params_set_period_time_near(ai->alsa.handle, params, - &ai->alsa.period_time, &dir); + &ai->alsa.period_time, &dir); if (err < 0) { - MP_ERR(ai, "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_ERR(ai, "Unable to install hardware parameters: %s", snd_strerror(err)); - snd_pcm_hw_params_dump(params, ai->alsa.log); - return -1; + MP_ERR(ai, "Unable to install hardware parameters: %s", snd_strerror(err)); + snd_pcm_hw_params_dump(params, ai->alsa.log); + return -1; } dir = -1; @@ -102,8 +102,8 @@ 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_ERR(ai, "Can't use period equal to buffer size (%u == %lu)\n", ai->alsa.chunk_size, (long)buffer_size); - return -1; + MP_ERR(ai, "Can't use period equal to buffer size (%u == %lu)\n", ai->alsa.chunk_size, (long)buffer_size); + return -1; } snd_pcm_sw_params_current(ai->alsa.handle, swparams); @@ -113,13 +113,13 @@ 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_ERR(ai, "Unable to install software parameters:\n"); - snd_pcm_sw_params_dump(swparams, ai->alsa.log); - return -1; + MP_ERR(ai, "Unable to install software parameters:\n"); + snd_pcm_sw_params_dump(swparams, ai->alsa.log); + return -1; } if (mp_msg_test(ai->log, MSGL_V)) { - snd_pcm_dump(ai->alsa.handle, ai->alsa.log); + snd_pcm_dump(ai->alsa.handle, ai->alsa.log); } ai->alsa.bits_per_sample = snd_pcm_format_physical_width(SND_PCM_FORMAT_S16_LE); @@ -137,14 +137,14 @@ 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_ERR(ai, "Error opening audio: %s\n", snd_strerror(err)); - return -1; + MP_ERR(ai, "Error opening audio: %s\n", snd_strerror(err)); + return -1; } err = snd_output_stdio_attach(&ai->alsa.log, stderr, 0); if (err < 0) { - return -1; + return -1; } err = ai_alsa_setup(ai); @@ -153,14 +153,14 @@ int ai_alsa_init(audio_in_t *ai) } #ifndef timersub -#define timersub(a, b, result) \ +#define timersub(a, b, result) \ do { \ - (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ - (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ - if ((result)->tv_usec < 0) { \ - --(result)->tv_sec; \ - (result)->tv_usec += 1000000; \ - } \ + (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ + (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ + if ((result)->tv_usec < 0) { \ + --(result)->tv_sec; \ + (result)->tv_usec += 1000000; \ + } \ } while (0) #endif @@ -171,25 +171,25 @@ int ai_alsa_xrun(audio_in_t *ai) snd_pcm_status_alloca(&status); if ((res = snd_pcm_status(ai->alsa.handle, status))<0) { - MP_ERR(ai, "ALSA status error: %s", snd_strerror(res)); - return -1; + MP_ERR(ai, "ALSA status error: %s", snd_strerror(res)); + return -1; } if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) { - struct timeval now, diff, tstamp; - gettimeofday(&now, 0); - snd_pcm_status_get_trigger_tstamp(status, &tstamp); - timersub(&now, &tstamp, &diff); - MP_ERR(ai, "ALSA xrun!!! (at least %.3f ms long)\n", - diff.tv_sec * 1000 + diff.tv_usec / 1000.0); - if (mp_msg_test(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_ERR(ai, "ALSA xrun: prepare error: %s", snd_strerror(res)); - return -1; - } - return 0; /* ok, data should be accepted again */ + struct timeval now, diff, tstamp; + gettimeofday(&now, 0); + snd_pcm_status_get_trigger_tstamp(status, &tstamp); + timersub(&now, &tstamp, &diff); + MP_ERR(ai, "ALSA xrun!!! (at least %.3f ms long)\n", + diff.tv_sec * 1000 + diff.tv_usec / 1000.0); + if (mp_msg_test(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_ERR(ai, "ALSA xrun: prepare error: %s", snd_strerror(res)); + return -1; + } + return 0; /* ok, data should be accepted again */ } MP_ERR(ai, "ALSA read/write error"); return -1; |