summaryrefslogtreecommitdiffstats
path: root/libao2/ao_alsa.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-01-25 15:04:07 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-01-25 15:07:30 +0200
commit69fe2522f8c2a04eda112eee6319ca2e85d7038b (patch)
tree83a8b19997e621309344ca1f3997a48886ef0944 /libao2/ao_alsa.c
parent9436e0452fad48e671d7320cb18c588655f3d230 (diff)
parent1cda8b002fb19c3da14760fe1f9fc76992a05c29 (diff)
downloadmpv-69fe2522f8c2a04eda112eee6319ca2e85d7038b.tar.bz2
mpv-69fe2522f8c2a04eda112eee6319ca2e85d7038b.tar.xz
Merge svn changes up to r30301
Diffstat (limited to 'libao2/ao_alsa.c')
-rw-r--r--libao2/ao_alsa.c22
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;