]> git.sesse.net Git - vlc/commitdiff
* ffmpeg: disable direct rendering by default. I have too many files
authorLaurent Aimar <fenrir@videolan.org>
Sun, 17 Nov 2002 06:46:56 +0000 (06:46 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Sun, 17 Nov 2002 06:46:56 +0000 (06:46 +0000)
that don't work with it (I don't see why it doesn't work :(
 * mp4: fix a bug in timestamp calculation. Replace s/u* by s/uint*_t
 * avi : remove an useless debug message.
 * src/misc/objects.c : fix stream output object allocation.

modules/codec/ffmpeg/ffmpeg.c
modules/demux/avi/avi.c
modules/demux/mp4/libmp4.c
modules/demux/mp4/libmp4.h
modules/demux/mp4/mp4.c
modules/demux/mp4/mp4.h
src/misc/objects.c

index 64816076e6bac77917844bc45486d8d1b00e022c..00dbd1e3e5713c72cb2ee497ad910a14cadaaa3d 100644 (file)
@@ -2,7 +2,7 @@
  * ffmpeg.c: video decoder using ffmpeg library
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ffmpeg.c,v 1.15 2002/11/10 02:47:27 fenrir Exp $
+ * $Id: ffmpeg.c,v 1.16 2002/11/17 06:46:55 fenrir Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -98,7 +98,7 @@ static int ffmpeg_GetFfmpegCodec( vlc_fourcc_t, int *, int *, char ** );
 vlc_module_begin();
     add_category_hint( N_("Ffmpeg"), NULL );
 #if LIBAVCODEC_BUILD >= 4615
-    add_bool( "ffmpeg-dr", 1, NULL,
+    add_bool( "ffmpeg-dr", 0, NULL,
               "direct rendering", 
               "direct rendering" );
 #endif
index d09c630c9a1632cdbacb575d22f2696b3b07d2be..9a08dc5ec89eea0cf6988255285fd09e76f0109f 100644 (file)
@@ -2,7 +2,7 @@
  * avi.c : AVI file Stream input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: avi.c,v 1.13 2002/11/16 22:25:07 fenrir Exp $
+ * $Id: avi.c,v 1.14 2002/11/17 06:46:56 fenrir Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  * 
  * This program is free software; you can redistribute it and/or modify
@@ -1108,8 +1108,6 @@ static int AVIInit( vlc_object_t * p_this )
     {
         // already at begining of p_movi
     }
-    msg_Info( p_input, "skipping 12 bytes" );
-
     AVI_SkipBytes( p_input, 12 ); // enter in p_movi
 
     p_avi->i_movi_begin = p_movi->i_chunk_pos;
index ea7d41915e8f739b737b6006ffe1b51e33cd032e..296d365358b57927487c1e2a0c4e07615fc6dcfc 100644 (file)
@@ -2,7 +2,7 @@
  * libmp4.c : LibMP4 library for mp4 module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: libmp4.c,v 1.8 2002/10/26 19:14:45 fenrir Exp $
+ * $Id: libmp4.c,v 1.9 2002/11/17 06:46:56 fenrir Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  * 
  * This program is free software; you can redistribute it and/or modify
@@ -87,8 +87,8 @@
     
 
 #define MP4_READBOX_ENTER( MP4_Box_data_TYPE_t ) \
-    s64 i_read = p_box->i_size; \
-    u8 *p_peek, *p_buff; \
+    int64_t  i_read = p_box->i_size; \
+    uint8_t *p_peek, *p_buff; \
     i_read = p_box->i_size; \
     if( !( p_peek = p_buff = malloc( i_read ) ) ) \
     { \
 */
 
 /* Some functions to manipulate memory */
-static u16 GetWLE( u8 *p_buff )
+static uint16_t GetWLE( uint8_t *p_buff )
 {
     return( (p_buff[0]) + ( p_buff[1] <<8 ) );
 }
 
-static u32 GetDWLE( u8 *p_buff )
+static uint32_t GetDWLE( uint8_t *p_buff )
 {
     return( p_buff[0] + ( p_buff[1] <<8 ) +
             ( p_buff[2] <<16 ) + ( p_buff[3] <<24 ) );
 }
 
-static u16 GetWBE( u8 *p_buff )
+static uint16_t GetWBE( uint8_t *p_buff )
 {
     return( (p_buff[0]<<8) + p_buff[1] );
 }
 
-static u32 Get24bBE( u8 *p_buff )
+static uint32_t Get24bBE( uint8_t *p_buff )
 {
     return( ( p_buff[0] <<16 ) + ( p_buff[1] <<8 ) + p_buff[2] );
 }
 
 
-static u32 GetDWBE( u8 *p_buff )
+static uint32_t GetDWBE( uint8_t *p_buff )
 {
     return( (p_buff[0] << 24) + ( p_buff[1] <<16 ) +
             ( p_buff[2] <<8 ) + p_buff[3] );
 }
 
-static u64 GetQWBE( u8 *p_buff )
+static uint64_t GetQWBE( uint8_t *p_buff )
 {
-    return( ( (u64)GetDWBE( p_buff ) << 32 )|( (u64)GetDWBE( p_buff + 4 ) ) );
+    return( ( (uint64_t)GetDWBE( p_buff ) << 32 )|( (uint64_t)GetDWBE( p_buff + 4 ) ) );
 }
 
 
-static void GetUUID( UUID_t *p_uuid, u8 *p_buff )
+static void GetUUID( UUID_t *p_uuid, uint8_t *p_buff )
 {
     memcpy( p_uuid, 
             p_buff,
             16 );
 }
 
-static void CreateUUID( UUID_t *p_uuid, u32 i_fourcc )
+static void CreateUUID( UUID_t *p_uuid, uint32_t i_fourcc )
 {
     /* made by 0xXXXXXXXX-0011-0010-8000-00aa00389b71 
             where XXXXXXXX is the fourcc */
@@ -176,7 +176,7 @@ static void CreateUUID( UUID_t *p_uuid, u32 i_fourcc )
 
 /* some functions for mp4 encoding of variables */
 
-void MP4_ConvertDate2Str( char *psz, u64 i_date )
+void MP4_ConvertDate2Str( char *psz, uint64_t i_date )
 {
     int i_day;
     int i_hour;
@@ -238,7 +238,7 @@ int MP4_SeekAbsolute( input_thread_t *p_input,
 }
 
 /* return 1 if success, 0 if fail */
-int MP4_ReadData( input_thread_t *p_input, u8 *p_buff, int i_size )
+int MP4_ReadData( input_thread_t *p_input, uint8_t *p_buff, int i_size )
 {
     data_packet_t *p_data;
 
@@ -304,7 +304,7 @@ MP4_Stream_t *MP4_InputStream( input_thread_t *p_input )
  *
  ****************************************************************************/
 MP4_Stream_t *MP4_MemoryStream( input_thread_t *p_input,
-                                int i_size, u8 *p_buffer )
+                                int i_size, uint8_t *p_buffer )
 {
     MP4_Stream_t *p_stream;
 
@@ -335,7 +335,7 @@ MP4_Stream_t *MP4_MemoryStream( input_thread_t *p_input,
  * MP4_ReadStream read from a MP4_Stream_t
  *
  ****************************************************************************/
-int MP4_ReadStream( MP4_Stream_t *p_stream, u8 *p_buff, int i_size )
+int MP4_ReadStream( MP4_Stream_t *p_stream, uint8_t *p_buff, int i_size )
 {
     if( p_stream->b_memory )
     {
@@ -359,7 +359,7 @@ int MP4_ReadStream( MP4_Stream_t *p_stream, u8 *p_buff, int i_size )
  * MP4_PeekStream peek from a MP4_Stream_t
  *
  ****************************************************************************/
-int MP4_PeekStream( MP4_Stream_t *p_stream, u8 **pp_peek, int i_size )
+int MP4_PeekStream( MP4_Stream_t *p_stream, uint8_t **pp_peek, int i_size )
 {
     if( p_stream->b_memory )
     {
@@ -426,7 +426,7 @@ int MP4_SeekStream( MP4_Stream_t *p_stream, off_t i_pos)
 int MP4_ReadBoxCommon( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
 {
     int i_read;
-    u8  *p_peek;
+    uint8_t  *p_peek;
     
     if( ( ( i_read = MP4_PeekStream( p_stream, &p_peek, 32 ) ) < 8 ) )
     {
@@ -467,13 +467,13 @@ int MP4_ReadBoxCommon( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
         CreateUUID( &p_box->i_uuid, p_box->i_type );
     }
 #ifdef MP4_VERBOSE
-    /* FIXME how to write u64 ??? */
+    /* FIXME how to write uint64_t ??? */
     if( p_box->i_size )
     {
         msg_Dbg( p_stream->p_input, "Found Box: %c%c%c%c size %d",
                  (p_box->i_type)&0xff, (p_box->i_type>>8)&0xff, 
                      (p_box->i_type>>16)&0xff, (p_box->i_type>>24)&0xff,
-                 (u32)p_box->i_size );
+                 (uint32_t)p_box->i_size );
     }
 #endif
 
@@ -614,7 +614,7 @@ int MP4_ReadBox_ftyp( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
     {
         int i;
         p_box->data.p_ftyp->i_compatible_brands = 
-            calloc( p_box->data.p_ftyp->i_compatible_brands_count, sizeof(u32));
+            calloc( p_box->data.p_ftyp->i_compatible_brands_count, sizeof(uint32_t));
 
         for( i =0; i < p_box->data.p_ftyp->i_compatible_brands_count; i++ )
         {
@@ -698,11 +698,11 @@ int MP4_ReadBox_mvhd(  MP4_Stream_t *p_stream, MP4_Box_t *p_box )
     msg_Dbg( p_stream->p_input, "Read Box: \"mvhd\" creation %s modification %s time scale %d duration %s rate %f volume %f next track id %d",
                   s_creation_time,
                   s_modification_time,
-                  (u32)p_box->data.p_mvhd->i_timescale,
+                  (uint32_t)p_box->data.p_mvhd->i_timescale,
                   s_duration,
                   (float)p_box->data.p_mvhd->i_rate / (1<<16 ),
                   (float)p_box->data.p_mvhd->i_volume / 256 ,
-                  (u32)p_box->data.p_mvhd->i_next_track_id );
+                  (uint32_t)p_box->data.p_mvhd->i_next_track_id );
 #endif
     MP4_READBOX_EXIT( 1 );
 }
@@ -798,7 +798,7 @@ int MP4_ReadBox_tref( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
 int MP4_ReadBox_mdhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
 {
     int i;
-    u16 i_language;
+    uint16_t i_language;
 #ifdef MP4_VERBOSE
     char s_creation_time[128];
     char s_modification_time[128];
@@ -838,7 +838,7 @@ int MP4_ReadBox_mdhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
     msg_Dbg( p_stream->p_input, "Read Box: \"mdhd\" creation %s modification %s time scale %d duration %s language %c%c%c",
                   s_creation_time,
                   s_modification_time,
-                  (u32)p_box->data.p_mdhd->i_timescale,
+                  (uint32_t)p_box->data.p_mdhd->i_timescale,
                   s_duration,
                   p_box->data.p_mdhd->i_language[0],
                   p_box->data.p_mdhd->i_language[1],
@@ -1021,9 +1021,9 @@ int MP4_ReadBox_stts( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
     MP4_GET4BYTES( p_box->data.p_stts->i_entry_count );
 
     p_box->data.p_stts->i_sample_count = 
-        calloc( sizeof( u32 ), p_box->data.p_stts->i_entry_count );
+        calloc( sizeof( uint32_t ), p_box->data.p_stts->i_entry_count );
     p_box->data.p_stts->i_sample_delta =
-        calloc( sizeof( u32 ), p_box->data.p_stts->i_entry_count );
+        calloc( sizeof( uint32_t ), p_box->data.p_stts->i_entry_count );
     
     for( i = 0; (i < p_box->data.p_stts->i_entry_count )&&( i_read >=8 ); i++ )
     {
@@ -1057,9 +1057,9 @@ int MP4_ReadBox_ctts( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
     MP4_GET4BYTES( p_box->data.p_ctts->i_entry_count );
 
     p_box->data.p_ctts->i_sample_count = 
-        calloc( sizeof( u32 ), p_box->data.p_ctts->i_entry_count );
+        calloc( sizeof( uint32_t ), p_box->data.p_ctts->i_entry_count );
     p_box->data.p_ctts->i_sample_offset =
-        calloc( sizeof( u32 ), p_box->data.p_ctts->i_entry_count );
+        calloc( sizeof( uint32_t ), p_box->data.p_ctts->i_entry_count );
     
     for( i = 0; (i < p_box->data.p_ctts->i_entry_count )&&( i_read >=8 ); i++ )
     {
@@ -1082,7 +1082,7 @@ void MP4_FreeBox_ctts( input_thread_t *p_input, MP4_Box_t *p_box )
     FREE( p_box->data.p_ctts->i_sample_offset );
 }
 
-static int MP4_ReadLengthDescriptor( u8 **pp_peek, s64 *i_read )
+static int MP4_ReadLengthDescriptor( uint8_t **pp_peek, int64_t  *i_read )
 {
     int i_b;
     int i_len = 0;
@@ -1351,7 +1351,7 @@ int MP4_ReadBox_stsz( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
     MP4_GET4BYTES( p_box->data.p_stsz->i_sample_count );
 
     p_box->data.p_stsz->i_entry_size = 
-        calloc( sizeof( u32 ), p_box->data.p_stsz->i_sample_count );
+        calloc( sizeof( uint32_t ), p_box->data.p_stsz->i_sample_count );
     
     if( !p_box->data.p_stsz->i_sample_size )
     {
@@ -1387,11 +1387,11 @@ int MP4_ReadBox_stsc( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
     MP4_GET4BYTES( p_box->data.p_stsc->i_entry_count );
 
     p_box->data.p_stsc->i_first_chunk = 
-        calloc( sizeof( u32 ), p_box->data.p_stsc->i_entry_count );
+        calloc( sizeof( uint32_t ), p_box->data.p_stsc->i_entry_count );
     p_box->data.p_stsc->i_samples_per_chunk = 
-        calloc( sizeof( u32 ), p_box->data.p_stsc->i_entry_count );
+        calloc( sizeof( uint32_t ), p_box->data.p_stsc->i_entry_count );
     p_box->data.p_stsc->i_sample_description_index = 
-        calloc( sizeof( u32 ), p_box->data.p_stsc->i_entry_count );
+        calloc( sizeof( uint32_t ), p_box->data.p_stsc->i_entry_count );
 
     for( i = 0; (i < p_box->data.p_stsc->i_entry_count )&&( i_read >= 12 );i++ )
     {
@@ -1427,7 +1427,7 @@ int MP4_ReadBox_stco_co64( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
     MP4_GET4BYTES( p_box->data.p_co64->i_entry_count );
 
     p_box->data.p_co64->i_chunk_offset = 
-        calloc( sizeof( u64 ), p_box->data.p_co64->i_entry_count );
+        calloc( sizeof( uint64_t ), p_box->data.p_co64->i_entry_count );
 
     for( i = 0; i < p_box->data.p_co64->i_entry_count; i++ )
     {
@@ -1474,7 +1474,7 @@ int MP4_ReadBox_stss( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
     MP4_GET4BYTES( p_box->data.p_stss->i_entry_count );
 
     p_box->data.p_stss->i_sample_number = 
-        calloc( sizeof( u32 ), p_box->data.p_stss->i_entry_count );
+        calloc( sizeof( uint32_t ), p_box->data.p_stss->i_entry_count );
 
     for( i = 0; (i < p_box->data.p_stss->i_entry_count )&&( i_read >= 4 ); i++ )
     {
@@ -1510,10 +1510,10 @@ int MP4_ReadBox_stsh( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
     MP4_GET4BYTES( p_box->data.p_stsh->i_entry_count );
 
     p_box->data.p_stsh->i_shadowed_sample_number = 
-        calloc( sizeof( u32 ), p_box->data.p_stsh->i_entry_count );
+        calloc( sizeof( uint32_t ), p_box->data.p_stsh->i_entry_count );
 
     p_box->data.p_stsh->i_sync_sample_number = 
-        calloc( sizeof( u32 ), p_box->data.p_stsh->i_entry_count );
+        calloc( sizeof( uint32_t ), p_box->data.p_stsh->i_entry_count );
 
 
     for( i = 0; (i < p_box->data.p_stss->i_entry_count )&&( i_read >= 8 ); i++ )
@@ -1547,7 +1547,7 @@ int MP4_ReadBox_stdp( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
     MP4_GETVERSIONFLAGS( p_box->data.p_stdp );
 
     p_box->data.p_stdp->i_priority = 
-        calloc( sizeof( u16 ), i_read / 2 );
+        calloc( sizeof( uint16_t ), i_read / 2 );
 
     for( i = 0; i < i_read / 2 ; i++ )
     {
@@ -1581,13 +1581,13 @@ int MP4_ReadBox_padb( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
     MP4_GET4BYTES( p_box->data.p_padb->i_sample_count );
 
     p_box->data.p_padb->i_reserved1 = 
-        calloc( sizeof( u16 ), ( p_box->data.p_padb->i_sample_count + 1 ) / 2 );
+        calloc( sizeof( uint16_t ), ( p_box->data.p_padb->i_sample_count + 1 ) / 2 );
     p_box->data.p_padb->i_pad2 = 
-        calloc( sizeof( u16 ), ( p_box->data.p_padb->i_sample_count + 1 ) / 2 );
+        calloc( sizeof( uint16_t ), ( p_box->data.p_padb->i_sample_count + 1 ) / 2 );
     p_box->data.p_padb->i_reserved2 = 
-        calloc( sizeof( u16 ), ( p_box->data.p_padb->i_sample_count + 1 ) / 2 );
+        calloc( sizeof( uint16_t ), ( p_box->data.p_padb->i_sample_count + 1 ) / 2 );
     p_box->data.p_padb->i_pad1 = 
-        calloc( sizeof( u16 ), ( p_box->data.p_padb->i_sample_count + 1 ) / 2 );
+        calloc( sizeof( uint16_t ), ( p_box->data.p_padb->i_sample_count + 1 ) / 2 );
 
 
     for( i = 0; i < i_read / 2 ; i++ )
@@ -1629,13 +1629,13 @@ int MP4_ReadBox_elst( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
     MP4_GET4BYTES( p_box->data.p_elst->i_entry_count );
 
     p_box->data.p_elst->i_segment_duration =
-        calloc( sizeof( u64 ), p_box->data.p_elst->i_entry_count );
+        calloc( sizeof( uint64_t ), p_box->data.p_elst->i_entry_count );
     p_box->data.p_elst->i_media_time =
-        calloc( sizeof( u64 ), p_box->data.p_elst->i_entry_count );
+        calloc( sizeof( uint64_t ), p_box->data.p_elst->i_entry_count );
     p_box->data.p_elst->i_media_rate_integer =
-        calloc( sizeof( u16 ), p_box->data.p_elst->i_entry_count );
+        calloc( sizeof( uint16_t ), p_box->data.p_elst->i_entry_count );
     p_box->data.p_elst->i_media_rate_fraction= 
-        calloc( sizeof( u16 ), p_box->data.p_elst->i_entry_count );
+        calloc( sizeof( uint16_t ), p_box->data.p_elst->i_entry_count );
 
 
     for( i = 0; i < p_box->data.p_elst->i_entry_count; i++ )
@@ -1773,7 +1773,7 @@ int MP4_ReadBox_cmov( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
 #ifdef HAVE_ZLIB_H
     z_stream  z_data;
 #endif
-    u8 *p_data;
+    uint8_t *p_data;
     
     int i_result;
 
@@ -1906,7 +1906,7 @@ int MP4_ReadBox_cmov( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
 
 static struct 
 {
-    u32 i_type;
+    uint32_t i_type;
     int  (*MP4_ReadBox_function )( MP4_Stream_t *p_stream, MP4_Box_t *p_box ); 
     void (*MP4_FreeBox_function )( input_thread_t *p_input, MP4_Box_t *p_box );
 } MP4_Box_Function [] =
@@ -2059,7 +2059,7 @@ int MP4_ReadBox( MP4_Stream_t *p_stream, MP4_Box_t *p_box, MP4_Box_t *p_father )
  * MP4_CountBox: given a box, count how many child have the requested type 
  * FIXME : support GUUID 
  *****************************************************************************/
-int MP4_CountBox( MP4_Box_t *p_box, u32 i_type )
+int MP4_CountBox( MP4_Box_t *p_box, uint32_t i_type )
 {
     int i_count;
     MP4_Box_t *p_child;
@@ -2089,7 +2089,7 @@ int MP4_CountBox( MP4_Box_t *p_box, u32 i_type )
  *      return NULL if not found
  *****************************************************************************/
 
-MP4_Box_t *MP4_FindBox( MP4_Box_t *p_box, u32 i_type )
+MP4_Box_t *MP4_FindBox( MP4_Box_t *p_box, uint32_t i_type )
 {
     MP4_Box_t *p_child;
     
@@ -2140,7 +2140,7 @@ MP4_Box_t *MP4_FindNextBox( MP4_Box_t *p_box )
 /*****************************************************************************
  * MP4_FindNbBox:  find the box i_number
  *****************************************************************************/
-MP4_Box_t *MP4_FindNbBox( MP4_Box_t *p_box, u32 i_number )
+MP4_Box_t *MP4_FindNbBox( MP4_Box_t *p_box, uint32_t i_number )
 {
     MP4_Box_t *p_child = p_box->p_first;
     
@@ -2299,7 +2299,7 @@ static void __MP4_BoxDumpStructure( input_thread_t *p_input,
     {
         char str[512];
         int i;
-        memset( str, (u8)' ', 512 );
+        memset( str, (uint8_t)' ', 512 );
         for( i = 0; i < i_level; i++ )
         {
             str[i*5] = '|';
@@ -2309,7 +2309,7 @@ static void __MP4_BoxDumpStructure( input_thread_t *p_input,
                       (p_box->i_type>>8 ) &0xff,
                       (p_box->i_type>>16 ) &0xff,
                       (p_box->i_type>>24 ) &0xff,
-                      (u32)p_box->i_size );
+                      (uint32_t)p_box->i_size );
         
         msg_Dbg( p_input, "%s", str );
     }
@@ -2470,7 +2470,7 @@ static void __MP4_BoxGet( MP4_Box_t **pp_result,
         else
         if( strlen( psz_token ) == 4 )
         {
-            u32 i_fourcc;
+            uint32_t i_fourcc;
             i_fourcc = VLC_FOURCC( psz_token[0], psz_token[1],
                                    psz_token[2], psz_token[3] );
             p_box = p_box->p_first;
index 5f25e1837e5da3922c5cb966d7fb47b4ed6570d9..dc33d3df63608ad0431d5483cc58395fd7c5c1d8 100644 (file)
@@ -2,7 +2,7 @@
  * libmp4.h : LibMP4 library for mp4 module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: libmp4.h,v 1.3 2002/09/17 11:57:38 fenrir Exp $
+ * $Id: libmp4.h,v 1.4 2002/11/17 06:46:56 fenrir Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  * 
  * This program is free software; you can redistribute it and/or modify
 
 typedef struct MP4_Stream_s
 {
-    int b_memory;   /* do we uses a memory buffer */
+    int     b_memory;   /* do we uses a memory buffer */
 
     input_thread_t *p_input;
     
-    off_t i_start; /* in the buffer position for memory stream */
-    off_t i_stop;
-    u *p_buffer;
+    off_t   i_start; /* in the buffer position for memory stream */
+    off_t   i_stop;
+    uint8_t *p_buffer;
 
 } MP4_Stream_t;
     
@@ -131,38 +131,38 @@ struct MP4_Box_s;
 /* uuid Universal Unique IDentifiers */
 typedef struct UUID_s 
 {
-    u8 b[16];
+    uint8_t b[16];
 } UUID_t;
 
 /* specific structure for all boxes */
 
 typedef struct MP4_Box_data_ftyp_s
 {
-    u32 i_major_brand;
-    u32 i_minor_version;
+    uint32_t i_major_brand;
+    uint32_t i_minor_version;
 
-    u32 i_compatible_brands_count;
-    u32 *i_compatible_brands;
+    uint32_t i_compatible_brands_count;
+    uint32_t *i_compatible_brands;
 
 } MP4_Box_data_ftyp_t;
 
 typedef struct MP4_Box_data_mvhd_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
         
-    u64 i_creation_time;
-    u64 i_modification_time;
-    u32 i_timescale;
-    u64 i_duration;
-
-    s32 i_rate;
-    s16 i_volume;
-    s16 i_reserved1;
-    u32 i_reserved2[2];
-    s32 i_matrix[9];
-    u32 i_predefined[6];
-    u32 i_next_track_id;
+    uint64_t i_creation_time;
+    uint64_t i_modification_time;
+    uint32_t i_timescale;
+    uint64_t i_duration;
+
+    int32_t  i_rate;
+    int16_t  i_volume;
+    int16_t  i_reserved1;
+    uint32_t i_reserved2[2];
+    int32_t  i_matrix[9];
+    uint32_t i_predefined[6];
+    uint32_t i_next_track_id;
 
 } MP4_Box_data_mvhd_t;
 
@@ -171,51 +171,51 @@ typedef struct MP4_Box_data_mvhd_s
 #define MP4_TRACK_IN_PREVIEW 0x000004
 typedef struct MP4_Box_data_tkhd_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
         
-    u64 i_creation_time;
-    u64 i_modification_time;
-    u32 i_track_ID;
-    u32 i_reserved;
-    u64 i_duration;
-    
-    u32 i_reserved2[2];
-    s16 i_layer;
-    s16 i_predefined;
-    
-    s16 i_volume;
-    u16 i_reserved3;
-    s32 i_matrix[9];
-    s32 i_width;
-    s32 i_height;
+    uint64_t i_creation_time;
+    uint64_t i_modification_time;
+    uint32_t i_track_ID;
+    uint32_t i_reserved;
+    uint64_t i_duration;
+    
+    uint32_t i_reserved2[2];
+    int16_t  i_layer;
+    int16_t  i_predefined;
+    
+    int16_t  i_volume;
+    uint16_t i_reserved3;
+    int32_t  i_matrix[9];
+    int32_t  i_width;
+    int32_t  i_height;
     
 } MP4_Box_data_tkhd_t;
 
 typedef struct MP4_Box_data_mdhd_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
         
-    u64 i_creation_time;
-    u64 i_modification_time;
-    u32 i_timescale;
-    u64 i_duration;
+    uint64_t i_creation_time;
+    uint64_t i_modification_time;
+    uint32_t i_timescale;
+    uint64_t i_duration;
 
     /* one bit for pad */
     /* unsigned int(5)[3] language difference with 0x60*/
     unsigned char i_language[3]; 
-    u16 i_predefined;
+    uint16_t i_predefined;
 
 } MP4_Box_data_mdhd_t;
 
 typedef struct MP4_Box_data_hdlr_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
     
-    u32 i_predefined;
-    u32 i_handler_type; /* "vide" "soun" "hint" "odsm" 
+    uint32_t i_predefined;
+    uint32_t i_handler_type; /* "vide" "soun" "hint" "odsm" 
                            "crsm" "sdsm" "m7sm" "ocsm" 
                            "ipsm" "mjsm" */
     
@@ -225,41 +225,41 @@ typedef struct MP4_Box_data_hdlr_s
 
 typedef struct MP4_Box_data_vmhd_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
     
-    s16 i_graphics_mode;
-    s16 i_opcolor[3];    
+    int16_t  i_graphics_mode;
+    int16_t  i_opcolor[3];    
 
 } MP4_Box_data_vmhd_t;
 
 typedef struct MP4_Box_data_smhd_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
     
-    s16 i_balance;
-    s16 i_reserved;
+    int16_t  i_balance;
+    int16_t  i_reserved;
 
 } MP4_Box_data_smhd_t;
 
 typedef struct MP4_Box_data_hmhd_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
        
-    u16 i_max_PDU_size;
-    u16 i_avg_PDU_size;
-    u32 i_max_bitrate;
-    u32 i_avg_bitrate;
-    u32 i_reserved;
+    uint16_t i_max_PDU_size;
+    uint16_t i_avg_PDU_size;
+    uint32_t i_max_bitrate;
+    uint32_t i_avg_bitrate;
+    uint32_t i_reserved;
 
 } MP4_Box_data_hmhd_t;
 
 typedef struct MP4_Box_data_url_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
     
     unsigned char *psz_location;
     
@@ -267,8 +267,8 @@ typedef struct MP4_Box_data_url_s
 
 typedef struct MP4_Box_data_urn_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
 
     unsigned char *psz_name;
     unsigned char *psz_location;
@@ -277,89 +277,89 @@ typedef struct MP4_Box_data_urn_s
 
 typedef struct MP4_Box_data_dref_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
 
-    u32 i_entry_count;
+    uint32_t i_entry_count;
 /* XXX it's also a container with i_entry_count entry */
 } MP4_Box_data_dref_t;
 
 typedef struct MP4_Box_data_stts_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
 
-    u32 i_entry_count;
-    u32 *i_sample_count; /* these are array */
-    s32 *i_sample_delta;
+    uint32_t i_entry_count;
+    uint32_t *i_sample_count; /* these are array */
+    int32_t  *i_sample_delta;
 
 } MP4_Box_data_stts_t;
 
 typedef struct MP4_Box_data_ctts_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
     
-    u32 i_entry_count;
+    uint32_t i_entry_count;
 
-    u32 *i_sample_count; /* these are array */
-    s32 *i_sample_offset;
+    uint32_t *i_sample_count; /* these are array */
+    int32_t  *i_sample_offset;
 
 } MP4_Box_data_ctts_t;
 
 
 typedef struct MP4_Box_data_sample_soun_s
 {
-    u8  i_reserved1[6];
-    u16 i_data_reference_index;
+    uint8_t  i_reserved1[6];
+    uint16_t i_data_reference_index;
 
-    u32 i_reserved2[2];
-    u16 i_channelcount;
-    u16 i_samplesize;
-    u16 i_predefined;
-    u16 i_reserved3;
-    u16 i_sampleratehi; /* timescale of track */
-    u16 i_sampleratelo;
+    uint32_t i_reserved2[2];
+    uint16_t i_channelcount;
+    uint16_t i_samplesize;
+    uint16_t i_predefined;
+    uint16_t i_reserved3;
+    uint16_t i_sampleratehi; /* timescale of track */
+    uint16_t i_sampleratelo;
     
 } MP4_Box_data_sample_soun_t;
 
 typedef struct MP4_Box_data_sample_vide_s
 {
-    u8  i_reserved1[6];
-    u16 i_data_reference_index;
+    uint8_t  i_reserved1[6];
+    uint16_t i_data_reference_index;
 
-    u16 i_predefined1;
-    u16 i_reserved2;
-    u32 i_predefined2[3];
+    uint16_t i_predefined1;
+    uint16_t i_reserved2;
+    uint32_t i_predefined2[3];
 
-    s16 i_width;
-    s16 i_height;
+    int16_t  i_width;
+    int16_t  i_height;
 
-    u32 i_horizresolution;
-    u32 i_vertresolution;
+    uint32_t i_horizresolution;
+    uint32_t i_vertresolution;
 
-    u32 i_reserved3;
-    u16 i_predefined3;
+    uint32_t i_reserved3;
+    uint16_t i_predefined3;
     
-    u8  i_compressorname[32];
-    s16 i_depth;
+    uint8_t  i_compressorname[32];
+    int16_t  i_depth;
 
-    s16 i_predefined4;
+    int16_t  i_predefined4;
     
 } MP4_Box_data_sample_vide_t;
 
 typedef struct MP4_Box_data_sample_hint_s
 {
-    u8  i_reserved1[6];
-    u16 i_data_reference_index;
+    uint8_t  i_reserved1[6];
+    uint16_t i_data_reference_index;
 
-    u8 *p_data;
+    uint8_t *p_data;
 
 } MP4_Box_data_sample_hint_t;
 
 typedef struct MP4_Box_data_moviehintinformation_rtp_s
 {
-    u32 i_description_format;
+    uint32_t i_description_format;
     unsigned char *psz_text;
 
 } MP4_Box_data_moviehintinformation_rtp_t;
@@ -368,10 +368,10 @@ typedef struct MP4_Box_data_moviehintinformation_rtp_s
 
 typedef struct MP4_Box_data_stsd_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
     
-    u32 i_entry_count;
+    uint32_t i_entry_count;
 
     /* it contains SampleEntry handled as if it was Box */
     
@@ -380,98 +380,98 @@ typedef struct MP4_Box_data_stsd_s
 
 typedef struct MP4_Box_data_stsz_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
 
-    u32 i_sample_size;
-    u32 i_sample_count;
+    uint32_t i_sample_size;
+    uint32_t i_sample_count;
    
-    u32 *i_entry_size; /* array , empty if i_sample_size != 0 */
+    uint32_t *i_entry_size; /* array , empty if i_sample_size != 0 */
 
 } MP4_Box_data_stsz_t;
 
 typedef struct MP4_Box_data_stz2_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
 
-    u32 i_sample_size; /* 24 bits */
-    u8  i_field_size;
-    u32 i_sample_count;
+    uint32_t i_sample_size; /* 24 bits */
+    uint8_t  i_field_size;
+    uint32_t i_sample_count;
 
-    u32 *i_entry_size; /* array: unsigned int(i_field_size) entry_size */
+    uint32_t *i_entry_size; /* array: unsigned int(i_field_size) entry_size */
 
 } MP4_Box_data_stz2_t;
 
 typedef struct MP4_Box_data_stsc_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
 
-    u32 i_entry_count;
+    uint32_t i_entry_count;
 
-    u32 *i_first_chunk; /* theses are arrays */
-    u32 *i_samples_per_chunk;
-    u32 *i_sample_description_index;
+    uint32_t *i_first_chunk; /* theses are arrays */
+    uint32_t *i_samples_per_chunk;
+    uint32_t *i_sample_description_index;
     
 } MP4_Box_data_stsc_t;
 
 
 typedef struct MP4_Box_data_co64_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
 
-    u32 i_entry_count;
+    uint32_t i_entry_count;
     
-    u64 *i_chunk_offset;
+    uint64_t *i_chunk_offset;
 
 } MP4_Box_data_co64_t;
 
 
 typedef struct MP4_Box_data_stss_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
     
-    u32 i_entry_count;
+    uint32_t i_entry_count;
     
-    u32 *i_sample_number;
+    uint32_t *i_sample_number;
     
 } MP4_Box_data_stss_t;
 
 typedef struct MP4_Box_data_stsh_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
 
-    u32 i_entry_count;
+    uint32_t i_entry_count;
     
-    u32 *i_shadowed_sample_number;
-    u32 *i_sync_sample_number;
+    uint32_t *i_shadowed_sample_number;
+    uint32_t *i_sync_sample_number;
 
 } MP4_Box_data_stsh_t;
 
 typedef struct MP4_Box_data_stdp_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
 
-    u16 *i_priority;
+    uint16_t *i_priority;
 
 } MP4_Box_data_stdp_t;
 
 typedef struct MP4_Box_data_padb_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
 
-    u32 i_sample_count;
+    uint32_t i_sample_count;
 
-    u16 *i_reserved1;   /* 1bit  */
-    u16 *i_pad2;        /* 3bits */
-    u16 *i_reserved2;   /* 1bit  */
-    u16 *i_pad1;        /* 3bits */
+    uint16_t *i_reserved1;   /* 1bit  */
+    uint16_t *i_pad2;        /* 3bits */
+    uint16_t *i_reserved2;   /* 1bit  */
+    uint16_t *i_pad1;        /* 3bits */
     
 
 } MP4_Box_data_padb_t;
@@ -479,23 +479,23 @@ typedef struct MP4_Box_data_padb_s
 
 typedef struct MP4_Box_data_elst_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
 
-    u32 i_entry_count;
+    uint32_t i_entry_count;
 
-    u64 *i_segment_duration;
-    s64 *i_media_time;
-    u16 *i_media_rate_integer;
-    u16 *i_media_rate_fraction;
+    uint64_t *i_segment_duration;
+    int64_t  *i_media_time;
+    uint16_t *i_media_rate_integer;
+    uint16_t *i_media_rate_fraction;
 
     
 } MP4_Box_data_elst_t;
 
 typedef struct MP4_Box_data_cprt_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
     /* 1 pad bit */
     unsigned char i_language[3];
     
@@ -506,15 +506,15 @@ typedef struct MP4_Box_data_cprt_s
 /* DecoderConfigDescriptor */
 typedef struct MP4_descriptor_decoder_config_s
 {
-    u i_objectTypeIndication;
-    u i_streamType;
-    int b_upStream;
-    int i_buffer_sizeDB;
-    int i_max_bitrate;
-    int i_avg_bitrate;
+    uint8_t i_objectTypeIndication;
+    uint8_t i_streamType;
+    int     b_upStream;
+    int     i_buffer_sizeDB;
+    int     i_max_bitrate;
+    int     i_avg_bitrate;
     
-    int i_decoder_specific_info_len;
-    u *p_decoder_specific_info;
+    int     i_decoder_specific_info_len;
+    uint8_t *p_decoder_specific_info;
     /* some other stuff */
     
 } MP4_descriptor_decoder_config_t;
@@ -529,17 +529,17 @@ typedef struct MP4_descriptor_SL_config_s
 
 typedef struct MP4_descriptor_ES_s
 {
-    u16 i_ES_ID;
-    int b_stream_dependence;
-    int b_url;
-    int b_OCRstream;
-    int i_stream_priority;
+    uint16_t i_ES_ID;
+    int      b_stream_dependence;
+    int      b_url;
+    int      b_OCRstream;
+    int      i_stream_priority;
 
-    int i_depend_on_ES_ID; /* if b_stream_dependence set */
+    int      i_depend_on_ES_ID; /* if b_stream_dependence set */
 
     unsigned char *psz_URL;
 
-    u16 i_OCR_ES_ID;       /* if b_OCRstream */
+    uint16_t i_OCR_ES_ID;       /* if b_OCRstream */
     MP4_descriptor_decoder_config_t *p_decConfigDescr;
     
     MP4_descriptor_SL_config_t *p_slConfigDescr;
@@ -551,8 +551,8 @@ typedef struct MP4_descriptor_ES_s
 /* ES descriptor */
 typedef struct MP4_Box_data_esds_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
     
     MP4_descriptor_ES_t es_descriptor;
     
@@ -561,17 +561,17 @@ typedef struct MP4_Box_data_esds_s
 
 typedef struct MP4_Box_data_dcom_s
 {
-    u32 i_algorithm; /* fourcc */
+    uint32_t i_algorithm; /* fourcc */
     
 } MP4_Box_data_dcom_t;
 
 typedef struct MP4_Box_data_cmvd_s
 {
-    u32 i_uncompressed_size;
-    u32 i_compressed_size;
+    uint32_t i_uncompressed_size;
+    uint32_t i_compressed_size;
 
-    int b_compressed; /* Set to 1 if compressed data, 0 if uncompressed */
-    u8 *p_data;
+    int     b_compressed; /* Set to 1 if compressed data, 0 if uncompressed */
+    uint8_t *p_data;
 
 } MP4_Box_data_cmvd_t;
 
@@ -584,8 +584,8 @@ typedef struct MP4_Box_data_cmov_s
 /*
 typedef struct MP4_Box_data_cmov_s
 {
-    u8  i_version;
-    u32 i_flags;
+    uint8_t  i_version;
+    uint32_t i_flags;
 
 } MP4_Box_data__t;
 
@@ -638,14 +638,14 @@ typedef union MP4_Box_data_s
 /* the most basic structure */
 typedef struct MP4_Box_s
 {
-    off_t   i_pos;      /* absolute position */
+    off_t        i_pos;      /* absolute position */
     
-    u32     i_type;
-    u32     i_shortsize;
+    uint32_t     i_type;
+    uint32_t     i_shortsize;
 
-    UUID_t  i_uuid;  /* Set if i_type == "uuid" */
+    UUID_t       i_uuid;  /* Set if i_type == "uuid" */
     
-    u64     i_size; /* always set so use it */
+    uint64_t     i_size; /* always set so use it */
 
     MP4_Box_data_t   data;   /* union of pointers on extended data depending    
                                 on i_type (or i_usertype) */
@@ -671,7 +671,7 @@ typedef struct MP4_Box_s
 
 off_t MP4_TellAbsolute( input_thread_t *p_input );
 int   MP4_SeekAbsolute( input_thread_t *p_input, off_t i_pos);
-int   MP4_ReadData( input_thread_t *p_input, u8 *p_buff, int i_size );
+int   MP4_ReadData( input_thread_t *p_input, uint8_t *p_buff, int i_size );
 
 /*****************************************************************************
  * MP4_BoxGetRoot : Parse the entire file, and create all boxes in memory
@@ -734,14 +734,14 @@ int MP4_BoxCount( MP4_Box_t *p_box, char *psz_fmt, ... );
  * MP4_CountBox: given a box, count how many child have the requested type 
  * FIXME : support GUUID 
  *****************************************************************************/
-int MP4_CountBox( MP4_Box_t *p_box, u32 i_type );
+int MP4_CountBox( MP4_Box_t *p_box, uint32_t i_type );
 #endif
 
 /*****************************************************************************
  * MP4_FindBox:  find first box with i_type child of p_box
  *      return NULL if not found
  *****************************************************************************/
-MP4_Box_t *MP4_FindBox( MP4_Box_t *p_box, u32 i_type );
+MP4_Box_t *MP4_FindBox( MP4_Box_t *p_box, uint32_t i_type );
 
 #if 0
 /*****************************************************************************
@@ -753,7 +753,7 @@ MP4_Box_t *MP4_FindNextBox( MP4_Box_t *p_box );
 /*****************************************************************************
  * MP4_FindNbBox:  find the box i_number 
  *****************************************************************************/
-MP4_Box_t *MP4_FindNbBox( MP4_Box_t *p_box, u32 i_number );
+MP4_Box_t *MP4_FindNbBox( MP4_Box_t *p_box, uint32_t i_number );
 #endif
 
 /*---------------------------------------------------------------------------*/
@@ -780,19 +780,19 @@ MP4_Stream_t *MP4_InputStream( input_thread_t *p_input );
  *
  ****************************************************************************/
 MP4_Stream_t *MP4_MemoryStream( input_thread_t *p_input,
-                                int i_size, u8 *p_buffer );
+                                int i_size, uint8_t *p_buffer );
 
 /****************************************************************************
  * MP4_ReadStream read from a MP4_Stream_t
  *
  ****************************************************************************/
-int MP4_ReadStream( MP4_Stream_t *p_stream, u8 *p_buff, int i_size );
+int MP4_ReadStream( MP4_Stream_t *p_stream, uint8_t *p_buff, int i_size );
 
 /****************************************************************************
  * MP4_PeekStream guess it ;)
  *
  ****************************************************************************/
-int MP4_PeekStream( MP4_Stream_t *p_stream, u8 **pp_peek, int i_size );
+int MP4_PeekStream( MP4_Stream_t *p_stream, uint8_t **pp_peek, int i_size );
     
 /****************************************************************************
  * MP4_TellStream give absolute position in the stream
index d0eaec0690b7827a1993ab5a1f2b5a6e2e71f7d5..263f579a07ca9b82f79d926aac63ede961a465a8 100644 (file)
@@ -2,7 +2,7 @@
  * mp4.c : MP4 file input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: mp4.c,v 1.4 2002/09/17 11:57:38 fenrir Exp $
+ * $Id: mp4.c,v 1.5 2002/11/17 06:46:56 fenrir Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  * 
  * This program is free software; you can redistribute it and/or modify
@@ -73,14 +73,14 @@ static int  MP4_ReadSample();
 static int  MP4_DecodeSample();
 
 #define MP4_Set4BytesLE( p, dw ) \
-    *((u8*)p)   = ( (dw)&0xff ); \
-    *((u8*)p+1) = ( ((dw)>> 8)&0xff ); \
-    *((u8*)p+2) = ( ((dw)>>16)&0xff ); \
-    *((u8*)p+3) = ( ((dw)>>24)&0xff )
+    *((uint8_t*)p)   = ( (dw)&0xff ); \
+    *((uint8_t*)p+1) = ( ((dw)>> 8)&0xff ); \
+    *((uint8_t*)p+2) = ( ((dw)>>16)&0xff ); \
+    *((uint8_t*)p+3) = ( ((dw)>>24)&0xff )
 
 #define MP4_Set2BytesLE( p, dw ) \
-    *((u8*)p) = ( (dw)&0xff ); \
-    *((u8*)p+1) = ( ((dw)>> 8)&0xff )
+    *((uint8_t*)p) = ( (dw)&0xff ); \
+    *((uint8_t*)p+1) = ( ((dw)>> 8)&0xff )
 
     
 /*****************************************************************************
@@ -88,19 +88,19 @@ static int  MP4_DecodeSample();
  *****************************************************************************/
 static int MP4Init( vlc_object_t * p_this )
 {   
-    input_thread_t *p_input = (input_thread_t *)p_this;
-    u8  *p_peek;
-    u32 i_type;
+    input_thread_t  *p_input = (input_thread_t *)p_this;
+    uint8_t         *p_peek;
+    uint32_t        i_type;
     
-    demux_sys_t *p_demux;
+    demux_sys_t     *p_demux;
     
-    MP4_Box_t *p_ftyp;
+    MP4_Box_t       *p_ftyp;
 
 
-    MP4_Box_t *p_mvhd;
-    MP4_Box_t *p_trak;
+    MP4_Box_t       *p_mvhd;
+    MP4_Box_t       *p_trak;
 
-    int i;
+    int             i;
     /* I need to seek */
     if( !p_input->stream.b_seekable )
     {
@@ -351,7 +351,6 @@ static int MP4Demux( input_thread_t *p_input )
         {
             continue; /* no need to read something */
         }
-
         while( MP4_GetTrackPTS( &p_demux->track[i_track] ) <
                         MP4_GetMoviePTS( p_demux ) )
         {
@@ -769,13 +768,13 @@ static int MP4_CreateSamplesIndex( input_thread_t *p_input,
                           as a unique type */
     /* TODO use also stss and stsh table for seeking */
     /* FIXME use edit table */
-    int i_sample;
-    int i_chunk;
+    int64_t i_sample;
+    int64_t i_chunk;
 
-    int i_index;
-    int i_index_sample_used;
+    int64_t i_index;
+    int64_t i_index_sample_used;
 
-    u64 i_last_dts; 
+    int64_t i_last_dts; 
     
     p_stts = MP4_BoxGet( p_demux_track->p_stbl, "stts" );
     p_stsz = MP4_BoxGet( p_demux_track->p_stbl, "stsz" ); /* FIXME and stz2 */
@@ -802,7 +801,7 @@ static int MP4_CreateSamplesIndex( input_thread_t *p_input,
         /* 2: each sample can have a different size */
         p_demux_track->i_sample_size = 0;
         p_demux_track->p_sample_size = 
-            calloc( p_demux_track->i_sample_count, sizeof( u32 ) );
+            calloc( p_demux_track->i_sample_count, sizeof( uint32_t ) );
         
         for( i_sample = 0; i_sample < p_demux_track->i_sample_count; i_sample++ )
         {
@@ -819,18 +818,20 @@ static int MP4_CreateSamplesIndex( input_thread_t *p_input,
         
     i_last_dts = 0;
     i_index = 0; i_index_sample_used =0;
+
     /* create and init last data for each chunk */
     for(i_chunk = 0 ; i_chunk < p_demux_track->i_chunk_count; i_chunk++ )
     {
 
-        int i_entry, i_sample_count, i;
+        int64_t i_entry, i_sample_count, i;
         /* save last dts */
         p_demux_track->chunk[i_chunk].i_first_dts = i_last_dts;
     /* count how many entries needed for this chunk 
        for p_sample_delta_dts and p_sample_count_dts */
 
-        i_entry = 0;
         i_sample_count = p_demux_track->chunk[i_chunk].i_sample_count;
+
+        i_entry = 0;
         while( i_sample_count > 0 )
         {
             i_sample_count -= p_stts->data.p_stts->i_sample_count[i_index+i_entry];
@@ -841,24 +842,26 @@ static int MP4_CreateSamplesIndex( input_thread_t *p_input,
             }
             i_entry++;
         }
+
         /* allocate them */
         p_demux_track->chunk[i_chunk].p_sample_count_dts = 
-            calloc( i_entry, sizeof( u32 ) );
+            calloc( i_entry, sizeof( uint32_t ) );
         p_demux_track->chunk[i_chunk].p_sample_delta_dts =
-            calloc( i_entry, sizeof( u32 ) );
+            calloc( i_entry, sizeof( uint32_t ) );
 
         /* now copy */
         i_sample_count = p_demux_track->chunk[i_chunk].i_sample_count;
         for( i = 0; i < i_entry; i++ )
         {
-            int i_used;
-            int i_rest;
+            int64_t i_used;
+            int64_t i_rest;
             
             i_rest = p_stts->data.p_stts->i_sample_count[i_index] - i_index_sample_used;
 
             i_used = __MIN( i_rest, i_sample_count );
 
             i_index_sample_used += i_used;
+            i_sample_count -= i_used;
 
             p_demux_track->chunk[i_chunk].p_sample_count_dts[i] = i_used;
 
@@ -871,6 +874,7 @@ static int MP4_CreateSamplesIndex( input_thread_t *p_input,
             if( i_index_sample_used >=
                              p_stts->data.p_stts->i_sample_count[i_index] )
             {
+
                 i_index++;
                 i_index_sample_used = 0;
             }
@@ -879,9 +883,10 @@ static int MP4_CreateSamplesIndex( input_thread_t *p_input,
     }
 
     msg_Dbg( p_input, 
-             "track[Id 0x%x] read %d samples", 
+             "track[Id 0x%x] read %d samples length:"I64Fd"s", 
              p_demux_track->i_track_ID,
-             p_demux_track->i_sample_count );
+             p_demux_track->i_sample_count,
+             i_last_dts / p_demux_track->i_timescale );
 
     return( 1 );
 }
@@ -889,16 +894,16 @@ static int MP4_CreateSamplesIndex( input_thread_t *p_input,
 static void MP4_StartDecoder( input_thread_t *p_input,
                                  track_data_mp4_t *p_demux_track )
 {
-    MP4_Box_t *p_sample;
-    int i;
-    int i_chunk;
+    MP4_Box_t   *p_sample;
+    int         i;
+    int         i_chunk;
 
-    int i_decoder_specific_info_len;
-    u8  *p_decoder_specific_info;
+    int         i_decoder_specific_info_len;
+    uint8_t     *p_decoder_specific_info;
     
-    u8  *p_init;
+    uint8_t     *p_init;
  
-    MP4_Box_t *p_esds;
+    MP4_Box_t   *p_esds;
 
     
     if( (!p_demux_track->b_ok )||( p_demux_track->i_cat == UNKNOWN_ES ) )
index 176c95c3c16a355acfb4016a73ba7b65a41e2a17..1ab16bc973fb37c0cb8646cc31dfcb37495c2728 100644 (file)
@@ -2,7 +2,7 @@
  * mp4.h : MP4 file input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: mp4.h,v 1.3 2002/09/17 11:57:38 fenrir Exp $
+ * $Id: mp4.h,v 1.4 2002/11/17 06:46:56 fenrir Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  * 
  * This program is free software; you can redistribute it and/or modify
  *****************************************************************************/
 typedef struct bitmapinfoheader_s
 {
-    u32 i_size; /* size of header 40 + size of data follwoing this header */
-    u32 i_width;
-    u32 i_height;
-    u16 i_planes;
-    u16 i_bitcount;
-    u32 i_compression;
-    u32 i_sizeimage;
-    u32 i_xpelspermeter;
-    u32 i_ypelspermeter;
-    u32 i_clrused;
-    u32 i_clrimportant;
+    uint32_t i_size; /* size of header 40 + size of data follwoing this header */
+    uint32_t i_width;
+    uint32_t i_height;
+    uint16_t i_planes;
+    uint16_t i_bitcount;
+    uint32_t i_compression;
+    uint32_t i_sizeimage;
+    uint32_t i_xpelspermeter;
+    uint32_t i_ypelspermeter;
+    uint32_t i_clrused;
+    uint32_t i_clrimportant;
 } bitmapinfoheader_t;
 
 typedef struct waveformatex_s
 {
-    u16 i_format;
-    u16 i_channels;
-    u32 i_samplepersec;
-    u32 i_avgbytespersec;
-    u16 i_blockalign;
-    u16 i_bitspersample;
-    u16 i_size;          /* This give size of data 
+    uint16_t i_format;
+    uint16_t i_channels;
+    uint32_t i_samplepersec;
+    uint32_t i_avgbytespersec;
+    uint16_t i_blockalign;
+    uint16_t i_bitspersample;
+    uint16_t i_size;          /* This give size of data 
                             imediatly following this header. */
 } waveformatex_t;
 
@@ -57,18 +57,18 @@ typedef struct waveformatex_s
  *****************************************************************************/
 typedef struct chunk_data_mp4_s
 {
-    u64     i_offset; /* absolute position of this chunk in the file */
-    u32     i_sample_description_index; /* index for SampleEntry to use */
-    u32     i_sample_count; /* how many samples in this chunk */
-    u32     i_sample_first; /* index of the first sample in this chunk */
+    uint64_t     i_offset; /* absolute position of this chunk in the file */
+    uint32_t     i_sample_description_index; /* index for SampleEntry to use */
+    uint32_t     i_sample_count; /* how many samples in this chunk */
+    uint32_t     i_sample_first; /* index of the first sample in this chunk */
 
     /* now provide way to calculate pts, dts, and offset without to 
         much memory and with fast acces */
 
     /* with this we can calculate dts/pts without waste memory */
-    u64     i_first_dts;
-    u32     *p_sample_count_dts;
-    u32     *p_sample_delta_dts; /* dts delta */
+    uint64_t     i_first_dts;
+    uint32_t     *p_sample_count_dts;
+    uint32_t     *p_sample_delta_dts; /* dts delta */
 
     /* TODO if needed add pts 
         but quickly *add* support for edts and seeking */
@@ -93,22 +93,22 @@ typedef struct track_data_mp4_s
     int         i_height;
  
     /* more internal data */    
-    u64         i_timescale;  /* time scale for this track only */
+    uint64_t         i_timescale;  /* time scale for this track only */
 
     /* give the next sample to read, i_chunk is to find quickly where 
       the sample is located */
-    u32         i_sample;       /* next sample to read */
-    u32         i_chunk;        /* chunk where next sample is stored */
+    uint32_t         i_sample;       /* next sample to read */
+    uint32_t         i_chunk;        /* chunk where next sample is stored */
     /* total count of chunk and sample */
-    u32         i_chunk_count;  
-    u32         i_sample_count;
+    uint32_t         i_chunk_count;  
+    uint32_t         i_sample_count;
     
     chunk_data_mp4_t    *chunk; /* always defined  for each chunk */
     
     /* sample size, p_sample_size defined only if i_sample_size == 0 
         else i_sample_size is size for all sample */
-    u32         i_sample_size;
-    u32         *p_sample_size; /* XXX perhaps add file offset if take 
+    uint32_t         i_sample_size;
+    uint32_t         *p_sample_size; /* XXX perhaps add file offset if take 
                                     too much time to do sumations each time*/
     
     es_descriptor_t *p_es; /* vlc es for this track */
@@ -130,19 +130,19 @@ struct demux_sys_t
 
     mtime_t     i_pcr;
     
-    u64         i_time;         /* time position of the presentation in movie timescale */
-    u64         i_timescale;    /* movie time scale */
-    u64         i_duration;     /* movie duration */
-    int i_tracks;               /* number of track */  
-    track_data_mp4_t *track; /* array of track */
+    uint64_t    i_time;         /* time position of the presentation in movie timescale */
+    uint64_t    i_timescale;    /* movie time scale */
+    uint64_t    i_duration;     /* movie duration */
+    int         i_tracks;       /* number of track */  
+    track_data_mp4_t *track;    /* array of track */
     
   
 };
 
-static inline u64 MP4_GetTrackPos( track_data_mp4_t *p_track )
+static inline uint64_t MP4_GetTrackPos( track_data_mp4_t *p_track )
 {
-    int i_sample;
-    u64 i_pos;
+    int      i_sample;
+    uint64_t i_pos;
 
 
     i_pos = p_track->chunk[p_track->i_chunk].i_offset;
@@ -168,9 +168,9 @@ static inline u64 MP4_GetTrackPos( track_data_mp4_t *p_track )
 /* Return time in µs of a track */
 static inline mtime_t MP4_GetTrackPTS( track_data_mp4_t *p_track )
 {
-    int i_sample;
-    int i_index;
-    u64 i_dts;
+    int      i_sample;
+    int      i_index;
+    uint64_t i_dts;
     
     i_sample = p_track->i_sample - p_track->chunk[p_track->i_chunk].i_sample_first;
     i_dts = p_track->chunk[p_track->i_chunk].i_first_dts;
index 923ced51d4e17a58293d2cf125b73bced95127b6..a22d79ea56527d5e60f0003002ca0fa1bb91569c 100644 (file)
@@ -2,7 +2,7 @@
  * objects.c: vlc_object_t handling
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: objects.c,v 1.28 2002/11/09 16:34:53 sam Exp $
+ * $Id: objects.c,v 1.29 2002/11/17 06:46:56 fenrir Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -39,6 +39,7 @@
 
 #include "audio_output.h"
 #include "aout_internal.h"
+#include "stream_output.h"
 
 #include "vlc_playlist.h"
 #include "interface.h"
@@ -114,6 +115,10 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type )
             i_size = sizeof(aout_instance_t);
             psz_type = "audio output";
             break;
+        case VLC_OBJECT_SOUT:
+            i_size = sizeof(sout_instance_t);
+            psz_type = "stream output";
+            break;
         default:
             i_size = i_type > 0
                       ? i_type > sizeof(vlc_object_t)