Mercurial > mplayer.hg
changeset 5790:d141f1e9cc36
AFMT_AC3 autodetect/fallback to S16
author | arpi |
---|---|
date | Mon, 22 Apr 2002 22:33:06 +0000 |
parents | 0132c5747e8a |
children | b584598afac9 |
files | libao2/ao_alsa1x.c libao2/ao_alsa5.c libao2/ao_alsa9.c libao2/ao_nas.c libao2/ao_oss.c |
diffstat | 5 files changed, 35 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libao2/ao_alsa1x.c Mon Apr 22 21:36:12 2002 +0000 +++ b/libao2/ao_alsa1x.c Mon Apr 22 22:33:06 2002 +0000 @@ -125,9 +125,15 @@ case AFMT_U16_BE: alsa_format = SND_PCM_FORMAT_U16_BE; break; +#ifndef WORDS_BIGENDIAN + case AFMT_AC3: +#endif case AFMT_S16_LE: alsa_format = SND_PCM_FORMAT_S16_LE; break; +#ifdef WORDS_BIGENDIAN + case AFMT_AC3: +#endif case AFMT_S16_BE: alsa_format = SND_PCM_FORMAT_S16_BE; break;
--- a/libao2/ao_alsa5.c Mon Apr 22 21:36:12 2002 +0000 +++ b/libao2/ao_alsa5.c Mon Apr 22 22:33:06 2002 +0000 @@ -87,9 +87,15 @@ case AFMT_U16_BE: alsa_format.format = SND_PCM_SFMT_U16_BE; break; +#ifndef WORDS_BIGENDIAN + case AFMT_AC3: +#endif case AFMT_S16_LE: alsa_format.format = SND_PCM_SFMT_S16_LE; break; +#ifdef WORDS_BIGENDIAN + case AFMT_AC3: +#endif case AFMT_S16_BE: alsa_format.format = SND_PCM_SFMT_S16_BE; break;
--- a/libao2/ao_alsa9.c Mon Apr 22 21:36:12 2002 +0000 +++ b/libao2/ao_alsa9.c Mon Apr 22 22:33:06 2002 +0000 @@ -125,9 +125,15 @@ case AFMT_U16_BE: alsa_format = SND_PCM_FORMAT_U16_BE; break; +#ifndef WORDS_BIGENDIAN + case AFMT_AC3: +#endif case AFMT_S16_LE: alsa_format = SND_PCM_FORMAT_S16_LE; break; +#ifdef WORDS_BIGENDIAN + case AFMT_AC3: +#endif case AFMT_S16_BE: alsa_format = SND_PCM_FORMAT_S16_BE; break;
--- a/libao2/ao_nas.c Mon Apr 22 21:36:12 2002 +0000 +++ b/libao2/ao_nas.c Mon Apr 22 22:33:06 2002 +0000 @@ -291,7 +291,13 @@ case AFMT_S8: return AuFormatLinearSigned8; case AFMT_U16_LE: return AuFormatLinearUnsigned16LSB; case AFMT_U16_BE: return AuFormatLinearUnsigned16MSB; +#ifndef WORDS_BIGENDIAN + case AFMT_AC3: +#endif case AFMT_S16_LE: return AuFormatLinearSigned16LSB; +#ifdef WORDS_BIGENDIAN + case AFMT_AC3: +#endif case AFMT_S16_BE: return AuFormatLinearSigned16MSB; case AFMT_MU_LAW: return AuFormatULAW8; default: return 0;
--- a/libao2/ao_oss.c Mon Apr 22 21:36:12 2002 +0000 +++ b/libao2/ao_oss.c Mon Apr 22 22:33:06 2002 +0000 @@ -123,12 +123,18 @@ ao_data.samplerate=rate; ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_data.samplerate); } - + +ac3_retry: ao_data.format=format; - ioctl (audio_fd, SNDCTL_DSP_SETFMT, &ao_data.format); - if(format == AFMT_AC3 && ao_data.format != AFMT_AC3) { - printf("Can't set audio device %s to AC3 output\n", dsp); - return 0; + if( ioctl(audio_fd, SNDCTL_DSP_SETFMT, &ao_data.format)<0 || + ao_data.format != format) if(format == AFMT_AC3){ + printf("Can't set audio device %s to AC3 output, trying S16...\n", dsp); +#ifdef WORDS_BIGENDIAN + format=AFMT_S16_BE; +#else + format=AFMT_S16_LE; +#endif + goto ac3_retry; } printf("audio_setup: sample format: %s (requested: %s)\n", audio_out_format_name(ao_data.format), audio_out_format_name(format));