libmp4.h 55.7 KB
Newer Older
1 2 3
/*****************************************************************************
 * libmp4.h : LibMP4 library for mp4 module for vlc
 *****************************************************************************
Jean-Baptiste Kempf's avatar
LGPL  
Jean-Baptiste Kempf committed
4
 * Copyright (C) 2001-2004, 2010 VLC authors and VideoLAN
5
 *
6
 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
Laurent Aimar's avatar
Laurent Aimar committed
7
 *
Jean-Baptiste Kempf's avatar
LGPL  
Jean-Baptiste Kempf committed
8 9 10
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
11
 * (at your option) any later version.
Laurent Aimar's avatar
Laurent Aimar committed
12
 *
13 14
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Jean-Baptiste Kempf's avatar
LGPL  
Jean-Baptiste Kempf committed
15 16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
17
 *
Jean-Baptiste Kempf's avatar
LGPL  
Jean-Baptiste Kempf committed
18 19 20
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21
 *****************************************************************************/
22 23
#ifndef VLC_MP4_LIBMP4_H_
#define VLC_MP4_LIBMP4_H_
24

25
#include <vlc_es.h>
26
#include <vlc_codecs.h>
27

28 29 30
/* Use alias for scaled time */
typedef int64_t stime_t;

31 32
#define BLOCK16x16 (1<<16)

33 34 35 36 37 38 39
#define MAJOR_3gp4 VLC_FOURCC( '3', 'g', 'p', '4' )
#define MAJOR_3gp5 VLC_FOURCC( '3', 'g', 'p', '5' )
#define MAJOR_3gp6 VLC_FOURCC( '3', 'g', 'p', '6' )
#define MAJOR_3gp7 VLC_FOURCC( '3', 'g', 'p', '7' )
#define MAJOR_isml VLC_FOURCC( 'i', 's', 'm', 'l' )
#define MAJOR_isom VLC_FOURCC( 'i', 's', 'o', 'm' )
#define MAJOR_qt__ VLC_FOURCC( 'q', 't', ' ', ' ' )
40
#define MAJOR_dash VLC_FOURCC( 'd', 'a', 's', 'h' )
41 42
#define MAJOR_mp41 VLC_FOURCC( 'm', 'p', '4', '1' )
#define MAJOR_avc1 VLC_FOURCC( 'a', 'v', 'c', '1' )
43
#define MAJOR_M4A  VLC_FOURCC( 'M', '4', 'A', ' ' )
44

45
#define ATOM_root VLC_FOURCC( 'r', 'o', 'o', 't' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
46 47 48 49 50 51 52 53 54
#define ATOM_uuid VLC_FOURCC( 'u', 'u', 'i', 'd' )

#define ATOM_ftyp VLC_FOURCC( 'f', 't', 'y', 'p' )
#define ATOM_moov VLC_FOURCC( 'm', 'o', 'o', 'v' )
#define ATOM_foov VLC_FOURCC( 'f', 'o', 'o', 'v' )
#define ATOM_cmov VLC_FOURCC( 'c', 'm', 'o', 'v' )
#define ATOM_dcom VLC_FOURCC( 'd', 'c', 'o', 'm' )
#define ATOM_cmvd VLC_FOURCC( 'c', 'm', 'v', 'd' )

55
#define ATOM_styp VLC_FOURCC( 's', 't', 'y', 'p' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
56 57 58 59 60 61
#define ATOM_moof VLC_FOURCC( 'm', 'o', 'o', 'f' )
#define ATOM_mdat VLC_FOURCC( 'm', 'd', 'a', 't' )
#define ATOM_skip VLC_FOURCC( 's', 'k', 'i', 'p' )
#define ATOM_free VLC_FOURCC( 'f', 'r', 'e', 'e' )
#define ATOM_udta VLC_FOURCC( 'u', 'd', 't', 'a' )
#define ATOM_wide VLC_FOURCC( 'w', 'i', 'd', 'e' )
62
#define ATOM_binm VLC_FOURCC( 0x82, 0x82, 0x7f, 0x7d ) /* binary Computer Graphics Metafile */
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
63

64 65 66 67 68
/* Quicktime preview */
#define ATOM_pnot VLC_FOURCC( 'p', 'n', 'o', 't' )
#define ATOM_pict VLC_FOURCC( 'p', 'i', 'c', 't' )
#define ATOM_PICT VLC_FOURCC( 'P', 'I', 'C', 'T' )

69 70
#define ATOM_data VLC_FOURCC( 'd', 'a', 't', 'a' )

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
71 72 73 74
#define ATOM_trak VLC_FOURCC( 't', 'r', 'a', 'k' )
#define ATOM_mvhd VLC_FOURCC( 'm', 'v', 'h', 'd' )
#define ATOM_tkhd VLC_FOURCC( 't', 'k', 'h', 'd' )
#define ATOM_tref VLC_FOURCC( 't', 'r', 'e', 'f' )
75
#define ATOM_load VLC_FOURCC( 'l', 'o', 'a', 'd' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
76 77 78 79 80 81 82 83 84 85 86 87 88 89
#define ATOM_mdia VLC_FOURCC( 'm', 'd', 'i', 'a' )
#define ATOM_mdhd VLC_FOURCC( 'm', 'd', 'h', 'd' )
#define ATOM_hdlr VLC_FOURCC( 'h', 'd', 'l', 'r' )
#define ATOM_minf VLC_FOURCC( 'm', 'i', 'n', 'f' )
#define ATOM_vmhd VLC_FOURCC( 'v', 'm', 'h', 'd' )
#define ATOM_smhd VLC_FOURCC( 's', 'm', 'h', 'd' )
#define ATOM_hmhd VLC_FOURCC( 'h', 'm', 'h', 'd' )
#define ATOM_dinf VLC_FOURCC( 'd', 'i', 'n', 'f' )
#define ATOM_url  VLC_FOURCC( 'u', 'r', 'l', ' ' )
#define ATOM_urn  VLC_FOURCC( 'u', 'r', 'n', ' ' )
#define ATOM_dref VLC_FOURCC( 'd', 'r', 'e', 'f' )
#define ATOM_stbl VLC_FOURCC( 's', 't', 'b', 'l' )
#define ATOM_stts VLC_FOURCC( 's', 't', 't', 's' )
#define ATOM_ctts VLC_FOURCC( 'c', 't', 't', 's' )
90
#define ATOM_cslg VLC_FOURCC( 'c', 's', 'l', 'g' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
91 92 93 94 95 96
#define ATOM_stsd VLC_FOURCC( 's', 't', 's', 'd' )
#define ATOM_stsz VLC_FOURCC( 's', 't', 's', 'z' )
#define ATOM_stz2 VLC_FOURCC( 's', 't', 'z', '2' )
#define ATOM_stsc VLC_FOURCC( 's', 't', 's', 'c' )
#define ATOM_stco VLC_FOURCC( 's', 't', 'c', 'o' )
#define ATOM_co64 VLC_FOURCC( 'c', 'o', '6', '4' )
97
#define ATOM_sbgp VLC_FOURCC( 's', 'b', 'g', 'p' )
98
#define ATOM_sgpd VLC_FOURCC( 's', 'g', 'p', 'd' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
99 100 101 102 103 104 105
#define ATOM_stss VLC_FOURCC( 's', 't', 's', 's' )
#define ATOM_stsh VLC_FOURCC( 's', 't', 's', 'h' )
#define ATOM_stdp VLC_FOURCC( 's', 't', 'd', 'p' )
#define ATOM_padb VLC_FOURCC( 'p', 'a', 'd', 'b' )
#define ATOM_edts VLC_FOURCC( 'e', 'd', 't', 's' )
#define ATOM_elst VLC_FOURCC( 'e', 'l', 's', 't' )
#define ATOM_mvex VLC_FOURCC( 'm', 'v', 'e', 'x' )
106
#define ATOM_sdtp VLC_FOURCC( 's', 'd', 't', 'p' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
107
#define ATOM_trex VLC_FOURCC( 't', 'r', 'e', 'x' )
108
#define ATOM_mehd VLC_FOURCC( 'm', 'e', 'h', 'd' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
109 110
#define ATOM_mfhd VLC_FOURCC( 'm', 'f', 'h', 'd' )
#define ATOM_traf VLC_FOURCC( 't', 'r', 'a', 'f' )
111
#define ATOM_sidx VLC_FOURCC( 's', 'i', 'd', 'x' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
112
#define ATOM_tfhd VLC_FOURCC( 't', 'f', 'h', 'd' )
113
#define ATOM_tfdt VLC_FOURCC( 't', 'f', 'd', 't' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
114 115 116
#define ATOM_trun VLC_FOURCC( 't', 'r', 'u', 'n' )
#define ATOM_cprt VLC_FOURCC( 'c', 'p', 'r', 't' )
#define ATOM_iods VLC_FOURCC( 'i', 'o', 'd', 's' )
117
#define ATOM_pasp VLC_FOURCC( 'p', 'a', 's', 'p' )
118 119 120
#define ATOM_mfra VLC_FOURCC( 'm', 'f', 'r', 'a' )
#define ATOM_mfro VLC_FOURCC( 'm', 'f', 'r', 'o' )
#define ATOM_tfra VLC_FOURCC( 't', 'f', 'r', 'a' )
121
#define ATOM_keys VLC_FOURCC( 'k', 'e', 'y', 's' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
122

123 124 125 126 127 128 129
#define ATOM_st3d VLC_FOURCC( 's', 't', '3', 'd' )
#define ATOM_sv3d VLC_FOURCC( 's', 'v', '3', 'd' )
#define ATOM_proj VLC_FOURCC( 'p', 'r', 'o', 'j' )
#define ATOM_prhd VLC_FOURCC( 'p', 'r', 'h', 'd' )
#define ATOM_cbmp VLC_FOURCC( 'c', 'b', 'm', 'p' )
#define ATOM_equi VLC_FOURCC( 'e', 'q', 'u', 'i' )

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
130 131 132 133 134 135 136 137 138
#define ATOM_nmhd VLC_FOURCC( 'n', 'm', 'h', 'd' )
#define ATOM_mp2v VLC_FOURCC( 'm', 'p', '2', 'v' )
#define ATOM_mp4v VLC_FOURCC( 'm', 'p', '4', 'v' )
#define ATOM_mp4a VLC_FOURCC( 'm', 'p', '4', 'a' )
#define ATOM_mp4s VLC_FOURCC( 'm', 'p', '4', 's' )
#define ATOM_vide VLC_FOURCC( 'v', 'i', 'd', 'e' )
#define ATOM_soun VLC_FOURCC( 's', 'o', 'u', 'n' )
#define ATOM_hint VLC_FOURCC( 'h', 'i', 'n', 't' )
#define ATOM_hdv2 VLC_FOURCC( 'h', 'd', 'v', '2' )
139
#define ATOM_rrtp VLC_FOURCC( 'r', 'r', 't', 'p' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
140 141

#define ATOM_dpnd VLC_FOURCC( 'd', 'p', 'n', 'd' )
142
#define ATOM_cdsc VLC_FOURCC( 'c', 'd', 's', 'c' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
143 144 145 146
#define ATOM_ipir VLC_FOURCC( 'i', 'p', 'i', 'r' )
#define ATOM_mpod VLC_FOURCC( 'm', 'p', 'o', 'd' )
#define ATOM_hnti VLC_FOURCC( 'h', 'n', 't', 'i' )
#define ATOM_rtp  VLC_FOURCC( 'r', 't', 'p', ' ' )
147
#define ATOM_btrt VLC_FOURCC( 'b', 't', 'r', 't' )
148
#define ATOM_sdp  VLC_FOURCC( 's', 'd', 'p', ' ' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
149

150 151 152 153
#define ATOM_tims VLC_FOURCC( 't', 'i', 'm', 's' )
#define ATOM_tsro VLC_FOURCC( 't', 's', 'r', 'o' )
#define ATOM_tssy VLC_FOURCC( 't', 's', 's', 'y' )

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
154 155
#define ATOM_esds VLC_FOURCC( 'e', 's', 'd', 's' )

156
#define ATOM_lpcm VLC_FOURCC( 'l', 'p', 'c', 'm' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
157 158 159 160 161 162 163 164
#define ATOM__mp3 VLC_FOURCC( '.', 'm', 'p', '3' )
#define ATOM_ms02 VLC_FOURCC( 'm', 's', 0x0, 0x02 )
#define ATOM_ms11 VLC_FOURCC( 'm', 's', 0x0, 0x11 )
#define ATOM_ms55 VLC_FOURCC( 'm', 's', 0x0, 0x55 )
#define ATOM_twos VLC_FOURCC( 't', 'w', 'o', 's' )
#define ATOM_sowt VLC_FOURCC( 's', 'o', 'w', 't' )
#define ATOM_QDMC VLC_FOURCC( 'Q', 'D', 'M', 'C' )
#define ATOM_QDM2 VLC_FOURCC( 'Q', 'D', 'M', '2' )
165
#define ATOM_XiFL VLC_FOURCC( 'X', 'i', 'F', 'L' )
166
#define ATOM_XiVs VLC_FOURCC( 'X', 'i', 'V', 's' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
167 168 169 170 171 172 173 174 175 176 177
#define ATOM_ima4 VLC_FOURCC( 'i', 'm', 'a', '4' )
#define ATOM_IMA4 VLC_FOURCC( 'I', 'M', 'A', '4' )
#define ATOM_dvi  VLC_FOURCC( 'd', 'v', 'i', ' ' )
#define ATOM_MAC3 VLC_FOURCC( 'M', 'A', 'C', '3' )
#define ATOM_MAC6 VLC_FOURCC( 'M', 'A', 'C', '6' )
#define ATOM_alaw VLC_FOURCC( 'a', 'l', 'a', 'w' )
#define ATOM_ulaw VLC_FOURCC( 'u', 'l', 'a', 'w' )
#define ATOM_Qclp VLC_FOURCC( 'Q', 'c', 'l', 'p' )
#define ATOM_samr VLC_FOURCC( 's', 'a', 'm', 'r' )
#define ATOM_sawb VLC_FOURCC( 's', 'a', 'w', 'b' )
#define ATOM_OggS VLC_FOURCC( 'O', 'g', 'g', 'S' )
178
#define ATOM_agsm VLC_FOURCC( 'a', 'g', 's', 'm' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
179
#define ATOM_alac VLC_FOURCC( 'a', 'l', 'a', 'c' )
180 181
#define ATOM_ac3  VLC_FOURCC( 'a', 'c', '-', '3' )
#define ATOM_eac3 VLC_FOURCC( 'e', 'c', '-', '3' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
182 183
#define ATOM_dac3 VLC_FOURCC( 'd', 'a', 'c', '3' )
#define ATOM_dec3 VLC_FOURCC( 'd', 'e', 'c', '3' )
184
#define ATOM_vc1  VLC_FOURCC( 'v', 'c', '-', '1' )
185
#define ATOM_dvc1 VLC_FOURCC( 'd', 'v', 'c', '1' )
186
#define ATOM_WMA2 VLC_FOURCC( 'W', 'M', 'A', '2' )
187
#define ATOM_wma  VLC_FOURCC( 'w', 'm', 'a', ' ' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
188 189 190
#define ATOM_enda VLC_FOURCC( 'e', 'n', 'd', 'a' )
#define ATOM_gnre VLC_FOURCC( 'g', 'n', 'r', 'e' )
#define ATOM_trkn VLC_FOURCC( 't', 'r', 'k', 'n' )
191
#define ATOM_chan VLC_FOURCC( 'c', 'h', 'a', 'n' )
192 193 194 195
#define ATOM_in24 VLC_FOURCC( 'i', 'n', '2', '4' )
#define ATOM_in32 VLC_FOURCC( 'i', 'n', '3', '2' )
#define ATOM_fl32 VLC_FOURCC( 'f', 'l', '3', '2' )
#define ATOM_fl64 VLC_FOURCC( 'f', 'l', '6', '4' )
196
#define ATOM_Opus VLC_FOURCC( 'O', 'p', 'u', 's' )
197 198
#define ATOM_fLaC VLC_FOURCC( 'f', 'L', 'a', 'C' )
#define ATOM_dfLa VLC_FOURCC( 'd', 'f', 'L', 'a' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
199

200
/* XiphQT */
201
#define ATOM_fCtS VLC_FOURCC( 'f', 'C', 't', 'S' )
202 203 204 205
#define ATOM_vCtH VLC_FOURCC( 'v', 'C', 't', 'H' )
#define ATOM_vCtC VLC_FOURCC( 'v', 'C', 't', 'C' )
#define ATOM_vCtd VLC_FOURCC( 'v', 'C', 't', '#' )

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
206 207 208 209 210 211 212 213 214 215 216 217
#define ATOM_zlib VLC_FOURCC( 'z', 'l', 'i', 'b' )
#define ATOM_SVQ1 VLC_FOURCC( 'S', 'V', 'Q', '1' )
#define ATOM_SVQ3 VLC_FOURCC( 'S', 'V', 'Q', '3' )
#define ATOM_ZyGo VLC_FOURCC( 'Z', 'y', 'G', 'o' )
#define ATOM_3IV1 VLC_FOURCC( '3', 'I', 'V', '1' )
#define ATOM_3iv1 VLC_FOURCC( '3', 'i', 'v', '1' )
#define ATOM_3IV2 VLC_FOURCC( '3', 'I', 'V', '2' )
#define ATOM_3iv2 VLC_FOURCC( '3', 'i', 'v', '2' )
#define ATOM_3IVD VLC_FOURCC( '3', 'I', 'V', 'D' )
#define ATOM_3ivd VLC_FOURCC( '3', 'i', 'v', 'd' )
#define ATOM_3VID VLC_FOURCC( '3', 'V', 'I', 'D' )
#define ATOM_3vid VLC_FOURCC( '3', 'v', 'i', 'd' )
218
#define ATOM_FFV1 VLC_FOURCC( 'F', 'F', 'V', '1' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
219 220 221 222 223 224 225 226 227 228 229 230 231
#define ATOM_h263 VLC_FOURCC( 'h', '2', '6', '3' )
#define ATOM_s263 VLC_FOURCC( 's', '2', '6', '3' )
#define ATOM_DIVX VLC_FOURCC( 'D', 'I', 'V', 'X' )
#define ATOM_XVID VLC_FOURCC( 'X', 'V', 'I', 'D' )
#define ATOM_cvid VLC_FOURCC( 'c', 'v', 'i', 'd' )
#define ATOM_mjpa VLC_FOURCC( 'm', 'j', 'p', 'a' )
#define ATOM_mjpb VLC_FOURCC( 'm', 'j', 'q', 't' )
#define ATOM_mjqt VLC_FOURCC( 'm', 'j', 'h', 't' )
#define ATOM_mjht VLC_FOURCC( 'm', 'j', 'p', 'b' )
#define ATOM_VP31 VLC_FOURCC( 'V', 'P', '3', '1' )
#define ATOM_vp31 VLC_FOURCC( 'v', 'p', '3', '1' )
#define ATOM_h264 VLC_FOURCC( 'h', '2', '6', '4' )
#define ATOM_qdrw VLC_FOURCC( 'q', 'd', 'r', 'w' )
232 233 234
#define ATOM_vp08 VLC_FOURCC( 'v', 'p', '0', '8' )
#define ATOM_vp09 VLC_FOURCC( 'v', 'p', '0', '9' )
#define ATOM_vp10 VLC_FOURCC( 'v', 'p', '1', '0' )
235
#define ATOM_WMV3 VLC_FOURCC( 'W', 'M', 'V', '3' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
236 237

#define ATOM_avc1 VLC_FOURCC( 'a', 'v', 'c', '1' )
François Cartegnie's avatar
François Cartegnie committed
238
#define ATOM_avc3 VLC_FOURCC( 'a', 'v', 'c', '3' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
239
#define ATOM_avcC VLC_FOURCC( 'a', 'v', 'c', 'C' )
240
#define ATOM_vpcC VLC_FOURCC( 'v', 'p', 'c', 'C' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
241 242
#define ATOM_m4ds VLC_FOURCC( 'm', '4', 'd', 's' )

243
#define ATOM_fiel VLC_FOURCC( 'f', 'i', 'e', 'l' )
244
#define ATOM_glbl VLC_FOURCC( 'g', 'l', 'b', 'l' )
Denis Charmet's avatar
Denis Charmet committed
245 246
#define ATOM_hvcC VLC_FOURCC( 'h', 'v', 'c', 'C' )

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
247 248 249 250 251
#define ATOM_dvc  VLC_FOURCC( 'd', 'v', 'c', ' ' )
#define ATOM_dvp  VLC_FOURCC( 'd', 'v', 'p', ' ' )
#define ATOM_dv5n VLC_FOURCC( 'd', 'v', '5', 'n' )
#define ATOM_dv5p VLC_FOURCC( 'd', 'v', '5', 'p' )
#define ATOM_raw  VLC_FOURCC( 'r', 'a', 'w', ' ' )
252
#define ATOM_dOps VLC_FOURCC( 'd', 'O', 'p', 's' )
253
#define ATOM_wfex VLC_FOURCC( 'w', 'f', 'e', 'x' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270

#define ATOM_jpeg VLC_FOURCC( 'j', 'p', 'e', 'g' )

#define ATOM_yv12 VLC_FOURCC( 'y', 'v', '1', '2' )
#define ATOM_yuv2 VLC_FOURCC( 'y', 'u', 'v', '2' )

#define ATOM_rmra VLC_FOURCC( 'r', 'm', 'r', 'a' )
#define ATOM_rmda VLC_FOURCC( 'r', 'm', 'd', 'a' )
#define ATOM_rdrf VLC_FOURCC( 'r', 'd', 'r', 'f' )
#define ATOM_rmdr VLC_FOURCC( 'r', 'm', 'd', 'r' )
#define ATOM_rmvc VLC_FOURCC( 'r', 'm', 'v', 'c' )
#define ATOM_rmcd VLC_FOURCC( 'r', 'm', 'c', 'd' )
#define ATOM_rmqu VLC_FOURCC( 'r', 'm', 'q', 'u' )
#define ATOM_alis VLC_FOURCC( 'a', 'l', 'i', 's' )

#define ATOM_gmhd VLC_FOURCC( 'g', 'm', 'h', 'd' )
#define ATOM_wave VLC_FOURCC( 'w', 'a', 'v', 'e' )
271
#define ATOM_strf VLC_FOURCC( 's', 't', 'r', 'f' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
272 273 274 275 276 277 278

#define ATOM_drms VLC_FOURCC( 'd', 'r', 'm', 's' )
#define ATOM_sinf VLC_FOURCC( 's', 'i', 'n', 'f' )
#define ATOM_schi VLC_FOURCC( 's', 'c', 'h', 'i' )
#define ATOM_user VLC_FOURCC( 'u', 's', 'e', 'r' )
#define ATOM_key  VLC_FOURCC( 'k', 'e', 'y', ' ' )
#define ATOM_iviv VLC_FOURCC( 'i', 'v', 'i', 'v' )
279
#define ATOM_mean VLC_FOURCC( 'm', 'e', 'a', 'n' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
280 281 282 283 284
#define ATOM_name VLC_FOURCC( 'n', 'a', 'm', 'e' )
#define ATOM_priv VLC_FOURCC( 'p', 'r', 'i', 'v' )
#define ATOM_drmi VLC_FOURCC( 'd', 'r', 'm', 'i' )
#define ATOM_frma VLC_FOURCC( 'f', 'r', 'm', 'a' )
#define ATOM_skcr VLC_FOURCC( 's', 'k', 'c', 'r' )
285
#define ATOM_ASF  VLC_FOURCC( 'A', 'S', 'F', ' ' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
286 287 288 289

#define ATOM_text VLC_FOURCC( 't', 'e', 'x', 't' )
#define ATOM_tx3g VLC_FOURCC( 't', 'x', '3', 'g' )
#define ATOM_subp VLC_FOURCC( 's', 'u', 'b', 'p' )
François Cartegnie's avatar
François Cartegnie committed
290
#define ATOM_subt VLC_FOURCC( 's', 'u', 'b', 't' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
291
#define ATOM_sbtl VLC_FOURCC( 's', 'b', 't', 'l' )
292 293 294
#define ATOM_clcp VLC_FOURCC( 'c', 'l', 'c', 'p' )
#define ATOM_c608 VLC_FOURCC( 'c', '6', '0', '8' )
#define ATOM_c708 VLC_FOURCC( 'c', '7', '0', '8' )
295 296 297 298 299
#define ATOM_wvtt VLC_FOURCC( 'w', 'v', 't', 't' )

/* In sample for WebVTT */
#define ATOM_vttc VLC_FOURCC( 'v', 't', 't', 'c' )
#define ATOM_payl VLC_FOURCC( 'p', 'a', 'y', 'l' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
300 301 302 303 304

#define ATOM_0xa9nam VLC_FOURCC( 0xa9, 'n', 'a', 'm' )
#define ATOM_0xa9aut VLC_FOURCC( 0xa9, 'a', 'u', 't' )
#define ATOM_0xa9cpy VLC_FOURCC( 0xa9, 'c', 'p', 'y' )
#define ATOM_0xa9inf VLC_FOURCC( 0xa9, 'i', 'n', 'f' )
305 306 307
#define ATOM_0xa9isr VLC_FOURCC( 0xa9, 'i', 's', 'r' )
#define ATOM_0xa9lab VLC_FOURCC( 0xa9, 'l', 'a', 'b' )
#define ATOM_0xa9lal VLC_FOURCC( 0xa9, 'l', 'a', 'l' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
#define ATOM_0xa9ART VLC_FOURCC( 0xa9, 'A', 'R', 'T' )
#define ATOM_0xa9des VLC_FOURCC( 0xa9, 'd', 'e', 's' )
#define ATOM_0xa9dir VLC_FOURCC( 0xa9, 'd', 'i', 'r' )
#define ATOM_0xa9cmt VLC_FOURCC( 0xa9, 'c', 'm', 't' )
#define ATOM_0xa9req VLC_FOURCC( 0xa9, 'r', 'e', 'q' )
#define ATOM_0xa9day VLC_FOURCC( 0xa9, 'd', 'a', 'y' )
#define ATOM_0xa9fmt VLC_FOURCC( 0xa9, 'f', 'm', 't' )
#define ATOM_0xa9prd VLC_FOURCC( 0xa9, 'p', 'r', 'd' )
#define ATOM_0xa9prf VLC_FOURCC( 0xa9, 'p', 'r', 'f' )
#define ATOM_0xa9src VLC_FOURCC( 0xa9, 's', 'r', 'c' )
#define ATOM_0xa9alb VLC_FOURCC( 0xa9, 'a', 'l', 'b' )
#define ATOM_0xa9dis VLC_FOURCC( 0xa9, 'd', 'i', 's' )
#define ATOM_0xa9enc VLC_FOURCC( 0xa9, 'e', 'n', 'c' )
#define ATOM_0xa9trk VLC_FOURCC( 0xa9, 't', 'r', 'k' )
#define ATOM_0xa9url VLC_FOURCC( 0xa9, 'u', 'r', 'l' )
#define ATOM_0xa9dsa VLC_FOURCC( 0xa9, 'd', 's', 'a' )
#define ATOM_0xa9hst VLC_FOURCC( 0xa9, 'h', 's', 't' )
#define ATOM_0xa9ope VLC_FOURCC( 0xa9, 'o', 'p', 'e' )
#define ATOM_0xa9wrt VLC_FOURCC( 0xa9, 'w', 'r', 't' )
#define ATOM_0xa9com VLC_FOURCC( 0xa9, 'c', 'o', 'm' )
#define ATOM_0xa9gen VLC_FOURCC( 0xa9, 'g', 'e', 'n' )
#define ATOM_0xa9too VLC_FOURCC( 0xa9, 't', 'o', 'o' )
#define ATOM_0xa9wrn VLC_FOURCC( 0xa9, 'w', 'r', 'n' )
#define ATOM_0xa9swr VLC_FOURCC( 0xa9, 's', 'w', 'r' )
#define ATOM_0xa9mak VLC_FOURCC( 0xa9, 'm', 'a', 'k' )
333
#define ATOM_0xa9mal VLC_FOURCC( 0xa9, 'm', 'a', 'l' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
334 335 336
#define ATOM_0xa9mod VLC_FOURCC( 0xa9, 'm', 'o', 'd' )
#define ATOM_0xa9PRD VLC_FOURCC( 0xa9, 'P', 'R', 'D' )
#define ATOM_0xa9grp VLC_FOURCC( 0xa9, 'g', 'r', 'p' )
337 338 339 340 341 342 343 344 345 346 347 348
#define ATOM_0xa9lyr VLC_FOURCC( 0xa9, 'l', 'y', 'r' )
#define ATOM_0xa9gen VLC_FOURCC( 0xa9, 'g', 'e', 'n' )
#define ATOM_0xa9st3 VLC_FOURCC( 0xa9, 's', 't', '3' )
#define ATOM_0xa9ard VLC_FOURCC( 0xa9, 'a', 'r', 'd' )
#define ATOM_0xa9arg VLC_FOURCC( 0xa9, 'a', 'r', 'g' )
#define ATOM_0xa9cak VLC_FOURCC( 0xa9, 'c', 'a', 'k' )
#define ATOM_0xa9con VLC_FOURCC( 0xa9, 'c', 'o', 'n' )
#define ATOM_0xa9des VLC_FOURCC( 0xa9, 'd', 'e', 's' )
#define ATOM_0xa9lnt VLC_FOURCC( 0xa9, 'l', 'n', 't' )
#define ATOM_0xa9phg VLC_FOURCC( 0xa9, 'p', 'h', 'g' )
#define ATOM_0xa9pub VLC_FOURCC( 0xa9, 'p', 'u', 'b' )
#define ATOM_0xa9sne VLC_FOURCC( 0xa9, 's', 'n', 'e' )
349
#define ATOM_0xa9snm VLC_FOURCC( 0xa9, 's', 'n', 'm' )
350 351 352
#define ATOM_0xa9sol VLC_FOURCC( 0xa9, 's', 'o', 'l' )
#define ATOM_0xa9thx VLC_FOURCC( 0xa9, 't', 'h', 'x' )
#define ATOM_0xa9xpd VLC_FOURCC( 0xa9, 'x', 'p', 'd' )
353
#define ATOM_0xa9xyz VLC_FOURCC( 0xa9, 'x', 'y', 'z' )
354
#define ATOM_aART VLC_FOURCC( 'a', 'A', 'R', 'T' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
355
#define ATOM_chpl VLC_FOURCC( 'c', 'h', 'p', 'l' )
356
#define ATOM_HMMT VLC_FOURCC( 'H', 'M', 'M', 'T' )
357
#define ATOM_disk VLC_FOURCC( 'd', 'i', 's', 'k' )
358
#define ATOM_ID32 VLC_FOURCC( 'I', 'D', '3', '2' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
359
#define ATOM_WLOC VLC_FOURCC( 'W', 'L', 'O', 'C' )
360
#define ATOM_ITUN VLC_FOURCC( '-', '-', '-', '-' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
361 362

#define ATOM_meta VLC_FOURCC( 'm', 'e', 't', 'a' )
363
#define ATOM_atID VLC_FOURCC( 'a', 't', 'I', 'D' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
364
#define ATOM_ilst VLC_FOURCC( 'i', 'l', 's', 't' )
365
#define ATOM_cnID VLC_FOURCC( 'c', 'n', 'I', 'D' )
366
#define ATOM_covr VLC_FOURCC( 'c', 'o', 'v', 'r' )
367
#define ATOM_flvr VLC_FOURCC( 'f', 'l', 'v', 'r' )
368
#define ATOM_rtng VLC_FOURCC( 'r', 't', 'n', 'g' )
369
#define ATOM_tsel VLC_FOURCC( 't', 's', 'e', 'l' )
370
#define ATOM_xid_ VLC_FOURCC( 'x', 'i', 'd', ' ' )
371 372 373 374 375 376
#define ATOM_gshh VLC_FOURCC( 'g', 's', 'h', 'h' )
#define ATOM_gspm VLC_FOURCC( 'g', 's', 'p', 'm' )
#define ATOM_gspu VLC_FOURCC( 'g', 's', 'p', 'u' )
#define ATOM_gssd VLC_FOURCC( 'g', 's', 's', 'd' )
#define ATOM_gsst VLC_FOURCC( 'g', 's', 's', 't' )
#define ATOM_gstd VLC_FOURCC( 'g', 's', 't', 'd' )
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
377
#define ATOM_colr VLC_FOURCC( 'c', 'o', 'l', 'r' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
378

379 380
#define ATOM_0x40PRM VLC_FOURCC( '@', 'P', 'R', 'M' )
#define ATOM_0x40PRQ VLC_FOURCC( '@', 'P', 'R', 'Q' )
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
381
#define ATOM_chap VLC_FOURCC( 'c', 'h', 'a', 'p' )
382
#define ATOM_MCPS VLC_FOURCC( 'M', 'C', 'P', 'S' )
383 384
#define ATOM_SDLN VLC_FOURCC( 'S', 'D', 'L', 'N' )
#define ATOM_vndr VLC_FOURCC( 'v', 'n', 'd', 'r' )
385

386 387
#define ATOM_SA3D VLC_FOURCC( 'S', 'A', '3', 'D' )

388 389
#define HANDLER_mdta VLC_FOURCC('m', 'd', 't', 'a')
#define HANDLER_mdir VLC_FOURCC('m', 'd', 'i', 'r')
390
#define HANDLER_ID32 ATOM_ID32
391

392 393
#define SAMPLEGROUP_rap  VLC_FOURCC('r', 'a', 'p', ' ')

394
/* Do you want some debug information on all read boxes ? */
395 396
#ifndef NDEBUG
# define MP4_VERBOSE  1
397
//# define MP4_ULTRA_VERBOSE  1
398
#endif
Laurent Aimar's avatar
Laurent Aimar committed
399

400 401
struct MP4_Box_s;

402
#define MP4_MFRO_BOXSIZE 16
403 404

/* uuid Universal Unique IDentifiers */
Laurent Aimar's avatar
Laurent Aimar committed
405
typedef struct UUID_s
406
{
407
    uint8_t b[16];
408 409 410 411
} UUID_t;

/* specific structure for all boxes */

412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438
typedef struct MP4_Box_data_tfxd_s
{
    uint8_t  i_version;
    uint32_t i_flags;

    uint64_t i_fragment_duration;
    uint64_t i_fragment_abs_time;

} MP4_Box_data_tfxd_t;

typedef struct TfrfBoxDataFields_s
{
    uint64_t i_fragment_duration;
    uint64_t i_fragment_abs_time;

} TfrfBoxDataFields_t;

typedef struct MP4_Box_data_tfrf_s
{
    uint8_t  i_version;
    uint8_t  i_fragment_count;
    uint32_t i_flags;

    TfrfBoxDataFields_t *p_tfrf_data_fields;

} MP4_Box_data_tfrf_t;

439 440
typedef struct MP4_Box_data_ftyp_s
{
441 442
    uint32_t i_major_brand;
    uint32_t i_minor_version;
443

444 445
    uint32_t i_compatible_brands_count;
    uint32_t *i_compatible_brands;
446 447 448 449 450

} MP4_Box_data_ftyp_t;

typedef struct MP4_Box_data_mvhd_s
{
451 452
    uint8_t  i_version;
    uint32_t i_flags;
Laurent Aimar's avatar
Laurent Aimar committed
453

454 455 456 457 458 459 460 461 462 463 464 465
    uint64_t i_creation_time;
    uint64_t i_modification_time;
    uint32_t i_timescale;
    uint64_t i_duration;

    int32_t  i_rate;
    int16_t  i_volume;
    int16_t  i_reserved1;
    uint32_t i_reserved2[2];
    int32_t  i_matrix[9];
    uint32_t i_predefined[6];
    uint32_t i_next_track_id;
466 467 468 469 470 471 472 473

} MP4_Box_data_mvhd_t;

#define MP4_TRACK_ENABLED    0x000001
#define MP4_TRACK_IN_MOVIE   0x000002
#define MP4_TRACK_IN_PREVIEW 0x000004
typedef struct MP4_Box_data_tkhd_s
{
474 475
    uint8_t  i_version;
    uint32_t i_flags;
Laurent Aimar's avatar
Laurent Aimar committed
476

477 478 479 480 481
    uint64_t i_creation_time;
    uint64_t i_modification_time;
    uint32_t i_track_ID;
    uint32_t i_reserved;
    uint64_t i_duration;
Laurent Aimar's avatar
Laurent Aimar committed
482

483 484 485
    uint32_t i_reserved2[2];
    int16_t  i_layer;
    int16_t  i_predefined;
Laurent Aimar's avatar
Laurent Aimar committed
486

487 488 489 490 491
    int16_t  i_volume;
    uint16_t i_reserved3;
    int32_t  i_matrix[9];
    int32_t  i_width;
    int32_t  i_height;
492
    float    f_rotation;
Laurent Aimar's avatar
Laurent Aimar committed
493

494 495
} MP4_Box_data_tkhd_t;

496 497 498 499 500 501 502 503
typedef struct
{
    uint32_t i_start_time;
    int32_t  i_duration;
    uint32_t i_flags;
    uint32_t i_hints;
} MP4_Box_data_load_t;

504 505
typedef struct MP4_Box_data_mdhd_s
{
506 507
    uint8_t  i_version;
    uint32_t i_flags;
Laurent Aimar's avatar
Laurent Aimar committed
508

509 510 511 512
    uint64_t i_creation_time;
    uint64_t i_modification_time;
    uint32_t i_timescale;
    uint64_t i_duration;
513

514 515 516
    char     rgs_language[3]; /* ISO-639-2/T or Mac lang table */
    bool     b_mac_encoding;  /* media using mac encoding */

517
    uint16_t i_quality;
518 519 520 521 522

} MP4_Box_data_mdhd_t;

typedef struct MP4_Box_data_hdlr_s
{
523 524
    uint8_t  i_version;
    uint32_t i_flags;
Laurent Aimar's avatar
Laurent Aimar committed
525

526
    uint32_t i_predefined;
Laurent Aimar's avatar
Laurent Aimar committed
527 528
    uint32_t i_handler_type; /* "vide" "soun" "hint" "odsm"
                           "crsm" "sdsm" "m7sm" "ocsm"
529
                           "ipsm" "mjsm" */
Laurent Aimar's avatar
Laurent Aimar committed
530

531 532 533 534 535 536
    unsigned char *psz_name; /* in UTF-8 */

} MP4_Box_data_hdlr_t;

typedef struct MP4_Box_data_vmhd_s
{
537 538
    uint8_t  i_version;
    uint32_t i_flags;
Laurent Aimar's avatar
Laurent Aimar committed
539

540
    int16_t  i_graphics_mode;
Laurent Aimar's avatar
Laurent Aimar committed
541
    int16_t  i_opcolor[3];
542 543 544 545 546

} MP4_Box_data_vmhd_t;

typedef struct MP4_Box_data_smhd_s
{
547 548
    uint8_t  i_version;
    uint32_t i_flags;
Laurent Aimar's avatar
Laurent Aimar committed
549

550 551
    int16_t  i_balance;
    int16_t  i_reserved;
552 553 554 555 556

} MP4_Box_data_smhd_t;

typedef struct MP4_Box_data_hmhd_s
{
557 558
    uint8_t  i_version;
    uint32_t i_flags;
Laurent Aimar's avatar
Laurent Aimar committed
559

560 561 562 563 564
    uint16_t i_max_PDU_size;
    uint16_t i_avg_PDU_size;
    uint32_t i_max_bitrate;
    uint32_t i_avg_bitrate;
    uint32_t i_reserved;
565 566 567 568 569

} MP4_Box_data_hmhd_t;

typedef struct MP4_Box_data_url_s
{
570 571
    uint8_t  i_version;
    uint32_t i_flags;
Laurent Aimar's avatar
Laurent Aimar committed
572

573
    char *psz_location;
Laurent Aimar's avatar
Laurent Aimar committed
574

575 576 577 578
} MP4_Box_data_url_t;

typedef struct MP4_Box_data_urn_s
{
579 580
    uint8_t  i_version;
    uint32_t i_flags;
581

582 583
    char *psz_name;
    char *psz_location;
Laurent Aimar's avatar
Laurent Aimar committed
584

585 586
} MP4_Box_data_urn_t;

587
typedef struct MP4_Box_data_lcont_s
588
{
589 590
    uint8_t  i_version;
    uint32_t i_flags;
591

592
    uint32_t i_entry_count;
593
/* XXX it's also a container with i_entry_count entry */
594
} MP4_Box_data_lcont_t;
595 596 597

typedef struct MP4_Box_data_stts_s
{
598 599
    uint8_t  i_version;
    uint32_t i_flags;
600

601
    uint32_t i_entry_count;
602 603
    uint32_t *pi_sample_count; /* these are array */
    int32_t  *pi_sample_delta;
604 605 606 607 608

} MP4_Box_data_stts_t;

typedef struct MP4_Box_data_ctts_s
{
609 610
    uint8_t  i_version;
    uint32_t i_flags;
Laurent Aimar's avatar
Laurent Aimar committed
611

612
    uint32_t i_entry_count;
613

614 615
    uint32_t *pi_sample_count; /* these are array */
    int32_t *pi_sample_offset;
616 617 618

} MP4_Box_data_ctts_t;

619 620 621 622 623 624 625 626 627 628
typedef struct MP4_Box_data_cslg_s
{
    int64_t ct_to_dts_shift;
    int64_t i_least_delta;
    int64_t i_max_delta;
    int64_t i_composition_starttime;
    int64_t i_composition_endtime;

} MP4_Box_data_cslg_t;

Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
629 630 631 632 633 634 635 636 637 638 639 640 641 642 643
// https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-125526
typedef struct MP4_Box_data_colr_s
{
    uint32_t i_type;
    union
    {
        struct
        {
            uint16_t i_primary_idx;
            uint16_t i_transfer_function_idx;
            uint16_t i_matrix_idx;
            uint8_t i_full_range;
        } nclc;
    };
} MP4_Box_data_colr_t;
644 645 646

typedef struct MP4_Box_data_sample_soun_s
{
647 648
    uint8_t  i_reserved1[6];
    uint16_t i_data_reference_index;
649

650 651 652 653 654
    //uint32_t i_reserved2[2];
    uint16_t i_qt_version;
    uint16_t i_qt_revision_level;
    uint32_t i_qt_vendor;

655 656
    uint16_t i_channelcount;
    uint16_t i_samplesize;
François Cartegnie's avatar
François Cartegnie committed
657
    uint16_t i_compressionid;
658
    uint16_t i_reserved3;
659 660
    uint32_t i_sampleratehi; /* timescale of track */
    uint32_t i_sampleratelo;
661 662 663 664 665 666

    /* for version 1 (i_reserved1[0] == 1) */
    uint32_t i_sample_per_packet;
    uint32_t i_bytes_per_packet;
    uint32_t i_bytes_per_frame;
    uint32_t i_bytes_per_sample;
667

668 669 670 671 672 673
    /* v2 */
    uint32_t i_constbitsperchannel; /* consts are nonzero only if constant */
    uint32_t i_formatflags;
    uint32_t i_constbytesperaudiopacket;
    uint32_t i_constLPCMframesperaudiopacket;

674 675 676 677
    /* XXX hack */
    int     i_qt_description;
    uint8_t *p_qt_description;

678 679 680 681
} MP4_Box_data_sample_soun_t;

typedef struct MP4_Box_data_sample_vide_s
{
682 683
    uint8_t  i_reserved1[6];
    uint16_t i_data_reference_index;
684

685 686 687 688 689 690
    uint16_t i_qt_version;
    uint16_t i_qt_revision_level;
    uint32_t i_qt_vendor;

    uint32_t i_qt_temporal_quality;
    uint32_t i_qt_spatial_quality;
691

692 693
    int16_t  i_width;
    int16_t  i_height;
694

695 696
    uint32_t i_horizresolution;
    uint32_t i_vertresolution;
697

698 699 700
    uint32_t i_qt_data_size;
    uint16_t i_qt_frame_count;

701
    char     sz_compressorname[32];
702
    int16_t  i_depth;
703

704 705 706 707 708 709
    int16_t  i_qt_color_table;

    /* XXX hack ImageDescription */
    int     i_qt_image_description;
    uint8_t *p_qt_image_description;

710 711
} MP4_Box_data_sample_vide_t;

712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730
#define MP4_TEXT_DISPLAY_FLAG_DONT_DISPLAY       (1<<0)
#define MP4_TEXT_DISPLAY_FLAG_AUTO_SCALE         (1<<1)
#define MP4_TEXT_DISPLAY_FLAG_CLIP_TO_TEXT_BOX   (1<<2)
#define MP4_TEXT_DISPLAY_FLAG_USE_MOVIE_BG_COLOR (1<<3)
#define MP4_TEXT_DISPLAY_FLAG_SHRINK_TEXT_BOX_TO_FIT (1<<4)
#define MP4_TEXT_DISPLAY_FLAG_SCROLL_IN          (1<<5)
#define MP4_TEXT_DISPLAY_FLAG_SCROLL_OUT         (1<<6)
#define MP4_TEXT_DISPLAY_FLAG_HORIZONTAL_SCROLL  (1<<7)
#define MP4_TEXT_DISPLAY_FLAG_REVERSE_SCROLL     (1<<8)
#define MP4_TEXT_DISPLAY_FLAG_CONTINUOUS_SCROLL  (1<<9)
#define MP4_TEXT_DISPLAY_FLAG_FLOW_HORIZONTAL    (1<<10)
#define MP4_TEXT_DISPLAY_FLAG_CONTINUOUS_KARAOKE (1<<11)
#define MP4_TEXT_DISPLAY_FLAG_DROP_SHADOW        (1<<12)
#define MP4_TEXT_DISPLAY_FLAG_ANTI_ALIAS         (1<<13)
#define MP4_TEXT_DISPLAY_FLAG_KEYED_TEXT         (1<<14)
#define MP4_TEXT_DISPLAY_FLAG_INVERSE_HILITE     (1<<15)
#define MP4_TEXT_DISPLAY_FLAG_COLOR_HILITE       (1<<16)
#define MP4_TEXT_DISPLAY_FLAG_WRITE_VERTICALLY   (1<<17)

731 732
typedef struct
{
733 734 735
    uint32_t i_reserved1;
    uint16_t i_reserved2;

736 737
    uint16_t i_data_reference_index;

738 739 740 741 742 743
    uint32_t i_display_flags;   // TextDescription and Tx3gDescription

    int8_t i_justification_horizontal; // left(0), centered(1), right(-1)
    int8_t i_justification_vertical;   // top(0), centered(1), bottom(-1)

    uint16_t i_background_color[4];
744

745 746 747 748
    uint16_t i_text_box_top;
    uint16_t i_text_box_left;
    uint16_t i_text_box_bottom;
    uint16_t i_text_box_right;
749

750 751 752 753 754 755 756
    uint32_t i_reserved3;

    uint16_t i_font_id;
    uint8_t  i_font_face;
    uint8_t  i_font_size;
    uint32_t i_font_color; //RGBA

757
    // TODO to complete
758 759
} MP4_Box_data_sample_text_t;

760 761 762 763 764 765 766
typedef struct
{
    uint8_t  i_reserved1[6];
    uint16_t i_data_reference_index;

} MP4_Box_data_sample_clcp_t;

767 768
typedef struct MP4_Box_data_sample_hint_s
{
769 770
    uint8_t  i_reserved1[6];
    uint16_t i_data_reference_index;
771

772
    uint8_t *p_data;
773 774 775

} MP4_Box_data_sample_hint_t;

776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803
typedef struct MP4_Box_data_rrtp_sample_s
{
    uint16_t i_hinttrackversion;
    uint16_t i_highestcompatibleversion;
    uint32_t i_maxpacketsize;

    uint8_t *p_additionaldata;

} MP4_Box_data_rrtp_sample_t;

typedef struct MP4_Box_data_timescale_entry_s
{
    uint32_t i_timescale;

} MP4_Box_data_timescale_entry_t;

typedef struct MP4_Box_data_time_offset_s
{
    uint32_t i_offset;

} MP4_Box_data_time_offset_t;

typedef struct MP4_Box_data_timestampsynchrony_s
{
    uint8_t i_reserved_timestamp_sync;

} MP4_Box_data_timestampsynchrony_t;

804 805
typedef struct MP4_Box_data_moviehintinformation_rtp_s
{
806
    uint32_t i_description_format;
807 808 809 810
    unsigned char *psz_text;

} MP4_Box_data_moviehintinformation_rtp_t;

811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846
typedef struct MP4_Box_data_sdp_s
{
    char *psz_text;

} MP4_Box_data_sdp_t;

typedef struct MP4_Box_data_tims_s
{
    uint32_t i_timescale;

} MP4_Box_data_tims_t;

typedef struct MP4_Box_data_tsro_s
{
    int32_t i_offset;

} MP4_Box_data_tsro_t;

typedef struct MP4_Box_data_tssy_s
{
    uint8_t i_reserved_timestamp_sync;

} MP4_Box_data_tssy_t;

typedef struct MP4_Box_data_stsd_s
{
    uint8_t  i_version;
    uint32_t i_flags;

    uint32_t i_entry_count;

    /* it contains SampleEntry handled as if it was Box */

} MP4_Box_data_stsd_t;


847 848
typedef struct MP4_Box_data_stsz_s
{
849 850
    uint8_t  i_version;
    uint32_t i_flags;
851

852 853
    uint32_t i_sample_size;
    uint32_t i_sample_count;
Laurent Aimar's avatar
Laurent Aimar committed
854

855
    uint32_t *i_entry_size; /* array , empty if i_sample_size != 0 */
856 857 858 859 860

} MP4_Box_data_stsz_t;

typedef struct MP4_Box_data_stz2_s
{
861 862
    uint8_t  i_version;
    uint32_t i_flags;
863

864 865 866
    uint32_t i_sample_size; /* 24 bits */
    uint8_t  i_field_size;
    uint32_t i_sample_count;
867

868
    uint32_t *i_entry_size; /* array: unsigned int(i_field_size) entry_size */
869 870 871 872 873

} MP4_Box_data_stz2_t;

typedef struct MP4_Box_data_stsc_s
{
874 875
    uint8_t  i_version;
    uint32_t i_flags;
876

877
    uint32_t i_entry_count;
878

879 880 881
    uint32_t *i_first_chunk; /* theses are arrays */
    uint32_t *i_samples_per_chunk;
    uint32_t *i_sample_description_index;
Laurent Aimar's avatar
Laurent Aimar committed
882

883 884 885 886 887
} MP4_Box_data_stsc_t;


typedef struct MP4_Box_data_co64_s
{
888 889
    uint8_t  i_version;
    uint32_t i_flags;
890

891
    uint32_t i_entry_count;
Laurent Aimar's avatar
Laurent Aimar committed
892

893
    uint64_t *i_chunk_offset;
894 895 896 897 898 899

} MP4_Box_data_co64_t;


typedef struct MP4_Box_data_stss_s
{
900 901
    uint8_t  i_version;
    uint32_t i_flags;
Laurent Aimar's avatar
Laurent Aimar committed
902

903
    uint32_t i_entry_count;
Laurent Aimar's avatar
Laurent Aimar committed
904

905
    uint32_t *i_sample_number;
Laurent Aimar's avatar
Laurent Aimar committed
906

907 908 909 910
} MP4_Box_data_stss_t;

typedef struct MP4_Box_data_stsh_s
{
911 912
    uint8_t  i_version;
    uint32_t i_flags;
913

914
    uint32_t i_entry_count;
Laurent Aimar's avatar
Laurent Aimar committed
915

916 917
    uint32_t *i_shadowed_sample_number;
    uint32_t *i_sync_sample_number;
918 919 920 921 922

} MP4_Box_data_stsh_t;

typedef struct MP4_Box_data_stdp_s
{
923 924
    uint8_t  i_version;
    uint32_t i_flags;
925

926
    uint16_t *i_priority;
927 928 929 930 931

} MP4_Box_data_stdp_t;

typedef struct MP4_Box_data_padb_s
{
932 933
    uint8_t  i_version;
    uint32_t i_flags;
934

935
    uint32_t i_sample_count;
936

937 938 939 940
    uint16_t *i_reserved1;   /* 1bit  */
    uint16_t *i_pad2;        /* 3bits */
    uint16_t *i_reserved2;   /* 1bit  */
    uint16_t *i_pad1;        /* 3bits */
Laurent Aimar's avatar
Laurent Aimar committed
941

942 943 944 945 946 947

} MP4_Box_data_padb_t;


typedef struct MP4_Box_data_elst_s
{
948 949
    uint8_t  i_version;
    uint32_t i_flags;
950

951
    uint32_t i_entry_count;
952

953 954 955 956
    uint64_t *i_segment_duration;
    int64_t  *i_media_time;
    uint16_t *i_media_rate_integer;
    uint16_t *i_media_rate_fraction;
957

Laurent Aimar's avatar
Laurent Aimar committed
958

959 960 961 962
} MP4_Box_data_elst_t;

typedef struct MP4_Box_data_cprt_s
{
963 964
    uint8_t  i_version;
    uint32_t i_flags;
965 966

    char     rgs_language[3]; /* ISO-639-2/T */
Laurent Aimar's avatar
Laurent Aimar committed
967

968
    char *psz_notice;
969 970 971 972 973 974
} MP4_Box_data_cprt_t;


/* DecoderConfigDescriptor */
typedef struct MP4_descriptor_decoder_config_s
{
975
    uint8_t i_objectProfileIndication;
976 977 978 979 980
    uint8_t i_streamType;
    int     b_upStream;
    int     i_buffer_sizeDB;
    int     i_max_bitrate;
    int     i_avg_bitrate;
Laurent Aimar's avatar
Laurent Aimar committed
981

982 983
    int     i_decoder_specific_info_len;
    uint8_t *p_decoder_specific_info;
984
    /* some other stuff */
Laurent Aimar's avatar
Laurent Aimar committed
985

986 987 988 989
} MP4_descriptor_decoder_config_t;

typedef struct MP4_descriptor_SL_config_s
{
990 991

    int i_dummy; /* ANSI C forbids empty structures */
Laurent Aimar's avatar
Laurent Aimar committed
992

993 994 995 996 997
} MP4_descriptor_SL_config_t;


typedef struct MP4_descriptor_ES_s
{
998 999 1000 1001 1002
    uint16_t i_ES_ID;
    int      b_stream_dependence;
    int      b_url;
    int      b_OCRstream;
    int      i_stream_priority;
1003

1004
    int      i_depend_on_ES_ID; /* if b_stream_dependence set */
1005 1006 1007

    unsigned char *psz_URL;

1008
    uint16_t i_OCR_ES_ID;       /* if b_OCRstream */
1009
    MP4_descriptor_decoder_config_t *p_decConfigDescr;
Laurent Aimar's avatar
Laurent Aimar committed
1010

1011 1012 1013 1014 1015 1016 1017 1018 1019
    MP4_descriptor_SL_config_t *p_slConfigDescr;

    /* some other stuff ... */

} MP4_descriptor_ES_t;

/* ES descriptor */
typedef struct MP4_Box_data_esds_s
{
1020 1021
    uint8_t  i_version;
    uint32_t i_flags;
Laurent Aimar's avatar
Laurent Aimar committed
1022

1023
    MP4_descriptor_ES_t es_descriptor;
Laurent Aimar's avatar
Laurent Aimar committed
1024

1025 1026 1027 1028 1029
} MP4_Box_data_esds_t;


typedef struct MP4_Box_data_dcom_s
{
1030
    uint32_t i_algorithm; /* fourcc */
Laurent Aimar's avatar
Laurent Aimar committed
1031

1032 1033 1034 1035
} MP4_Box_data_dcom_t;

typedef struct MP4_Box_data_cmvd_s
{
1036 1037
    uint32_t i_uncompressed_size;
    uint32_t i_compressed_size;
1038

1039 1040
    int     b_compressed; /* Set to 1 if compressed data, 0 if uncompressed */
    uint8_t *p_data;
1041 1042 1043 1044 1045 1046

} MP4_Box_data_cmvd_t;

typedef struct MP4_Box_data_cmov_s
{
    struct MP4_Box_s *p_moov; /* uncompressed moov */
1047

1048 1049
} MP4_Box_data_cmov_t;

Iain Wade's avatar
Iain Wade committed
1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061
typedef struct
{
    uint32_t i_type;
} MP4_Box_data_frma_t;

typedef struct
{
    uint32_t i_init;
    uint32_t i_encr;
    uint32_t i_decr;
} MP4_Box_data_skcr_t;

1062
typedef struct
1063 1064 1065 1066 1067 1068 1069 1070 1071
{
    uint8_t  i_version;
    uint32_t i_flags;

    uint32_t i_ref_type;
    char     *psz_ref;

} MP4_Box_data_rdrf_t;

1072
typedef struct
1073 1074 1075 1076 1077 1078 1079 1080
{
    uint8_t  i_version;
    uint32_t i_flags;

    uint32_t i_rate;

} MP4_Box_data_rmdr_t;

1081
typedef struct
1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093
{
    uint8_t  i_version;
    uint32_t i_flags;

    uint32_t i_gestaltType;
    uint32_t i_val1;
    uint32_t i_val2;
    uint16_t i_checkType;   /* 0: val1 is version min
                               1: gestalt value & val2 == val1 */

} MP4_Box_data_rmvc_t;

1094
typedef struct
1095 1096 1097 1098 1099 1100 1101
{
    uint8_t  i_version;
    uint32_t i_flags;


} MP4_Box_data_rmcd_t;

1102
typedef struct
1103 1104 1105 1106 1107
{
    uint32_t i_quality;

} MP4_Box_data_rmqu_t;

1108 1109
typedef struct MP4_Box_data_mfhd_s
{
F. Yhuel's avatar
F. Yhuel committed
1110 1111
    uint8_t  i_version;
    uint32_t i_flags;
1112

F. Yhuel's avatar
F. Yhuel committed
1113
    uint32_t i_sequence_number;
1114 1115 1116

} MP4_Box_data_mfhd_t;

1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142
typedef struct MP4_Box_sidx_item_s
{
    bool     b_reference_type;
    uint32_t i_referenced_size;
    uint32_t i_subsegment_duration;
    bool     b_starts_with_SAP;
    uint8_t  i_SAP_type;
    uint32_t i_SAP_delta_time;

} MP4_Box_sidx_item_t;

typedef struct MP4_Box_data_sidx_s
{
    uint8_t  i_version;
    uint32_t i_flags;

    uint32_t i_reference_ID;
    uint32_t i_timescale;
    uint64_t i_earliest_presentation_time;
    uint64_t i_first_offset;
    uint16_t i_reference_count;

    MP4_Box_sidx_item_t *p_items;

} MP4_Box_data_sidx_t;

1143 1144 1145 1146 1147
#define MP4_TFHD_BASE_DATA_OFFSET     (1LL<<0)
#define MP4_TFHD_SAMPLE_DESC_INDEX    (1LL<<1)
#define MP4_TFHD_DFLT_SAMPLE_DURATION (1LL<<3)
#define MP4_TFHD_DFLT_SAMPLE_SIZE     (1LL<<4)
#define MP4_TFHD_DFLT_SAMPLE_FLAGS    (1LL<<5)
Frédéric Yhuel's avatar
Frédéric Yhuel committed
1148
#define MP4_TFHD_DURATION_IS_EMPTY    (1LL<<16)
1149
#define MP4_TFHD_DEFAULT_BASE_IS_MOOF (1LL<<17)
1150 1151 1152
typedef struct MP4_Box_data_tfhd_s
{
    uint8_t  i_version;
Frédéric Yhuel's avatar
Frédéric Yhuel committed
1153
    bool     b_empty;
1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176
    uint32_t i_flags;
    uint32_t i_track_ID;

    /* optional fields */
    uint64_t i_base_data_offset;
    uint32_t i_sample_description_index;
    uint32_t i_default_sample_duration;
    uint32_t i_default_sample_size;
    uint32_t i_default_sample_flags;

} MP4_Box_data_tfhd_t;

#define MP4_TRUN_DATA_OFFSET         (1<<0)
#define MP4_TRUN_FIRST_FLAGS         (1<<2)
#define MP4_TRUN_SAMPLE_DURATION     (1<<8)
#define MP4_TRUN_SAMPLE_SIZE         (1<<9)
#define MP4_TRUN_SAMPLE_FLAGS        (1<<10)
#define MP4_TRUN_SAMPLE_TIME_OFFSET  (1<<11)
typedef struct MP4_descriptor_trun_sample_t
{
    uint32_t i_duration;
    uint32_t i_size;
    uint32_t i_flags;
1177 1178 1179 1180 1181
    union
    {
        uint32_t v0;
        int32_t  v1; /* version == 1 ? signed : unsigned */
    } i_composition_time_offset;
1182 1183 1184 1185 1186 1187 1188 1189 1190
} MP4_descriptor_trun_sample_t;

typedef struct MP4_Box_data_trun_s
{
    uint8_t  i_version;
    uint32_t i_flags;
    uint32_t i_sample_count;

    /* optional fields */
1191
    int32_t i_data_offset;
1192 1193 1194 1195 1196 1197
    uint32_t i_first_sample_flags;

    MP4_descriptor_trun_sample_t *p_samples;

} MP4_Box_data_trun_t;

1198 1199 1200 1201 1202 1203 1204 1205
typedef struct MP4_Box_data_tfdt_s
{
    uint8_t  i_version;
    uint32_t i_flags;
    int64_t  i_base_media_decode_time;

} MP4_Box_data_tfdt_t;

1206 1207 1208 1209 1210 1211 1212
typedef struct
{
    uint32_t i_date;
    uint32_t i_type;
    uint16_t i_index;
} MP4_Box_data_pnot_t;

1213 1214 1215
typedef struct
{
    char *psz_text;
1216
    uint64_t i_length;
1217

1218
} MP4_Box_data_string_t;
1219

1220 1221
typedef struct
{
1222 1223
    void  *p_blob;
    size_t i_blob;
1224 1225
} MP4_Box_data_binary_t;

1226 1227 1228 1229 1230 1231 1232
typedef struct
{
    uint32_t i_entry_count;
    uint32_t *i_track_ID;

} MP4_Box_data_tref_generic_t;

1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245
typedef struct
{
    uint8_t  i_version;
    uint32_t i_flags;

    uint8_t i_chapter;
    struct
    {
        char    *psz_name;
        int64_t  i_start;
    } chapter[256];
} MP4_Box_data_chpl_t;

1246 1247 1248 1249 1250 1251 1252
typedef struct
{
    uint32_t i_chapter_count;
    uint32_t *pi_chapter_start;

} MP4_Box_data_HMMT_t;

1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277
typedef struct
{
    uint8_t i_version;
    uint8_t i_profile;
    uint8_t i_profile_compatibility;
    uint8_t i_level;

    uint8_t i_reserved1;     /* 6 bits */
    uint8_t i_length_size;

    uint8_t i_reserved2;    /* 3 bits */
    uint8_t  i_sps;
    uint16_t *i_sps_length;
    uint8_t  **sps;

    uint8_t  i_pps;
    uint16_t *i_pps_length;
    uint8_t  **pps;

    /* XXX: Hack raw avcC atom payload */
    int     i_avcC;
    uint8_t *p_avcC;

} MP4_Box_data_avcC_t;

1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290
typedef struct
{
    uint8_t i_profile;
    uint8_t i_level;
    uint8_t i_bit_depth;
    uint8_t i_color_space;
    uint8_t i_chroma_subsampling;
    uint8_t i_xfer_function;
    uint8_t i_fullrange;
    uint16_t i_codec_init_datasize;
    uint8_t *p_codec_init_data;
} MP4_Box_data_vpcC_t;

1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304
typedef struct
{
    WAVEFORMATEX Format;
    uint32_t i_extra;
    char    *p_extra;
} MP4_Box_data_WMA2_t;

typedef struct
{
    VLC_BITMAPINFOHEADER bmiHeader;
    uint32_t i_extra;
    char    *p_extra;
} MP4_Box_data_strf_t;

1305 1306 1307 1308 1309
typedef struct
{
    uint8_t i_stream_number;
} MP4_Box_data_ASF_t;

1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325
typedef struct
{
    uint8_t i_version;
    uint32_t i_grouping_type;
    uint32_t i_default_sample_description_index;
    uint32_t i_entry_count;
    union
    {
        struct
        {
            uint8_t i_num_leading_samples_known;
            uint8_t i_num_leading_samples;
        } rap;
    } *p_entries;
} MP4_Box_data_sgpd_t;

1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338
typedef struct
{
    uint8_t i_version;
    uint32_t i_grouping_type;
    uint32_t i_grouping_type_parameter;
    uint32_t i_entry_count;
    struct
    {
        uint32_t *pi_sample_count;
        uint32_t *pi_group_description_index;
    } entries;
} MP4_Box_data_sbgp_t;

1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387
/* According to Apple's CoreAudio/CoreAudioTypes.h */
#define MP4_CHAN_USE_CHANNELS_DESC           0
#define MP4_CHAN_USE_CHANNELS_BITMAP         (1<<16)

#define MP4_CHAN_BITMAP_LEFT                 (1<<0)
#define MP4_CHAN_BITMAP_RIGHT                (1<<1)
#define MP4_CHAN_BITMAP_CENTER               (1<<2)
#define MP4_CHAN_BITMAP_LFESCREEN            (1<<3)
#define MP4_CHAN_BITMAP_BACKLEFT             (1<<4)
#define MP4_CHAN_BITMAP_BACKRIGHT            (1<<5)
#define MP4_CHAN_BITMAP_LEFTCENTER           (1<<6)
#define MP4_CHAN_BITMAP_RIGHTCENTER          (1<<7)
#define MP4_CHAN_BITMAP_BACKCENTER           (1<<8)
#define MP4_CHAN_BITMAP_SIDELEFT             (1<<9)
#define MP4_CHAN_BITMAP_SIDERIGHT            (1<<10)
#define MP4_CHAN_BITMAP_TOPCENTER            (1<<11)
#define MP4_CHAN_BITMAP_TOPFRONTLEFT         (1<<12)
#define MP4_CHAN_BITMAP_TOPFRONTENTER        (1<<13)
#define MP4_CHAN_BITMAP_TOPFRONTRIGHT        (1<<14)
#define MP4_CHAN_BITMAP_TOPBACKLEFT          (1<<15)
#define MP4_CHAN_BITMAP_TOPBACKCENTER        (1<<16)
#define MP4_CHAN_BITMAP_TOPBACKRIGHT         (1<<17)

#define MP4_CHAN_BITMAP_MAPPING_COUNT 18
static const struct
{
    uint32_t i_bitmap;
    uint32_t i_vlc;
} chan_bitmap_mapping[MP4_CHAN_BITMAP_MAPPING_COUNT] = {
    { MP4_CHAN_BITMAP_LEFT,         AOUT_CHAN_LEFT },
    { MP4_CHAN_BITMAP_RIGHT,        AOUT_CHAN_RIGHT },
    { MP4_CHAN_BITMAP_CENTER,       AOUT_CHAN_CENTER },
    { MP4_CHAN_BITMAP_LFESCREEN,    AOUT_CHAN_LFE },
    { MP4_CHAN_BITMAP_BACKLEFT,     AOUT_CHAN_REARLEFT },
    { MP4_CHAN_BITMAP_BACKRIGHT,    AOUT_CHAN_REARRIGHT },
    { MP4_CHAN_BITMAP_LEFTCENTER,   AOUT_CHAN_MIDDLELEFT },
    { MP4_CHAN_BITMAP_RIGHTCENTER,  AOUT_CHAN_MIDDLERIGHT },
    { MP4_CHAN_BITMAP_BACKCENTER,   AOUT_CHAN_REARCENTER },
    { MP4_CHAN_BITMAP_SIDELEFT,     AOUT_CHAN_LEFT },
    { MP4_CHAN_BITMAP_SIDERIGHT,    AOUT_CHAN_RIGHT },
    { MP4_CHAN_BITMAP_TOPCENTER,    AOUT_CHAN_CENTER },
    { MP4_CHAN_BITMAP_TOPFRONTLEFT, AOUT_CHAN_LEFT },
    { MP4_CHAN_BITMAP_TOPFRONTENTER,AOUT_CHAN_CENTER },
    { MP4_CHAN_BITMAP_TOPFRONTRIGHT,AOUT_CHAN_RIGHT },
    { MP4_CHAN_BITMAP_TOPBACKLEFT,  AOUT_CHAN_REARLEFT },
    { MP4_CHAN_BITMAP_TOPBACKCENTER,AOUT_CHAN_REARCENTER },
    { MP4_CHAN_BITMAP_TOPBACKRIGHT, AOUT_CHAN_REARRIGHT },
};

1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400