00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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 #define FOURCC_dac3 VLC_FOURCC( 'd', 'a', 'c', '3' )
00122 #define FOURCC_dec3 VLC_FOURCC( 'd', 'e', 'c', '3' )
00123 #define FOURCC_enda VLC_FOURCC( 'e', 'n', 'd', 'a' )
00124 #define FOURCC_gnre VLC_FOURCC( 'g', 'n', 'r', 'e' )
00125 #define FOURCC_trkn VLC_FOURCC( 't', 'r', 'k', 'n' )
00126
00127 #define FOURCC_zlib VLC_FOURCC( 'z', 'l', 'i', 'b' )
00128 #define FOURCC_SVQ1 VLC_FOURCC( 'S', 'V', 'Q', '1' )
00129 #define FOURCC_SVQ3 VLC_FOURCC( 'S', 'V', 'Q', '3' )
00130 #define FOURCC_ZyGo VLC_FOURCC( 'Z', 'y', 'G', 'o' )
00131 #define FOURCC_3IV1 VLC_FOURCC( '3', 'I', 'V', '1' )
00132 #define FOURCC_3iv1 VLC_FOURCC( '3', 'i', 'v', '1' )
00133 #define FOURCC_3IV2 VLC_FOURCC( '3', 'I', 'V', '2' )
00134 #define FOURCC_3iv2 VLC_FOURCC( '3', 'i', 'v', '2' )
00135 #define FOURCC_3IVD VLC_FOURCC( '3', 'I', 'V', 'D' )
00136 #define FOURCC_3ivd VLC_FOURCC( '3', 'i', 'v', 'd' )
00137 #define FOURCC_3VID VLC_FOURCC( '3', 'V', 'I', 'D' )
00138 #define FOURCC_3vid VLC_FOURCC( '3', 'v', 'i', 'd' )
00139 #define FOURCC_h263 VLC_FOURCC( 'h', '2', '6', '3' )
00140 #define FOURCC_s263 VLC_FOURCC( 's', '2', '6', '3' )
00141 #define FOURCC_DIVX VLC_FOURCC( 'D', 'I', 'V', 'X' )
00142 #define FOURCC_XVID VLC_FOURCC( 'X', 'V', 'I', 'D' )
00143 #define FOURCC_cvid VLC_FOURCC( 'c', 'v', 'i', 'd' )
00144 #define FOURCC_mjpa VLC_FOURCC( 'm', 'j', 'p', 'a' )
00145 #define FOURCC_mjpb VLC_FOURCC( 'm', 'j', 'q', 't' )
00146 #define FOURCC_mjqt VLC_FOURCC( 'm', 'j', 'h', 't' )
00147 #define FOURCC_mjht VLC_FOURCC( 'm', 'j', 'p', 'b' )
00148 #define FOURCC_VP31 VLC_FOURCC( 'V', 'P', '3', '1' )
00149 #define FOURCC_vp31 VLC_FOURCC( 'v', 'p', '3', '1' )
00150 #define FOURCC_h264 VLC_FOURCC( 'h', '2', '6', '4' )
00151 #define FOURCC_qdrw VLC_FOURCC( 'q', 'd', 'r', 'w' )
00152
00153 #define FOURCC_avc1 VLC_FOURCC( 'a', 'v', 'c', '1' )
00154 #define FOURCC_avcC VLC_FOURCC( 'a', 'v', 'c', 'C' )
00155 #define FOURCC_m4ds VLC_FOURCC( 'm', '4', 'd', 's' )
00156
00157 #define FOURCC_dvc VLC_FOURCC( 'd', 'v', 'c', ' ' )
00158 #define FOURCC_dvp VLC_FOURCC( 'd', 'v', 'p', ' ' )
00159 #define FOURCC_dv5n VLC_FOURCC( 'd', 'v', '5', 'n' )
00160 #define FOURCC_dv5p VLC_FOURCC( 'd', 'v', '5', 'p' )
00161 #define FOURCC_raw VLC_FOURCC( 'r', 'a', 'w', ' ' )
00162
00163 #define FOURCC_jpeg VLC_FOURCC( 'j', 'p', 'e', 'g' )
00164
00165 #define FOURCC_yv12 VLC_FOURCC( 'y', 'v', '1', '2' )
00166 #define FOURCC_yuv2 VLC_FOURCC( 'y', 'u', 'v', '2' )
00167
00168 #define FOURCC_rmra VLC_FOURCC( 'r', 'm', 'r', 'a' )
00169 #define FOURCC_rmda VLC_FOURCC( 'r', 'm', 'd', 'a' )
00170 #define FOURCC_rdrf VLC_FOURCC( 'r', 'd', 'r', 'f' )
00171 #define FOURCC_rmdr VLC_FOURCC( 'r', 'm', 'd', 'r' )
00172 #define FOURCC_rmvc VLC_FOURCC( 'r', 'm', 'v', 'c' )
00173 #define FOURCC_rmcd VLC_FOURCC( 'r', 'm', 'c', 'd' )
00174 #define FOURCC_rmqu VLC_FOURCC( 'r', 'm', 'q', 'u' )
00175 #define FOURCC_alis VLC_FOURCC( 'a', 'l', 'i', 's' )
00176
00177 #define FOURCC_gmhd VLC_FOURCC( 'g', 'm', 'h', 'd' )
00178 #define FOURCC_wave VLC_FOURCC( 'w', 'a', 'v', 'e' )
00179
00180 #define FOURCC_drms VLC_FOURCC( 'd', 'r', 'm', 's' )
00181 #define FOURCC_sinf VLC_FOURCC( 's', 'i', 'n', 'f' )
00182 #define FOURCC_schi VLC_FOURCC( 's', 'c', 'h', 'i' )
00183 #define FOURCC_user VLC_FOURCC( 'u', 's', 'e', 'r' )
00184 #define FOURCC_key VLC_FOURCC( 'k', 'e', 'y', ' ' )
00185 #define FOURCC_iviv VLC_FOURCC( 'i', 'v', 'i', 'v' )
00186 #define FOURCC_name VLC_FOURCC( 'n', 'a', 'm', 'e' )
00187 #define FOURCC_priv VLC_FOURCC( 'p', 'r', 'i', 'v' )
00188 #define FOURCC_drmi VLC_FOURCC( 'd', 'r', 'm', 'i' )
00189 #define FOURCC_frma VLC_FOURCC( 'f', 'r', 'm', 'a' )
00190 #define FOURCC_skcr VLC_FOURCC( 's', 'k', 'c', 'r' )
00191
00192 #define FOURCC_text VLC_FOURCC( 't', 'e', 'x', 't' )
00193 #define FOURCC_tx3g VLC_FOURCC( 't', 'x', '3', 'g' )
00194 #define FOURCC_subp VLC_FOURCC( 's', 'u', 'b', 'p' )
00195 #define FOURCC_sbtl VLC_FOURCC( 's', 'b', 't', 'l' )
00196
00197 #define FOURCC_0xa9nam VLC_FOURCC( 0xa9, 'n', 'a', 'm' )
00198 #define FOURCC_0xa9aut VLC_FOURCC( 0xa9, 'a', 'u', 't' )
00199 #define FOURCC_0xa9swr VLC_FOURCC( 0xa9, 's', 'w', 'r' )
00200 #define FOURCC_0xa9cpy VLC_FOURCC( 0xa9, 'c', 'p', 'y' )
00201 #define FOURCC_0xa9inf VLC_FOURCC( 0xa9, 'i', 'n', 'f' )
00202 #define FOURCC_0xa9ART VLC_FOURCC( 0xa9, 'A', 'R', 'T' )
00203 #define FOURCC_0xa9des VLC_FOURCC( 0xa9, 'd', 'e', 's' )
00204 #define FOURCC_0xa9dir VLC_FOURCC( 0xa9, 'd', 'i', 'r' )
00205 #define FOURCC_0xa9cmt VLC_FOURCC( 0xa9, 'c', 'm', 't' )
00206 #define FOURCC_0xa9req VLC_FOURCC( 0xa9, 'r', 'e', 'q' )
00207 #define FOURCC_0xa9day VLC_FOURCC( 0xa9, 'd', 'a', 'y' )
00208 #define FOURCC_0xa9fmt VLC_FOURCC( 0xa9, 'f', 'm', 't' )
00209 #define FOURCC_0xa9prd VLC_FOURCC( 0xa9, 'p', 'r', 'd' )
00210 #define FOURCC_0xa9prf VLC_FOURCC( 0xa9, 'p', 'r', 'f' )
00211 #define FOURCC_0xa9src VLC_FOURCC( 0xa9, 's', 'r', 'c' )
00212 #define FOURCC_0xa9alb VLC_FOURCC( 0xa9, 'a', 'l', 'b' )
00213 #define FOURCC_0xa9dis VLC_FOURCC( 0xa9, 'd', 'i', 's' )
00214 #define FOURCC_0xa9enc VLC_FOURCC( 0xa9, 'e', 'n', 'c' )
00215 #define FOURCC_0xa9trk VLC_FOURCC( 0xa9, 't', 'r', 'k' )
00216 #define FOURCC_0xa9url VLC_FOURCC( 0xa9, 'u', 'r', 'l' )
00217 #define FOURCC_0xa9dsa VLC_FOURCC( 0xa9, 'd', 's', 'a' )
00218 #define FOURCC_0xa9hst VLC_FOURCC( 0xa9, 'h', 's', 't' )
00219 #define FOURCC_0xa9ope VLC_FOURCC( 0xa9, 'o', 'p', 'e' )
00220 #define FOURCC_0xa9wrt VLC_FOURCC( 0xa9, 'w', 'r', 't' )
00221 #define FOURCC_0xa9com VLC_FOURCC( 0xa9, 'c', 'o', 'm' )
00222 #define FOURCC_0xa9gen VLC_FOURCC( 0xa9, 'g', 'e', 'n' )
00223 #define FOURCC_chpl VLC_FOURCC( 'c', 'h', 'p', 'l' )
00224 #define FOURCC_WLOC VLC_FOURCC( 'W', 'L', 'O', 'C' )
00225
00226 #define FOURCC_meta VLC_FOURCC( 'm', 'e', 't', 'a' )
00227 #define FOURCC_ilst VLC_FOURCC( 'i', 'l', 's', 't' )
00228
00229 #define FOURCC_chap VLC_FOURCC( 'c', 'h', 'a', 'p' )
00230
00231
00232 #define MP4_VERBOSE 1
00233
00234
00235 struct MP4_Box_s;
00236
00237
00238
00239 typedef struct UUID_s
00240 {
00241 uint8_t b[16];
00242 } UUID_t;
00243
00244
00245
00246 typedef struct MP4_Box_data_ftyp_s
00247 {
00248 uint32_t i_major_brand;
00249 uint32_t i_minor_version;
00250
00251 uint32_t i_compatible_brands_count;
00252 uint32_t *i_compatible_brands;
00253
00254 } MP4_Box_data_ftyp_t;
00255
00256 typedef struct MP4_Box_data_mvhd_s
00257 {
00258 uint8_t i_version;
00259 uint32_t i_flags;
00260
00261 uint64_t i_creation_time;
00262 uint64_t i_modification_time;
00263 uint32_t i_timescale;
00264 uint64_t i_duration;
00265
00266 int32_t i_rate;
00267 int16_t i_volume;
00268 int16_t i_reserved1;
00269 uint32_t i_reserved2[2];
00270 int32_t i_matrix[9];
00271 uint32_t i_predefined[6];
00272 uint32_t i_next_track_id;
00273
00274 } MP4_Box_data_mvhd_t;
00275
00276 #define MP4_TRACK_ENABLED 0x000001
00277 #define MP4_TRACK_IN_MOVIE 0x000002
00278 #define MP4_TRACK_IN_PREVIEW 0x000004
00279 typedef struct MP4_Box_data_tkhd_s
00280 {
00281 uint8_t i_version;
00282 uint32_t i_flags;
00283
00284 uint64_t i_creation_time;
00285 uint64_t i_modification_time;
00286 uint32_t i_track_ID;
00287 uint32_t i_reserved;
00288 uint64_t i_duration;
00289
00290 uint32_t i_reserved2[2];
00291 int16_t i_layer;
00292 int16_t i_predefined;
00293
00294 int16_t i_volume;
00295 uint16_t i_reserved3;
00296 int32_t i_matrix[9];
00297 int32_t i_width;
00298 int32_t i_height;
00299
00300 } MP4_Box_data_tkhd_t;
00301
00302 typedef struct MP4_Box_data_mdhd_s
00303 {
00304 uint8_t i_version;
00305 uint32_t i_flags;
00306
00307 uint64_t i_creation_time;
00308 uint64_t i_modification_time;
00309 uint32_t i_timescale;
00310 uint64_t i_duration;
00311
00312
00313 uint16_t i_language_code;
00314
00315 unsigned char i_language[3];
00316 uint16_t i_predefined;
00317
00318 } MP4_Box_data_mdhd_t;
00319
00320 typedef struct MP4_Box_data_hdlr_s
00321 {
00322 uint8_t i_version;
00323 uint32_t i_flags;
00324
00325 uint32_t i_predefined;
00326 uint32_t i_handler_type;
00327
00328
00329
00330 unsigned char *psz_name;
00331
00332 } MP4_Box_data_hdlr_t;
00333
00334 typedef struct MP4_Box_data_vmhd_s
00335 {
00336 uint8_t i_version;
00337 uint32_t i_flags;
00338
00339 int16_t i_graphics_mode;
00340 int16_t i_opcolor[3];
00341
00342 } MP4_Box_data_vmhd_t;
00343
00344 typedef struct MP4_Box_data_smhd_s
00345 {
00346 uint8_t i_version;
00347 uint32_t i_flags;
00348
00349 int16_t i_balance;
00350 int16_t i_reserved;
00351
00352 } MP4_Box_data_smhd_t;
00353
00354 typedef struct MP4_Box_data_hmhd_s
00355 {
00356 uint8_t i_version;
00357 uint32_t i_flags;
00358
00359 uint16_t i_max_PDU_size;
00360 uint16_t i_avg_PDU_size;
00361 uint32_t i_max_bitrate;
00362 uint32_t i_avg_bitrate;
00363 uint32_t i_reserved;
00364
00365 } MP4_Box_data_hmhd_t;
00366
00367 typedef struct MP4_Box_data_url_s
00368 {
00369 uint8_t i_version;
00370 uint32_t i_flags;
00371
00372 char *psz_location;
00373
00374 } MP4_Box_data_url_t;
00375
00376 typedef struct MP4_Box_data_urn_s
00377 {
00378 uint8_t i_version;
00379 uint32_t i_flags;
00380
00381 char *psz_name;
00382 char *psz_location;
00383
00384 } MP4_Box_data_urn_t;
00385
00386 typedef struct MP4_Box_data_dref_s
00387 {
00388 uint8_t i_version;
00389 uint32_t i_flags;
00390
00391 uint32_t i_entry_count;
00392
00393 } MP4_Box_data_dref_t;
00394
00395 typedef struct MP4_Box_data_stts_s
00396 {
00397 uint8_t i_version;
00398 uint32_t i_flags;
00399
00400 uint32_t i_entry_count;
00401 uint32_t *i_sample_count;
00402 int32_t *i_sample_delta;
00403
00404 } MP4_Box_data_stts_t;
00405
00406 typedef struct MP4_Box_data_ctts_s
00407 {
00408 uint8_t i_version;
00409 uint32_t i_flags;
00410
00411 uint32_t i_entry_count;
00412
00413 uint32_t *i_sample_count;
00414 int32_t *i_sample_offset;
00415
00416 } MP4_Box_data_ctts_t;
00417
00418
00419 typedef struct MP4_Box_data_sample_soun_s
00420 {
00421 uint8_t i_reserved1[6];
00422 uint16_t i_data_reference_index;
00423
00424
00425 uint16_t i_qt_version;
00426 uint16_t i_qt_revision_level;
00427 uint32_t i_qt_vendor;
00428
00429 uint16_t i_channelcount;
00430 uint16_t i_samplesize;
00431 uint16_t i_predefined;
00432 uint16_t i_reserved3;
00433 uint16_t i_sampleratehi;
00434 uint16_t i_sampleratelo;
00435
00436
00437 uint32_t i_sample_per_packet;
00438 uint32_t i_bytes_per_packet;
00439 uint32_t i_bytes_per_frame;
00440 uint32_t i_bytes_per_sample;
00441
00442
00443 int i_qt_description;
00444 uint8_t *p_qt_description;
00445
00446 void *p_drms;
00447
00448 } MP4_Box_data_sample_soun_t;
00449
00450 typedef struct MP4_Box_data_sample_vide_s
00451 {
00452 uint8_t i_reserved1[6];
00453 uint16_t i_data_reference_index;
00454
00455 uint16_t i_qt_version;
00456 uint16_t i_qt_revision_level;
00457 uint32_t i_qt_vendor;
00458
00459 uint32_t i_qt_temporal_quality;
00460 uint32_t i_qt_spatial_quality;
00461
00462 int16_t i_width;
00463 int16_t i_height;
00464
00465 uint32_t i_horizresolution;
00466 uint32_t i_vertresolution;
00467
00468 uint32_t i_qt_data_size;
00469 uint16_t i_qt_frame_count;
00470
00471 uint8_t i_compressorname[32];
00472 int16_t i_depth;
00473
00474 int16_t i_qt_color_table;
00475
00476
00477 int i_qt_image_description;
00478 uint8_t *p_qt_image_description;
00479
00480 void *p_drms;
00481
00482 } MP4_Box_data_sample_vide_t;
00483
00484 #define MP4_TEXT_DISPLAY_FLAG_DONT_DISPLAY (1<<0)
00485 #define MP4_TEXT_DISPLAY_FLAG_AUTO_SCALE (1<<1)
00486 #define MP4_TEXT_DISPLAY_FLAG_CLIP_TO_TEXT_BOX (1<<2)
00487 #define MP4_TEXT_DISPLAY_FLAG_USE_MOVIE_BG_COLOR (1<<3)
00488 #define MP4_TEXT_DISPLAY_FLAG_SHRINK_TEXT_BOX_TO_FIT (1<<4)
00489 #define MP4_TEXT_DISPLAY_FLAG_SCROLL_IN (1<<5)
00490 #define MP4_TEXT_DISPLAY_FLAG_SCROLL_OUT (1<<6)
00491 #define MP4_TEXT_DISPLAY_FLAG_HORIZONTAL_SCROLL (1<<7)
00492 #define MP4_TEXT_DISPLAY_FLAG_REVERSE_SCROLL (1<<8)
00493 #define MP4_TEXT_DISPLAY_FLAG_CONTINUOUS_SCROLL (1<<9)
00494 #define MP4_TEXT_DISPLAY_FLAG_FLOW_HORIZONTAL (1<<10)
00495 #define MP4_TEXT_DISPLAY_FLAG_CONTINUOUS_KARAOKE (1<<11)
00496 #define MP4_TEXT_DISPLAY_FLAG_DROP_SHADOW (1<<12)
00497 #define MP4_TEXT_DISPLAY_FLAG_ANTI_ALIAS (1<<13)
00498 #define MP4_TEXT_DISPLAY_FLAG_KEYED_TEXT (1<<14)
00499 #define MP4_TEXT_DISPLAY_FLAG_INVERSE_HILITE (1<<15)
00500 #define MP4_TEXT_DISPLAY_FLAG_COLOR_HILITE (1<<16)
00501 #define MP4_TEXT_DISPLAY_FLAG_WRITE_VERTICALLY (1<<17)
00502
00503 typedef struct
00504 {
00505 uint32_t i_reserved1;
00506 uint16_t i_reserved2;
00507
00508 uint16_t i_data_reference_index;
00509
00510 uint32_t i_display_flags;
00511
00512 int8_t i_justification_horizontal;
00513 int8_t i_justification_vertical;
00514
00515 uint16_t i_background_color[4];
00516
00517 uint16_t i_text_box_top;
00518 uint16_t i_text_box_left;
00519 uint16_t i_text_box_bottom;
00520 uint16_t i_text_box_right;
00521
00522
00523 } MP4_Box_data_sample_text_t;
00524
00525 typedef struct MP4_Box_data_sample_hint_s
00526 {
00527 uint8_t i_reserved1[6];
00528 uint16_t i_data_reference_index;
00529
00530 uint8_t *p_data;
00531
00532 } MP4_Box_data_sample_hint_t;
00533
00534 typedef struct MP4_Box_data_moviehintinformation_rtp_s
00535 {
00536 uint32_t i_description_format;
00537 unsigned char *psz_text;
00538
00539 } MP4_Box_data_moviehintinformation_rtp_t;
00540
00541
00542
00543 typedef struct MP4_Box_data_stsd_s
00544 {
00545 uint8_t i_version;
00546 uint32_t i_flags;
00547
00548 uint32_t i_entry_count;
00549
00550
00551
00552 } MP4_Box_data_stsd_t;
00553
00554
00555 typedef struct MP4_Box_data_stsz_s
00556 {
00557 uint8_t i_version;
00558 uint32_t i_flags;
00559
00560 uint32_t i_sample_size;
00561 uint32_t i_sample_count;
00562
00563 uint32_t *i_entry_size;
00564
00565 } MP4_Box_data_stsz_t;
00566
00567 typedef struct MP4_Box_data_stz2_s
00568 {
00569 uint8_t i_version;
00570 uint32_t i_flags;
00571
00572 uint32_t i_sample_size;
00573 uint8_t i_field_size;
00574 uint32_t i_sample_count;
00575
00576 uint32_t *i_entry_size;
00577
00578 } MP4_Box_data_stz2_t;
00579
00580 typedef struct MP4_Box_data_stsc_s
00581 {
00582 uint8_t i_version;
00583 uint32_t i_flags;
00584
00585 uint32_t i_entry_count;
00586
00587 uint32_t *i_first_chunk;
00588 uint32_t *i_samples_per_chunk;
00589 uint32_t *i_sample_description_index;
00590
00591 } MP4_Box_data_stsc_t;
00592
00593
00594 typedef struct MP4_Box_data_co64_s
00595 {
00596 uint8_t i_version;
00597 uint32_t i_flags;
00598
00599 uint32_t i_entry_count;
00600
00601 uint64_t *i_chunk_offset;
00602
00603 } MP4_Box_data_co64_t;
00604
00605
00606 typedef struct MP4_Box_data_stss_s
00607 {
00608 uint8_t i_version;
00609 uint32_t i_flags;
00610
00611 uint32_t i_entry_count;
00612
00613 uint32_t *i_sample_number;
00614
00615 } MP4_Box_data_stss_t;
00616
00617 typedef struct MP4_Box_data_stsh_s
00618 {
00619 uint8_t i_version;
00620 uint32_t i_flags;
00621
00622 uint32_t i_entry_count;
00623
00624 uint32_t *i_shadowed_sample_number;
00625 uint32_t *i_sync_sample_number;
00626
00627 } MP4_Box_data_stsh_t;
00628
00629 typedef struct MP4_Box_data_stdp_s
00630 {
00631 uint8_t i_version;
00632 uint32_t i_flags;
00633
00634 uint16_t *i_priority;
00635
00636 } MP4_Box_data_stdp_t;
00637
00638 typedef struct MP4_Box_data_padb_s
00639 {
00640 uint8_t i_version;
00641 uint32_t i_flags;
00642
00643 uint32_t i_sample_count;
00644
00645 uint16_t *i_reserved1;
00646 uint16_t *i_pad2;
00647 uint16_t *i_reserved2;
00648 uint16_t *i_pad1;
00649
00650
00651 } MP4_Box_data_padb_t;
00652
00653
00654 typedef struct MP4_Box_data_elst_s
00655 {
00656 uint8_t i_version;
00657 uint32_t i_flags;
00658
00659 uint32_t i_entry_count;
00660
00661 uint64_t *i_segment_duration;
00662 int64_t *i_media_time;
00663 uint16_t *i_media_rate_integer;
00664 uint16_t *i_media_rate_fraction;
00665
00666
00667 } MP4_Box_data_elst_t;
00668
00669 typedef struct MP4_Box_data_cprt_s
00670 {
00671 uint8_t i_version;
00672 uint32_t i_flags;
00673
00674 unsigned char i_language[3];
00675
00676 char *psz_notice;
00677 } MP4_Box_data_cprt_t;
00678
00679
00680
00681 typedef struct MP4_descriptor_decoder_config_s
00682 {
00683 uint8_t i_objectTypeIndication;
00684 uint8_t i_streamType;
00685 int b_upStream;
00686 int i_buffer_sizeDB;
00687 int i_max_bitrate;
00688 int i_avg_bitrate;
00689
00690 int i_decoder_specific_info_len;
00691 uint8_t *p_decoder_specific_info;
00692
00693
00694 } MP4_descriptor_decoder_config_t;
00695
00696 typedef struct MP4_descriptor_SL_config_s
00697 {
00698
00699 int i_dummy;
00700
00701 } MP4_descriptor_SL_config_t;
00702
00703
00704 typedef struct MP4_descriptor_ES_s
00705 {
00706 uint16_t i_ES_ID;
00707 int b_stream_dependence;
00708 int b_url;
00709 int b_OCRstream;
00710 int i_stream_priority;
00711
00712 int i_depend_on_ES_ID;
00713
00714 unsigned char *psz_URL;
00715
00716 uint16_t i_OCR_ES_ID;
00717 MP4_descriptor_decoder_config_t *p_decConfigDescr;
00718
00719 MP4_descriptor_SL_config_t *p_slConfigDescr;
00720
00721
00722
00723 } MP4_descriptor_ES_t;
00724
00725
00726 typedef struct MP4_Box_data_esds_s
00727 {
00728 uint8_t i_version;
00729 uint32_t i_flags;
00730
00731 MP4_descriptor_ES_t es_descriptor;
00732
00733 } MP4_Box_data_esds_t;
00734
00735
00736 typedef struct MP4_Box_data_dcom_s
00737 {
00738 uint32_t i_algorithm;
00739
00740 } MP4_Box_data_dcom_t;
00741
00742 typedef struct MP4_Box_data_cmvd_s
00743 {
00744 uint32_t i_uncompressed_size;
00745 uint32_t i_compressed_size;
00746
00747 int b_compressed;
00748 uint8_t *p_data;
00749
00750 } MP4_Box_data_cmvd_t;
00751
00752 typedef struct MP4_Box_data_cmov_s
00753 {
00754 struct MP4_Box_s *p_moov;
00755
00756 } MP4_Box_data_cmov_t;
00757
00758 typedef struct
00759 {
00760 uint32_t i_type;
00761 } MP4_Box_data_frma_t;
00762
00763 typedef struct
00764 {
00765 uint32_t i_init;
00766 uint32_t i_encr;
00767 uint32_t i_decr;
00768 } MP4_Box_data_skcr_t;
00769
00770 typedef struct
00771 {
00772 uint8_t i_version;
00773 uint32_t i_flags;
00774
00775 uint32_t i_ref_type;
00776 char *psz_ref;
00777
00778 } MP4_Box_data_rdrf_t;
00779
00780 typedef struct
00781 {
00782 uint8_t i_version;
00783 uint32_t i_flags;
00784
00785 uint32_t i_rate;
00786
00787 } MP4_Box_data_rmdr_t;
00788
00789 typedef struct
00790 {
00791 uint8_t i_version;
00792 uint32_t i_flags;
00793
00794 uint32_t i_gestaltType;
00795 uint32_t i_val1;
00796 uint32_t i_val2;
00797 uint16_t i_checkType;
00798
00799
00800 } MP4_Box_data_rmvc_t;
00801
00802 typedef struct
00803 {
00804 uint8_t i_version;
00805 uint32_t i_flags;
00806
00807
00808 } MP4_Box_data_rmcd_t;
00809
00810 typedef struct
00811 {
00812 uint32_t i_quality;
00813
00814 } MP4_Box_data_rmqu_t;
00815
00816 typedef struct
00817 {
00818 char *psz_text;
00819
00820 } MP4_Box_data_0xa9xxx_t;
00821
00822 typedef struct
00823 {
00824 uint32_t i_entry_count;
00825 uint32_t *i_track_ID;
00826
00827 } MP4_Box_data_tref_generic_t;
00828
00829 typedef struct
00830 {
00831 uint8_t i_version;
00832 uint32_t i_flags;
00833
00834 uint8_t i_chapter;
00835 struct
00836 {
00837 char *psz_name;
00838 int64_t i_start;
00839 } chapter[256];
00840 } MP4_Box_data_chpl_t;
00841
00842 typedef struct
00843 {
00844 uint8_t i_version;
00845 uint8_t i_profile;
00846 uint8_t i_profile_compatibility;
00847 uint8_t i_level;
00848
00849 uint8_t i_reserved1;
00850 uint8_t i_length_size;
00851
00852 uint8_t i_reserved2;
00853 uint8_t i_sps;
00854 uint16_t *i_sps_length;
00855 uint8_t **sps;
00856
00857 uint8_t i_pps;
00858 uint16_t *i_pps_length;
00859 uint8_t **pps;
00860
00861
00862 int i_avcC;
00863 uint8_t *p_avcC;
00864
00865 } MP4_Box_data_avcC_t;
00866
00867 typedef struct
00868 {
00869 uint8_t i_fscod;
00870 uint8_t i_bsid;
00871 uint8_t i_bsmod;
00872 uint8_t i_acmod;
00873 uint8_t i_lfeon;
00874 uint8_t i_bitrate_code;
00875
00876 } MP4_Box_data_dac3_t;
00877
00878 typedef struct
00879 {
00880 uint16_t i_little_endian;
00881
00882 } MP4_Box_data_enda_t;
00883
00884 typedef struct
00885 {
00886 uint16_t i_genre;
00887
00888 } MP4_Box_data_gnre_t;
00889
00890 typedef struct
00891 {
00892 uint32_t i_track_number;
00893 uint32_t i_track_total;
00894
00895 } MP4_Box_data_trkn_t;
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907 typedef union MP4_Box_data_s
00908 {
00909 MP4_Box_data_ftyp_t *p_ftyp;
00910 MP4_Box_data_mvhd_t *p_mvhd;
00911 MP4_Box_data_tkhd_t *p_tkhd;
00912 MP4_Box_data_mdhd_t *p_mdhd;
00913 MP4_Box_data_hdlr_t *p_hdlr;
00914 MP4_Box_data_vmhd_t *p_vmhd;
00915 MP4_Box_data_smhd_t *p_smhd;
00916 MP4_Box_data_hmhd_t *p_hmhd;
00917 MP4_Box_data_url_t *p_url;
00918 MP4_Box_data_urn_t *p_urn;
00919 MP4_Box_data_dref_t *p_dref;
00920 MP4_Box_data_stts_t *p_stts;
00921 MP4_Box_data_ctts_t *p_ctts;
00922 MP4_Box_data_stsd_t *p_stsd;
00923 MP4_Box_data_sample_vide_t *p_sample_vide;
00924 MP4_Box_data_sample_soun_t *p_sample_soun;
00925 MP4_Box_data_sample_text_t *p_sample_text;
00926 MP4_Box_data_sample_hint_t *p_sample_hint;
00927
00928 MP4_Box_data_esds_t *p_esds;
00929 MP4_Box_data_avcC_t *p_avcC;
00930 MP4_Box_data_dac3_t *p_dac3;
00931 MP4_Box_data_enda_t *p_enda;
00932 MP4_Box_data_gnre_t *p_gnre;
00933 MP4_Box_data_trkn_t *p_trkn;
00934
00935 MP4_Box_data_stsz_t *p_stsz;
00936 MP4_Box_data_stz2_t *p_stz2;
00937 MP4_Box_data_stsc_t *p_stsc;
00938 MP4_Box_data_co64_t *p_co64;
00939 MP4_Box_data_stss_t *p_stss;
00940 MP4_Box_data_stsh_t *p_stsh;
00941 MP4_Box_data_stdp_t *p_stdp;
00942 MP4_Box_data_padb_t *p_padb;
00943 MP4_Box_data_elst_t *p_elst;
00944 MP4_Box_data_cprt_t *p_cprt;
00945
00946 MP4_Box_data_dcom_t *p_dcom;
00947 MP4_Box_data_cmvd_t *p_cmvd;
00948 MP4_Box_data_cmov_t *p_cmov;
00949
00950 MP4_Box_data_moviehintinformation_rtp_t p_moviehintinformation_rtp;
00951
00952 MP4_Box_data_frma_t *p_frma;
00953 MP4_Box_data_skcr_t *p_skcr;
00954
00955 MP4_Box_data_rdrf_t *p_rdrf;
00956 MP4_Box_data_rmdr_t *p_rmdr;
00957 MP4_Box_data_rmqu_t *p_rmqu;
00958 MP4_Box_data_rmvc_t *p_rmvc;
00959
00960 MP4_Box_data_0xa9xxx_t *p_0xa9xxx;
00961 MP4_Box_data_chpl_t *p_chpl;
00962 MP4_Box_data_tref_generic_t *p_tref_generic;
00963
00964 void *p_data;
00965 } MP4_Box_data_t;
00966
00967
00968
00969
00970 typedef struct MP4_Box_s
00971 {
00972 off_t i_pos;
00973
00974 uint32_t i_type;
00975 uint32_t i_shortsize;
00976
00977 UUID_t i_uuid;
00978
00979 uint64_t i_size;
00980
00981 MP4_Box_data_t data;
00982
00983
00984 struct MP4_Box_s *p_father;
00985
00986 struct MP4_Box_s *p_first;
00987 struct MP4_Box_s *p_last;
00988
00989 struct MP4_Box_s *p_next;
00990
00991 } MP4_Box_t;
00992
00993
00994
00995
00996
00997
00998
00999
01000
01001 MP4_Box_t *MP4_BoxGetRoot( stream_t * );
01002
01003
01004
01005
01006
01007
01008
01009 void MP4_BoxFree( stream_t *, MP4_Box_t *p_box );
01010
01011
01012
01013
01014
01015
01016 void MP4_BoxDumpStructure( stream_t *p_input, MP4_Box_t *p_box );
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028 MP4_Box_t *MP4_BoxGet( MP4_Box_t *p_box, const char *psz_fmt, ... );
01029
01030
01031
01032
01033
01034
01035
01036
01037
01038
01039 int MP4_BoxCount( MP4_Box_t *p_box, const char *psz_fmt, ... );
01040
01041 int MP4_ReadBoxCommon( stream_t *p_stream, MP4_Box_t *p_box );
01042 int MP4_ReadBox_sample_vide( stream_t *p_stream, MP4_Box_t *p_box );
01043 void MP4_FreeBox_sample_vide( MP4_Box_t *p_box );
01044
01045 #endif