annotate libmpdemux/parse_mp4.h @ 18778:8491f306b52f

intercept VFCTRL_FLIP_PAGE if needed
author michael
date Wed, 21 Jun 2006 20:52:07 +0000
parents 492c6d674c3e
children 2e3981fa938c
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
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
7 #ifndef __PARSE_MP4_H
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
8 #define __PARSE_MP4_H 1
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
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
62
5301
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
63 /* I define uint24 here for better understanding */
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
64 #ifndef uint24_t
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
65 #define uint24_t uint32_t
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
66 #endif
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
67
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
68 /* esds_t */
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
69 typedef struct {
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
70 uint8_t version;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
71 uint24_t flags;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
72
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
73 /* 0x03 ESDescrTag */
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
74 uint16_t ESId;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
75 uint8_t streamPriority;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
76
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
77 /* 0x04 DecConfigDescrTag */
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
78 uint8_t objectTypeId;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
79 uint8_t streamType;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
80 /* XXX: really streamType is
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
81 * only 6bit, followed by:
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
82 * 1bit upStream
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
83 * 1bit reserved
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
84 */
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
85 uint24_t bufferSizeDB;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
86 uint32_t maxBitrate;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
87 uint32_t avgBitrate;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
88
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
89 /* 0x05 DecSpecificDescrTag */
18666
492c6d674c3e decoderConfigLen can be larger than 255 bytes
nicodvb
parents: 13954
diff changeset
90 uint16_t decoderConfigLen;
5301
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
91 uint8_t *decoderConfig;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
92
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
93 /* 0x06 SLConfigDescrTag */
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
94 uint8_t SLConfigLen;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
95 uint8_t *SLConfig;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
96
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
97 /* TODO: add the missing tags,
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
98 * I currently have no specs
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
99 * for them and doubt they
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
100 * are currently needed ::atmos
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
101 */
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
102
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
103 } esds_t;
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
104
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
105 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
106 void mp4_free_esds(esds_t *esds);
5301
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
107
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
108 #endif /* !__PARSE_MP4_H */
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents:
diff changeset
109