Mercurial > mplayer.hg
annotate libmpdemux/parse_mp4.h @ 18001:a2683ee7cb5a
fix descrambling of asf file,
where signed buffer could cause erroneous values to be filled in descrable variables,
add misssing check for one of these variables
and restore sign of these variables as insurance that these checks will work even in such case.
author | iive |
---|---|
date | Thu, 30 Mar 2006 23:06:18 +0000 |
parents | 7dfda76015c8 |
children | 492c6d674c3e |
rev | line source |
---|---|
5301 | 1 /* parse_mp4.h - Headerfile for MP4 file format parser code |
2 * This file is part of MPlayer, see http://mplayerhq.hu/ for info. | |
3 * (c)2002 by Felix Buenemann <atmosfear at users.sourceforge.net> | |
4 * File licensed under the GPL, see http://www.fsf.org/ for more info. | |
5 */ | |
6 | |
7 #ifndef __PARSE_MP4_H | |
8 #define __PARSE_MP4_H 1 | |
9 | |
10 #include <inttypes.h> | |
11 | |
12 /* one byte tag identifiers */ | |
13 #define MP4ODescrTag 0x01 | |
14 #define MP4IODescrTag 0x02 | |
15 #define MP4ESDescrTag 0x03 | |
16 #define MP4DecConfigDescrTag 0x04 | |
17 #define MP4DecSpecificDescrTag 0x05 | |
18 #define MP4SLConfigDescrTag 0x06 | |
19 #define MP4ContentIdDescrTag 0x07 | |
20 #define MP4SupplContentIdDescrTag 0x08 | |
21 #define MP4IPIPtrDescrTag 0x09 | |
22 #define MP4IPMPPtrDescrTag 0x0A | |
23 #define MP4IPMPDescrTag 0x0B | |
24 #define MP4RegistrationDescrTag 0x0D | |
25 #define MP4ESIDIncDescrTag 0x0E | |
26 #define MP4ESIDRefDescrTag 0x0F | |
27 #define MP4FileIODescrTag 0x10 | |
28 #define MP4FileODescrTag 0x11 | |
29 #define MP4ExtProfileLevelDescrTag 0x13 | |
30 #define MP4ExtDescrTagsStart 0x80 | |
31 #define MP4ExtDescrTagsEnd 0xFE | |
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 | 63 /* I define uint24 here for better understanding */ |
64 #ifndef uint24_t | |
65 #define uint24_t uint32_t | |
66 #endif | |
67 | |
68 /* esds_t */ | |
69 typedef struct { | |
70 uint8_t version; | |
71 uint24_t flags; | |
72 | |
73 /* 0x03 ESDescrTag */ | |
74 uint16_t ESId; | |
75 uint8_t streamPriority; | |
76 | |
77 /* 0x04 DecConfigDescrTag */ | |
78 uint8_t objectTypeId; | |
79 uint8_t streamType; | |
80 /* XXX: really streamType is | |
81 * only 6bit, followed by: | |
82 * 1bit upStream | |
83 * 1bit reserved | |
84 */ | |
85 uint24_t bufferSizeDB; | |
86 uint32_t maxBitrate; | |
87 uint32_t avgBitrate; | |
88 | |
89 /* 0x05 DecSpecificDescrTag */ | |
90 uint8_t decoderConfigLen; | |
91 uint8_t *decoderConfig; | |
92 | |
93 /* 0x06 SLConfigDescrTag */ | |
94 uint8_t SLConfigLen; | |
95 uint8_t *SLConfig; | |
96 | |
97 /* TODO: add the missing tags, | |
98 * I currently have no specs | |
99 * for them and doubt they | |
100 * are currently needed ::atmos | |
101 */ | |
102 | |
103 } esds_t; | |
104 | |
105 int mp4_parse_esds(unsigned char *data, int datalen, esds_t *esds); | |
5305 | 106 void mp4_free_esds(esds_t *esds); |
5301 | 107 |
108 #endif /* !__PARSE_MP4_H */ | |
109 |