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