summaryrefslogtreecommitdiffstats
path: root/libao2
diff options
context:
space:
mode:
authorUoti Urpala <uau@symbol.nonexistent.invalid>2008-05-07 13:07:48 +0300
committerUoti Urpala <uau@symbol.nonexistent.invalid>2008-05-07 13:15:37 +0300
commit267a3f4c9c00848f32c341595d2d831157a79bee (patch)
treecdef15bb746e3a41b1813076f24035fcc8385c30 /libao2
parent5484215d044522bcd30516e458e421f403ca8e35 (diff)
parent96fa9c4e249e9467f21e32191882e511e762fb1f (diff)
downloadmpv-267a3f4c9c00848f32c341595d2d831157a79bee.tar.bz2
mpv-267a3f4c9c00848f32c341595d2d831157a79bee.tar.xz
Merge svn changes up to r26680
Conflicts: Makefile configure osdep/timer-darwin.c
Diffstat (limited to 'libao2')
-rw-r--r--libao2/ao_pcm.c17
-rw-r--r--libao2/ao_pulse.c11
2 files changed, 19 insertions, 9 deletions
diff --git a/libao2/ao_pcm.c b/libao2/ao_pcm.c
index 7182630fe2..ad0e0626b1 100644
--- a/libao2/ao_pcm.c
+++ b/libao2/ao_pcm.c
@@ -36,6 +36,7 @@ static int fast = 0;
#define WAV_ID_FMT 0x20746d66 /* "fmt " */
#define WAV_ID_DATA 0x61746164 /* "data" */
#define WAV_ID_PCM 0x0001
+#define WAV_ID_FLOAT_PCM 0x0003
struct WaveHeader
{
@@ -85,12 +86,18 @@ static int init(int rate,int channels,int format,int flags){
strdup(ao_pcm_waveheader?"audiodump.wav":"audiodump.pcm");
}
- /* bits is only equal to format if (format == 8) or (format == 16);
- this means that the following "if" is a kludge and should
- really be a switch to be correct in all cases */
-
bits=8;
switch(format){
+ case AF_FORMAT_S32_BE:
+ format=AF_FORMAT_S32_LE;
+ case AF_FORMAT_S32_LE:
+ bits=32;
+ break;
+ case AF_FORMAT_FLOAT_BE:
+ format=AF_FORMAT_FLOAT_LE;
+ case AF_FORMAT_FLOAT_LE:
+ bits=32;
+ break;
case AF_FORMAT_S8:
format=AF_FORMAT_U8;
case AF_FORMAT_U8:
@@ -115,7 +122,7 @@ static int init(int rate,int channels,int format,int flags){
wavhdr.wave = le2me_32(WAV_ID_WAVE);
wavhdr.fmt = le2me_32(WAV_ID_FMT);
wavhdr.fmt_length = le2me_32(16);
- wavhdr.fmt_tag = le2me_16(WAV_ID_PCM);
+ wavhdr.fmt_tag = le2me_16(format == AF_FORMAT_FLOAT_LE ? WAV_ID_FLOAT_PCM : WAV_ID_PCM);
wavhdr.channels = le2me_16(ao_data.channels);
wavhdr.sample_rate = le2me_32(ao_data.samplerate);
wavhdr.bytes_per_second = le2me_32(ao_data.bps);
diff --git a/libao2/ao_pulse.c b/libao2/ao_pulse.c
index a2440609c8..5140a5e5c5 100644
--- a/libao2/ao_pulse.c
+++ b/libao2/ao_pulse.c
@@ -114,11 +114,13 @@ static const struct format_map_s {
int mp_format;
pa_sample_format_t pa_format;
} format_maps[] = {
- {AF_FORMAT_U8, PA_SAMPLE_U8},
{AF_FORMAT_S16_LE, PA_SAMPLE_S16LE},
{AF_FORMAT_S16_BE, PA_SAMPLE_S16BE},
+ {AF_FORMAT_S32_LE, PA_SAMPLE_S32LE},
+ {AF_FORMAT_S32_BE, PA_SAMPLE_S32BE},
{AF_FORMAT_FLOAT_LE, PA_SAMPLE_FLOAT32LE},
{AF_FORMAT_FLOAT_BE, PA_SAMPLE_FLOAT32BE},
+ {AF_FORMAT_U8, PA_SAMPLE_U8},
{AF_FORMAT_MU_LAW, PA_SAMPLE_ULAW},
{AF_FORMAT_A_LAW, PA_SAMPLE_ALAW},
{AF_FORMAT_UNKNOWN, 0}
@@ -143,17 +145,18 @@ static int init(int rate_hz, int channels, int format, int flags) {
ss.rate = rate_hz;
ao_data.samplerate = rate_hz;
- ao_data.format = format;
ao_data.channels = channels;
fmt_map = format_maps;
while (fmt_map->mp_format != format) {
if (fmt_map->mp_format == AF_FORMAT_UNKNOWN) {
- mp_msg(MSGT_AO, MSGL_ERR, "AO: [pulse] Unsupported sample spec\n");
- goto fail;
+ mp_msg(MSGT_AO, MSGL_V, "AO: [pulse] Unsupported format, using default\n");
+ fmt_map = format_maps;
+ break;
}
fmt_map++;
}
+ ao_data.format = fmt_map->mp_format;
ss.format = fmt_map->pa_format;
if (!pa_sample_spec_valid(&ss)) {