annotate libmpdemux/parse_mp4.h @ 27748:6b0875706a22

fixed overlay x and y calculation
author faust3
date Thu, 16 Oct 2008 18:13:26 +0000
parents 4129c8cfa742
children 4932a522100e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5301
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
1 /* parse_mp4.h - Headerfile for MP4 file format parser code
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
2 * This file is part of MPlayer, see http://mplayerhq.hu/ for info.
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
3 * (c)2002 by Felix Buenemann <atmosfear at users.sourceforge.net>
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
4 * File licensed under the GPL, see http://www.fsf.org/ for more info.
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
5 */
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
6
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25546
diff changeset
7 #ifndef MPLAYER_PARSE_MP4_H
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25546
diff changeset
8 #define MPLAYER_PARSE_MP4_H
5301
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
9
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
10 #include <inttypes.h>
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
11
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
12 /* one byte tag identifiers */
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
13 #define MP4ODescrTag 0x01
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
14 #define MP4IODescrTag 0x02
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
15 #define MP4ESDescrTag 0x03
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
16 #define MP4DecConfigDescrTag 0x04
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
17 #define MP4DecSpecificDescrTag 0x05
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
18 #define MP4SLConfigDescrTag 0x06
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
19 #define MP4ContentIdDescrTag 0x07
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
20 #define MP4SupplContentIdDescrTag 0x08
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
21 #define MP4IPIPtrDescrTag 0x09
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
22 #define MP4IPMPPtrDescrTag 0x0A
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
23 #define MP4IPMPDescrTag 0x0B
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
24 #define MP4RegistrationDescrTag 0x0D
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
25 #define MP4ESIDIncDescrTag 0x0E
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
26 #define MP4ESIDRefDescrTag 0x0F
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
27 #define MP4FileIODescrTag 0x10
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
28 #define MP4FileODescrTag 0x11
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
29 #define MP4ExtProfileLevelDescrTag 0x13
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
30 #define MP4ExtDescrTagsStart 0x80
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
31 #define MP4ExtDescrTagsEnd 0xFE
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
32
13954
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
33 /* object type identifiers in the ESDS */
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
34 /* See http://gpac.sourceforge.net/tutorial/mediatypes.htm */
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
35 /* BIFS stream version 1 */
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
36 #define MP4OTI_MPEG4Systems1 0x01
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
37 /* BIFS stream version 2 */
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
38 #define MP4OTI_MPEG4Systems2 0x02
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
39 /* MPEG-4 visual stream */
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
40 #define MP4OTI_MPEG4Visual 0x20
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
41 /* MPEG-4 audio stream */
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
42 #define MP4OTI_MPEG4Audio 0x40
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
43 /* MPEG-2 visual streams with various profiles */
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
44 #define MP4OTI_MPEG2VisualSimple 0x60
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
45 #define MP4OTI_MPEG2VisualMain 0x61
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
46 #define MP4OTI_MPEG2VisualSNR 0x62
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
47 #define MP4OTI_MPEG2VisualSpatial 0x63
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
48 #define MP4OTI_MPEG2VisualHigh 0x64
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
49 #define MP4OTI_MPEG2Visual422 0x65
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
50 /* MPEG-2 audio stream part 7 ("AAC") with various profiles */
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
51 #define MP4OTI_MPEG2AudioMain 0x66
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
52 #define MP4OTI_MPEG2AudioLowComplexity 0x67
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
53 #define MP4OTI_MPEG2AudioScaleableSamplingRate 0x68
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
54 /* MPEG-2 audio part 3 ("MP3") */
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
55 #define MP4OTI_MPEG2AudioPart3 0x69
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
56 /* MPEG-1 visual visual stream */
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
57 #define MP4OTI_MPEG1Visual 0x6A
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
58 /* MPEG-1 audio stream part 3 ("MP3") */
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
59 #define MP4OTI_MPEG1Audio 0x6B
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
60 /* JPEG visual stream */
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
61 #define MP4OTI_JPEG 0x6C
19363
2e3981fa938c Add support for 13k Voice (Qclp) in 3g2 files
rtogni
parents: 18666
diff changeset
62 /* 3GPP2 */
2e3981fa938c Add support for 13k Voice (Qclp) in 3g2 files
rtogni
parents: 18666
diff changeset
63 #define MP4OTI_13kVoice 0xE1
13954
7dfda76015c8 Extended support for other object type IDs in the ESDS. This enables e.g. MPEG2 video in the MP4 container.
mosu
parents: 5305
diff changeset
64
5301
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
65 /* I define uint24 here for better understanding */
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
66 #ifndef uint24_t
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
67 #define uint24_t uint32_t
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
68 #endif
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
69
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
70 /* esds_t */
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
71 typedef struct {
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
72 uint8_t version;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
73 uint24_t flags;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
74
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
75 /* 0x03 ESDescrTag */
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
76 uint16_t ESId;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
77 uint8_t streamPriority;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
78
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
79 /* 0x04 DecConfigDescrTag */
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
80 uint8_t objectTypeId;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
81 uint8_t streamType;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
82 /* XXX: really streamType is
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
83 * only 6bit, followed by:
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
84 * 1bit upStream
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
85 * 1bit reserved
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
86 */
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
87 uint24_t bufferSizeDB;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
88 uint32_t maxBitrate;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
89 uint32_t avgBitrate;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
90
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
91 /* 0x05 DecSpecificDescrTag */
18666
492c6d674c3e decoderConfigLen can be larger than 255 bytes
nicodvb
parents: 13954
diff changeset
92 uint16_t decoderConfigLen;
5301
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
93 uint8_t *decoderConfig;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
94
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
95 /* 0x06 SLConfigDescrTag */
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
96 uint8_t SLConfigLen;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
97 uint8_t *SLConfig;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
98
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
99 /* TODO: add the missing tags,
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
100 * I currently have no specs
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
101 * for them and doubt they
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
102 * are currently needed ::atmos
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
103 */
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
104
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
105 } esds_t;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
106
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
107 int mp4_parse_esds(unsigned char *data, int datalen, esds_t *esds);
5305
77ac28af44ec - Add parsing of Sync Layer Descriptor
atmos4
parents: 5301
diff changeset
108 void mp4_free_esds(esds_t *esds);
5301
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
109
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25546
diff changeset
110 #endif /* MPLAYER_PARSE_MP4_H */
5301
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
111