]> git.sesse.net Git - vlc/commitdiff
Ported fix from STABLE.
authorChristophe Massiot <massiot@videolan.org>
Sun, 11 Aug 2002 21:59:46 +0000 (21:59 +0000)
committerChristophe Massiot <massiot@videolan.org>
Sun, 11 Aug 2002 21:59:46 +0000 (21:59 +0000)
modules/codec/lpcm/lpcm.c

index 9c08d8f1ecfda5d1e0e66939c5a3698428fde3a3..1a075d1b1a1672bc2828d42fe9afda8ff5bdf78c 100644 (file)
@@ -2,7 +2,7 @@
  * lpcm.c: lpcm decoder module
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: lpcm.c,v 1.1 2002/08/04 17:23:42 sam Exp $
+ * $Id: lpcm.c,v 1.2 2002/08/11 21:59:46 massiot Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Henri Fallon <henri@videolan.org>
@@ -145,7 +145,10 @@ static int InitThread (lpcmdec_thread_t * p_lpcmdec)
  *****************************************************************************/
 void DecodeFrame( lpcmdec_thread_t * p_lpcmdec )
 {
-    byte_t *    buffer,p_temp[LPCMDEC_FRAME_SIZE];
+    byte_t *    buffer;
+#ifndef WORDS_BIGENDIAN
+    byte_t *    p_temp[LPCMDEC_FRAME_SIZE];
+#endif
     vlc_bool_t  b_sync;
     int         i_loop;
 
@@ -168,8 +171,8 @@ void DecodeFrame( lpcmdec_thread_t * p_lpcmdec )
     
     /* I only have 2 test streams. As far as I understand
      * after the RemoveBits and the 2 GetBits, we should be exactly 
-     * where we whant : the sync word : 0x0180.
-     * If not, we got and find it. */
+     * where we want : the sync word : 0x0180.
+     * If not, we go and find it. */
     while( ( byte1 != 0x01 || byte2 != 0x80 ) && (!p_lpcmdec->p_fifo->b_die)
                                        && (!p_lpcmdec->p_fifo->b_error) )
     {
@@ -190,15 +193,25 @@ void DecodeFrame( lpcmdec_thread_t * p_lpcmdec )
     RemoveBits( &p_lpcmdec->bit_stream, 8 );
 #endif
     
+#ifndef WORDS_BIGENDIAN
     GetChunk( &p_lpcmdec->bit_stream, p_temp, LPCMDEC_FRAME_SIZE);
     if( p_lpcmdec->p_fifo->b_die || p_lpcmdec->p_fifo->b_error ) return;
 
+#   ifdef HAVE_SWAB
+    swab( buffer, p_temp, LPCMDEC_FRAME_SIZE );
+#   else
     for( i_loop = 0; i_loop < LPCMDEC_FRAME_SIZE/2; i_loop++ )
     {
         buffer[2*i_loop]=p_temp[2*i_loop+1];
         buffer[2*i_loop+1]=p_temp[2*i_loop];
     }
-    
+#   endif
+
+#else
+    GetChunk( &p_lpcmdec->bit_stream, buffer, LPCMDEC_FRAME_SIZE);
+    if( p_lpcmdec->p_fifo->b_die ) return;
+#endif
+
     vlc_mutex_lock (&p_lpcmdec->p_aout_fifo->data_lock);
     p_lpcmdec->p_aout_fifo->i_end_frame = 
         (p_lpcmdec->p_aout_fifo->i_end_frame + 1) & AOUT_FIFO_SIZE;