Mercurial > mplayer.hg
annotate libmpdemux/parse_mp4.h @ 25746:330af0160c2d
Fix code to prevent from accessing queue->packets[-1].pts that causes a crash.
Found and patched by Reimar.
author | ulion |
---|---|
date | Thu, 17 Jan 2008 02:18:49 +0000 |
parents | 917ae737b3d4 |
children | 4129c8cfa742 |
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 | |
23689
3f0d00abc073
Do not use leading underscores in multiple inclusion guards, they are reserved.
diego
parents:
19363
diff
changeset
|
7 #ifndef PARSE_MP4_H |
3f0d00abc073
Do not use leading underscores in multiple inclusion guards, they are reserved.
diego
parents:
19363
diff
changeset
|
8 #define PARSE_MP4_H |
5301 | 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 |
19363 | 62 /* 3GPP2 */ |
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 | 65 /* I define uint24 here for better understanding */ |
66 #ifndef uint24_t | |
67 #define uint24_t uint32_t | |
68 #endif | |
69 | |
70 /* esds_t */ | |
71 typedef struct { | |
72 uint8_t version; | |
73 uint24_t flags; | |
74 | |
75 /* 0x03 ESDescrTag */ | |
76 uint16_t ESId; | |
77 uint8_t streamPriority; | |
78 | |
79 /* 0x04 DecConfigDescrTag */ | |
80 uint8_t objectTypeId; | |
81 uint8_t streamType; | |
82 /* XXX: really streamType is | |
83 * only 6bit, followed by: | |
84 * 1bit upStream | |
85 * 1bit reserved | |
86 */ | |
87 uint24_t bufferSizeDB; | |
88 uint32_t maxBitrate; | |
89 uint32_t avgBitrate; | |
90 | |
91 /* 0x05 DecSpecificDescrTag */ | |
18666 | 92 uint16_t decoderConfigLen; |
5301 | 93 uint8_t *decoderConfig; |
94 | |
95 /* 0x06 SLConfigDescrTag */ | |
96 uint8_t SLConfigLen; | |
97 uint8_t *SLConfig; | |
98 | |
99 /* TODO: add the missing tags, | |
100 * I currently have no specs | |
101 * for them and doubt they | |
102 * are currently needed ::atmos | |
103 */ | |
104 | |
105 } esds_t; | |
106 | |
107 int mp4_parse_esds(unsigned char *data, int datalen, esds_t *esds); | |
5305 | 108 void mp4_free_esds(esds_t *esds); |
5301 | 109 |
25546
917ae737b3d4
Consistently use just the name of the #ifdef directive in #endif comments.
diego
parents:
23689
diff
changeset
|
110 #endif /* PARSE_MP4_H */ |
5301 | 111 |