mirror of
https://github.com/mpv-player/mpv
synced 2025-02-01 20:52:05 +00:00
AFMT_AC3 autodetect/fallback to S16
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5791 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
b8f39a4f86
commit
ceda76523a
@ -125,9 +125,15 @@ static int init(int rate_hz, int channels, int format, int flags)
|
||||
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;
|
||||
|
@ -87,9 +87,15 @@ static int init(int rate_hz, int channels, int format, int flags)
|
||||
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;
|
||||
|
@ -125,9 +125,15 @@ static int init(int rate_hz, int channels, int format, int flags)
|
||||
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;
|
||||
|
@ -291,7 +291,13 @@ static unsigned char nas_aformat_to_auformat(unsigned int format)
|
||||
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;
|
||||
|
@ -123,12 +123,18 @@ static int init(int rate,int channels,int format,int flags){
|
||||
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));
|
||||
|
Loading…
Reference in New Issue
Block a user