Make ao_pulse fall back to s16le format instead of just failing.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26634 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2008-05-01 16:47:54 +00:00
parent a7b11f3927
commit e1e2527cd4
1 changed files with 5 additions and 4 deletions

View File

@ -114,11 +114,11 @@ static const struct format_map_s {
int mp_format; int mp_format;
pa_sample_format_t pa_format; pa_sample_format_t pa_format;
} format_maps[] = { } format_maps[] = {
{AF_FORMAT_U8, PA_SAMPLE_U8},
{AF_FORMAT_S16_LE, PA_SAMPLE_S16LE}, {AF_FORMAT_S16_LE, PA_SAMPLE_S16LE},
{AF_FORMAT_S16_BE, PA_SAMPLE_S16BE}, {AF_FORMAT_S16_BE, PA_SAMPLE_S16BE},
{AF_FORMAT_FLOAT_LE, PA_SAMPLE_FLOAT32LE}, {AF_FORMAT_FLOAT_LE, PA_SAMPLE_FLOAT32LE},
{AF_FORMAT_FLOAT_BE, PA_SAMPLE_FLOAT32BE}, {AF_FORMAT_FLOAT_BE, PA_SAMPLE_FLOAT32BE},
{AF_FORMAT_U8, PA_SAMPLE_U8},
{AF_FORMAT_MU_LAW, PA_SAMPLE_ULAW}, {AF_FORMAT_MU_LAW, PA_SAMPLE_ULAW},
{AF_FORMAT_A_LAW, PA_SAMPLE_ALAW}, {AF_FORMAT_A_LAW, PA_SAMPLE_ALAW},
{AF_FORMAT_UNKNOWN, 0} {AF_FORMAT_UNKNOWN, 0}
@ -143,17 +143,18 @@ static int init(int rate_hz, int channels, int format, int flags) {
ss.rate = rate_hz; ss.rate = rate_hz;
ao_data.samplerate = rate_hz; ao_data.samplerate = rate_hz;
ao_data.format = format;
ao_data.channels = channels; ao_data.channels = channels;
fmt_map = format_maps; fmt_map = format_maps;
while (fmt_map->mp_format != format) { while (fmt_map->mp_format != format) {
if (fmt_map->mp_format == AF_FORMAT_UNKNOWN) { if (fmt_map->mp_format == AF_FORMAT_UNKNOWN) {
mp_msg(MSGT_AO, MSGL_ERR, "AO: [pulse] Unsupported sample spec\n"); mp_msg(MSGT_AO, MSGL_V, "AO: [pulse] Unsupported format, using default\n");
goto fail; fmt_map = format_maps;
break;
} }
fmt_map++; fmt_map++;
} }
ao_data.format = fmt_map->mp_format;
ss.format = fmt_map->pa_format; ss.format = fmt_map->pa_format;
if (!pa_sample_spec_valid(&ss)) { if (!pa_sample_spec_valid(&ss)) {