diff options
Diffstat (limited to 'libao2/ao_alsa.c')
-rw-r--r-- | libao2/ao_alsa.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libao2/ao_alsa.c b/libao2/ao_alsa.c index 140b13a62a..92b8b64ea7 100644 --- a/libao2/ao_alsa.c +++ b/libao2/ao_alsa.c @@ -128,7 +128,7 @@ static int control(int cmd, void *arg) long get_vol, set_vol; float f_multi; - if(ao_data.format == AF_FORMAT_AC3) + if(AF_FORMAT_IS_AC3(ao_data.format)) return CONTROL_TRUE; if(mixer_channel) { @@ -374,15 +374,11 @@ static int init(int rate_hz, int channels, int format, int flags) case AF_FORMAT_U16_BE: alsa_format = SND_PCM_FORMAT_U16_BE; break; -#if !HAVE_BIGENDIAN - case AF_FORMAT_AC3: -#endif + case AF_FORMAT_AC3_LE: case AF_FORMAT_S16_LE: alsa_format = SND_PCM_FORMAT_S16_LE; break; -#if HAVE_BIGENDIAN - case AF_FORMAT_AC3: -#endif + case AF_FORMAT_AC3_BE: case AF_FORMAT_S16_BE: alsa_format = SND_PCM_FORMAT_S16_BE; break; @@ -437,7 +433,7 @@ static int init(int rate_hz, int channels, int format, int flags) * while opening the abstract alias for the spdif subdevice * 'iec958' */ - if (format == AF_FORMAT_AC3) { + if (AF_FORMAT_IS_AC3(format)) { device.str = "iec958"; mp_msg(MSGT_AO,MSGL_V,"alsa-spdif-init: playing AC3, %i channels\n", channels); } @@ -496,12 +492,13 @@ static int init(int rate_hz, int channels, int format, int flags) } if (!alsa_handler) { + int isac3 = AF_FORMAT_IS_AC3(format); //modes = 0, SND_PCM_NONBLOCK, SND_PCM_ASYNC - if ((err = try_open_device(alsa_device, open_mode, format == AF_FORMAT_AC3)) < 0) + if ((err = try_open_device(alsa_device, open_mode, isac3)) < 0) { if (err != -EBUSY && ao_noblock) { mp_tmsg(MSGT_AO,MSGL_INFO,"[AO_ALSA] Open in nonblock-mode failed, trying to open in block-mode.\n"); - if ((err = try_open_device(alsa_device, 0, format == AF_FORMAT_AC3)) < 0) { + if ((err = try_open_device(alsa_device, 0, isac3)) < 0) { mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Playback open error: %s\n", snd_strerror(err)); return 0; } @@ -544,6 +541,9 @@ static int init(int rate_hz, int channels, int format, int flags) mp_tmsg(MSGT_AO,MSGL_INFO, "[AO_ALSA] Format %s is not supported by hardware, trying default.\n", af_fmt2str_short(format)); alsa_format = SND_PCM_FORMAT_S16_LE; + if (AF_FORMAT_IS_AC3(ao_data.format)) + ao_data.format = AF_FORMAT_AC3_LE; + else ao_data.format = AF_FORMAT_S16_LE; } @@ -583,7 +583,7 @@ static int init(int rate_hz, int channels, int format, int flags) return 0; } - bytes_per_sample = snd_pcm_format_physical_width(alsa_format) / 8; + bytes_per_sample = af_fmt2bits(ao_data.format) / 8; bytes_per_sample *= ao_data.channels; ao_data.bps = ao_data.samplerate * bytes_per_sample; |