]> git.sesse.net Git - vlc/blobdiff - modules/demux/mp4/libmp4.h
* modules/demux/mp4, modules/codec/ffmpeg: support for Apple Lossless Audio Codec.
[vlc] / modules / demux / mp4 / libmp4.h
index 42f8c37d4e64e7df2efe1bd75a8d2f8fc4844276..0bc7899b5348c07a0ed73eb559f0803f3e60a047 100644 (file)
@@ -1,15 +1,15 @@
 /*****************************************************************************
  * libmp4.h : LibMP4 library for mp4 module for vlc
  *****************************************************************************
- * Copyright (C) 2001 VideoLAN
- * $Id: libmp4.h,v 1.15 2003/08/17 20:45:50 fenrir Exp $
+ * Copyright (C) 2001-2004 VideoLAN
+ * $Id$
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -28,7 +28,7 @@
 #define FOURCC_cmov VLC_FOURCC( 'c', 'm', 'o', 'v' )
 #define FOURCC_dcom VLC_FOURCC( 'd', 'c', 'o', 'm' )
 #define FOURCC_cmvd VLC_FOURCC( 'c', 'm', 'v', 'd' )
-    
+
 #define FOURCC_moof VLC_FOURCC( 'm', 'o', 'o', 'f' )
 #define FOURCC_mdat VLC_FOURCC( 'm', 'd', 'a', 't' )
 #define FOURCC_skip VLC_FOURCC( 's', 'k', 'i', 'p' )
 #define FOURCC_ulaw VLC_FOURCC( 'u', 'l', 'a', 'w' )
 #define FOURCC_Qclp VLC_FOURCC( 'Q', 'c', 'l', 'p' )
 #define FOURCC_samr VLC_FOURCC( 's', 'a', 'm', 'r' )
+#define FOURCC_sawb VLC_FOURCC( 's', 'a', 'w', 'b' )
 #define FOURCC_OggS VLC_FOURCC( 'O', 'g', 'g', 'S' )
+#define FOURCC_alac VLC_FOURCC( 'a', 'l', 'a', 'c' )
 
 #define FOURCC_zlib VLC_FOURCC( 'z', 'l', 'i', 'b' )
 #define FOURCC_SVQ1 VLC_FOURCC( 'S', 'V', 'Q', '1' )
 #define FOURCC_h263 VLC_FOURCC( 'h', '2', '6', '3' )
 #define FOURCC_s263 VLC_FOURCC( 's', '2', '6', '3' )
 #define FOURCC_DIVX VLC_FOURCC( 'D', 'I', 'V', 'X' )
+#define FOURCC_XVID VLC_FOURCC( 'X', 'V', 'I', 'D' )
 #define FOURCC_cvid VLC_FOURCC( 'c', 'v', 'i', 'd' )
 #define FOURCC_mjpa VLC_FOURCC( 'm', 'j', 'p', 'a' )
 #define FOURCC_mjpb VLC_FOURCC( 'm', 'j', 'q', 't' )
 #define FOURCC_mjht VLC_FOURCC( 'm', 'j', 'p', 'b' )
 #define FOURCC_VP31 VLC_FOURCC( 'V', 'P', '3', '1' )
 #define FOURCC_vp31 VLC_FOURCC( 'v', 'p', '3', '1' )
+#define FOURCC_h264 VLC_FOURCC( 'h', '2', '6', '4' )
+
+#define FOURCC_avc1 VLC_FOURCC( 'a', 'v', 'c', '1' )
+#define FOURCC_avcC VLC_FOURCC( 'a', 'v', 'c', 'C' )
+#define FOURCC_m4ds VLC_FOURCC( 'm', '4', 'd', 's' )
 
 #define FOURCC_dvc  VLC_FOURCC( 'd', 'v', 'c', ' ' )
 #define FOURCC_dvp  VLC_FOURCC( 'd', 'v', 'p', ' ' )
 #define FOURCC_alis VLC_FOURCC( 'a', 'l', 'i', 's' )
 
 #define FOURCC_gmhd VLC_FOURCC( 'g', 'm', 'h', 'd' )
+#define FOURCC_wave VLC_FOURCC( 'w', 'a', 'v', 'e' )
+
+#define FOURCC_drms VLC_FOURCC( 'd', 'r', 'm', 's' )
+#define FOURCC_sinf VLC_FOURCC( 's', 'i', 'n', 'f' )
+#define FOURCC_schi VLC_FOURCC( 's', 'c', 'h', 'i' )
+#define FOURCC_user VLC_FOURCC( 'u', 's', 'e', 'r' )
+#define FOURCC_key  VLC_FOURCC( 'k', 'e', 'y', ' ' )
+#define FOURCC_iviv VLC_FOURCC( 'i', 'v', 'i', 'v' )
+#define FOURCC_name VLC_FOURCC( 'n', 'a', 'm', 'e' )
+#define FOURCC_priv VLC_FOURCC( 'p', 'r', 'i', 'v' )
+
+#define FOURCC_text VLC_FOURCC( 't', 'e', 'x', 't' )
+#define FOURCC_subp VLC_FOURCC( 's', 'u', 'b', 'p' )
+
+#define FOURCC_0xa9nam VLC_FOURCC( 0xa9, 'n', 'a', 'm' )
+#define FOURCC_0xa9aut VLC_FOURCC( 0xa9, 'a', 'u', 't' )
+#define FOURCC_0xa9swr VLC_FOURCC( 0xa9, 's', 'w', 'r' )
+#define FOURCC_0xa9cpy VLC_FOURCC( 0xa9, 'c', 'p', 'y' )
+#define FOURCC_0xa9inf VLC_FOURCC( 0xa9, 'i', 'n', 'f' )
+#define FOURCC_0xa9ART VLC_FOURCC( 0xa9, 'A', 'R', 'T' )
+#define FOURCC_0xa9des VLC_FOURCC( 0xa9, 'd', 'e', 's' )
+#define FOURCC_0xa9dir VLC_FOURCC( 0xa9, 'd', 'i', 'r' )
+#define FOURCC_0xa9cmt VLC_FOURCC( 0xa9, 'c', 'm', 't' )
+#define FOURCC_0xa9req VLC_FOURCC( 0xa9, 'r', 'e', 'q' )
+#define FOURCC_0xa9day VLC_FOURCC( 0xa9, 'd', 'a', 'y' )
+#define FOURCC_0xa9fmt VLC_FOURCC( 0xa9, 'f', 'm', 't' )
+#define FOURCC_0xa9prd VLC_FOURCC( 0xa9, 'p', 'r', 'd' )
+#define FOURCC_0xa9prf VLC_FOURCC( 0xa9, 'p', 'r', 'f' )
+#define FOURCC_0xa9src VLC_FOURCC( 0xa9, 's', 'r', 'c' )
+#define FOURCC_0xa9alb VLC_FOURCC( 0xa9, 'a', 'l', 'b' )
+#define FOURCC_0xa9dis VLC_FOURCC( 0xa9, 'd', 'i', 's' )
+#define FOURCC_0xa9enc VLC_FOURCC( 0xa9, 'e', 'n', 'c' )
+#define FOURCC_0xa9trk VLC_FOURCC( 0xa9, 't', 'r', 'k' )
+#define FOURCC_0xa9url VLC_FOURCC( 0xa9, 'u', 'r', 'l' )
+#define FOURCC_0xa9dsa VLC_FOURCC( 0xa9, 'd', 's', 'a' )
+#define FOURCC_0xa9hst VLC_FOURCC( 0xa9, 'h', 's', 't' )
+#define FOURCC_0xa9ope VLC_FOURCC( 0xa9, 'o', 'p', 'e' )
+#define FOURCC_0xa9wrt VLC_FOURCC( 0xa9, 'w', 'r', 't' )
+#define FOURCC_0xa9com VLC_FOURCC( 0xa9, 'c', 'o', 'm' )
+#define FOURCC_0xa9gen VLC_FOURCC( 0xa9, 'g', 'e', 'n' )
+#define FOURCC_WLOC VLC_FOURCC( 'W', 'L', 'O', 'C' )
 
 /* Do you want some debug information on all read boxes ? */
 #define MP4_VERBOSE  1
 
-/* memory stream and file stream object */
 
-typedef struct MP4_Stream_s
-{
-    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;
-    uint8_t *p_buffer;
-
-} MP4_Stream_t;
-    
 struct MP4_Box_s;
 
 
 /* uuid Universal Unique IDentifiers */
-typedef struct UUID_s 
+typedef struct UUID_s
 {
     uint8_t b[16];
 } UUID_t;
@@ -195,7 +231,7 @@ typedef struct MP4_Box_data_mvhd_s
 {
     uint8_t  i_version;
     uint32_t i_flags;
-        
+
     uint64_t i_creation_time;
     uint64_t i_modification_time;
     uint32_t i_timescale;
@@ -218,30 +254,30 @@ typedef struct MP4_Box_data_tkhd_s
 {
     uint8_t  i_version;
     uint32_t i_flags;
-        
+
     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
 {
     uint8_t  i_version;
     uint32_t i_flags;
-        
+
     uint64_t i_creation_time;
     uint64_t i_modification_time;
     uint32_t i_timescale;
@@ -249,7 +285,7 @@ typedef struct MP4_Box_data_mdhd_s
 
     /* one bit for pad */
     /* unsigned int(5)[3] language difference with 0x60*/
-    unsigned char i_language[3]; 
+    unsigned char i_language[3];
     uint16_t i_predefined;
 
 } MP4_Box_data_mdhd_t;
@@ -258,12 +294,12 @@ typedef struct MP4_Box_data_hdlr_s
 {
     uint8_t  i_version;
     uint32_t i_flags;
-    
+
     uint32_t i_predefined;
-    uint32_t i_handler_type; /* "vide" "soun" "hint" "odsm" 
-                           "crsm" "sdsm" "m7sm" "ocsm" 
+    uint32_t i_handler_type; /* "vide" "soun" "hint" "odsm"
+                           "crsm" "sdsm" "m7sm" "ocsm"
                            "ipsm" "mjsm" */
-    
+
     unsigned char *psz_name; /* in UTF-8 */
 
 } MP4_Box_data_hdlr_t;
@@ -272,9 +308,9 @@ typedef struct MP4_Box_data_vmhd_s
 {
     uint8_t  i_version;
     uint32_t i_flags;
-    
+
     int16_t  i_graphics_mode;
-    int16_t  i_opcolor[3];    
+    int16_t  i_opcolor[3];
 
 } MP4_Box_data_vmhd_t;
 
@@ -282,7 +318,7 @@ typedef struct MP4_Box_data_smhd_s
 {
     uint8_t  i_version;
     uint32_t i_flags;
-    
+
     int16_t  i_balance;
     int16_t  i_reserved;
 
@@ -292,7 +328,7 @@ typedef struct MP4_Box_data_hmhd_s
 {
     uint8_t  i_version;
     uint32_t i_flags;
-       
+
     uint16_t i_max_PDU_size;
     uint16_t i_avg_PDU_size;
     uint32_t i_max_bitrate;
@@ -305,9 +341,9 @@ typedef struct MP4_Box_data_url_s
 {
     uint8_t  i_version;
     uint32_t i_flags;
-    
+
     unsigned char *psz_location;
-    
+
 } MP4_Box_data_url_t;
 
 typedef struct MP4_Box_data_urn_s
@@ -317,7 +353,7 @@ typedef struct MP4_Box_data_urn_s
 
     unsigned char *psz_name;
     unsigned char *psz_location;
-    
+
 } MP4_Box_data_urn_t;
 
 typedef struct MP4_Box_data_dref_s
@@ -344,7 +380,7 @@ typedef struct MP4_Box_data_ctts_s
 {
     uint8_t  i_version;
     uint32_t i_flags;
-    
+
     uint32_t i_entry_count;
 
     uint32_t *i_sample_count; /* these are array */
@@ -380,6 +416,8 @@ typedef struct MP4_Box_data_sample_soun_s
     int     i_qt_description;
     uint8_t *p_qt_description;
 
+    void    *p_drms;
+
 } MP4_Box_data_sample_soun_t;
 
 typedef struct MP4_Box_data_sample_vide_s
@@ -414,6 +452,25 @@ typedef struct MP4_Box_data_sample_vide_s
 
 } MP4_Box_data_sample_vide_t;
 
+typedef struct
+{
+    uint8_t  i_reserved1[6];
+    uint16_t i_data_reference_index;
+
+    uint32_t i_display_flags;
+    uint32_t i_justification;
+    uint16_t i_background_color[3];
+    uint64_t i_text_box;
+    uint64_t i_reserved2;
+    uint16_t i_font_number;
+    uint16_t i_font_face;
+    uint16_t i_reserved3;
+
+    uint16_t i_foreground_color[3];
+
+    char    *psz_text_name;
+} MP4_Box_data_sample_text_t;
+
 typedef struct MP4_Box_data_sample_hint_s
 {
     uint8_t  i_reserved1[6];
@@ -436,11 +493,11 @@ typedef struct MP4_Box_data_stsd_s
 {
     uint8_t  i_version;
     uint32_t i_flags;
-    
+
     uint32_t i_entry_count;
 
     /* it contains SampleEntry handled as if it was Box */
-    
+
 } MP4_Box_data_stsd_t;
 
 
@@ -451,7 +508,7 @@ typedef struct MP4_Box_data_stsz_s
 
     uint32_t i_sample_size;
     uint32_t i_sample_count;
-   
+
     uint32_t *i_entry_size; /* array , empty if i_sample_size != 0 */
 
 } MP4_Box_data_stsz_t;
@@ -479,7 +536,7 @@ typedef struct MP4_Box_data_stsc_s
     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;
 
 
@@ -489,7 +546,7 @@ typedef struct MP4_Box_data_co64_s
     uint32_t i_flags;
 
     uint32_t i_entry_count;
-    
+
     uint64_t *i_chunk_offset;
 
 } MP4_Box_data_co64_t;
@@ -499,11 +556,11 @@ typedef struct MP4_Box_data_stss_s
 {
     uint8_t  i_version;
     uint32_t i_flags;
-    
+
     uint32_t i_entry_count;
-    
+
     uint32_t *i_sample_number;
-    
+
 } MP4_Box_data_stss_t;
 
 typedef struct MP4_Box_data_stsh_s
@@ -512,7 +569,7 @@ typedef struct MP4_Box_data_stsh_s
     uint32_t i_flags;
 
     uint32_t i_entry_count;
-    
+
     uint32_t *i_shadowed_sample_number;
     uint32_t *i_sync_sample_number;
 
@@ -538,7 +595,7 @@ typedef struct MP4_Box_data_padb_s
     uint16_t *i_pad2;        /* 3bits */
     uint16_t *i_reserved2;   /* 1bit  */
     uint16_t *i_pad1;        /* 3bits */
-    
+
 
 } MP4_Box_data_padb_t;
 
@@ -555,7 +612,7 @@ typedef struct MP4_Box_data_elst_s
     uint16_t *i_media_rate_integer;
     uint16_t *i_media_rate_fraction;
 
-    
+
 } MP4_Box_data_elst_t;
 
 typedef struct MP4_Box_data_cprt_s
@@ -564,7 +621,7 @@ typedef struct MP4_Box_data_cprt_s
     uint32_t i_flags;
     /* 1 pad bit */
     unsigned char i_language[3];
-    
+
     unsigned char *psz_notice;
 } MP4_Box_data_cprt_t;
 
@@ -578,18 +635,18 @@ typedef struct MP4_descriptor_decoder_config_s
     int     i_buffer_sizeDB;
     int     i_max_bitrate;
     int     i_avg_bitrate;
-    
+
     int     i_decoder_specific_info_len;
     uint8_t *p_decoder_specific_info;
     /* some other stuff */
-    
+
 } MP4_descriptor_decoder_config_t;
 
 typedef struct MP4_descriptor_SL_config_s
 {
 
     int i_dummy; /* ANSI C forbids empty structures */
-    
+
 } MP4_descriptor_SL_config_t;
 
 
@@ -607,7 +664,7 @@ typedef struct MP4_descriptor_ES_s
 
     uint16_t i_OCR_ES_ID;       /* if b_OCRstream */
     MP4_descriptor_decoder_config_t *p_decConfigDescr;
-    
+
     MP4_descriptor_SL_config_t *p_slConfigDescr;
 
     /* some other stuff ... */
@@ -619,16 +676,16 @@ typedef struct MP4_Box_data_esds_s
 {
     uint8_t  i_version;
     uint32_t i_flags;
-    
+
     MP4_descriptor_ES_t es_descriptor;
-    
+
 } MP4_Box_data_esds_t;
 
 
 typedef struct MP4_Box_data_dcom_s
 {
     uint32_t i_algorithm; /* fourcc */
-    
+
 } MP4_Box_data_dcom_t;
 
 typedef struct MP4_Box_data_cmvd_s
@@ -647,7 +704,7 @@ typedef struct MP4_Box_data_cmov_s
 
 } MP4_Box_data_cmov_t;
 
-typedef struct MP4_Box_data_rdrf_s
+typedef struct
 {
     uint8_t  i_version;
     uint32_t i_flags;
@@ -657,7 +714,7 @@ typedef struct MP4_Box_data_rdrf_s
 
 } MP4_Box_data_rdrf_t;
 
-typedef struct MP4_Box_data_rmdr_s
+typedef struct
 {
     uint8_t  i_version;
     uint32_t i_flags;
@@ -666,7 +723,7 @@ typedef struct MP4_Box_data_rmdr_s
 
 } MP4_Box_data_rmdr_t;
 
-typedef struct MP4_Box_data_rmvc_s
+typedef struct
 {
     uint8_t  i_version;
     uint32_t i_flags;
@@ -679,7 +736,7 @@ typedef struct MP4_Box_data_rmvc_s
 
 } MP4_Box_data_rmvc_t;
 
-typedef struct MP4_Box_data_rmcd_s
+typedef struct
 {
     uint8_t  i_version;
     uint32_t i_flags;
@@ -687,12 +744,43 @@ typedef struct MP4_Box_data_rmcd_s
 
 } MP4_Box_data_rmcd_t;
 
-typedef struct MP4_Box_data_rmqu_s
+typedef struct
 {
     uint32_t i_quality;
 
 } MP4_Box_data_rmqu_t;
 
+typedef struct
+{
+    char *psz_text;
+
+} MP4_Box_data_0xa9xxx_t;
+
+typedef struct
+{
+    uint8_t i_version;
+    uint8_t i_profile;
+    uint8_t i_profile_compatibility;
+    uint8_t i_level;
+
+    uint8_t i_reserved1;     /* 6 bits */
+    uint8_t i_length_size;
+
+    uint8_t i_reserved2;    /* 3 bits */
+    uint8_t  i_sps;
+    uint16_t *i_sps_length;
+    uint8_t  **sps;
+
+    uint8_t  i_pps;
+    uint16_t *i_pps_length;
+    uint8_t  **pps;
+
+    /* XXX: Hack raw avcC atom payload */
+    int     i_avcC;
+    uint8_t *p_avcC;
+
+} MP4_Box_data_avcC_t;
+
 /*
 typedef struct MP4_Box_data__s
 {
@@ -721,9 +809,11 @@ typedef union MP4_Box_data_s
     MP4_Box_data_stsd_t *p_stsd;
         MP4_Box_data_sample_vide_t *p_sample_vide;
         MP4_Box_data_sample_soun_t *p_sample_soun;
+        MP4_Box_data_sample_text_t *p_sample_text;
         MP4_Box_data_sample_hint_t *p_sample_hint;
 
         MP4_Box_data_esds_t *p_esds;
+        MP4_Box_data_avcC_t *p_avcC;
 
     MP4_Box_data_stsz_t *p_stsz;
     MP4_Box_data_stz2_t *p_stz2;
@@ -747,6 +837,8 @@ typedef union MP4_Box_data_s
     MP4_Box_data_rmqu_t *p_rmqu;
     MP4_Box_data_rmvc_t *p_rmvc;
 
+    MP4_Box_data_0xa9xxx_t *p_0xa9xxx;
+
     void                *p_data; /* for unknow type */
 } MP4_Box_data_t;
 
@@ -756,15 +848,15 @@ typedef union MP4_Box_data_s
 typedef struct MP4_Box_s
 {
     off_t        i_pos;      /* absolute position */
-    
+
     uint32_t     i_type;
     uint32_t     i_shortsize;
 
     UUID_t       i_uuid;  /* Set if i_type == "uuid" */
-    
+
     uint64_t     i_size; /* always set so use it */
 
-    MP4_Box_data_t   data;   /* union of pointers on extended data depending    
+    MP4_Box_data_t   data;   /* union of pointers on extended data depending
                                 on i_type (or i_usertype) */
 
     struct MP4_Box_s *p_father; /* pointer on the father Box */
@@ -776,44 +868,30 @@ typedef struct MP4_Box_s
 
 } MP4_Box_t;
 
-/*---------------------------------------------------------------------------*/
-/*                                                                           */
-/****----------------------- High level functions ------------------------****/
-/*                                                                           */
-/*---------------------------------------------------------------------------*/
 
-/*****************************************************************************
- * Function for manipulate stream easily
- *****************************************************************************/
-
-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, uint8_t *p_buff, int i_size );
 
 /*****************************************************************************
  * MP4_BoxGetRoot : Parse the entire file, and create all boxes in memory
  *****************************************************************************
- *  The first box is a virtual box "root" and is the father for all first 
- *  level boxes 
- *
- *  RETURN : 1 if succes and 0 if it failed
+ *  The first box is a virtual box "root" and is the father for all first
+ *  level boxes
  *****************************************************************************/
-int MP4_BoxGetRoot( input_thread_t *p_input, MP4_Box_t *p_root );
+MP4_Box_t *MP4_BoxGetRoot( stream_t * );
 
 /*****************************************************************************
  * MP4_FreeBox : free memory allocated after read with MP4_ReadBox
  *               or MP4_BoxGetRoot, this means also children boxes
- * XXX : all children have to be allocated by a malloc !! and 
- *         p_box isn't freeing  
+ * XXX : all children have to be allocated by a malloc !! and
+ *         p_box is freed
  *****************************************************************************/
-void MP4_BoxFree( input_thread_t *p_input, MP4_Box_t *p_box );
+void MP4_BoxFree( stream_t *, MP4_Box_t *p_box );
 
 /*****************************************************************************
  * MP4_DumpBoxStructure: print the structure of the p_box
  *****************************************************************************
  * Usefull while debugging
  *****************************************************************************/
-void MP4_BoxDumpStructure( input_thread_t *p_input, MP4_Box_t *p_box );
+void MP4_BoxDumpStructure( stream_t *p_input, MP4_Box_t *p_box );
 
 
 /*****************************************************************************
@@ -821,142 +899,23 @@ void MP4_BoxDumpStructure( input_thread_t *p_input, MP4_Box_t *p_box );
  *****************************************************************************
  * Path Format: . .. / as usual
  *              [number] to specifie box number ex: trak[12]
- *              
+ *
  * ex: /moov/trak[12]
- *     ../mdia 
+ *     ../mdia
  *****************************************************************************/
 MP4_Box_t *MP4_BoxGet( MP4_Box_t *p_box, char *psz_fmt, ... );
-    
+
 /*****************************************************************************
  * MP4_BoxCount: find number of box given a path relative to p_box
  *****************************************************************************
  * Path Format: . .. / as usual
  *              [number] to specifie box number ex: trak[12]
- *              
+ *
  * ex: /moov/trak
- *     ../mdia 
+ *     ../mdia
  *****************************************************************************/
 int MP4_BoxCount( MP4_Box_t *p_box, char *psz_fmt, ... );
 
-
-
-/*---------------------------------------------------------------------------*/
-/*                                                                           */
-/****---------------------- Medium level functions -----------------------****/
-/*                                                                           */
-/*---------------------------------------------------------------------------*/
-
-#if 0
-/*****************************************************************************
- * MP4_CountBox: given a box, count how many child have the requested type 
- * FIXME : support GUUID 
- *****************************************************************************/
-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, uint32_t i_type );
-
-#if 0
-/*****************************************************************************
- * MP4_FindNextBox:  find next box with thesame type and at the same level 
- *                  than p_box
- *****************************************************************************/
-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, uint32_t i_number );
-#endif
-
-/*---------------------------------------------------------------------------*/
-/****----------------------- Lower level functions -----------------------****/
-/****                                                                     ****/
-/****------Use them only when you known what they really do and need------****/
-/****                                                                     ****/
-/****---------------------------------------------------------------------****/
-/*---------------------------------------------------------------------------*/
-
-
-/****  ------- First some function to make abstract from input --------  */
-
-/****************************************************************************
- * MP4_InputStream create an stram with an input
- *
- ****************************************************************************/
-MP4_Stream_t *MP4_InputStream( input_thread_t *p_input );
-
-/****************************************************************************
- * MP4_MemoryStream create a memory stream
- * if p_buffer == NULL, will allocate a buffer of i_size, else 
- *     it uses p_buffer XXX you have to unallocate yourself !
- *
- ****************************************************************************/
-MP4_Stream_t *MP4_MemoryStream( input_thread_t *p_input,
-                                int i_size, uint8_t *p_buffer );
-
-/****************************************************************************
- * MP4_ReadStream read from a MP4_Stream_t
- *
- ****************************************************************************/
-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, uint8_t **pp_peek, int i_size );
-    
-/****************************************************************************
- * MP4_TellStream give absolute position in the stream
- * XXX for a memory stream give position from begining of the buffer
- ****************************************************************************/
-off_t MP4_TellStream( MP4_Stream_t *p_stream );
-
-/****************************************************************************
- * MP4_SeekStream seek in a MP4_Stream_t
- *
- ****************************************************************************/
-int MP4_SeekStream( MP4_Stream_t *p_stream, off_t i_pos);
-
-
-
-/*****************************************************************************
- * MP4_ReadBox : parse the actual box and the children if they exist
- *  
- *  RETURN : 1 if succes and 0 if it failed
- *****************************************************************************/
-int MP4_ReadBox( MP4_Stream_t *p_stream, MP4_Box_t *p_box, MP4_Box_t *p_father );
-
-
-/*****************************************************************************
- * MP4_ReadBoxCommon : Load only common parameters for all boxes 
- *****************************************************************************
- * p_box need to be an already allocated MP4_Box_t, and all data 
- *  will only be peek not read
- *
- * RETURN : 0 if it fail, 1 otherwise
- *****************************************************************************/
-int MP4_ReadBoxCommon( MP4_Stream_t *p_stream, MP4_Box_t *p_box );
-
-
-/*****************************************************************************
- * MP4_MP4_GotoBox : Go to this particular box 
- *****************************************************************************
- * RETURN : 0 if it fail, 1 otherwise
- *****************************************************************************/
-int MP4_GotoBox( MP4_Stream_t *p_stream, MP4_Box_t *p_box );
-
-    
-/*****************************************************************************
- * MP4_MP4_NextBox : Go to the next box wiithin p_box->p_father 
- *****************************************************************************
- * if p_box == NULL, go to the next box in witch we are( at the begining ).
- *****************************************************************************/
-int MP4_NextBox( MP4_Stream_t *p_stream, MP4_Box_t *p_box );
-
-
+int MP4_ReadBoxCommon( stream_t *p_stream, MP4_Box_t *p_box );
+int MP4_ReadBox_sample_vide( stream_t *p_stream, MP4_Box_t *p_box );
+void MP4_FreeBox_sample_vide( MP4_Box_t *p_box );