demux: libmp4: split CoreAudio definitions
[vlc.git] / modules / demux / mp4 / libmp4.h
blobdf545c83b2d04bbd2ec5bb196024d9c079bbb6a2
1 /*****************************************************************************
2 * libmp4.h : LibMP4 library for mp4 module for vlc
3 *****************************************************************************
4 * Copyright (C) 2001-2004, 2010 VLC authors and VideoLAN
6 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
22 #ifndef VLC_MP4_LIBMP4_H_
23 #define VLC_MP4_LIBMP4_H_
25 #include <vlc_es.h>
26 #include <vlc_codecs.h>
27 #include "coreaudio.h"
29 /* Use alias for scaled time */
30 typedef int64_t stime_t;
32 #define BLOCK16x16 (1<<16)
34 #define BRAND_3gp4 VLC_FOURCC( '3', 'g', 'p', '4' )
35 #define BRAND_3gp5 VLC_FOURCC( '3', 'g', 'p', '5' )
36 #define BRAND_3gp6 VLC_FOURCC( '3', 'g', 'p', '6' )
37 #define BRAND_3gp7 VLC_FOURCC( '3', 'g', 'p', '7' )
38 #define BRAND_isml VLC_FOURCC( 'i', 's', 'm', 'l' )
39 #define BRAND_isom VLC_FOURCC( 'i', 's', 'o', 'm' )
40 #define BRAND_iso2 VLC_FOURCC( 'i', 's', 'o', '2' )
41 #define BRAND_iso6 VLC_FOURCC( 'i', 's', 'o', '6' )
42 #define BRAND_qt__ VLC_FOURCC( 'q', 't', ' ', ' ' )
43 #define BRAND_f4v VLC_FOURCC( 'f', '4', 'v', ' ' ) /* Adobe Flash */
44 #define BRAND_dash VLC_FOURCC( 'd', 'a', 's', 'h' )
45 #define BRAND_smoo VLC_FOURCC( 's', 'm', 'o', 'o' ) /* Internal use */
46 #define BRAND_mp41 VLC_FOURCC( 'm', 'p', '4', '1' )
47 #define BRAND_av01 VLC_FOURCC( 'a', 'v', '0', '1' )
48 #define BRAND_avc1 VLC_FOURCC( 'a', 'v', 'c', '1' )
49 #define BRAND_M4A VLC_FOURCC( 'M', '4', 'A', ' ' )
50 #define BRAND_piff VLC_FOURCC( 'p', 'i', 'f', 'f' )
51 #define BRAND_mif1 VLC_FOURCC( 'm', 'i', 'f', '1' ) /* heif */
52 #define BRAND_msf1 VLC_FOURCC( 'm', 's', 'f', '1' ) /* heif */
53 #define BRAND_heic VLC_FOURCC( 'h', 'e', 'i', 'c' ) /* heif */
54 #define BRAND_heix VLC_FOURCC( 'h', 'e', 'i', 'x' ) /* heif */
55 #define BRAND_hevc VLC_FOURCC( 'h', 'e', 'v', 'c' ) /* heif */
56 #define BRAND_hevx VLC_FOURCC( 'h', 'e', 'v', 'x' ) /* heif */
57 #define BRAND_jpeg VLC_FOURCC( 'j', 'p', 'e', 'g' ) /* heif */
58 #define BRAND_jpgs VLC_FOURCC( 'j', 'p', 'g', 's' ) /* heif */
59 #define BRAND_avci VLC_FOURCC( 'a', 'v', 'c', 'i' ) /* heif */
60 #define BRAND_avcs VLC_FOURCC( 'a', 'v', 'c', 's' ) /* heif */
61 #define BRAND_avif VLC_FOURCC( 'a', 'v', 'i', 'f' ) /* heif AV1 AVIF */
62 #define BRAND_avis VLC_FOURCC( 'a', 'v', 'i', 's' ) /* heig AV1 AVIF */
64 #define ATOM_root VLC_FOURCC( 'r', 'o', 'o', 't' )
65 #define ATOM_uuid VLC_FOURCC( 'u', 'u', 'i', 'd' )
67 #define ATOM_ftyp VLC_FOURCC( 'f', 't', 'y', 'p' )
68 #define ATOM_moov VLC_FOURCC( 'm', 'o', 'o', 'v' )
69 #define ATOM_foov VLC_FOURCC( 'f', 'o', 'o', 'v' )
70 #define ATOM_cmov VLC_FOURCC( 'c', 'm', 'o', 'v' )
71 #define ATOM_dcom VLC_FOURCC( 'd', 'c', 'o', 'm' )
72 #define ATOM_cmvd VLC_FOURCC( 'c', 'm', 'v', 'd' )
74 #define ATOM_styp VLC_FOURCC( 's', 't', 'y', 'p' )
75 #define ATOM_moof VLC_FOURCC( 'm', 'o', 'o', 'f' )
76 #define ATOM_mdat VLC_FOURCC( 'm', 'd', 'a', 't' )
77 #define ATOM_skip VLC_FOURCC( 's', 'k', 'i', 'p' )
78 #define ATOM_free VLC_FOURCC( 'f', 'r', 'e', 'e' )
79 #define ATOM_udta VLC_FOURCC( 'u', 'd', 't', 'a' )
80 #define ATOM_wide VLC_FOURCC( 'w', 'i', 'd', 'e' )
81 #define ATOM_binm VLC_FOURCC( 0x82, 0x82, 0x7f, 0x7d ) /* binary Computer Graphics Metafile */
83 /* Quicktime preview */
84 #define ATOM_pnot VLC_FOURCC( 'p', 'n', 'o', 't' )
85 #define ATOM_pict VLC_FOURCC( 'p', 'i', 'c', 't' )
86 #define ATOM_PICT VLC_FOURCC( 'P', 'I', 'C', 'T' )
88 #define ATOM_data VLC_FOURCC( 'd', 'a', 't', 'a' )
90 #define ATOM_trak VLC_FOURCC( 't', 'r', 'a', 'k' )
91 #define ATOM_mvhd VLC_FOURCC( 'm', 'v', 'h', 'd' )
92 #define ATOM_tkhd VLC_FOURCC( 't', 'k', 'h', 'd' )
93 #define ATOM_tref VLC_FOURCC( 't', 'r', 'e', 'f' )
94 #define ATOM_load VLC_FOURCC( 'l', 'o', 'a', 'd' )
95 #define ATOM_mdia VLC_FOURCC( 'm', 'd', 'i', 'a' )
96 #define ATOM_mdhd VLC_FOURCC( 'm', 'd', 'h', 'd' )
97 #define ATOM_hdlr VLC_FOURCC( 'h', 'd', 'l', 'r' )
98 #define ATOM_minf VLC_FOURCC( 'm', 'i', 'n', 'f' )
99 #define ATOM_vmhd VLC_FOURCC( 'v', 'm', 'h', 'd' )
100 #define ATOM_smhd VLC_FOURCC( 's', 'm', 'h', 'd' )
101 #define ATOM_hmhd VLC_FOURCC( 'h', 'm', 'h', 'd' )
102 #define ATOM_dinf VLC_FOURCC( 'd', 'i', 'n', 'f' )
103 #define ATOM_url VLC_FOURCC( 'u', 'r', 'l', ' ' )
104 #define ATOM_urn VLC_FOURCC( 'u', 'r', 'n', ' ' )
105 #define ATOM_dref VLC_FOURCC( 'd', 'r', 'e', 'f' )
106 #define ATOM_stbl VLC_FOURCC( 's', 't', 'b', 'l' )
107 #define ATOM_stts VLC_FOURCC( 's', 't', 't', 's' )
108 #define ATOM_ctts VLC_FOURCC( 'c', 't', 't', 's' )
109 #define ATOM_cslg VLC_FOURCC( 'c', 's', 'l', 'g' )
110 #define ATOM_stsd VLC_FOURCC( 's', 't', 's', 'd' )
111 #define ATOM_stsz VLC_FOURCC( 's', 't', 's', 'z' )
112 #define ATOM_stz2 VLC_FOURCC( 's', 't', 'z', '2' )
113 #define ATOM_stsc VLC_FOURCC( 's', 't', 's', 'c' )
114 #define ATOM_stco VLC_FOURCC( 's', 't', 'c', 'o' )
115 #define ATOM_co64 VLC_FOURCC( 'c', 'o', '6', '4' )
116 #define ATOM_sbgp VLC_FOURCC( 's', 'b', 'g', 'p' )
117 #define ATOM_sgpd VLC_FOURCC( 's', 'g', 'p', 'd' )
118 #define ATOM_stss VLC_FOURCC( 's', 't', 's', 's' )
119 #define ATOM_stsh VLC_FOURCC( 's', 't', 's', 'h' )
120 #define ATOM_stdp VLC_FOURCC( 's', 't', 'd', 'p' )
121 #define ATOM_edts VLC_FOURCC( 'e', 'd', 't', 's' )
122 #define ATOM_elst VLC_FOURCC( 'e', 'l', 's', 't' )
123 #define ATOM_mvex VLC_FOURCC( 'm', 'v', 'e', 'x' )
124 #define ATOM_sdtp VLC_FOURCC( 's', 'd', 't', 'p' )
125 #define ATOM_trex VLC_FOURCC( 't', 'r', 'e', 'x' )
126 #define ATOM_mehd VLC_FOURCC( 'm', 'e', 'h', 'd' )
127 #define ATOM_mfhd VLC_FOURCC( 'm', 'f', 'h', 'd' )
128 #define ATOM_traf VLC_FOURCC( 't', 'r', 'a', 'f' )
129 #define ATOM_sidx VLC_FOURCC( 's', 'i', 'd', 'x' )
130 #define ATOM_tfhd VLC_FOURCC( 't', 'f', 'h', 'd' )
131 #define ATOM_tfdt VLC_FOURCC( 't', 'f', 'd', 't' )
132 #define ATOM_trun VLC_FOURCC( 't', 'r', 'u', 'n' )
133 #define ATOM_cprt VLC_FOURCC( 'c', 'p', 'r', 't' )
134 #define ATOM_iods VLC_FOURCC( 'i', 'o', 'd', 's' )
135 #define ATOM_pasp VLC_FOURCC( 'p', 'a', 's', 'p' )
136 #define ATOM_mfra VLC_FOURCC( 'm', 'f', 'r', 'a' )
137 #define ATOM_mfro VLC_FOURCC( 'm', 'f', 'r', 'o' )
138 #define ATOM_tfra VLC_FOURCC( 't', 'f', 'r', 'a' )
139 #define ATOM_keys VLC_FOURCC( 'k', 'e', 'y', 's' )
141 #define ATOM_st3d VLC_FOURCC( 's', 't', '3', 'd' )
142 #define ATOM_sv3d VLC_FOURCC( 's', 'v', '3', 'd' )
143 #define ATOM_proj VLC_FOURCC( 'p', 'r', 'o', 'j' )
144 #define ATOM_prhd VLC_FOURCC( 'p', 'r', 'h', 'd' )
145 #define ATOM_cbmp VLC_FOURCC( 'c', 'b', 'm', 'p' )
146 #define ATOM_equi VLC_FOURCC( 'e', 'q', 'u', 'i' )
148 #define ATOM_nmhd VLC_FOURCC( 'n', 'm', 'h', 'd' )
149 #define ATOM_mp2v VLC_FOURCC( 'm', 'p', '2', 'v' )
150 #define ATOM_mp4v VLC_FOURCC( 'm', 'p', '4', 'v' )
151 #define ATOM_mp4a VLC_FOURCC( 'm', 'p', '4', 'a' )
152 #define ATOM_mp4s VLC_FOURCC( 'm', 'p', '4', 's' )
153 #define ATOM_vide VLC_FOURCC( 'v', 'i', 'd', 'e' )
154 #define ATOM_soun VLC_FOURCC( 's', 'o', 'u', 'n' )
155 #define ATOM_hint VLC_FOURCC( 'h', 'i', 'n', 't' )
156 #define ATOM_hdv2 VLC_FOURCC( 'h', 'd', 'v', '2' )
157 #define ATOM_rrtp VLC_FOURCC( 'r', 'r', 't', 'p' )
159 #define ATOM_dpnd VLC_FOURCC( 'd', 'p', 'n', 'd' )
160 #define ATOM_cdsc VLC_FOURCC( 'c', 'd', 's', 'c' )
161 #define ATOM_ipir VLC_FOURCC( 'i', 'p', 'i', 'r' )
162 #define ATOM_mpod VLC_FOURCC( 'm', 'p', 'o', 'd' )
163 #define ATOM_hnti VLC_FOURCC( 'h', 'n', 't', 'i' )
164 #define ATOM_rtp VLC_FOURCC( 'r', 't', 'p', ' ' )
165 #define ATOM_btrt VLC_FOURCC( 'b', 't', 'r', 't' )
166 #define ATOM_sdp VLC_FOURCC( 's', 'd', 'p', ' ' )
168 #define ATOM_tims VLC_FOURCC( 't', 'i', 'm', 's' )
169 #define ATOM_tsro VLC_FOURCC( 't', 's', 'r', 'o' )
170 #define ATOM_tssy VLC_FOURCC( 't', 's', 's', 'y' )
172 #define ATOM_esds VLC_FOURCC( 'e', 's', 'd', 's' )
174 #define ATOM_lpcm VLC_FOURCC( 'l', 'p', 'c', 'm' )
175 #define ATOM__mp3 VLC_FOURCC( '.', 'm', 'p', '3' )
176 #define ATOM_ms02 VLC_FOURCC( 'm', 's', 0x0, 0x02 )
177 #define ATOM_ms11 VLC_FOURCC( 'm', 's', 0x0, 0x11 )
178 #define ATOM_ms55 VLC_FOURCC( 'm', 's', 0x0, 0x55 )
179 #define ATOM_twos VLC_FOURCC( 't', 'w', 'o', 's' )
180 #define ATOM_sowt VLC_FOURCC( 's', 'o', 'w', 't' )
181 #define ATOM_QDMC VLC_FOURCC( 'Q', 'D', 'M', 'C' )
182 #define ATOM_QDM2 VLC_FOURCC( 'Q', 'D', 'M', '2' )
183 #define ATOM_XiFL VLC_FOURCC( 'X', 'i', 'F', 'L' )
184 #define ATOM_XiVs VLC_FOURCC( 'X', 'i', 'V', 's' )
185 #define ATOM_ima4 VLC_FOURCC( 'i', 'm', 'a', '4' )
186 #define ATOM_IMA4 VLC_FOURCC( 'I', 'M', 'A', '4' )
187 #define ATOM_dvi VLC_FOURCC( 'd', 'v', 'i', ' ' )
188 #define ATOM_MAC3 VLC_FOURCC( 'M', 'A', 'C', '3' )
189 #define ATOM_MAC6 VLC_FOURCC( 'M', 'A', 'C', '6' )
190 #define ATOM_alaw VLC_FOURCC( 'a', 'l', 'a', 'w' )
191 #define ATOM_ulaw VLC_FOURCC( 'u', 'l', 'a', 'w' )
192 #define ATOM_Qclp VLC_FOURCC( 'Q', 'c', 'l', 'p' )
193 #define ATOM_samr VLC_FOURCC( 's', 'a', 'm', 'r' )
194 #define ATOM_sawb VLC_FOURCC( 's', 'a', 'w', 'b' )
195 #define ATOM_OggS VLC_FOURCC( 'O', 'g', 'g', 'S' )
196 #define ATOM_agsm VLC_FOURCC( 'a', 'g', 's', 'm' )
197 #define ATOM_alac VLC_FOURCC( 'a', 'l', 'a', 'c' )
198 #define ATOM_AC3 VLC_FOURCC( 'A', 'C', '-', '3' )
199 #define ATOM_ac3 VLC_FOURCC( 'a', 'c', '-', '3' )
200 #define ATOM_eac3 VLC_FOURCC( 'e', 'c', '-', '3' )
201 #define ATOM_dac3 VLC_FOURCC( 'd', 'a', 'c', '3' )
202 #define ATOM_dec3 VLC_FOURCC( 'd', 'e', 'c', '3' )
203 #define ATOM_ddts VLC_FOURCC( 'd', 'd', 't', 's' ) /* DTS formats */
204 #define ATOM_dtsc VLC_FOURCC( 'd', 't', 's', 'c' )
205 #define ATOM_dtsh VLC_FOURCC( 'd', 't', 's', 'h' )
206 #define ATOM_dtsl VLC_FOURCC( 'd', 't', 's', 'l' )
207 #define ATOM_dtse VLC_FOURCC( 'd', 't', 's', 'e' )
208 #define ATOM_dtsm VLC_FOURCC( 'd', 't', 's', '-' )
209 #define ATOM_dtsp VLC_FOURCC( 'd', 't', 's', '+' )
210 #define ATOM_vc1 VLC_FOURCC( 'v', 'c', '-', '1' )
211 #define ATOM_dvc1 VLC_FOURCC( 'd', 'v', 'c', '1' )
212 #define ATOM_WMA2 VLC_FOURCC( 'W', 'M', 'A', '2' )
213 #define ATOM_wma VLC_FOURCC( 'w', 'm', 'a', ' ' )
214 #define ATOM_enda VLC_FOURCC( 'e', 'n', 'd', 'a' )
215 #define ATOM_gnre VLC_FOURCC( 'g', 'n', 'r', 'e' )
216 #define ATOM_trkn VLC_FOURCC( 't', 'r', 'k', 'n' )
217 #define ATOM_chan VLC_FOURCC( 'c', 'h', 'a', 'n' )
218 #define ATOM_in24 VLC_FOURCC( 'i', 'n', '2', '4' )
219 #define ATOM_in32 VLC_FOURCC( 'i', 'n', '3', '2' )
220 #define ATOM_fl32 VLC_FOURCC( 'f', 'l', '3', '2' )
221 #define ATOM_fl64 VLC_FOURCC( 'f', 'l', '6', '4' )
222 #define ATOM_Opus VLC_FOURCC( 'O', 'p', 'u', 's' )
223 #define ATOM_fLaC VLC_FOURCC( 'f', 'L', 'a', 'C' )
224 #define ATOM_dfLa VLC_FOURCC( 'd', 'f', 'L', 'a' )
226 /* XiphQT */
227 #define ATOM_fCtS VLC_FOURCC( 'f', 'C', 't', 'S' )
228 #define ATOM_vCtH VLC_FOURCC( 'v', 'C', 't', 'H' )
229 #define ATOM_vCtC VLC_FOURCC( 'v', 'C', 't', 'C' )
230 #define ATOM_vCtd VLC_FOURCC( 'v', 'C', 't', '#' )
232 #define ATOM_zlib VLC_FOURCC( 'z', 'l', 'i', 'b' )
233 #define ATOM_SVQ1 VLC_FOURCC( 'S', 'V', 'Q', '1' )
234 #define ATOM_SVQ3 VLC_FOURCC( 'S', 'V', 'Q', '3' )
235 #define ATOM_ZyGo VLC_FOURCC( 'Z', 'y', 'G', 'o' )
236 #define ATOM_3IV1 VLC_FOURCC( '3', 'I', 'V', '1' )
237 #define ATOM_3iv1 VLC_FOURCC( '3', 'i', 'v', '1' )
238 #define ATOM_3IV2 VLC_FOURCC( '3', 'I', 'V', '2' )
239 #define ATOM_3iv2 VLC_FOURCC( '3', 'i', 'v', '2' )
240 #define ATOM_3IVD VLC_FOURCC( '3', 'I', 'V', 'D' )
241 #define ATOM_3ivd VLC_FOURCC( '3', 'i', 'v', 'd' )
242 #define ATOM_3VID VLC_FOURCC( '3', 'V', 'I', 'D' )
243 #define ATOM_3vid VLC_FOURCC( '3', 'v', 'i', 'd' )
244 #define ATOM_FFV1 VLC_FOURCC( 'F', 'F', 'V', '1' )
245 #define ATOM_h263 VLC_FOURCC( 'h', '2', '6', '3' )
246 #define ATOM_s263 VLC_FOURCC( 's', '2', '6', '3' )
247 #define ATOM_DIVX VLC_FOURCC( 'D', 'I', 'V', 'X' )
248 #define ATOM_XVID VLC_FOURCC( 'X', 'V', 'I', 'D' )
249 #define ATOM_cvid VLC_FOURCC( 'c', 'v', 'i', 'd' )
250 #define ATOM_mjpa VLC_FOURCC( 'm', 'j', 'p', 'a' )
251 #define ATOM_mjpb VLC_FOURCC( 'm', 'j', 'q', 't' )
252 #define ATOM_mjqt VLC_FOURCC( 'm', 'j', 'h', 't' )
253 #define ATOM_mjht VLC_FOURCC( 'm', 'j', 'p', 'b' )
254 #define ATOM_VP31 VLC_FOURCC( 'V', 'P', '3', '1' )
255 #define ATOM_vp31 VLC_FOURCC( 'v', 'p', '3', '1' )
256 #define ATOM_h264 VLC_FOURCC( 'h', '2', '6', '4' )
257 #define ATOM_H264 VLC_FOURCC( 'H', '2', '6', '4' )
258 #define ATOM_qdrw VLC_FOURCC( 'q', 'd', 'r', 'w' )
259 #define ATOM_vp08 VLC_FOURCC( 'v', 'p', '0', '8' )
260 #define ATOM_vp09 VLC_FOURCC( 'v', 'p', '0', '9' )
261 #define ATOM_vp10 VLC_FOURCC( 'v', 'p', '1', '0' )
262 #define ATOM_WMV3 VLC_FOURCC( 'W', 'M', 'V', '3' )
263 #define ATOM_WVC1 VLC_FOURCC( 'W', 'V', 'C', '1' )
265 #define ATOM_av01 VLC_FOURCC( 'a', 'v', '0', '1' )
266 #define ATOM_avc1 VLC_FOURCC( 'a', 'v', 'c', '1' )
267 #define ATOM_avc3 VLC_FOURCC( 'a', 'v', 'c', '3' )
268 #define ATOM_av1C VLC_FOURCC( 'a', 'v', '1', 'C' )
269 #define ATOM_avcC VLC_FOURCC( 'a', 'v', 'c', 'C' )
270 #define ATOM_vpcC VLC_FOURCC( 'v', 'p', 'c', 'C' )
271 #define ATOM_m4ds VLC_FOURCC( 'm', '4', 'd', 's' )
273 #define ATOM_fiel VLC_FOURCC( 'f', 'i', 'e', 'l' )
274 #define ATOM_glbl VLC_FOURCC( 'g', 'l', 'b', 'l' )
275 #define ATOM_hvcC VLC_FOURCC( 'h', 'v', 'c', 'C' )
276 #define ATOM_jpeC VLC_FOURCC( 'j', 'p', 'e', 'C' )
278 #define ATOM_dvc VLC_FOURCC( 'd', 'v', 'c', ' ' )
279 #define ATOM_dvp VLC_FOURCC( 'd', 'v', 'p', ' ' )
280 #define ATOM_dv5n VLC_FOURCC( 'd', 'v', '5', 'n' )
281 #define ATOM_dv5p VLC_FOURCC( 'd', 'v', '5', 'p' )
282 #define ATOM_raw VLC_FOURCC( 'r', 'a', 'w', ' ' )
283 #define ATOM_dOps VLC_FOURCC( 'd', 'O', 'p', 's' )
284 #define ATOM_wfex VLC_FOURCC( 'w', 'f', 'e', 'x' )
286 #define ATOM_jpeg VLC_FOURCC( 'j', 'p', 'e', 'g' )
288 #define ATOM_yv12 VLC_FOURCC( 'y', 'v', '1', '2' )
289 #define ATOM_yuv2 VLC_FOURCC( 'y', 'u', 'v', '2' )
291 #define ATOM_rmra VLC_FOURCC( 'r', 'm', 'r', 'a' )
292 #define ATOM_rmda VLC_FOURCC( 'r', 'm', 'd', 'a' )
293 #define ATOM_rdrf VLC_FOURCC( 'r', 'd', 'r', 'f' )
294 #define ATOM_rmdr VLC_FOURCC( 'r', 'm', 'd', 'r' )
295 #define ATOM_rmvc VLC_FOURCC( 'r', 'm', 'v', 'c' )
296 #define ATOM_rmcd VLC_FOURCC( 'r', 'm', 'c', 'd' )
297 #define ATOM_rmqu VLC_FOURCC( 'r', 'm', 'q', 'u' )
298 #define ATOM_alis VLC_FOURCC( 'a', 'l', 'i', 's' )
300 #define ATOM_gmhd VLC_FOURCC( 'g', 'm', 'h', 'd' )
301 #define ATOM_wave VLC_FOURCC( 'w', 'a', 'v', 'e' )
302 #define ATOM_strf VLC_FOURCC( 's', 't', 'r', 'f' )
304 #define ATOM_drms VLC_FOURCC( 'd', 'r', 'm', 's' )
305 #define ATOM_sinf VLC_FOURCC( 's', 'i', 'n', 'f' )
306 #define ATOM_schi VLC_FOURCC( 's', 'c', 'h', 'i' )
307 #define ATOM_user VLC_FOURCC( 'u', 's', 'e', 'r' )
308 #define ATOM_key VLC_FOURCC( 'k', 'e', 'y', ' ' )
309 #define ATOM_iviv VLC_FOURCC( 'i', 'v', 'i', 'v' )
310 #define ATOM_mean VLC_FOURCC( 'm', 'e', 'a', 'n' )
311 #define ATOM_name VLC_FOURCC( 'n', 'a', 'm', 'e' )
312 #define ATOM_priv VLC_FOURCC( 'p', 'r', 'i', 'v' )
313 #define ATOM_drmi VLC_FOURCC( 'd', 'r', 'm', 'i' )
314 #define ATOM_frma VLC_FOURCC( 'f', 'r', 'm', 'a' )
315 #define ATOM_skcr VLC_FOURCC( 's', 'k', 'c', 'r' )
316 #define ATOM_ASF VLC_FOURCC( 'A', 'S', 'F', ' ' )
318 #define ATOM_text VLC_FOURCC( 't', 'e', 'x', 't' )
319 #define ATOM_tx3g VLC_FOURCC( 't', 'x', '3', 'g' )
320 #define ATOM_subp VLC_FOURCC( 's', 'u', 'b', 'p' )
321 #define ATOM_subt VLC_FOURCC( 's', 'u', 'b', 't' )
322 #define ATOM_sbtl VLC_FOURCC( 's', 'b', 't', 'l' )
323 #define ATOM_clcp VLC_FOURCC( 'c', 'l', 'c', 'p' )
324 #define ATOM_c608 VLC_FOURCC( 'c', '6', '0', '8' )
325 #define ATOM_c708 VLC_FOURCC( 'c', '7', '0', '8' )
326 #define ATOM_wvtt VLC_FOURCC( 'w', 'v', 't', 't' )
328 /* In sample for WebVTT */
329 #define ATOM_vttc VLC_FOURCC( 'v', 't', 't', 'c' )
330 #define ATOM_payl VLC_FOURCC( 'p', 'a', 'y', 'l' )
332 #define ATOM_0xa9nam VLC_FOURCC( 0xa9, 'n', 'a', 'm' )
333 #define ATOM_0xa9aut VLC_FOURCC( 0xa9, 'a', 'u', 't' )
334 #define ATOM_0xa9cpy VLC_FOURCC( 0xa9, 'c', 'p', 'y' )
335 #define ATOM_0xa9inf VLC_FOURCC( 0xa9, 'i', 'n', 'f' )
336 #define ATOM_0xa9isr VLC_FOURCC( 0xa9, 'i', 's', 'r' )
337 #define ATOM_0xa9lab VLC_FOURCC( 0xa9, 'l', 'a', 'b' )
338 #define ATOM_0xa9lal VLC_FOURCC( 0xa9, 'l', 'a', 'l' )
339 #define ATOM_0xa9ART VLC_FOURCC( 0xa9, 'A', 'R', 'T' )
340 #define ATOM_0xa9des VLC_FOURCC( 0xa9, 'd', 'e', 's' )
341 #define ATOM_0xa9dir VLC_FOURCC( 0xa9, 'd', 'i', 'r' )
342 #define ATOM_0xa9cmt VLC_FOURCC( 0xa9, 'c', 'm', 't' )
343 #define ATOM_0xa9req VLC_FOURCC( 0xa9, 'r', 'e', 'q' )
344 #define ATOM_0xa9day VLC_FOURCC( 0xa9, 'd', 'a', 'y' )
345 #define ATOM_0xa9fmt VLC_FOURCC( 0xa9, 'f', 'm', 't' )
346 #define ATOM_0xa9prd VLC_FOURCC( 0xa9, 'p', 'r', 'd' )
347 #define ATOM_0xa9prf VLC_FOURCC( 0xa9, 'p', 'r', 'f' )
348 #define ATOM_0xa9src VLC_FOURCC( 0xa9, 's', 'r', 'c' )
349 #define ATOM_0xa9alb VLC_FOURCC( 0xa9, 'a', 'l', 'b' )
350 #define ATOM_0xa9dis VLC_FOURCC( 0xa9, 'd', 'i', 's' )
351 #define ATOM_0xa9enc VLC_FOURCC( 0xa9, 'e', 'n', 'c' )
352 #define ATOM_0xa9trk VLC_FOURCC( 0xa9, 't', 'r', 'k' )
353 #define ATOM_0xa9url VLC_FOURCC( 0xa9, 'u', 'r', 'l' )
354 #define ATOM_0xa9dsa VLC_FOURCC( 0xa9, 'd', 's', 'a' )
355 #define ATOM_0xa9hst VLC_FOURCC( 0xa9, 'h', 's', 't' )
356 #define ATOM_0xa9ope VLC_FOURCC( 0xa9, 'o', 'p', 'e' )
357 #define ATOM_0xa9wrt VLC_FOURCC( 0xa9, 'w', 'r', 't' )
358 #define ATOM_0xa9com VLC_FOURCC( 0xa9, 'c', 'o', 'm' )
359 #define ATOM_0xa9gen VLC_FOURCC( 0xa9, 'g', 'e', 'n' )
360 #define ATOM_0xa9too VLC_FOURCC( 0xa9, 't', 'o', 'o' )
361 #define ATOM_0xa9wrn VLC_FOURCC( 0xa9, 'w', 'r', 'n' )
362 #define ATOM_0xa9swr VLC_FOURCC( 0xa9, 's', 'w', 'r' )
363 #define ATOM_0xa9mak VLC_FOURCC( 0xa9, 'm', 'a', 'k' )
364 #define ATOM_0xa9mal VLC_FOURCC( 0xa9, 'm', 'a', 'l' )
365 #define ATOM_0xa9mod VLC_FOURCC( 0xa9, 'm', 'o', 'd' )
366 #define ATOM_0xa9PRD VLC_FOURCC( 0xa9, 'P', 'R', 'D' )
367 #define ATOM_0xa9grp VLC_FOURCC( 0xa9, 'g', 'r', 'p' )
368 #define ATOM_0xa9lyr VLC_FOURCC( 0xa9, 'l', 'y', 'r' )
369 #define ATOM_0xa9gen VLC_FOURCC( 0xa9, 'g', 'e', 'n' )
370 #define ATOM_0xa9st3 VLC_FOURCC( 0xa9, 's', 't', '3' )
371 #define ATOM_0xa9ard VLC_FOURCC( 0xa9, 'a', 'r', 'd' )
372 #define ATOM_0xa9arg VLC_FOURCC( 0xa9, 'a', 'r', 'g' )
373 #define ATOM_0xa9cak VLC_FOURCC( 0xa9, 'c', 'a', 'k' )
374 #define ATOM_0xa9con VLC_FOURCC( 0xa9, 'c', 'o', 'n' )
375 #define ATOM_0xa9des VLC_FOURCC( 0xa9, 'd', 'e', 's' )
376 #define ATOM_0xa9lnt VLC_FOURCC( 0xa9, 'l', 'n', 't' )
377 #define ATOM_0xa9phg VLC_FOURCC( 0xa9, 'p', 'h', 'g' )
378 #define ATOM_0xa9pub VLC_FOURCC( 0xa9, 'p', 'u', 'b' )
379 #define ATOM_0xa9sne VLC_FOURCC( 0xa9, 's', 'n', 'e' )
380 #define ATOM_0xa9snm VLC_FOURCC( 0xa9, 's', 'n', 'm' )
381 #define ATOM_0xa9sol VLC_FOURCC( 0xa9, 's', 'o', 'l' )
382 #define ATOM_0xa9thx VLC_FOURCC( 0xa9, 't', 'h', 'x' )
383 #define ATOM_0xa9xpd VLC_FOURCC( 0xa9, 'x', 'p', 'd' )
384 #define ATOM_0xa9xyz VLC_FOURCC( 0xa9, 'x', 'y', 'z' )
385 #define ATOM_aART VLC_FOURCC( 'a', 'A', 'R', 'T' )
386 #define ATOM_chpl VLC_FOURCC( 'c', 'h', 'p', 'l' )
387 #define ATOM_HMMT VLC_FOURCC( 'H', 'M', 'M', 'T' )
388 #define ATOM_desc VLC_FOURCC( 'd', 'e', 's', 'c' )
389 #define ATOM_disk VLC_FOURCC( 'd', 'i', 's', 'k' )
390 #define ATOM_ID32 VLC_FOURCC( 'I', 'D', '3', '2' )
391 #define ATOM_WLOC VLC_FOURCC( 'W', 'L', 'O', 'C' )
392 #define ATOM_ITUN VLC_FOURCC( '-', '-', '-', '-' )
394 #define ATOM_meta VLC_FOURCC( 'm', 'e', 't', 'a' )
395 #define ATOM_atID VLC_FOURCC( 'a', 't', 'I', 'D' )
396 #define ATOM_ilst VLC_FOURCC( 'i', 'l', 's', 't' )
397 #define ATOM_cnID VLC_FOURCC( 'c', 'n', 'I', 'D' )
398 #define ATOM_covr VLC_FOURCC( 'c', 'o', 'v', 'r' )
399 #define ATOM_flvr VLC_FOURCC( 'f', 'l', 'v', 'r' )
400 #define ATOM_rtng VLC_FOURCC( 'r', 't', 'n', 'g' )
401 #define ATOM_tsel VLC_FOURCC( 't', 's', 'e', 'l' )
402 #define ATOM_xid_ VLC_FOURCC( 'x', 'i', 'd', ' ' )
403 #define ATOM_gshh VLC_FOURCC( 'g', 's', 'h', 'h' )
404 #define ATOM_gspm VLC_FOURCC( 'g', 's', 'p', 'm' )
405 #define ATOM_gspu VLC_FOURCC( 'g', 's', 'p', 'u' )
406 #define ATOM_gssd VLC_FOURCC( 'g', 's', 's', 'd' )
407 #define ATOM_gsst VLC_FOURCC( 'g', 's', 's', 't' )
408 #define ATOM_gstd VLC_FOURCC( 'g', 's', 't', 'd' )
409 #define ATOM_colr VLC_FOURCC( 'c', 'o', 'l', 'r' )
410 #define ATOM_irot VLC_FOURCC( 'i', 'r', 'o', 't' )
411 #define ATOM_SmDm VLC_FOURCC( 'S', 'm', 'D', 'm' )
412 #define ATOM_CoLL VLC_FOURCC( 'C', 'o', 'L', 'L' )
413 #define ATOM_mdcv VLC_FOURCC( 'm', 'd', 'c', 'v' )
414 #define ATOM_clli VLC_FOURCC( 'c', 'l', 'l', 'i' )
416 #define ATOM_0x40PRM VLC_FOURCC( '@', 'P', 'R', 'M' )
417 #define ATOM_0x40PRQ VLC_FOURCC( '@', 'P', 'R', 'Q' )
418 #define ATOM_chap VLC_FOURCC( 'c', 'h', 'a', 'p' )
419 #define ATOM_MCPS VLC_FOURCC( 'M', 'C', 'P', 'S' )
420 #define ATOM_SDLN VLC_FOURCC( 'S', 'D', 'L', 'N' )
421 #define ATOM_vndr VLC_FOURCC( 'v', 'n', 'd', 'r' )
423 #define ATOM_SA3D VLC_FOURCC( 'S', 'A', '3', 'D' )
425 /* iso4 meta references */
426 #define ATOM_idat VLC_FOURCC('i','d','a','t')
427 #define ATOM_iloc VLC_FOURCC('i','l','o','c')
428 #define ATOM_iinf VLC_FOURCC('i','i','n','f')
429 #define ATOM_infe VLC_FOURCC('i','n','f','e')
430 #define ATOM_iref VLC_FOURCC('i','r','e','f')
431 #define ATOM_pitm VLC_FOURCC('p','i','t','m')
432 /* HEIF specific meta */
433 #define ATOM_iprp VLC_FOURCC('i','p','r','p')
434 #define ATOM_ipco VLC_FOURCC('i','p','c','o')
435 #define ATOM_ispe VLC_FOURCC('i','s','p','e')
436 #define ATOM_ipma VLC_FOURCC('i','p','m','a')
438 #define HANDLER_mdta VLC_FOURCC('m', 'd', 't', 'a')
439 #define HANDLER_mdir VLC_FOURCC('m', 'd', 'i', 'r')
440 #define HANDLER_ID32 ATOM_ID32
442 #define SAMPLEGROUP_rap VLC_FOURCC('r', 'a', 'p', ' ')
444 /* HEIF Specific */
445 #define HANDLER_pict VLC_FOURCC('p', 'i', 'c', 't')
447 /* Do you want some debug information on all read boxes ? */
448 #ifndef NDEBUG
449 # define MP4_VERBOSE 1
450 //# define MP4_ULTRA_VERBOSE 1
451 #endif
453 struct MP4_Box_s;
455 #define MP4_MFRO_BOXSIZE 16
457 /* uuid Universal Unique IDentifiers */
458 typedef struct UUID_s
460 uint8_t b[16];
461 } UUID_t;
463 /* specific structure for all boxes */
465 typedef struct MP4_Box_data_tfxd_s
467 uint8_t i_version;
468 uint32_t i_flags;
470 uint64_t i_fragment_duration;
471 uint64_t i_fragment_abs_time;
473 } MP4_Box_data_tfxd_t;
475 typedef struct TfrfBoxDataFields_s
477 uint64_t i_fragment_duration;
478 uint64_t i_fragment_abs_time;
480 } TfrfBoxDataFields_t;
482 typedef struct MP4_Box_data_tfrf_s
484 uint8_t i_version;
485 uint8_t i_fragment_count;
486 uint32_t i_flags;
488 TfrfBoxDataFields_t *p_tfrf_data_fields;
490 } MP4_Box_data_tfrf_t;
492 typedef struct MP4_Box_data_ftyp_s
494 uint32_t i_major_brand;
495 uint32_t i_minor_version;
497 uint32_t i_compatible_brands_count;
498 uint32_t *i_compatible_brands;
500 } MP4_Box_data_ftyp_t;
502 typedef struct MP4_Box_data_mvhd_s
504 uint8_t i_version;
505 uint32_t i_flags;
507 uint64_t i_creation_time;
508 uint64_t i_modification_time;
509 uint32_t i_timescale;
510 uint64_t i_duration;
512 int32_t i_rate;
513 int16_t i_volume;
514 int16_t i_reserved1;
515 uint32_t i_reserved2[2];
516 int32_t i_matrix[9];
517 uint32_t i_predefined[6];
518 uint32_t i_next_track_id;
520 } MP4_Box_data_mvhd_t;
522 #define MP4_TRACK_ENABLED 0x000001
523 #define MP4_TRACK_IN_MOVIE 0x000002
524 #define MP4_TRACK_IN_PREVIEW 0x000004
525 typedef struct MP4_Box_data_tkhd_s
527 uint8_t i_version;
528 uint32_t i_flags;
530 uint64_t i_creation_time;
531 uint64_t i_modification_time;
532 uint32_t i_track_ID;
533 uint32_t i_reserved;
534 uint64_t i_duration;
536 uint32_t i_reserved2[2];
537 int16_t i_layer;
538 int16_t i_predefined;
540 int16_t i_volume;
541 uint16_t i_reserved3;
542 int32_t i_matrix[9];
543 int32_t i_width;
544 int32_t i_height;
545 float f_rotation;
547 } MP4_Box_data_tkhd_t;
549 typedef struct
551 uint32_t i_start_time;
552 int32_t i_duration;
553 uint32_t i_flags;
554 uint32_t i_hints;
555 } MP4_Box_data_load_t;
557 typedef struct MP4_Box_data_mdhd_s
559 uint8_t i_version;
560 uint32_t i_flags;
562 uint64_t i_creation_time;
563 uint64_t i_modification_time;
564 uint32_t i_timescale;
565 uint64_t i_duration;
567 char rgs_language[3]; /* ISO-639-2/T or Mac lang table */
568 bool b_mac_encoding; /* media using mac encoding */
570 uint16_t i_quality;
572 } MP4_Box_data_mdhd_t;
574 typedef struct MP4_Box_data_hdlr_s
576 uint8_t i_version;
577 uint32_t i_flags;
579 uint32_t i_predefined;
580 uint32_t i_handler_type; /* "vide" "soun" "hint" "odsm"
581 "crsm" "sdsm" "m7sm" "ocsm"
582 "ipsm" "mjsm" */
584 unsigned char *psz_name; /* in UTF-8 */
586 } MP4_Box_data_hdlr_t;
588 typedef struct MP4_Box_data_vmhd_s
590 uint8_t i_version;
591 uint32_t i_flags;
593 int16_t i_graphics_mode;
594 int16_t i_opcolor[3];
596 } MP4_Box_data_vmhd_t;
598 typedef struct MP4_Box_data_smhd_s
600 uint8_t i_version;
601 uint32_t i_flags;
603 int16_t i_balance;
604 int16_t i_reserved;
606 } MP4_Box_data_smhd_t;
608 typedef struct MP4_Box_data_hmhd_s
610 uint8_t i_version;
611 uint32_t i_flags;
613 uint16_t i_max_PDU_size;
614 uint16_t i_avg_PDU_size;
615 uint32_t i_max_bitrate;
616 uint32_t i_avg_bitrate;
617 uint32_t i_reserved;
619 } MP4_Box_data_hmhd_t;
621 typedef struct MP4_Box_data_url_s
623 uint8_t i_version;
624 uint32_t i_flags;
626 char *psz_location;
628 } MP4_Box_data_url_t;
630 typedef struct MP4_Box_data_urn_s
632 uint8_t i_version;
633 uint32_t i_flags;
635 char *psz_name;
636 char *psz_location;
638 } MP4_Box_data_urn_t;
640 typedef struct MP4_Box_data_lcont_s
642 uint8_t i_version;
643 uint32_t i_flags;
645 uint32_t i_entry_count;
646 /* XXX it's also a container with i_entry_count entry */
647 } MP4_Box_data_lcont_t;
649 typedef struct MP4_Box_data_stts_s
651 uint8_t i_version;
652 uint32_t i_flags;
654 uint32_t i_entry_count;
655 uint32_t *pi_sample_count; /* these are array */
656 int32_t *pi_sample_delta;
658 } MP4_Box_data_stts_t;
660 typedef struct MP4_Box_data_ctts_s
662 uint8_t i_version;
663 uint32_t i_flags;
665 uint32_t i_entry_count;
667 uint32_t *pi_sample_count; /* these are array */
668 int32_t *pi_sample_offset;
670 } MP4_Box_data_ctts_t;
672 typedef struct MP4_Box_data_cslg_s
674 int64_t ct_to_dts_shift;
675 int64_t i_least_delta;
676 int64_t i_max_delta;
677 int64_t i_composition_starttime;
678 int64_t i_composition_endtime;
680 } MP4_Box_data_cslg_t;
682 // https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-125526
683 typedef struct MP4_Box_data_colr_s
685 uint32_t i_type;
686 union
688 struct
690 uint16_t i_primary_idx;
691 uint16_t i_transfer_function_idx;
692 uint16_t i_matrix_idx;
693 uint8_t i_full_range;
694 } nclc;
696 } MP4_Box_data_colr_t;
698 typedef struct
700 uint16_t i_ccw_degrees;
701 } MP4_Box_data_irot_t;
703 typedef struct MP4_Box_data_sample_soun_s
705 uint8_t i_reserved1[6];
706 uint16_t i_data_reference_index;
708 //uint32_t i_reserved2[2];
709 uint16_t i_qt_version;
710 uint16_t i_qt_revision_level;
711 uint32_t i_qt_vendor;
713 uint16_t i_channelcount;
714 uint16_t i_samplesize;
715 uint16_t i_compressionid;
716 uint16_t i_reserved3;
717 uint32_t i_sampleratehi; /* timescale of track */
718 uint32_t i_sampleratelo;
720 /* for version 1 (i_reserved1[0] == 1) */
721 uint32_t i_sample_per_packet;
722 uint32_t i_bytes_per_packet;
723 uint32_t i_bytes_per_frame;
724 uint32_t i_bytes_per_sample;
726 /* v2 */
727 uint32_t i_constbitsperchannel; /* consts are nonzero only if constant */
728 uint32_t i_formatflags;
729 uint32_t i_constbytesperaudiopacket;
730 uint32_t i_constLPCMframesperaudiopacket;
732 /* XXX hack */
733 int i_qt_description;
734 uint8_t *p_qt_description;
736 } MP4_Box_data_sample_soun_t;
738 typedef struct MP4_Box_data_sample_vide_s
740 uint8_t i_reserved1[6];
741 uint16_t i_data_reference_index;
743 uint16_t i_qt_version;
744 uint16_t i_qt_revision_level;
745 uint32_t i_qt_vendor;
747 uint32_t i_qt_temporal_quality;
748 uint32_t i_qt_spatial_quality;
750 int16_t i_width;
751 int16_t i_height;
753 uint32_t i_horizresolution;
754 uint32_t i_vertresolution;
756 uint32_t i_qt_data_size;
757 uint16_t i_qt_frame_count;
759 char sz_compressorname[32];
760 int16_t i_depth;
762 int16_t i_qt_color_table;
764 /* XXX hack ImageDescription */
765 int i_qt_image_description;
766 uint8_t *p_qt_image_description;
768 } MP4_Box_data_sample_vide_t;
770 #define MP4_TEXT_DISPLAY_FLAG_DONT_DISPLAY (1<<0)
771 #define MP4_TEXT_DISPLAY_FLAG_AUTO_SCALE (1<<1)
772 #define MP4_TEXT_DISPLAY_FLAG_CLIP_TO_TEXT_BOX (1<<2)
773 #define MP4_TEXT_DISPLAY_FLAG_USE_MOVIE_BG_COLOR (1<<3)
774 #define MP4_TEXT_DISPLAY_FLAG_SHRINK_TEXT_BOX_TO_FIT (1<<4)
775 #define MP4_TEXT_DISPLAY_FLAG_SCROLL_IN (1<<5)
776 #define MP4_TEXT_DISPLAY_FLAG_SCROLL_OUT (1<<6)
777 #define MP4_TEXT_DISPLAY_FLAG_HORIZONTAL_SCROLL (1<<7)
778 #define MP4_TEXT_DISPLAY_FLAG_REVERSE_SCROLL (1<<8)
779 #define MP4_TEXT_DISPLAY_FLAG_CONTINUOUS_SCROLL (1<<9)
780 #define MP4_TEXT_DISPLAY_FLAG_FLOW_HORIZONTAL (1<<10)
781 #define MP4_TEXT_DISPLAY_FLAG_CONTINUOUS_KARAOKE (1<<11)
782 #define MP4_TEXT_DISPLAY_FLAG_DROP_SHADOW (1<<12)
783 #define MP4_TEXT_DISPLAY_FLAG_ANTI_ALIAS (1<<13)
784 #define MP4_TEXT_DISPLAY_FLAG_KEYED_TEXT (1<<14)
785 #define MP4_TEXT_DISPLAY_FLAG_INVERSE_HILITE (1<<15)
786 #define MP4_TEXT_DISPLAY_FLAG_COLOR_HILITE (1<<16)
787 #define MP4_TEXT_DISPLAY_FLAG_WRITE_VERTICALLY (1<<17)
789 typedef struct
791 uint32_t i_reserved1;
792 uint16_t i_reserved2;
794 uint16_t i_data_reference_index;
796 uint8_t *p_data;
797 size_t i_data;
799 } MP4_Box_data_sample_text_t;
801 typedef struct
803 uint8_t i_reserved1[6];
804 uint16_t i_data_reference_index;
806 } MP4_Box_data_sample_clcp_t;
808 typedef struct MP4_Box_data_sample_hint_s
810 uint8_t i_reserved1[6];
811 uint16_t i_data_reference_index;
813 uint8_t *p_data;
815 } MP4_Box_data_sample_hint_t;
817 typedef struct MP4_Box_data_rrtp_sample_s
819 uint16_t i_hinttrackversion;
820 uint16_t i_highestcompatibleversion;
821 uint32_t i_maxpacketsize;
823 uint8_t *p_additionaldata;
825 } MP4_Box_data_rrtp_sample_t;
827 typedef struct MP4_Box_data_timescale_entry_s
829 uint32_t i_timescale;
831 } MP4_Box_data_timescale_entry_t;
833 typedef struct MP4_Box_data_time_offset_s
835 uint32_t i_offset;
837 } MP4_Box_data_time_offset_t;
839 typedef struct MP4_Box_data_timestampsynchrony_s
841 uint8_t i_reserved_timestamp_sync;
843 } MP4_Box_data_timestampsynchrony_t;
845 typedef struct MP4_Box_data_moviehintinformation_rtp_s
847 uint32_t i_description_format;
848 char *psz_text;
850 } MP4_Box_data_moviehintinformation_rtp_t;
852 typedef struct MP4_Box_data_sdp_s
854 char *psz_text;
856 } MP4_Box_data_sdp_t;
858 typedef struct MP4_Box_data_tims_s
860 uint32_t i_timescale;
862 } MP4_Box_data_tims_t;
864 typedef struct MP4_Box_data_tsro_s
866 int32_t i_offset;
868 } MP4_Box_data_tsro_t;
870 typedef struct MP4_Box_data_tssy_s
872 uint8_t i_reserved_timestamp_sync;
874 } MP4_Box_data_tssy_t;
876 typedef struct MP4_Box_data_stsd_s
878 uint8_t i_version;
879 uint32_t i_flags;
881 uint32_t i_entry_count;
883 /* it contains SampleEntry handled as if it was Box */
885 } MP4_Box_data_stsd_t;
888 typedef struct MP4_Box_data_stsz_s
890 uint8_t i_version;
891 uint32_t i_flags;
893 uint32_t i_sample_size;
894 uint32_t i_sample_count;
896 uint32_t *i_entry_size; /* array , empty if i_sample_size != 0 */
898 } MP4_Box_data_stsz_t;
900 typedef struct MP4_Box_data_stz2_s
902 uint8_t i_version;
903 uint32_t i_flags;
905 uint32_t i_sample_size; /* 24 bits */
906 uint8_t i_field_size;
907 uint32_t i_sample_count;
909 uint32_t *i_entry_size; /* array: unsigned int(i_field_size) entry_size */
911 } MP4_Box_data_stz2_t;
913 typedef struct MP4_Box_data_stsc_s
915 uint8_t i_version;
916 uint32_t i_flags;
918 uint32_t i_entry_count;
920 uint32_t *i_first_chunk; /* theses are arrays */
921 uint32_t *i_samples_per_chunk;
922 uint32_t *i_sample_description_index;
924 } MP4_Box_data_stsc_t;
927 typedef struct MP4_Box_data_co64_s
929 uint8_t i_version;
930 uint32_t i_flags;
932 uint32_t i_entry_count;
934 uint64_t *i_chunk_offset;
936 } MP4_Box_data_co64_t;
939 typedef struct MP4_Box_data_stss_s
941 uint8_t i_version;
942 uint32_t i_flags;
944 uint32_t i_entry_count;
946 uint32_t *i_sample_number;
948 } MP4_Box_data_stss_t;
950 typedef struct MP4_Box_data_stsh_s
952 uint8_t i_version;
953 uint32_t i_flags;
955 uint32_t i_entry_count;
957 uint32_t *i_shadowed_sample_number;
958 uint32_t *i_sync_sample_number;
960 } MP4_Box_data_stsh_t;
962 typedef struct MP4_Box_data_stdp_s
964 uint8_t i_version;
965 uint32_t i_flags;
967 uint16_t *i_priority;
969 } MP4_Box_data_stdp_t;
971 typedef struct MP4_Box_data_elst_s
973 uint8_t i_version;
974 uint32_t i_flags;
976 uint32_t i_entry_count;
978 uint64_t *i_segment_duration; /* movie timescale */
979 int64_t *i_media_time; /* media(track) timescale */
980 uint16_t *i_media_rate_integer;
981 uint16_t *i_media_rate_fraction;
984 } MP4_Box_data_elst_t;
986 typedef struct MP4_Box_data_cprt_s
988 uint8_t i_version;
989 uint32_t i_flags;
991 char rgs_language[3]; /* ISO-639-2/T */
993 char *psz_notice;
994 } MP4_Box_data_cprt_t;
997 /* DecoderConfigDescriptor */
998 typedef struct MP4_descriptor_decoder_config_s
1000 uint8_t i_objectProfileIndication;
1001 uint8_t i_streamType;
1002 int b_upStream;
1003 int i_buffer_sizeDB;
1004 int i_max_bitrate;
1005 int i_avg_bitrate;
1007 int i_decoder_specific_info_len;
1008 uint8_t *p_decoder_specific_info;
1009 /* some other stuff */
1011 } MP4_descriptor_decoder_config_t;
1013 typedef struct MP4_descriptor_SL_config_s
1016 int i_dummy; /* ANSI C forbids empty structures */
1018 } MP4_descriptor_SL_config_t;
1021 typedef struct MP4_descriptor_ES_s
1023 uint16_t i_ES_ID;
1024 int b_stream_dependence;
1025 int b_url;
1026 int b_OCRstream;
1027 int i_stream_priority;
1029 int i_depend_on_ES_ID; /* if b_stream_dependence set */
1031 unsigned char *psz_URL;
1033 uint16_t i_OCR_ES_ID; /* if b_OCRstream */
1034 MP4_descriptor_decoder_config_t *p_decConfigDescr;
1036 MP4_descriptor_SL_config_t *p_slConfigDescr;
1038 /* some other stuff ... */
1040 } MP4_descriptor_ES_t;
1042 /* ES descriptor */
1043 typedef struct MP4_Box_data_esds_s
1045 uint8_t i_version;
1046 uint32_t i_flags;
1048 MP4_descriptor_ES_t es_descriptor;
1050 } MP4_Box_data_esds_t;
1053 typedef struct MP4_Box_data_dcom_s
1055 uint32_t i_algorithm; /* fourcc */
1057 } MP4_Box_data_dcom_t;
1059 typedef struct MP4_Box_data_cmvd_s
1061 uint32_t i_uncompressed_size;
1062 uint32_t i_compressed_size;
1064 int b_compressed; /* Set to 1 if compressed data, 0 if uncompressed */
1065 uint8_t *p_data;
1067 } MP4_Box_data_cmvd_t;
1069 typedef struct MP4_Box_data_cmov_s
1071 struct MP4_Box_s *p_moov; /* uncompressed moov */
1073 } MP4_Box_data_cmov_t;
1075 typedef struct
1077 uint32_t i_type;
1078 } MP4_Box_data_frma_t;
1080 typedef struct
1082 uint32_t i_init;
1083 uint32_t i_encr;
1084 uint32_t i_decr;
1085 } MP4_Box_data_skcr_t;
1087 typedef struct
1089 uint8_t i_version;
1090 uint32_t i_flags;
1092 uint32_t i_ref_type;
1093 char *psz_ref;
1095 } MP4_Box_data_rdrf_t;
1097 typedef struct
1099 uint8_t i_version;
1100 uint32_t i_flags;
1102 uint32_t i_rate;
1104 } MP4_Box_data_rmdr_t;
1106 typedef struct
1108 uint8_t i_version;
1109 uint32_t i_flags;
1111 uint32_t i_gestaltType;
1112 uint32_t i_val1;
1113 uint32_t i_val2;
1114 uint16_t i_checkType; /* 0: val1 is version min
1115 1: gestalt value & val2 == val1 */
1117 } MP4_Box_data_rmvc_t;
1119 typedef struct
1121 uint8_t i_version;
1122 uint32_t i_flags;
1125 } MP4_Box_data_rmcd_t;
1127 typedef struct
1129 uint32_t i_quality;
1131 } MP4_Box_data_rmqu_t;
1133 typedef struct MP4_Box_data_mfhd_s
1135 uint8_t i_version;
1136 uint32_t i_flags;
1138 uint32_t i_sequence_number;
1140 } MP4_Box_data_mfhd_t;
1142 typedef struct MP4_Box_sidx_item_s
1144 bool b_reference_type;
1145 uint32_t i_referenced_size;
1146 uint32_t i_subsegment_duration;
1147 bool b_starts_with_SAP;
1148 uint8_t i_SAP_type;
1149 uint32_t i_SAP_delta_time;
1151 } MP4_Box_sidx_item_t;
1153 typedef struct MP4_Box_data_sidx_s
1155 uint8_t i_version;
1156 uint32_t i_flags;
1158 uint32_t i_reference_ID;
1159 uint32_t i_timescale;
1160 uint64_t i_earliest_presentation_time;
1161 uint64_t i_first_offset;
1162 uint16_t i_reference_count;
1164 MP4_Box_sidx_item_t *p_items;
1166 } MP4_Box_data_sidx_t;
1168 #define MP4_TFHD_BASE_DATA_OFFSET (1LL<<0)
1169 #define MP4_TFHD_SAMPLE_DESC_INDEX (1LL<<1)
1170 #define MP4_TFHD_DFLT_SAMPLE_DURATION (1LL<<3)
1171 #define MP4_TFHD_DFLT_SAMPLE_SIZE (1LL<<4)
1172 #define MP4_TFHD_DFLT_SAMPLE_FLAGS (1LL<<5)
1173 #define MP4_TFHD_DURATION_IS_EMPTY (1LL<<16)
1174 #define MP4_TFHD_DEFAULT_BASE_IS_MOOF (1LL<<17)
1175 typedef struct MP4_Box_data_tfhd_s
1177 uint8_t i_version;
1178 bool b_empty;
1179 uint32_t i_flags;
1180 uint32_t i_track_ID;
1182 /* optional fields */
1183 uint64_t i_base_data_offset;
1184 uint32_t i_sample_description_index;
1185 uint32_t i_default_sample_duration;
1186 uint32_t i_default_sample_size;
1187 uint32_t i_default_sample_flags;
1189 } MP4_Box_data_tfhd_t;
1191 #define MP4_TRUN_DATA_OFFSET (1<<0)
1192 #define MP4_TRUN_FIRST_FLAGS (1<<2)
1193 #define MP4_TRUN_SAMPLE_DURATION (1<<8)
1194 #define MP4_TRUN_SAMPLE_SIZE (1<<9)
1195 #define MP4_TRUN_SAMPLE_FLAGS (1<<10)
1196 #define MP4_TRUN_SAMPLE_TIME_OFFSET (1<<11)
1197 typedef struct MP4_descriptor_trun_sample_t
1199 uint32_t i_duration;
1200 uint32_t i_size;
1201 uint32_t i_flags;
1202 union
1204 uint32_t v0;
1205 int32_t v1; /* version == 1 ? signed : unsigned */
1206 } i_composition_time_offset;
1207 } MP4_descriptor_trun_sample_t;
1209 typedef struct MP4_Box_data_trun_s
1211 uint8_t i_version;
1212 uint32_t i_flags;
1213 uint32_t i_sample_count;
1215 /* optional fields */
1216 int32_t i_data_offset;
1217 uint32_t i_first_sample_flags;
1219 MP4_descriptor_trun_sample_t *p_samples;
1221 } MP4_Box_data_trun_t;
1223 typedef struct MP4_Box_data_tfdt_s
1225 uint8_t i_version;
1226 uint32_t i_flags;
1227 int64_t i_base_media_decode_time;
1229 } MP4_Box_data_tfdt_t;
1231 typedef struct
1233 uint32_t i_date;
1234 uint32_t i_type;
1235 uint16_t i_index;
1236 } MP4_Box_data_pnot_t;
1238 typedef struct
1240 char *psz_text;
1241 uint64_t i_length;
1243 } MP4_Box_data_string_t;
1245 typedef struct
1247 void *p_blob;
1248 size_t i_blob;
1249 } MP4_Box_data_binary_t;
1251 typedef struct
1253 uint32_t i_entry_count;
1254 uint32_t *i_track_ID;
1256 } MP4_Box_data_tref_generic_t;
1258 typedef struct
1260 uint8_t i_version;
1261 uint32_t i_flags;
1263 uint8_t i_chapter;
1264 struct
1266 char *psz_name;
1267 int64_t i_start;
1268 } chapter[256];
1269 } MP4_Box_data_chpl_t;
1271 typedef struct
1273 uint32_t i_chapter_count;
1274 uint32_t *pi_chapter_start;
1276 } MP4_Box_data_HMMT_t;
1278 typedef struct
1280 uint8_t i_version;
1281 uint8_t i_profile;
1282 uint8_t i_profile_compatibility;
1283 uint8_t i_level;
1285 size_t i_avcC;
1286 uint8_t *p_avcC;
1288 } MP4_Box_data_avcC_t;
1290 typedef struct
1292 uint8_t i_profile;
1293 uint8_t i_level;
1294 uint8_t i_presentation_delay;
1296 size_t i_av1C;
1297 uint8_t *p_av1C;
1299 } MP4_Box_data_av1C_t;
1301 typedef struct
1303 uint8_t i_version;
1304 uint8_t i_profile;
1305 uint8_t i_level;
1306 uint8_t i_bit_depth;
1307 uint8_t i_chroma_subsampling;
1308 uint8_t i_color_primaries;
1309 uint8_t i_xfer_function;
1310 uint8_t i_matrix_coeffs;
1311 uint8_t i_fullrange;
1312 uint16_t i_codec_init_datasize;
1313 uint8_t *p_codec_init_data;
1314 } MP4_Box_data_vpcC_t;
1316 typedef struct
1318 uint16_t primaries[3*2]; /* G,B,R / x,y */
1319 uint16_t white_point[2]; /* x,y */
1320 uint32_t i_luminanceMax;
1321 uint32_t i_luminanceMin;
1322 } MP4_Box_data_SmDm_t;
1324 typedef struct
1326 uint16_t i_maxCLL;
1327 uint16_t i_maxFALL;
1328 } MP4_Box_data_CoLL_t;
1330 typedef struct
1332 WAVEFORMATEX Format;
1333 uint32_t i_extra;
1334 char *p_extra;
1335 } MP4_Box_data_WMA2_t;
1337 typedef struct
1339 VLC_BITMAPINFOHEADER bmiHeader;
1340 uint32_t i_extra;
1341 char *p_extra;
1342 } MP4_Box_data_strf_t;
1344 typedef struct
1346 uint8_t i_stream_number;
1347 } MP4_Box_data_ASF_t;
1349 typedef struct
1351 uint8_t i_version;
1352 uint32_t i_grouping_type;
1353 uint32_t i_default_sample_description_index;
1354 uint32_t i_entry_count;
1355 union
1357 struct
1359 uint8_t i_num_leading_samples_known;
1360 uint8_t i_num_leading_samples;
1361 } rap;
1362 } *p_entries;
1363 } MP4_Box_data_sgpd_t;
1365 typedef struct
1367 uint8_t i_version;
1368 uint32_t i_grouping_type;
1369 uint32_t i_grouping_type_parameter;
1370 uint32_t i_entry_count;
1371 struct
1373 uint32_t *pi_sample_count;
1374 uint32_t *pi_group_description_index;
1375 } entries;
1376 } MP4_Box_data_sbgp_t;
1378 typedef struct
1380 uint8_t i_version;
1381 uint32_t i_channels_flags; /* 24 bits */
1382 struct
1384 uint32_t i_channels_layout_tag;
1385 uint32_t i_channels_bitmap;
1386 uint32_t i_channels_description_count;
1387 struct
1389 uint32_t i_channel_label;
1390 uint32_t i_channel_flags;
1391 float f_coordinates[3];
1392 } *p_descriptions;
1393 } layout;
1394 } MP4_Box_data_chan_t;
1396 typedef struct
1398 uint16_t i_data_rate;
1399 uint8_t i_num_ind_sub;
1400 struct
1402 uint8_t i_fscod;
1403 uint8_t i_bsid;
1404 uint8_t i_bsmod;
1405 uint8_t i_acmod;
1406 uint8_t i_lfeon;
1407 uint8_t i_num_dep_sub;
1408 uint16_t i_chan_loc;
1409 } stream[8];
1411 } MP4_Box_data_dec3_t;
1413 typedef struct
1415 uint8_t i_fscod;
1416 uint8_t i_bsid;
1417 uint8_t i_bsmod;
1418 uint8_t i_acmod;
1419 uint8_t i_lfeon;
1420 uint8_t i_bitrate_code;
1422 } MP4_Box_data_dac3_t;
1424 typedef struct
1426 uint8_t i_profile_level;
1428 uint32_t i_vc1;
1429 uint8_t *p_vc1;
1431 } MP4_Box_data_dvc1_t;
1433 typedef struct
1435 uint32_t i_flags;
1436 } MP4_Box_data_fiel_t;
1438 typedef struct
1440 uint16_t i_little_endian;
1442 } MP4_Box_data_enda_t;
1444 typedef struct
1446 uint32_t i_entry_count;
1447 struct
1449 uint32_t i_namespace;
1450 char *psz_value;
1451 } *p_entries;
1452 } MP4_Box_data_keys_t;
1454 typedef struct
1456 uint8_t i_version;
1457 uint32_t i_flags;
1459 uint16_t i_object_descriptor;
1460 uint8_t i_OD_profile_level;
1461 uint8_t i_scene_profile_level;
1462 uint8_t i_audio_profile_level;
1463 uint8_t i_visual_profile_level;
1464 uint8_t i_graphics_profile_level;
1466 } MP4_Box_data_iods_t;
1468 typedef struct
1470 uint32_t i_buffer_size;
1471 uint32_t i_max_bitrate;
1472 uint32_t i_avg_bitrate;
1473 } MP4_Box_data_btrt_t;
1475 typedef struct
1477 uint32_t i_horizontal_spacing;
1478 uint32_t i_vertical_spacing;
1479 } MP4_Box_data_pasp_t;
1481 typedef struct
1483 uint8_t i_version;
1484 uint32_t i_flags;
1486 uint64_t i_fragment_duration;
1487 } MP4_Box_data_mehd_t;
1489 typedef struct
1491 uint8_t i_version;
1492 uint32_t i_flags;
1494 uint32_t i_track_ID;
1495 uint32_t i_default_sample_description_index;
1496 uint32_t i_default_sample_duration;
1497 uint32_t i_default_sample_size;
1498 uint32_t i_default_sample_flags;
1499 } MP4_Box_data_trex_t;
1501 typedef struct
1503 uint8_t i_version;
1504 uint32_t i_flags;
1506 uint8_t *p_sample_table;
1507 } MP4_Box_data_sdtp_t;
1509 typedef struct
1511 uint32_t i_switch_group;
1512 } MP4_Box_data_tsel_t;
1514 typedef struct
1516 uint8_t i_version;
1517 uint32_t i_flags;
1519 uint32_t i_size;
1520 } MP4_Box_data_mfro_t;
1522 typedef struct
1524 uint8_t i_version;
1525 uint32_t i_flags;
1527 uint32_t i_track_ID;
1528 uint32_t i_number_of_entries;
1530 uint8_t i_length_size_of_traf_num;
1531 uint8_t i_length_size_of_trun_num;
1532 uint8_t i_length_size_of_sample_num;
1534 uint32_t *p_time;
1535 uint32_t *p_moof_offset;
1536 uint8_t *p_traf_number;
1537 uint8_t *p_trun_number;
1538 uint8_t *p_sample_number;
1539 } MP4_Box_data_tfra_t;
1541 typedef struct
1543 enum
1545 DATA_WKT_RESERVED = 0,
1546 DATA_WKT_UTF8 = 1,
1547 DATA_WKT_UTF16 = 2,
1548 DATA_WKT_SJIS = 3,
1549 DATA_WKT_UTF8_SORT = 4,
1550 DATA_WKT_UTF16_SORT = 5,
1551 DATA_WKT_JPEG = 13,
1552 DATA_WKT_PNG = 14,
1553 DATA_WKT_BE_SIGNED = 21,
1554 DATA_WKT_BE_UNSIGNED = 22,
1555 DATA_WKT_BE_FLOAT32 = 23,
1556 DATA_WKT_BE_FLOAT64 = 24,
1557 DATA_WKT_BMP = 27,
1558 DATA_WKT_QUICKTIME_METADATA_ATOM = 28,
1559 } e_wellknowntype;
1560 struct
1562 uint16_t i_country;
1563 uint16_t i_language;
1564 } locale;
1565 uint8_t *p_blob;
1566 uint32_t i_blob;
1567 } MP4_Box_data_data_t;
1569 typedef struct
1571 uint32_t i_projection_mode;
1572 enum {
1573 XML360_MONOSCOPIC = 0,
1574 XML360_STEREOSCOPIC_TOP_BOTTOM = 1,
1575 XML360_STEREOSCOPIC_LEFT_RIGHT = 2,
1576 } e_stereo_mode;
1577 } MP4_Box_data_360_t;
1580 typedef struct
1582 enum {
1583 ST3D_MONOSCOPIC = 0,
1584 ST3D_STEREOSCOPIC_TOP_BOTTOM = 1,
1585 ST3D_STEREOSCOPIC_LEFT_RIGHT = 2,
1586 } e_stereo_mode;
1587 uint8_t i_stereo_mode;
1588 } MP4_Box_data_st3d_t;
1590 typedef struct
1592 float f_pose_yaw_degrees;
1593 float f_pose_pitch_degrees;
1594 float f_pose_roll_degrees;
1595 } MP4_Box_data_prhd_t;
1597 typedef struct
1599 uint32_t i_projection_bounds_top;
1600 uint32_t i_projection_bounds_bottom;
1601 uint32_t i_projection_bounds_left;
1602 uint32_t i_projection_bounds_right;
1603 } MP4_Box_data_equi_t;
1605 typedef struct
1607 uint32_t i_layout;
1608 uint32_t i_padding;
1609 } MP4_Box_data_cbmp_t;
1611 typedef struct
1613 uint8_t i_ambisonic_type;
1614 uint32_t i_ambisonic_order;
1615 uint8_t i_ambisonic_channel_ordering;
1616 uint8_t i_ambisonic_normalization;
1617 uint32_t i_num_channels;
1618 } MP4_Box_data_SA3D_t;
1620 typedef struct
1622 uint32_t i_from_item_id;
1623 uint16_t i_reference_count;
1624 struct
1626 uint32_t i_to_item_id;
1627 } *p_references;
1628 } MP4_Box_data_refbox_t;
1630 typedef struct
1632 uint8_t i_version;
1633 uint32_t i_flags;
1634 } MP4_Box_data_iref_t;
1636 typedef struct
1638 uint8_t i_offset_size;
1639 uint8_t i_length_size;
1640 uint8_t i_base_offset_size;
1641 uint8_t i_index_size;
1642 uint32_t i_item_count;
1643 struct
1645 uint32_t i_item_id;
1646 uint8_t i_construction_method;
1647 uint16_t i_data_reference_index;
1648 uint64_t i_base_offset;
1649 uint16_t i_extent_count;
1650 struct
1652 uint64_t i_extent_index;
1653 uint64_t i_extent_offset;
1654 uint64_t i_extent_length;
1655 } *p_extents;
1656 } *p_items;
1657 } MP4_Box_data_iloc_t;
1659 typedef struct
1661 uint32_t i_entry_count;
1662 } MP4_Box_data_iinf_t;
1664 typedef struct
1666 uint32_t i_flags;
1667 uint32_t i_item_id;
1668 uint16_t i_item_protection_index;
1669 vlc_fourcc_t item_type;
1670 char *psz_item_name;
1671 char *psz_content_type;
1672 char *psz_content_encoding;
1673 char *psz_item_uri_type;
1674 } MP4_Box_data_infe_t;
1676 typedef struct
1678 uint32_t i_item_id;
1679 } MP4_Box_data_pitm_t;
1681 typedef struct
1683 uint32_t i_width;
1684 uint32_t i_height;
1685 } MP4_Box_data_ispe_t;
1687 typedef struct
1689 uint32_t i_entry_count;
1690 struct
1692 uint32_t i_item_id;
1693 uint8_t i_association_count;
1694 struct
1696 uint8_t b_essential;
1697 uint16_t i_property_index;
1698 } *p_assocs;
1699 } *p_entries;
1700 } MP4_Box_data_ipma_t;
1703 typedef struct MP4_Box_data__s
1705 uint8_t i_version;
1706 uint32_t i_flags;
1708 } MP4_Box_data__t;
1712 typedef union MP4_Box_data_s
1714 MP4_Box_data_ftyp_t *p_ftyp;
1715 MP4_Box_data_mvhd_t *p_mvhd;
1716 MP4_Box_data_mfhd_t *p_mfhd;
1717 MP4_Box_data_sidx_t *p_sidx;
1718 MP4_Box_data_tfhd_t *p_tfhd;
1719 MP4_Box_data_trun_t *p_trun;
1720 MP4_Box_data_tfdt_t *p_tfdt;
1721 MP4_Box_data_tkhd_t *p_tkhd;
1722 MP4_Box_data_mdhd_t *p_mdhd;
1723 MP4_Box_data_hdlr_t *p_hdlr;
1724 MP4_Box_data_vmhd_t *p_vmhd;
1725 MP4_Box_data_smhd_t *p_smhd;
1726 MP4_Box_data_hmhd_t *p_hmhd;
1727 MP4_Box_data_url_t *p_url;
1728 MP4_Box_data_urn_t *p_urn;
1729 MP4_Box_data_lcont_t *p_lcont;
1730 MP4_Box_data_stts_t *p_stts;
1731 MP4_Box_data_ctts_t *p_ctts;
1732 MP4_Box_data_cslg_t *p_cslg;
1733 MP4_Box_data_colr_t *p_colr;
1734 MP4_Box_data_irot_t *p_irot;
1736 MP4_Box_data_sbgp_t *p_sbgp;
1737 MP4_Box_data_sgpd_t *p_sgpd;
1739 MP4_Box_data_sample_vide_t *p_sample_vide;
1740 MP4_Box_data_sample_soun_t *p_sample_soun;
1741 MP4_Box_data_sample_text_t *p_sample_text;
1742 MP4_Box_data_sample_clcp_t *p_sample_clcp;
1743 MP4_Box_data_sample_hint_t *p_sample_hint;
1745 MP4_Box_data_esds_t *p_esds;
1746 MP4_Box_data_av1C_t *p_av1C;
1747 MP4_Box_data_avcC_t *p_avcC;
1748 MP4_Box_data_dac3_t *p_dac3;
1749 MP4_Box_data_dec3_t *p_dec3;
1750 MP4_Box_data_dvc1_t *p_dvc1;
1751 MP4_Box_data_fiel_t *p_fiel;
1752 MP4_Box_data_chan_t *p_chan;
1753 MP4_Box_data_enda_t *p_enda;
1754 MP4_Box_data_keys_t *p_keys;
1755 MP4_Box_data_iods_t *p_iods;
1756 MP4_Box_data_btrt_t *p_btrt;
1757 MP4_Box_data_pasp_t *p_pasp;
1758 MP4_Box_data_trex_t *p_trex;
1759 MP4_Box_data_mehd_t *p_mehd;
1760 MP4_Box_data_sdtp_t *p_sdtp;
1761 MP4_Box_data_tsel_t *p_tsel;
1762 MP4_Box_data_load_t *p_load;
1763 MP4_Box_data_vpcC_t *p_vpcC;
1764 MP4_Box_data_SmDm_t *p_SmDm;
1765 MP4_Box_data_CoLL_t *p_CoLL;
1767 MP4_Box_data_tfra_t *p_tfra;
1768 MP4_Box_data_mfro_t *p_mfro;
1770 MP4_Box_data_sdp_t *p_sdp;
1772 MP4_Box_data_tims_t *p_tims;
1773 MP4_Box_data_tsro_t *p_tsro;
1774 MP4_Box_data_tssy_t *p_tssy;
1776 MP4_Box_data_stsz_t *p_stsz;
1777 MP4_Box_data_stz2_t *p_stz2;
1778 MP4_Box_data_stsc_t *p_stsc;
1779 MP4_Box_data_co64_t *p_co64;
1780 MP4_Box_data_stss_t *p_stss;
1781 MP4_Box_data_stsh_t *p_stsh;
1782 MP4_Box_data_stdp_t *p_stdp;
1783 MP4_Box_data_elst_t *p_elst;
1784 MP4_Box_data_cprt_t *p_cprt;
1786 MP4_Box_data_dcom_t *p_dcom;
1787 MP4_Box_data_cmvd_t *p_cmvd;
1788 MP4_Box_data_cmov_t *p_cmov;
1790 MP4_Box_data_moviehintinformation_rtp_t *p_moviehintinformation_rtp;
1792 MP4_Box_data_frma_t *p_frma;
1793 MP4_Box_data_skcr_t *p_skcr;
1795 MP4_Box_data_rdrf_t *p_rdrf;
1796 MP4_Box_data_rmdr_t *p_rmdr;
1797 MP4_Box_data_rmqu_t *p_rmqu;
1798 MP4_Box_data_rmvc_t *p_rmvc;
1800 MP4_Box_data_pnot_t *p_pnot;
1801 MP4_Box_data_chpl_t *p_chpl;
1802 MP4_Box_data_HMMT_t *p_hmmt;
1803 MP4_Box_data_tref_generic_t *p_tref_generic;
1805 MP4_Box_data_tfrf_t *p_tfrf;
1806 MP4_Box_data_tfxd_t *p_tfxd;
1807 MP4_Box_data_WMA2_t *p_WMA2; /* flip4mac Little endian audio config */
1808 MP4_Box_data_strf_t *p_strf; /* flip4mac Little endian video config */
1809 MP4_Box_data_ASF_t *p_asf; /* flip4mac asf streams indicator */
1811 MP4_Box_data_360_t *p_360;
1812 MP4_Box_data_st3d_t *p_st3d;
1813 MP4_Box_data_prhd_t *p_prhd;
1814 MP4_Box_data_equi_t *p_equi;
1815 MP4_Box_data_cbmp_t *p_cbmp;
1816 MP4_Box_data_SA3D_t *p_SA3D;
1818 MP4_Box_data_refbox_t *p_refbox;
1819 MP4_Box_data_iref_t *p_iref;
1820 MP4_Box_data_iloc_t *p_iloc;
1821 MP4_Box_data_iinf_t *p_iinf;
1822 MP4_Box_data_infe_t *p_infe;
1823 MP4_Box_data_pitm_t *p_pitm;
1824 MP4_Box_data_ispe_t *p_ispe; /* heif */
1825 MP4_Box_data_ipma_t *p_ipma; /* heif */
1827 /* for generic handlers */
1828 MP4_Box_data_binary_t *p_binary;
1829 MP4_Box_data_data_t *p_data;
1831 void *p_payload; /* for unknown type */
1832 } MP4_Box_data_t;
1834 #define BOXDATA(type) type->data.type
1836 typedef struct MP4_Box_s MP4_Box_t;
1837 /* the most basic structure */
1838 struct MP4_Box_s
1840 uint64_t i_pos; /* absolute position */
1842 uint32_t i_type;
1843 uint32_t i_shortsize;
1844 uint32_t i_handler; /**/
1845 uint32_t i_index; /* indexed list (ilst) */
1847 enum
1849 BOX_FLAG_NONE = 0,
1850 BOX_FLAG_INCOMPLETE,
1851 } e_flags;
1853 UUID_t i_uuid; /* Set if i_type == "uuid" */
1855 uint64_t i_size; /* always set so use it */
1857 MP4_Box_t *p_father; /* pointer on the father Box */
1858 MP4_Box_t *p_first; /* pointer on the first child Box */
1859 MP4_Box_t *p_last;
1860 MP4_Box_t *p_next; /* pointer on the next boxes at the same level */
1862 void (*pf_free)( MP4_Box_t *p_box ); /* pointer to free function for this box */
1864 MP4_Box_data_t data; /* union of pointers on extended data depending
1865 on i_type (or i_usertype) */
1868 static inline size_t mp4_box_headersize( MP4_Box_t *p_box )
1870 return 8
1871 + ( p_box->i_shortsize == 1 ? 8 : 0 )
1872 + ( p_box->i_type == ATOM_uuid ? 16 : 0 );
1875 static inline int CmpUUID( const UUID_t *u1, const UUID_t *u2 )
1877 return memcmp( u1, u2, 16 );
1880 static const UUID_t TfrfBoxUUID = {
1881 { 0xd4, 0x80, 0x7e, 0xf2, 0xca, 0x39, 0x46, 0x95,
1882 0x8e, 0x54, 0x26, 0xcb, 0x9e, 0x46, 0xa7, 0x9f } };
1884 static const UUID_t TfxdBoxUUID = {
1885 { 0x6d, 0x1d, 0x9b, 0x05, 0x42, 0xd5, 0x44, 0xe6,
1886 0x80, 0xe2, 0x14, 0x1d, 0xaf, 0xf7, 0x57, 0xb2 } };
1888 static const UUID_t XML360BoxUUID = {
1889 { 0xff, 0xcc, 0x82, 0x63, 0xf8, 0x55, 0x4a, 0x93,
1890 0x88, 0x14, 0x58, 0x7a, 0x02, 0x52, 0x1f, 0xdd } };
1892 /* PS3 3D by HMMP video encoder */
1893 static const UUID_t PS3DDSBoxUUID = {
1894 { 0x33, 0x44, 0x44, 0x53, 0x21, 0xd2, 0x4f, 0xce,
1895 0xbb, 0x88, 0x69, 0x5c, 0xfa, 0xc9, 0xc7, 0x40 } };
1897 /*****************************************************************************
1898 * MP4_Seek : non seekable stream safe seek
1899 ****************************************************************************/
1900 int MP4_Seek( stream_t *p_stream, uint64_t i_pos );
1902 /*****************************************************************************
1903 * MP4_BoxGetNextChunk : Parse the entire moof box.
1904 *****************************************************************************
1905 * The first box is a virtual box "root" and is the father of the boxes
1906 * 'moof' and, possibly, 'sidx'.
1907 *****************************************************************************/
1908 MP4_Box_t *MP4_BoxGetNextChunk( stream_t * );
1910 /*****************************************************************************
1911 * MP4_BoxGetRoot : Parse the entire file, and create all boxes in memory
1912 *****************************************************************************
1913 * The first box is a virtual box "root" and is the father for all first
1914 * level boxes
1915 *****************************************************************************/
1916 MP4_Box_t *MP4_BoxGetRoot( stream_t * );
1918 /*****************************************************************************
1919 * MP4_BoxNew : Allocates a new MP4 Box with its atom type
1920 *****************************************************************************
1921 * returns NULL on failure
1922 *****************************************************************************/
1923 MP4_Box_t * MP4_BoxNew( uint32_t i_type );
1925 /*****************************************************************************
1926 * MP4_FreeBox : free memory allocated after read with MP4_ReadBox
1927 * or MP4_BoxGetRoot, this means also children boxes
1928 * XXX : all children have to be allocated by a malloc !! and
1929 * p_box is freed
1930 *****************************************************************************/
1931 void MP4_BoxFree( MP4_Box_t *p_box );
1933 /*****************************************************************************
1934 * MP4_DumpBoxStructure: print the structure of the p_box
1935 *****************************************************************************
1936 * Useful while debugging
1937 *****************************************************************************/
1938 void MP4_BoxDumpStructure( stream_t *p_input, const MP4_Box_t *p_box );
1940 /*****************************************************************************
1941 * MP4_BoxGet: find a box given a path relative to p_box
1942 *****************************************************************************
1943 * Path Format: . .. / as usual
1944 * [number] to specifie box number ex: trak[12]
1946 * ex: /moov/trak[12]
1947 * ../mdia
1948 *****************************************************************************/
1949 MP4_Box_t *MP4_BoxGet( const MP4_Box_t *p_box, const char *psz_fmt, ... );
1951 /*****************************************************************************
1952 * MP4_BoxCount: find number of box given a path relative to p_box
1953 *****************************************************************************
1954 * Path Format: . .. / as usual
1955 * [number] to specifie box number ex: trak[12]
1957 * ex: /moov/trak
1958 * ../mdia
1959 *****************************************************************************/
1960 unsigned MP4_BoxCount( const MP4_Box_t *p_box, const char *psz_fmt, ... );
1962 MP4_Box_t * MP4_BoxExtract( MP4_Box_t **pp_chain, uint32_t i_type );
1964 /* Internal functions exposed for demuxers */
1965 int MP4_ReadBoxContainerChildren( stream_t *p_stream, MP4_Box_t *p_container,
1966 const uint32_t stoplist[] );
1967 int MP4_ReadBoxContainerRestricted( stream_t *p_stream, MP4_Box_t *p_container,
1968 const uint32_t stoplist[],
1969 const uint32_t excludelist[] );
1971 int MP4_ReadBox_sample_vide( stream_t *p_stream, MP4_Box_t *p_box );
1973 #endif