Add runtime translation support
[mplayer/kovensky.git] / libmpdemux / parse_mp4.h
blob27d4d44d7dce7bd6741d0700d94f2cf88724149a
1 /*
2 * MP4 file format parser code
4 * Copyright (C) 2002 Felix Buenemann <atmosfear at users.sourceforge.net>
5 * Code inspired by libmp4 from http://mpeg4ip.sourceforge.net/.
7 * This file is part of MPlayer.
9 * MPlayer is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * MPlayer is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #ifndef MPLAYER_PARSE_MP4_H
25 #define MPLAYER_PARSE_MP4_H
27 #include <inttypes.h>
29 /* one byte tag identifiers */
30 #define MP4ODescrTag 0x01
31 #define MP4IODescrTag 0x02
32 #define MP4ESDescrTag 0x03
33 #define MP4DecConfigDescrTag 0x04
34 #define MP4DecSpecificDescrTag 0x05
35 #define MP4SLConfigDescrTag 0x06
36 #define MP4ContentIdDescrTag 0x07
37 #define MP4SupplContentIdDescrTag 0x08
38 #define MP4IPIPtrDescrTag 0x09
39 #define MP4IPMPPtrDescrTag 0x0A
40 #define MP4IPMPDescrTag 0x0B
41 #define MP4RegistrationDescrTag 0x0D
42 #define MP4ESIDIncDescrTag 0x0E
43 #define MP4ESIDRefDescrTag 0x0F
44 #define MP4FileIODescrTag 0x10
45 #define MP4FileODescrTag 0x11
46 #define MP4ExtProfileLevelDescrTag 0x13
47 #define MP4ExtDescrTagsStart 0x80
48 #define MP4ExtDescrTagsEnd 0xFE
50 /* object type identifiers in the ESDS */
51 /* See http://gpac.sourceforge.net/tutorial/mediatypes.htm */
52 /* BIFS stream version 1 */
53 #define MP4OTI_MPEG4Systems1 0x01
54 /* BIFS stream version 2 */
55 #define MP4OTI_MPEG4Systems2 0x02
56 /* MPEG-4 visual stream */
57 #define MP4OTI_MPEG4Visual 0x20
58 /* MPEG-4 audio stream */
59 #define MP4OTI_MPEG4Audio 0x40
60 /* MPEG-2 visual streams with various profiles */
61 #define MP4OTI_MPEG2VisualSimple 0x60
62 #define MP4OTI_MPEG2VisualMain 0x61
63 #define MP4OTI_MPEG2VisualSNR 0x62
64 #define MP4OTI_MPEG2VisualSpatial 0x63
65 #define MP4OTI_MPEG2VisualHigh 0x64
66 #define MP4OTI_MPEG2Visual422 0x65
67 /* MPEG-2 audio stream part 7 ("AAC") with various profiles */
68 #define MP4OTI_MPEG2AudioMain 0x66
69 #define MP4OTI_MPEG2AudioLowComplexity 0x67
70 #define MP4OTI_MPEG2AudioScaleableSamplingRate 0x68
71 /* MPEG-2 audio part 3 ("MP3") */
72 #define MP4OTI_MPEG2AudioPart3 0x69
73 /* MPEG-1 visual visual stream */
74 #define MP4OTI_MPEG1Visual 0x6A
75 /* MPEG-1 audio stream part 3 ("MP3") */
76 #define MP4OTI_MPEG1Audio 0x6B
77 /* JPEG visual stream */
78 #define MP4OTI_JPEG 0x6C
79 /* 3GPP2 */
80 #define MP4OTI_13kVoice 0xE1
82 /* I define uint24 here for better understanding */
83 #ifndef uint24_t
84 #define uint24_t uint32_t
85 #endif
87 /* esds_t */
88 typedef struct {
89 uint8_t version;
90 uint24_t flags;
92 /* 0x03 ESDescrTag */
93 uint16_t ESId;
94 uint8_t streamPriority;
96 /* 0x04 DecConfigDescrTag */
97 uint8_t objectTypeId;
98 uint8_t streamType;
99 /* XXX: really streamType is
100 * only 6bit, followed by:
101 * 1bit upStream
102 * 1bit reserved
104 uint24_t bufferSizeDB;
105 uint32_t maxBitrate;
106 uint32_t avgBitrate;
108 /* 0x05 DecSpecificDescrTag */
109 uint16_t decoderConfigLen;
110 uint8_t *decoderConfig;
112 /* 0x06 SLConfigDescrTag */
113 uint8_t SLConfigLen;
114 uint8_t *SLConfig;
116 /* TODO: add the missing tags,
117 * I currently have no specs
118 * for them and doubt they
119 * are currently needed ::atmos
122 } esds_t;
124 int mp4_parse_esds(unsigned char *data, int datalen, esds_t *esds);
125 void mp4_free_esds(esds_t *esds);
127 #endif /* MPLAYER_PARSE_MP4_H */