* all: Fix an other (and last ? ;) endian issue.
authorLaurent Aimar <fenrir@videolan.org>
Wed, 4 Dec 2002 15:47:31 +0000 (15:47 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Wed, 4 Dec 2002 15:47:31 +0000 (15:47 +0000)
modules/demux/avi/avi.c
modules/demux/avi/libavi.c
modules/demux/avi/libavi.h

index fc0a675..7cd9efe 100644 (file)
@@ -2,7 +2,7 @@
  * avi.c : AVI file Stream input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: avi.c,v 1.15 2002/12/03 17:00:16 fenrir Exp $
+ * $Id: avi.c,v 1.16 2002/12/04 15:47:31 fenrir Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  * 
  * This program is free software; you can redistribute it and/or modify
@@ -939,16 +939,16 @@ static int AVIInit( vlc_object_t * p_this )
                 p_info->i_cat = AUDIO_ES;
                 p_info->i_fourcc = 
                     AVI_FourccGetCodec( AUDIO_ES, 
-                                        p_avi_strf_auds->i_formattag );
+                                        p_avi_strf_auds->p_wf->wFormatTag );
                 p_info->i_codec  = p_info->i_fourcc;
                 i_init_size = p_avi_strf_auds->i_chunk_size;
-                p_init_data = p_avi_strf_auds->p_wfx;
+                p_init_data = p_avi_strf_auds->p_wf;
                 msg_Dbg( p_input, "stream[%d] audio(0x%x) %d channels %dHz %dbits",
                         i,
-                        p_avi_strf_auds->i_formattag,
-                        p_avi_strf_auds->i_channels,
-                        p_avi_strf_auds->i_samplespersec,
-                        p_avi_strf_auds->i_bitspersample );
+                        p_avi_strf_auds->p_wf->wFormatTag,
+                        p_avi_strf_auds->p_wf->nChannels,
+                        p_avi_strf_auds->p_wf->nSamplesPerSec,
+                        p_avi_strf_auds->p_wf->wBitsPerSample );
                 break;
                 
             case( AVIFOURCC_vids ):
index 8753b5f..a4cd2ba 100644 (file)
@@ -2,7 +2,7 @@
  * libavi.c : 
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: libavi.c,v 1.7 2002/11/08 10:26:53 gbazin Exp $
+ * $Id: libavi.c,v 1.8 2002/12/04 15:47:31 fenrir Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  * 
  * This program is free software; you can redistribute it and/or modify
@@ -513,28 +513,35 @@ static int AVI_ChunkRead_strf( input_thread_t *p_input,
     switch( p_strh->strh.i_type )
     {
         case( AVIFOURCC_auds ):
-            AVI_READ2BYTES( p_chk->strf.auds.i_formattag );
-            AVI_READ2BYTES( p_chk->strf.auds.i_channels );
-            AVI_READ4BYTES( p_chk->strf.auds.i_samplespersec );
-            AVI_READ4BYTES( p_chk->strf.auds.i_avgbytespersec );
-            AVI_READ2BYTES( p_chk->strf.auds.i_blockalign );
-            AVI_READ2BYTES( p_chk->strf.auds.i_bitspersample );
-            if( p_chk->strf.auds.i_formattag != WAVE_FORMAT_PCM )
+            p_chk->strf.auds.p_wf = malloc( p_chk->common.i_chunk_size );
+            AVI_READ2BYTES( p_chk->strf.auds.p_wf->wFormatTag );
+            AVI_READ2BYTES( p_chk->strf.auds.p_wf->nChannels );
+            AVI_READ4BYTES( p_chk->strf.auds.p_wf->nSamplesPerSec );
+            AVI_READ4BYTES( p_chk->strf.auds.p_wf->nAvgBytesPerSec );
+            AVI_READ2BYTES( p_chk->strf.auds.p_wf->nBlockAlign );
+            AVI_READ2BYTES( p_chk->strf.auds.p_wf->wBitsPerSample );
+            if( p_chk->strf.auds.p_wf->wFormatTag != WAVE_FORMAT_PCM )
             {
-                AVI_READ2BYTES( p_chk->strf.auds.i_size );
+                AVI_READ2BYTES( p_chk->strf.auds.p_wf->cbSize );
+            }
+            else
+            {
+                p_chk->strf.auds.p_wf->cbSize = 0;
+            }
+            if( p_chk->strf.auds.p_wf->cbSize > 0 )
+            {
+                memcpy( &p_chk->strf.auds.p_wf[1] , 
+                        p_buff + sizeof( WAVEFORMATEX ), 
+                        p_chk->common.i_chunk_size - sizeof( WAVEFORMATEX ));
             }
-            p_chk->strf.auds.p_wfx = malloc( p_chk->common.i_chunk_size );
-            memcpy( p_chk->strf.auds.p_wfx, 
-                    p_buff + 8, 
-                    p_chk->common.i_chunk_size );
 #ifdef AVI_DEBUG
             msg_Dbg( p_input, 
                      "strf: audio:0x%4.4x channels:%d %dHz %dbits/sample %dkb/s",
-                     p_chk->strf.auds.i_formattag,
-                     p_chk->strf.auds.i_channels,
-                     p_chk->strf.auds.i_samplespersec,
-                     p_chk->strf.auds.i_bitspersample,
-                     p_chk->strf.auds.i_avgbytespersec * 8 / 1024 );
+                     p_chk->strf.auds.p_wf->wFormatTag,
+                     p_chk->strf.auds.p_wf->nChannels,
+                     p_chk->strf.auds.p_wf->nSamplesPerSec,
+                     p_chk->strf.auds.p_wf->wBitsPerSample,
+                     p_chk->strf.auds.p_wf->nAvgBytesPerSec * 8 / 1024 );
 #endif
             break;
         case( AVIFOURCC_vids ):
index b617cc9..e44693b 100644 (file)
@@ -2,7 +2,7 @@
  * libavi.h : LibAVI library 
  ******************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: libavi.h,v 1.4 2002/11/06 14:44:30 sam Exp $
+ * $Id: libavi.h,v 1.5 2002/12/04 15:47:31 fenrir Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  * 
  * This program is free software; you can redistribute it and/or modify
@@ -237,16 +237,7 @@ typedef struct avi_chunk_strh_s
 typedef struct avi_chunk_strf_auds_s
 {
     AVI_CHUNK_COMMON
-    void *p_wfx;    //  waveformatex_t loaded from file
-
-    uint16_t i_formattag;        // + 0x00
-    uint16_t i_channels;         // + 0x02
-    uint32_t i_samplespersec;    // + 0x04
-    uint32_t i_avgbytespersec;   // + 0x08
-    uint16_t i_blockalign;       // + 0x0c
-    uint16_t i_bitspersample;    // + 0x0e
-    uint16_t i_size; /* the extra size in bytes */
-    uint8_t  *p_data;
+    WAVEFORMATEX    *p_wf;
 } avi_chunk_strf_auds_t;
 
 typedef struct avi_chunk_strf_vids_s