summaryrefslogtreecommitdiff
path: root/src/libffmpeg/dvaudio_decoder.c
diff options
context:
space:
mode:
authorStephen Torri <storri@users.sourceforge.net>2004-03-17 17:03:26 +0000
committerStephen Torri <storri@users.sourceforge.net>2004-03-17 17:03:26 +0000
commit93a7ebc4f4f5c3b4086f9e23fb508963ff123dd7 (patch)
tree583519c14685612cdcad844c5c8109794840ed14 /src/libffmpeg/dvaudio_decoder.c
parent103a70530fa72e749648ac8b9e0b0450c24efd12 (diff)
downloadxine-lib-93a7ebc4f4f5c3b4086f9e23fb508963ff123dd7.tar.gz
xine-lib-93a7ebc4f4f5c3b4086f9e23fb508963ff123dd7.tar.bz2
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
Diffstat (limited to 'src/libffmpeg/dvaudio_decoder.c')
-rw-r--r--src/libffmpeg/dvaudio_decoder.c29
1 files changed, 22 insertions, 7 deletions
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 <dan@dennedy.org>
*
@@ -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;
}
}