From 93a7ebc4f4f5c3b4086f9e23fb508963ff123dd7 Mon Sep 17 00:00:00 2001 From: Stephen Torri Date: Wed, 17 Mar 2004 17:03:26 +0000 Subject: Patch from Bill Fink to fix DV audio endianness problem for big-endian systems. The problem was little-endian systems were doing byte swapping which big-endian systems do not need to do. CVS patchset: 6282 CVS date: 2004/03/17 17:03:26 --- src/libffmpeg/dvaudio_decoder.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/libffmpeg/dvaudio_decoder.c b/src/libffmpeg/dvaudio_decoder.c index 1fb097a9c..56538d2e1 100644 --- a/src/libffmpeg/dvaudio_decoder.c +++ b/src/libffmpeg/dvaudio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: dvaudio_decoder.c,v 1.1 2004/03/16 23:31:30 jstembridge Exp $ + * $Id: dvaudio_decoder.c,v 1.2 2004/03/17 17:03:26 storri Exp $ * * dv audio decoder based on patch by Dan Dennedy * @@ -202,8 +202,13 @@ static int dv_extract_audio(uint8_t* frame, uint8_t* pcm, uint8_t* pcm2) if (of*2 >= size) continue; - pcm[of*2] = frame[d+1]; // FIXME: may be we have to admit - pcm[of*2+1] = frame[d]; // that DV is a big endian PCM +#ifdef WORDS_BIGENDIAN + pcm[of*2] = frame[d]; + pcm[of*2+1] = frame[d+1]; +#else + pcm[of*2] = frame[d+1]; + pcm[of*2+1] = frame[d]; +#endif if (pcm[of*2+1] == 0x80 && pcm[of*2] == 0x00) pcm[of*2+1] = 0; } else { /* 12bit quantization */ @@ -218,12 +223,22 @@ static int dv_extract_audio(uint8_t* frame, uint8_t* pcm, uint8_t* pcm2) if (of*2 >= size) continue; - pcm[of*2] = lc & 0xff; // FIXME: may be we have to admit - pcm[of*2+1] = lc >> 8; // that DV is a big endian PCM +#ifdef WORDS_BIGENDIAN + pcm[of*2] = lc >> 8; + pcm[of*2+1] = lc & 0xff; +#else + pcm[of*2] = lc & 0xff; + pcm[of*2+1] = lc >> 8; +#endif of = sys->audio_shuffle[i%half_ch+half_ch][j] + (d - 8)/3 * sys->audio_stride; - pcm[of*2] = rc & 0xff; // FIXME: may be we have to admit - pcm[of*2+1] = rc >> 8; // that DV is a big endian PCM +#ifdef WORDS_BIGENDIAN + pcm[of*2] = rc >> 8; + pcm[of*2+1] = rc & 0xff; +#else + pcm[of*2] = rc & 0xff; + pcm[of*2+1] = rc >> 8; +#endif ++d; } } -- cgit v1.2.3