diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-01-11 20:27:52 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-01-11 20:27:52 +0000 |
commit | 33bc71f10d0218a99128b6a786357f8c60ba821e (patch) | |
tree | f981d7109a26bccd2b06a07e348a6c9dc8b1bc54 /libao2 | |
parent | d3ae3611ce366b7598c49094a94109c6ee504322 (diff) |
Add support for distinguishing between little- and big-endian SPDIF AC3
and converting between both.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30283 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2')
-rw-r--r-- | libao2/ao_alsa.c | 11 | ||||
-rw-r--r-- | libao2/ao_alsa5.c | 8 | ||||
-rw-r--r-- | libao2/ao_dsound.c | 5 | ||||
-rw-r--r-- | libao2/ao_mpegpes.c | 7 | ||||
-rw-r--r-- | libao2/ao_oss.c | 6 | ||||
-rw-r--r-- | libao2/ao_pcm.c | 3 | ||||
-rw-r--r-- | libao2/ao_win32.c | 4 |
7 files changed, 24 insertions, 20 deletions
diff --git a/libao2/ao_alsa.c b/libao2/ao_alsa.c index 0734da46f1..ac9bb3b115 100644 --- a/libao2/ao_alsa.c +++ b/libao2/ao_alsa.c @@ -364,15 +364,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; @@ -535,6 +531,9 @@ static int init(int rate_hz, int channels, int format, int flags) mp_msg(MSGT_AO,MSGL_INFO, MSGTR_AO_ALSA_FormatNotSupportedByHardware, 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; } diff --git a/libao2/ao_alsa5.c b/libao2/ao_alsa5.c index 96c951a92a..a9b470e9d5 100644 --- a/libao2/ao_alsa5.c +++ b/libao2/ao_alsa5.c @@ -101,15 +101,11 @@ static int init(int rate_hz, int channels, int format, int flags) case AF_FORMAT_U16_BE: alsa_format.format = SND_PCM_SFMT_U16_BE; break; -#if !HAVE_BIGENDIAN - case AF_FORMAT_AC3: -#endif + case AF_FORMAT_AC3_LE: case AF_FORMAT_S16_LE: alsa_format.format = SND_PCM_SFMT_S16_LE; break; -#if HAVE_BIGENDIAN - case AF_FORMAT_AC3: -#endif + case AF_FORMAT_AC3_BE: case AF_FORMAT_S16_BE: alsa_format.format = SND_PCM_SFMT_S16_BE; break; diff --git a/libao2/ao_dsound.c b/libao2/ao_dsound.c index 8fbcfbe2fc..c53820638d 100644 --- a/libao2/ao_dsound.c +++ b/libao2/ao_dsound.c @@ -432,8 +432,11 @@ static int init(int rate, int channels, int format, int flags) mp_msg(MSGT_AO, MSGL_ERR, "ao_dsound: 8 channel audio not yet supported\n"); return 0; } + + if (AF_FORMAT_IS_AC3(format)) + format = AF_FORMAT_AC3_NE; switch(format){ - case AF_FORMAT_AC3: + case AF_FORMAT_AC3_NE: case AF_FORMAT_S24_LE: case AF_FORMAT_S16_LE: case AF_FORMAT_U8: diff --git a/libao2/ao_mpegpes.c b/libao2/ao_mpegpes.c index e05e3b1a53..c047fb304f 100644 --- a/libao2/ao_mpegpes.c +++ b/libao2/ao_mpegpes.c @@ -250,9 +250,12 @@ static int init(int rate,int channels,int format,int flags){ switch(format){ case AF_FORMAT_S16_BE: case AF_FORMAT_MPEG2: - case AF_FORMAT_AC3: + case AF_FORMAT_AC3_BE: ao_data.format=format; break; + case AF_FORMAT_AC3_LE: + ao_data.format=AF_FORMAT_AC3_BE; + break; default: ao_data.format=AF_FORMAT_S16_BE; } @@ -333,8 +336,6 @@ static int play(void* data,int len,int flags){ unsigned short *s=data; // if(len>2000) len=2000; // printf("ao_mpegpes: len=%d \n",len); - if(ao_data.format==AF_FORMAT_AC3) - for(i=0;i<len/2;i++) s[i]=(s[i]>>8)|(s[i]<<8); // le<->be send_mpeg_lpcm_packet(data, len, 0xA0, ao_data.pts, freq_id, my_ao_write); } return len; diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c index a054d7ce07..6c23026e87 100644 --- a/libao2/ao_oss.c +++ b/libao2/ao_oss.c @@ -96,7 +96,7 @@ static int format2oss(int format) case AF_FORMAT_MPEG2: return AFMT_MPEG; #endif #ifdef AFMT_AC3 - case AF_FORMAT_AC3: return AFMT_AC3; + case AF_FORMAT_AC3_NE: return AFMT_AC3; #endif } mp_msg(MSGT_AO, MSGL_V, "OSS: Unknown/not supported internal format: %s\n", af_fmt2str_short(format)); @@ -139,7 +139,7 @@ static int oss2format(int format) case AFMT_MPEG: return AF_FORMAT_MPEG2; #endif #ifdef AFMT_AC3 - case AFMT_AC3: return AF_FORMAT_AC3; + case AFMT_AC3: return AF_FORMAT_AC3_NE; #endif } mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_AO_OSS_UnknownUnsupportedFormat, format); @@ -303,6 +303,8 @@ static int init(int rate,int channels,int format,int flags){ } ac3_retry: + if (AF_FORMAT_IS_AC3(format)) + format = AF_FORMAT_AC3_NE; ao_data.format=format; oss_format=format2oss(format); if (oss_format == -1) { diff --git a/libao2/ao_pcm.c b/libao2/ao_pcm.c index 9167521f12..5a5c08b3e4 100644 --- a/libao2/ao_pcm.c +++ b/libao2/ao_pcm.c @@ -127,7 +127,8 @@ static int init(int rate,int channels,int format,int flags){ format=AF_FORMAT_U8; case AF_FORMAT_U8: break; - case AF_FORMAT_AC3: + case AF_FORMAT_AC3_BE: + case AF_FORMAT_AC3_LE: bits=16; break; default: diff --git a/libao2/ao_win32.c b/libao2/ao_win32.c index 59e758793d..55ed17b457 100644 --- a/libao2/ao_win32.c +++ b/libao2/ao_win32.c @@ -143,8 +143,10 @@ static int init(int rate,int channels,int format,int flags) unsigned char* buffer; int i; + if (AF_FORMAT_IS_AC3(format)) + format = AF_FORMAT_AC3_NE; switch(format){ - case AF_FORMAT_AC3: + case AF_FORMAT_AC3_NE: case AF_FORMAT_S24_LE: case AF_FORMAT_S16_LE: case AF_FORMAT_U8: |