libmp4.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * libmp4.h : LibMP4 library for mp4 module for vlc
00003  *****************************************************************************
00004  * Copyright (C) 2001-2004 the VideoLAN team
00005  * $Id$
00006  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
00007  *
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00021  *****************************************************************************/
00022 #ifndef _VLC_MP4_H
00023 #define _VLC_MP4_H 1
00024 
00025 
00026 #define FOURCC_uuid VLC_FOURCC( 'u', 'u', 'i', 'd' )
00027 
00028 #define FOURCC_ftyp VLC_FOURCC( 'f', 't', 'y', 'p' )
00029 #define FOURCC_moov VLC_FOURCC( 'm', 'o', 'o', 'v' )
00030 #define FOURCC_foov VLC_FOURCC( 'f', 'o', 'o', 'v' )
00031 #define FOURCC_cmov VLC_FOURCC( 'c', 'm', 'o', 'v' )
00032 #define FOURCC_dcom VLC_FOURCC( 'd', 'c', 'o', 'm' )
00033 #define FOURCC_cmvd VLC_FOURCC( 'c', 'm', 'v', 'd' )
00034 
00035 #define FOURCC_moof VLC_FOURCC( 'm', 'o', 'o', 'f' )
00036 #define FOURCC_mdat VLC_FOURCC( 'm', 'd', 'a', 't' )
00037 #define FOURCC_skip VLC_FOURCC( 's', 'k', 'i', 'p' )
00038 #define FOURCC_free VLC_FOURCC( 'f', 'r', 'e', 'e' )
00039 #define FOURCC_udta VLC_FOURCC( 'u', 'd', 't', 'a' )
00040 #define FOURCC_wide VLC_FOURCC( 'w', 'i', 'd', 'e' )
00041 
00042 #define FOURCC_trak VLC_FOURCC( 't', 'r', 'a', 'k' )
00043 #define FOURCC_mvhd VLC_FOURCC( 'm', 'v', 'h', 'd' )
00044 #define FOURCC_tkhd VLC_FOURCC( 't', 'k', 'h', 'd' )
00045 #define FOURCC_tref VLC_FOURCC( 't', 'r', 'e', 'f' )
00046 #define FOURCC_mdia VLC_FOURCC( 'm', 'd', 'i', 'a' )
00047 #define FOURCC_mdhd VLC_FOURCC( 'm', 'd', 'h', 'd' )
00048 #define FOURCC_hdlr VLC_FOURCC( 'h', 'd', 'l', 'r' )
00049 #define FOURCC_minf VLC_FOURCC( 'm', 'i', 'n', 'f' )
00050 #define FOURCC_vmhd VLC_FOURCC( 'v', 'm', 'h', 'd' )
00051 #define FOURCC_smhd VLC_FOURCC( 's', 'm', 'h', 'd' )
00052 #define FOURCC_hmhd VLC_FOURCC( 'h', 'm', 'h', 'd' )
00053 #define FOURCC_dinf VLC_FOURCC( 'd', 'i', 'n', 'f' )
00054 #define FOURCC_url  VLC_FOURCC( 'u', 'r', 'l', ' ' )
00055 #define FOURCC_urn  VLC_FOURCC( 'u', 'r', 'n', ' ' )
00056 #define FOURCC_dref VLC_FOURCC( 'd', 'r', 'e', 'f' )
00057 #define FOURCC_stbl VLC_FOURCC( 's', 't', 'b', 'l' )
00058 #define FOURCC_stts VLC_FOURCC( 's', 't', 't', 's' )
00059 #define FOURCC_ctts VLC_FOURCC( 'c', 't', 't', 's' )
00060 #define FOURCC_stsd VLC_FOURCC( 's', 't', 's', 'd' )
00061 #define FOURCC_stsz VLC_FOURCC( 's', 't', 's', 'z' )
00062 #define FOURCC_stz2 VLC_FOURCC( 's', 't', 'z', '2' )
00063 #define FOURCC_stsc VLC_FOURCC( 's', 't', 's', 'c' )
00064 #define FOURCC_stco VLC_FOURCC( 's', 't', 'c', 'o' )
00065 #define FOURCC_co64 VLC_FOURCC( 'c', 'o', '6', '4' )
00066 #define FOURCC_stss VLC_FOURCC( 's', 't', 's', 's' )
00067 #define FOURCC_stsh VLC_FOURCC( 's', 't', 's', 'h' )
00068 #define FOURCC_stdp VLC_FOURCC( 's', 't', 'd', 'p' )
00069 #define FOURCC_padb VLC_FOURCC( 'p', 'a', 'd', 'b' )
00070 #define FOURCC_edts VLC_FOURCC( 'e', 'd', 't', 's' )
00071 #define FOURCC_elst VLC_FOURCC( 'e', 'l', 's', 't' )
00072 #define FOURCC_udta VLC_FOURCC( 'u', 'd', 't', 'a' )
00073 #define FOURCC_mvex VLC_FOURCC( 'm', 'v', 'e', 'x' )
00074 #define FOURCC_trex VLC_FOURCC( 't', 'r', 'e', 'x' )
00075 #define FOURCC_mfhd VLC_FOURCC( 'm', 'f', 'h', 'd' )
00076 #define FOURCC_traf VLC_FOURCC( 't', 'r', 'a', 'f' )
00077 #define FOURCC_tfhd VLC_FOURCC( 't', 'f', 'h', 'd' )
00078 #define FOURCC_trun VLC_FOURCC( 't', 'r', 'u', 'n' )
00079 #define FOURCC_cprt VLC_FOURCC( 'c', 'p', 'r', 't' )
00080 #define FOURCC_iods VLC_FOURCC( 'i', 'o', 'd', 's' )
00081 
00082 #define FOURCC_nmhd VLC_FOURCC( 'n', 'm', 'h', 'd' )
00083 #define FOURCC_mp2v VLC_FOURCC( 'm', 'p', '2', 'v' )
00084 #define FOURCC_mp4v VLC_FOURCC( 'm', 'p', '4', 'v' )
00085 #define FOURCC_mp4a VLC_FOURCC( 'm', 'p', '4', 'a' )
00086 #define FOURCC_mp4s VLC_FOURCC( 'm', 'p', '4', 's' )
00087 #define FOURCC_vide VLC_FOURCC( 'v', 'i', 'd', 'e' )
00088 #define FOURCC_soun VLC_FOURCC( 's', 'o', 'u', 'n' )
00089 #define FOURCC_hint VLC_FOURCC( 'h', 'i', 'n', 't' )
00090 #define FOURCC_hdv2 VLC_FOURCC( 'h', 'd', 'v', '2' )
00091 
00092 #define FOURCC_dpnd VLC_FOURCC( 'd', 'p', 'n', 'd' )
00093 #define FOURCC_ipir VLC_FOURCC( 'i', 'p', 'i', 'r' )
00094 #define FOURCC_mpod VLC_FOURCC( 'm', 'p', 'o', 'd' )
00095 #define FOURCC_hnti VLC_FOURCC( 'h', 'n', 't', 'i' )
00096 #define FOURCC_rtp  VLC_FOURCC( 'r', 't', 'p', ' ' )
00097 
00098 #define FOURCC_isom VLC_FOURCC( 'i', 's', 'o', 'm' )
00099 #define FOURCC_esds VLC_FOURCC( 'e', 's', 'd', 's' )
00100 
00101 #define FOURCC__mp3 VLC_FOURCC( '.', 'm', 'p', '3' )
00102 #define FOURCC_ms02 VLC_FOURCC( 'm', 's', 0x0, 0x02 )
00103 #define FOURCC_ms11 VLC_FOURCC( 'm', 's', 0x0, 0x11 )
00104 #define FOURCC_ms55 VLC_FOURCC( 'm', 's', 0x0, 0x55 )
00105 #define FOURCC_twos VLC_FOURCC( 't', 'w', 'o', 's' )
00106 #define FOURCC_sowt VLC_FOURCC( 's', 'o', 'w', 't' )
00107 #define FOURCC_QDMC VLC_FOURCC( 'Q', 'D', 'M', 'C' )
00108 #define FOURCC_QDM2 VLC_FOURCC( 'Q', 'D', 'M', '2' )
00109 #define FOURCC_ima4 VLC_FOURCC( 'i', 'm', 'a', '4' )
00110 #define FOURCC_IMA4 VLC_FOURCC( 'I', 'M', 'A', '4' )
00111 #define FOURCC_dvi  VLC_FOURCC( 'd', 'v', 'i', ' ' )
00112 #define FOURCC_MAC3 VLC_FOURCC( 'M', 'A', 'C', '3' )
00113 #define FOURCC_MAC6 VLC_FOURCC( 'M', 'A', 'C', '6' )
00114 #define FOURCC_alaw VLC_FOURCC( 'a', 'l', 'a', 'w' )
00115 #define FOURCC_ulaw VLC_FOURCC( 'u', 'l', 'a', 'w' )
00116 #define FOURCC_Qclp VLC_FOURCC( 'Q', 'c', 'l', 'p' )
00117 #define FOURCC_samr VLC_FOURCC( 's', 'a', 'm', 'r' )
00118 #define FOURCC_sawb VLC_FOURCC( 's', 'a', 'w', 'b' )
00119 #define FOURCC_OggS VLC_FOURCC( 'O', 'g', 'g', 'S' )
00120 #define FOURCC_alac VLC_FOURCC( 'a', 'l', 'a', 'c' )
00121 
00122 #define FOURCC_zlib VLC_FOURCC( 'z', 'l', 'i', 'b' )
00123 #define FOURCC_SVQ1 VLC_FOURCC( 'S', 'V', 'Q', '1' )
00124 #define FOURCC_SVQ3 VLC_FOURCC( 'S', 'V', 'Q', '3' )
00125 #define FOURCC_ZyGo VLC_FOURCC( 'Z', 'y', 'G', 'o' )
00126 #define FOURCC_3IV1 VLC_FOURCC( '3', 'I', 'V', '1' )
00127 #define FOURCC_3iv1 VLC_FOURCC( '3', 'i', 'v', '1' )
00128 #define FOURCC_3IV2 VLC_FOURCC( '3', 'I', 'V', '2' )
00129 #define FOURCC_3iv2 VLC_FOURCC( '3', 'i', 'v', '2' )
00130 #define FOURCC_3IVD VLC_FOURCC( '3', 'I', 'V', 'D' )
00131 #define FOURCC_3ivd VLC_FOURCC( '3', 'i', 'v', 'd' )
00132 #define FOURCC_3VID VLC_FOURCC( '3', 'V', 'I', 'D' )
00133 #define FOURCC_3vid VLC_FOURCC( '3', 'v', 'i', 'd' )
00134 #define FOURCC_h263 VLC_FOURCC( 'h', '2', '6', '3' )
00135 #define FOURCC_s263 VLC_FOURCC( 's', '2', '6', '3' )
00136 #define FOURCC_DIVX VLC_FOURCC( 'D', 'I', 'V', 'X' )
00137 #define FOURCC_XVID VLC_FOURCC( 'X', 'V', 'I', 'D' )
00138 #define FOURCC_cvid VLC_FOURCC( 'c', 'v', 'i', 'd' )
00139 #define FOURCC_mjpa VLC_FOURCC( 'm', 'j', 'p', 'a' )
00140 #define FOURCC_mjpb VLC_FOURCC( 'm', 'j', 'q', 't' )
00141 #define FOURCC_mjqt VLC_FOURCC( 'm', 'j', 'h', 't' )
00142 #define FOURCC_mjht VLC_FOURCC( 'm', 'j', 'p', 'b' )
00143 #define FOURCC_VP31 VLC_FOURCC( 'V', 'P', '3', '1' )
00144 #define FOURCC_vp31 VLC_FOURCC( 'v', 'p', '3', '1' )
00145 #define FOURCC_h264 VLC_FOURCC( 'h', '2', '6', '4' )
00146 #define FOURCC_qdrw VLC_FOURCC( 'q', 'd', 'r', 'w' )
00147 
00148 #define FOURCC_avc1 VLC_FOURCC( 'a', 'v', 'c', '1' )
00149 #define FOURCC_avcC VLC_FOURCC( 'a', 'v', 'c', 'C' )
00150 #define FOURCC_m4ds VLC_FOURCC( 'm', '4', 'd', 's' )
00151 
00152 #define FOURCC_dvc  VLC_FOURCC( 'd', 'v', 'c', ' ' )
00153 #define FOURCC_dvp  VLC_FOURCC( 'd', 'v', 'p', ' ' )
00154 #define FOURCC_dv5n VLC_FOURCC( 'd', 'v', '5', 'n' )
00155 #define FOURCC_dv5p VLC_FOURCC( 'd', 'v', '5', 'p' )
00156 #define FOURCC_raw  VLC_FOURCC( 'r', 'a', 'w', ' ' )
00157 
00158 #define FOURCC_jpeg VLC_FOURCC( 'j', 'p', 'e', 'g' )
00159 
00160 #define FOURCC_yv12 VLC_FOURCC( 'y', 'v', '1', '2' )
00161 #define FOURCC_yuv2 VLC_FOURCC( 'y', 'u', 'v', '2' )
00162 
00163 #define FOURCC_rmra VLC_FOURCC( 'r', 'm', 'r', 'a' )
00164 #define FOURCC_rmda VLC_FOURCC( 'r', 'm', 'd', 'a' )
00165 #define FOURCC_rdrf VLC_FOURCC( 'r', 'd', 'r', 'f' )
00166 #define FOURCC_rmdr VLC_FOURCC( 'r', 'm', 'd', 'r' )
00167 #define FOURCC_rmvc VLC_FOURCC( 'r', 'm', 'v', 'c' )
00168 #define FOURCC_rmcd VLC_FOURCC( 'r', 'm', 'c', 'd' )
00169 #define FOURCC_rmqu VLC_FOURCC( 'r', 'm', 'q', 'u' )
00170 #define FOURCC_alis VLC_FOURCC( 'a', 'l', 'i', 's' )
00171 
00172 #define FOURCC_gmhd VLC_FOURCC( 'g', 'm', 'h', 'd' )
00173 #define FOURCC_wave VLC_FOURCC( 'w', 'a', 'v', 'e' )
00174 
00175 #define FOURCC_drms VLC_FOURCC( 'd', 'r', 'm', 's' )
00176 #define FOURCC_sinf VLC_FOURCC( 's', 'i', 'n', 'f' )
00177 #define FOURCC_schi VLC_FOURCC( 's', 'c', 'h', 'i' )
00178 #define FOURCC_user VLC_FOURCC( 'u', 's', 'e', 'r' )
00179 #define FOURCC_key  VLC_FOURCC( 'k', 'e', 'y', ' ' )
00180 #define FOURCC_iviv VLC_FOURCC( 'i', 'v', 'i', 'v' )
00181 #define FOURCC_name VLC_FOURCC( 'n', 'a', 'm', 'e' )
00182 #define FOURCC_priv VLC_FOURCC( 'p', 'r', 'i', 'v' )
00183 
00184 #define FOURCC_text VLC_FOURCC( 't', 'e', 'x', 't' )
00185 #define FOURCC_tx3g VLC_FOURCC( 't', 'x', '3', 'g' )
00186 #define FOURCC_subp VLC_FOURCC( 's', 'u', 'b', 'p' )
00187 
00188 #define FOURCC_0xa9nam VLC_FOURCC( 0xa9, 'n', 'a', 'm' )
00189 #define FOURCC_0xa9aut VLC_FOURCC( 0xa9, 'a', 'u', 't' )
00190 #define FOURCC_0xa9swr VLC_FOURCC( 0xa9, 's', 'w', 'r' )
00191 #define FOURCC_0xa9cpy VLC_FOURCC( 0xa9, 'c', 'p', 'y' )
00192 #define FOURCC_0xa9inf VLC_FOURCC( 0xa9, 'i', 'n', 'f' )
00193 #define FOURCC_0xa9ART VLC_FOURCC( 0xa9, 'A', 'R', 'T' )
00194 #define FOURCC_0xa9des VLC_FOURCC( 0xa9, 'd', 'e', 's' )
00195 #define FOURCC_0xa9dir VLC_FOURCC( 0xa9, 'd', 'i', 'r' )
00196 #define FOURCC_0xa9cmt VLC_FOURCC( 0xa9, 'c', 'm', 't' )
00197 #define FOURCC_0xa9req VLC_FOURCC( 0xa9, 'r', 'e', 'q' )
00198 #define FOURCC_0xa9day VLC_FOURCC( 0xa9, 'd', 'a', 'y' )
00199 #define FOURCC_0xa9fmt VLC_FOURCC( 0xa9, 'f', 'm', 't' )
00200 #define FOURCC_0xa9prd VLC_FOURCC( 0xa9, 'p', 'r', 'd' )
00201 #define FOURCC_0xa9prf VLC_FOURCC( 0xa9, 'p', 'r', 'f' )
00202 #define FOURCC_0xa9src VLC_FOURCC( 0xa9, 's', 'r', 'c' )
00203 #define FOURCC_0xa9alb VLC_FOURCC( 0xa9, 'a', 'l', 'b' )
00204 #define FOURCC_0xa9dis VLC_FOURCC( 0xa9, 'd', 'i', 's' )
00205 #define FOURCC_0xa9enc VLC_FOURCC( 0xa9, 'e', 'n', 'c' )
00206 #define FOURCC_0xa9trk VLC_FOURCC( 0xa9, 't', 'r', 'k' )
00207 #define FOURCC_0xa9url VLC_FOURCC( 0xa9, 'u', 'r', 'l' )
00208 #define FOURCC_0xa9dsa VLC_FOURCC( 0xa9, 'd', 's', 'a' )
00209 #define FOURCC_0xa9hst VLC_FOURCC( 0xa9, 'h', 's', 't' )
00210 #define FOURCC_0xa9ope VLC_FOURCC( 0xa9, 'o', 'p', 'e' )
00211 #define FOURCC_0xa9wrt VLC_FOURCC( 0xa9, 'w', 'r', 't' )
00212 #define FOURCC_0xa9com VLC_FOURCC( 0xa9, 'c', 'o', 'm' )
00213 #define FOURCC_0xa9gen VLC_FOURCC( 0xa9, 'g', 'e', 'n' )
00214 #define FOURCC_chpl VLC_FOURCC( 'c', 'h', 'p', 'l' )
00215 #define FOURCC_WLOC VLC_FOURCC( 'W', 'L', 'O', 'C' )
00216 
00217 #define FOURCC_meta VLC_FOURCC( 'm', 'e', 't', 'a' )
00218 #define FOURCC_ilst VLC_FOURCC( 'i', 'l', 's', 't' )
00219 
00220 #define FOURCC_chap VLC_FOURCC( 'c', 'h', 'a', 'p' )
00221 
00222 /* Do you want some debug information on all read boxes ? */
00223 #define MP4_VERBOSE  1
00224 
00225 
00226 struct MP4_Box_s;
00227 
00228 
00229 /* uuid Universal Unique IDentifiers */
00230 typedef struct UUID_s
00231 {
00232     uint8_t b[16];
00233 } UUID_t;
00234 
00235 /* specific structure for all boxes */
00236 
00237 typedef struct MP4_Box_data_ftyp_s
00238 {
00239     uint32_t i_major_brand;
00240     uint32_t i_minor_version;
00241 
00242     uint32_t i_compatible_brands_count;
00243     uint32_t *i_compatible_brands;
00244 
00245 } MP4_Box_data_ftyp_t;
00246 
00247 typedef struct MP4_Box_data_mvhd_s
00248 {
00249     uint8_t  i_version;
00250     uint32_t i_flags;
00251 
00252     uint64_t i_creation_time;
00253     uint64_t i_modification_time;
00254     uint32_t i_timescale;
00255     uint64_t i_duration;
00256 
00257     int32_t  i_rate;
00258     int16_t  i_volume;
00259     int16_t  i_reserved1;
00260     uint32_t i_reserved2[2];
00261     int32_t  i_matrix[9];
00262     uint32_t i_predefined[6];
00263     uint32_t i_next_track_id;
00264 
00265 } MP4_Box_data_mvhd_t;
00266 
00267 #define MP4_TRACK_ENABLED    0x000001
00268 #define MP4_TRACK_IN_MOVIE   0x000002
00269 #define MP4_TRACK_IN_PREVIEW 0x000004
00270 typedef struct MP4_Box_data_tkhd_s
00271 {
00272     uint8_t  i_version;
00273     uint32_t i_flags;
00274 
00275     uint64_t i_creation_time;
00276     uint64_t i_modification_time;
00277     uint32_t i_track_ID;
00278     uint32_t i_reserved;
00279     uint64_t i_duration;
00280 
00281     uint32_t i_reserved2[2];
00282     int16_t  i_layer;
00283     int16_t  i_predefined;
00284 
00285     int16_t  i_volume;
00286     uint16_t i_reserved3;
00287     int32_t  i_matrix[9];
00288     int32_t  i_width;
00289     int32_t  i_height;
00290 
00291 } MP4_Box_data_tkhd_t;
00292 
00293 typedef struct MP4_Box_data_mdhd_s
00294 {
00295     uint8_t  i_version;
00296     uint32_t i_flags;
00297 
00298     uint64_t i_creation_time;
00299     uint64_t i_modification_time;
00300     uint32_t i_timescale;
00301     uint64_t i_duration;
00302 
00303     /* one bit for pad */
00304     uint16_t      i_language_code;
00305     /* unsigned int(5)[3] language difference with 0x60*/
00306     unsigned char i_language[3];
00307     uint16_t i_predefined;
00308 
00309 } MP4_Box_data_mdhd_t;
00310 
00311 typedef struct MP4_Box_data_hdlr_s
00312 {
00313     uint8_t  i_version;
00314     uint32_t i_flags;
00315 
00316     uint32_t i_predefined;
00317     uint32_t i_handler_type; /* "vide" "soun" "hint" "odsm"
00318                            "crsm" "sdsm" "m7sm" "ocsm"
00319                            "ipsm" "mjsm" */
00320 
00321     unsigned char *psz_name; /* in UTF-8 */
00322 
00323 } MP4_Box_data_hdlr_t;
00324 
00325 typedef struct MP4_Box_data_vmhd_s
00326 {
00327     uint8_t  i_version;
00328     uint32_t i_flags;
00329 
00330     int16_t  i_graphics_mode;
00331     int16_t  i_opcolor[3];
00332 
00333 } MP4_Box_data_vmhd_t;
00334 
00335 typedef struct MP4_Box_data_smhd_s
00336 {
00337     uint8_t  i_version;
00338     uint32_t i_flags;
00339 
00340     int16_t  i_balance;
00341     int16_t  i_reserved;
00342 
00343 } MP4_Box_data_smhd_t;
00344 
00345 typedef struct MP4_Box_data_hmhd_s
00346 {
00347     uint8_t  i_version;
00348     uint32_t i_flags;
00349 
00350     uint16_t i_max_PDU_size;
00351     uint16_t i_avg_PDU_size;
00352     uint32_t i_max_bitrate;
00353     uint32_t i_avg_bitrate;
00354     uint32_t i_reserved;
00355 
00356 } MP4_Box_data_hmhd_t;
00357 
00358 typedef struct MP4_Box_data_url_s
00359 {
00360     uint8_t  i_version;
00361     uint32_t i_flags;
00362 
00363     char *psz_location;
00364 
00365 } MP4_Box_data_url_t;
00366 
00367 typedef struct MP4_Box_data_urn_s
00368 {
00369     uint8_t  i_version;
00370     uint32_t i_flags;
00371 
00372     char *psz_name;
00373     char *psz_location;
00374 
00375 } MP4_Box_data_urn_t;
00376 
00377 typedef struct MP4_Box_data_dref_s
00378 {
00379     uint8_t  i_version;
00380     uint32_t i_flags;
00381 
00382     uint32_t i_entry_count;
00383 /* XXX it's also a container with i_entry_count entry */
00384 } MP4_Box_data_dref_t;
00385 
00386 typedef struct MP4_Box_data_stts_s
00387 {
00388     uint8_t  i_version;
00389     uint32_t i_flags;
00390 
00391     uint32_t i_entry_count;
00392     uint32_t *i_sample_count; /* these are array */
00393     int32_t  *i_sample_delta;
00394 
00395 } MP4_Box_data_stts_t;
00396 
00397 typedef struct MP4_Box_data_ctts_s
00398 {
00399     uint8_t  i_version;
00400     uint32_t i_flags;
00401 
00402     uint32_t i_entry_count;
00403 
00404     uint32_t *i_sample_count; /* these are array */
00405     int32_t  *i_sample_offset;
00406 
00407 } MP4_Box_data_ctts_t;
00408 
00409 
00410 typedef struct MP4_Box_data_sample_soun_s
00411 {
00412     uint8_t  i_reserved1[6];
00413     uint16_t i_data_reference_index;
00414 
00415     //uint32_t i_reserved2[2];
00416     uint16_t i_qt_version;
00417     uint16_t i_qt_revision_level;
00418     uint32_t i_qt_vendor;
00419 
00420     uint16_t i_channelcount;
00421     uint16_t i_samplesize;
00422     uint16_t i_predefined;
00423     uint16_t i_reserved3;
00424     uint16_t i_sampleratehi; /* timescale of track */
00425     uint16_t i_sampleratelo;
00426 
00427     /* for version 1 (i_reserved1[0] == 1) */
00428     uint32_t i_sample_per_packet;
00429     uint32_t i_bytes_per_packet;
00430     uint32_t i_bytes_per_frame;
00431     uint32_t i_bytes_per_sample;
00432 
00433     /* XXX hack */
00434     int     i_qt_description;
00435     uint8_t *p_qt_description;
00436 
00437     void    *p_drms;
00438 
00439 } MP4_Box_data_sample_soun_t;
00440 
00441 typedef struct MP4_Box_data_sample_vide_s
00442 {
00443     uint8_t  i_reserved1[6];
00444     uint16_t i_data_reference_index;
00445 
00446     uint16_t i_qt_version;
00447     uint16_t i_qt_revision_level;
00448     uint32_t i_qt_vendor;
00449 
00450     uint32_t i_qt_temporal_quality;
00451     uint32_t i_qt_spatial_quality;
00452 
00453     int16_t  i_width;
00454     int16_t  i_height;
00455 
00456     uint32_t i_horizresolution;
00457     uint32_t i_vertresolution;
00458 
00459     uint32_t i_qt_data_size;
00460     uint16_t i_qt_frame_count;
00461 
00462     uint8_t  i_compressorname[32];
00463     int16_t  i_depth;
00464 
00465     int16_t  i_qt_color_table;
00466 
00467     /* XXX hack ImageDescription */
00468     int     i_qt_image_description;
00469     uint8_t *p_qt_image_description;
00470 
00471 } MP4_Box_data_sample_vide_t;
00472 
00473 #define MP4_TEXT_DISPLAY_FLAG_DONT_DISPLAY       (1<<0)
00474 #define MP4_TEXT_DISPLAY_FLAG_AUTO_SCALE         (1<<1)
00475 #define MP4_TEXT_DISPLAY_FLAG_CLIP_TO_TEXT_BOX   (1<<2)
00476 #define MP4_TEXT_DISPLAY_FLAG_USE_MOVIE_BG_COLOR (1<<3)
00477 #define MP4_TEXT_DISPLAY_FLAG_SHRINK_TEXT_BOX_TO_FIT (1<<4)
00478 #define MP4_TEXT_DISPLAY_FLAG_SCROLL_IN          (1<<5)
00479 #define MP4_TEXT_DISPLAY_FLAG_SCROLL_OUT         (1<<6)
00480 #define MP4_TEXT_DISPLAY_FLAG_HORIZONTAL_SCROLL  (1<<7)
00481 #define MP4_TEXT_DISPLAY_FLAG_REVERSE_SCROLL     (1<<8)
00482 #define MP4_TEXT_DISPLAY_FLAG_CONTINUOUS_SCROLL  (1<<9)
00483 #define MP4_TEXT_DISPLAY_FLAG_FLOW_HORIZONTAL    (1<<10)
00484 #define MP4_TEXT_DISPLAY_FLAG_CONTINUOUS_KARAOKE (1<<11)
00485 #define MP4_TEXT_DISPLAY_FLAG_DROP_SHADOW        (1<<12)
00486 #define MP4_TEXT_DISPLAY_FLAG_ANTI_ALIAS         (1<<13)
00487 #define MP4_TEXT_DISPLAY_FLAG_KEYED_TEXT         (1<<14)
00488 #define MP4_TEXT_DISPLAY_FLAG_INVERSE_HILITE     (1<<15)
00489 #define MP4_TEXT_DISPLAY_FLAG_COLOR_HILITE       (1<<16)
00490 #define MP4_TEXT_DISPLAY_FLAG_WRITE_VERTICALLY   (1<<17)
00491 
00492 typedef struct
00493 {
00494     uint32_t i_reserved1;
00495     uint16_t i_reserved2;
00496 
00497     uint16_t i_data_reference_index;
00498 
00499     uint32_t i_display_flags;   // TextDescription and Tx3gDescription
00500 
00501     int8_t i_justification_horizontal; // left(0), centered(1), right(-1)
00502     int8_t i_justification_vertical;   // top(0), centered(1), bottom(-1)
00503 
00504     uint16_t i_background_color[4];
00505 
00506     uint16_t i_text_box_top;
00507     uint16_t i_text_box_left;
00508     uint16_t i_text_box_bottom;
00509     uint16_t i_text_box_right;
00510 
00511     // TODO to complete
00512 } MP4_Box_data_sample_text_t;
00513 
00514 typedef struct MP4_Box_data_sample_hint_s
00515 {
00516     uint8_t  i_reserved1[6];
00517     uint16_t i_data_reference_index;
00518 
00519     uint8_t *p_data;
00520 
00521 } MP4_Box_data_sample_hint_t;
00522 
00523 typedef struct MP4_Box_data_moviehintinformation_rtp_s
00524 {
00525     uint32_t i_description_format;
00526     unsigned char *psz_text;
00527 
00528 } MP4_Box_data_moviehintinformation_rtp_t;
00529 
00530 
00531 
00532 typedef struct MP4_Box_data_stsd_s
00533 {
00534     uint8_t  i_version;
00535     uint32_t i_flags;
00536 
00537     uint32_t i_entry_count;
00538 
00539     /* it contains SampleEntry handled as if it was Box */
00540 
00541 } MP4_Box_data_stsd_t;
00542 
00543 
00544 typedef struct MP4_Box_data_stsz_s
00545 {
00546     uint8_t  i_version;
00547     uint32_t i_flags;
00548 
00549     uint32_t i_sample_size;
00550     uint32_t i_sample_count;
00551 
00552     uint32_t *i_entry_size; /* array , empty if i_sample_size != 0 */
00553 
00554 } MP4_Box_data_stsz_t;
00555 
00556 typedef struct MP4_Box_data_stz2_s
00557 {
00558     uint8_t  i_version;
00559     uint32_t i_flags;
00560 
00561     uint32_t i_sample_size; /* 24 bits */
00562     uint8_t  i_field_size;
00563     uint32_t i_sample_count;
00564 
00565     uint32_t *i_entry_size; /* array: unsigned int(i_field_size) entry_size */
00566 
00567 } MP4_Box_data_stz2_t;
00568 
00569 typedef struct MP4_Box_data_stsc_s
00570 {
00571     uint8_t  i_version;
00572     uint32_t i_flags;
00573 
00574     uint32_t i_entry_count;
00575 
00576     uint32_t *i_first_chunk; /* theses are arrays */
00577     uint32_t *i_samples_per_chunk;
00578     uint32_t *i_sample_description_index;
00579 
00580 } MP4_Box_data_stsc_t;
00581 
00582 
00583 typedef struct MP4_Box_data_co64_s
00584 {
00585     uint8_t  i_version;
00586     uint32_t i_flags;
00587 
00588     uint32_t i_entry_count;
00589 
00590     uint64_t *i_chunk_offset;
00591 
00592 } MP4_Box_data_co64_t;
00593 
00594 
00595 typedef struct MP4_Box_data_stss_s
00596 {
00597     uint8_t  i_version;
00598     uint32_t i_flags;
00599 
00600     uint32_t i_entry_count;
00601 
00602     uint32_t *i_sample_number;
00603 
00604 } MP4_Box_data_stss_t;
00605 
00606 typedef struct MP4_Box_data_stsh_s
00607 {
00608     uint8_t  i_version;
00609     uint32_t i_flags;
00610 
00611     uint32_t i_entry_count;
00612 
00613     uint32_t *i_shadowed_sample_number;
00614     uint32_t *i_sync_sample_number;
00615 
00616 } MP4_Box_data_stsh_t;
00617 
00618 typedef struct MP4_Box_data_stdp_s
00619 {
00620     uint8_t  i_version;
00621     uint32_t i_flags;
00622 
00623     uint16_t *i_priority;
00624 
00625 } MP4_Box_data_stdp_t;
00626 
00627 typedef struct MP4_Box_data_padb_s
00628 {
00629     uint8_t  i_version;
00630     uint32_t i_flags;
00631 
00632     uint32_t i_sample_count;
00633 
00634     uint16_t *i_reserved1;   /* 1bit  */
00635     uint16_t *i_pad2;        /* 3bits */
00636     uint16_t *i_reserved2;   /* 1bit  */
00637     uint16_t *i_pad1;        /* 3bits */
00638 
00639 
00640 } MP4_Box_data_padb_t;
00641 
00642 
00643 typedef struct MP4_Box_data_elst_s
00644 {
00645     uint8_t  i_version;
00646     uint32_t i_flags;
00647 
00648     uint32_t i_entry_count;
00649 
00650     uint64_t *i_segment_duration;
00651     int64_t  *i_media_time;
00652     uint16_t *i_media_rate_integer;
00653     uint16_t *i_media_rate_fraction;
00654 
00655 
00656 } MP4_Box_data_elst_t;
00657 
00658 typedef struct MP4_Box_data_cprt_s
00659 {
00660     uint8_t  i_version;
00661     uint32_t i_flags;
00662     /* 1 pad bit */
00663     unsigned char i_language[3];
00664 
00665     char *psz_notice;
00666 } MP4_Box_data_cprt_t;
00667 
00668 
00669 /* DecoderConfigDescriptor */
00670 typedef struct MP4_descriptor_decoder_config_s
00671 {
00672     uint8_t i_objectTypeIndication;
00673     uint8_t i_streamType;
00674     int     b_upStream;
00675     int     i_buffer_sizeDB;
00676     int     i_max_bitrate;
00677     int     i_avg_bitrate;
00678 
00679     int     i_decoder_specific_info_len;
00680     uint8_t *p_decoder_specific_info;
00681     /* some other stuff */
00682 
00683 } MP4_descriptor_decoder_config_t;
00684 
00685 typedef struct MP4_descriptor_SL_config_s
00686 {
00687 
00688     int i_dummy; /* ANSI C forbids empty structures */
00689 
00690 } MP4_descriptor_SL_config_t;
00691 
00692 
00693 typedef struct MP4_descriptor_ES_s
00694 {
00695     uint16_t i_ES_ID;
00696     int      b_stream_dependence;
00697     int      b_url;
00698     int      b_OCRstream;
00699     int      i_stream_priority;
00700 
00701     int      i_depend_on_ES_ID; /* if b_stream_dependence set */
00702 
00703     unsigned char *psz_URL;
00704 
00705     uint16_t i_OCR_ES_ID;       /* if b_OCRstream */
00706     MP4_descriptor_decoder_config_t *p_decConfigDescr;
00707 
00708     MP4_descriptor_SL_config_t *p_slConfigDescr;
00709 
00710     /* some other stuff ... */
00711 
00712 } MP4_descriptor_ES_t;
00713 
00714 /* ES descriptor */
00715 typedef struct MP4_Box_data_esds_s
00716 {
00717     uint8_t  i_version;
00718     uint32_t i_flags;
00719 
00720     MP4_descriptor_ES_t es_descriptor;
00721 
00722 } MP4_Box_data_esds_t;
00723 
00724 
00725 typedef struct MP4_Box_data_dcom_s
00726 {
00727     uint32_t i_algorithm; /* fourcc */
00728 
00729 } MP4_Box_data_dcom_t;
00730 
00731 typedef struct MP4_Box_data_cmvd_s
00732 {
00733     uint32_t i_uncompressed_size;
00734     uint32_t i_compressed_size;
00735 
00736     int     b_compressed; /* Set to 1 if compressed data, 0 if uncompressed */
00737     uint8_t *p_data;
00738 
00739 } MP4_Box_data_cmvd_t;
00740 
00741 typedef struct MP4_Box_data_cmov_s
00742 {
00743     struct MP4_Box_s *p_moov; /* uncompressed moov */
00744 
00745 } MP4_Box_data_cmov_t;
00746 
00747 typedef struct
00748 {
00749     uint8_t  i_version;
00750     uint32_t i_flags;
00751 
00752     uint32_t i_ref_type;
00753     char     *psz_ref;
00754 
00755 } MP4_Box_data_rdrf_t;
00756 
00757 typedef struct
00758 {
00759     uint8_t  i_version;
00760     uint32_t i_flags;
00761 
00762     uint32_t i_rate;
00763 
00764 } MP4_Box_data_rmdr_t;
00765 
00766 typedef struct
00767 {
00768     uint8_t  i_version;
00769     uint32_t i_flags;
00770 
00771     uint32_t i_gestaltType;
00772     uint32_t i_val1;
00773     uint32_t i_val2;
00774     uint16_t i_checkType;   /* 0: val1 is version min
00775                                1: gestalt value & val2 == val1 */
00776 
00777 } MP4_Box_data_rmvc_t;
00778 
00779 typedef struct
00780 {
00781     uint8_t  i_version;
00782     uint32_t i_flags;
00783 
00784 
00785 } MP4_Box_data_rmcd_t;
00786 
00787 typedef struct
00788 {
00789     uint32_t i_quality;
00790 
00791 } MP4_Box_data_rmqu_t;
00792 
00793 typedef struct
00794 {
00795     char *psz_text;
00796 
00797 } MP4_Box_data_0xa9xxx_t;
00798 
00799 typedef struct