61
|
1 /*
|
|
2 * The contents of this file are subject to the Mozilla Public
|
|
3 * License Version 1.1 (the "License"); you may not use this file
|
|
4 * except in compliance with the License. You may obtain a copy of
|
|
5 * the License at http://www.mozilla.org/MPL/
|
|
6 *
|
|
7 * Software distributed under the License is distributed on an "AS
|
|
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
9 * implied. See the License for the specific language governing
|
|
10 * rights and limitations under the License.
|
|
11 *
|
|
12 * The Original Code is MPEG4IP.
|
|
13 *
|
|
14 * The Initial Developer of the Original Code is Cisco Systems Inc.
|
|
15 * Portions created by Cisco Systems Inc. are
|
|
16 * Copyright (C) Cisco Systems Inc. 2001 - 2005. All Rights Reserved.
|
|
17 *
|
|
18 * 3GPP features implementation is based on 3GPP's TS26.234-v5.60,
|
|
19 * and was contributed by Ximpo Group Ltd.
|
|
20 *
|
|
21 * Portions created by Ximpo Group Ltd. are
|
|
22 * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved.
|
|
23 *
|
|
24 * Contributor(s):
|
|
25 * Dave Mackie dmackie@cisco.com
|
|
26 * Ximpo Group Ltd. mp4v2@ximpo.com
|
|
27 * Bill May wmay@cisco.com
|
|
28 */
|
|
29
|
|
30 #ifndef __MP4_ATOMS_INCLUDED__
|
|
31 #define __MP4_ATOMS_INCLUDED__
|
|
32
|
|
33 // declare all the atom subclasses
|
|
34 // i.e. spare us atom_xxxx.h for all the atoms
|
|
35 //
|
|
36 // The majority of atoms just need their own constructor declared
|
|
37 // Some atoms have a few special needs
|
|
38 // A small minority of atoms need lots of special handling
|
|
39
|
|
40 class MP4RootAtom : public MP4Atom {
|
|
41 public:
|
|
42 MP4RootAtom();
|
|
43 void BeginWrite(bool use64 = false);
|
|
44 void Write();
|
|
45 void FinishWrite(bool use64 = false);
|
|
46
|
|
47 void BeginOptimalWrite();
|
|
48 void FinishOptimalWrite();
|
|
49
|
|
50 protected:
|
|
51 u_int32_t GetLastMdatIndex();
|
|
52 void WriteAtomType(const char* type, bool onlyOne);
|
|
53 };
|
|
54
|
|
55 /***********************************************************************
|
|
56 * Common atom classes - standard for anything that just contains atoms
|
|
57 * and non-maleable properties, treftype and url
|
|
58 ***********************************************************************/
|
|
59 class MP4StandardAtom : public MP4Atom {
|
|
60 public:
|
|
61 MP4StandardAtom(const char *name);
|
|
62 };
|
|
63
|
|
64 class MP4TrefTypeAtom : public MP4Atom {
|
|
65 public:
|
|
66 MP4TrefTypeAtom(const char* type);
|
|
67 void Read();
|
|
68 };
|
|
69
|
|
70 class MP4UrlAtom : public MP4Atom {
|
|
71 public:
|
|
72 MP4UrlAtom(const char *type="url ");
|
|
73 void Read();
|
|
74 void Write();
|
|
75 };
|
|
76
|
|
77 /***********************************************************************
|
|
78 * Sound and Video atoms - use the generic atoms when possible
|
|
79 * (MP4SoundAtom and MP4VideoAtom)
|
|
80 ***********************************************************************/
|
|
81 class MP4SoundAtom : public MP4Atom {
|
|
82 public:
|
|
83 MP4SoundAtom(const char *atomid);
|
|
84 void Generate();
|
|
85 void Read();
|
|
86 protected:
|
|
87 void AddProperties(u_int8_t version);
|
|
88 };
|
|
89
|
|
90 class MP4VideoAtom : public MP4Atom {
|
|
91 public:
|
|
92 MP4VideoAtom(const char *atomid);
|
|
93 void Generate();
|
|
94 };
|
|
95
|
|
96 class MP4AmrAtom : public MP4Atom {
|
|
97 public:
|
|
98 MP4AmrAtom(const char *type);
|
|
99 void Generate();
|
|
100 };
|
|
101
|
|
102 // H.264 atoms
|
|
103
|
|
104 class MP4Avc1Atom : public MP4Atom {
|
|
105 public:
|
|
106 MP4Avc1Atom();
|
|
107 void Generate();
|
|
108 };
|
|
109
|
|
110 class MP4AvcCAtom : public MP4Atom {
|
|
111 public:
|
|
112 MP4AvcCAtom();
|
|
113 void Generate();
|
|
114 };
|
|
115
|
|
116
|
|
117
|
|
118 class MP4D263Atom : public MP4Atom {
|
|
119 public:
|
|
120 MP4D263Atom();
|
|
121 void Generate();
|
|
122 void Write();
|
|
123 };
|
|
124
|
|
125 class MP4DamrAtom : public MP4Atom {
|
|
126 public:
|
|
127 MP4DamrAtom();
|
|
128 void Generate();
|
|
129 };
|
|
130
|
|
131 class MP4EncaAtom : public MP4Atom {
|
|
132 public:
|
|
133 MP4EncaAtom();
|
|
134 void Generate();
|
|
135 };
|
|
136
|
|
137 class MP4EncvAtom : public MP4Atom {
|
|
138 public:
|
|
139 MP4EncvAtom();
|
|
140 void Generate();
|
|
141 };
|
|
142
|
|
143 class MP4Mp4aAtom : public MP4Atom {
|
|
144 public:
|
|
145 MP4Mp4aAtom();
|
|
146 void Generate();
|
|
147 };
|
|
148
|
|
149 class MP4Mp4sAtom : public MP4Atom {
|
|
150 public:
|
|
151 MP4Mp4sAtom();
|
|
152 void Generate();
|
|
153 };
|
|
154
|
|
155 class MP4Mp4vAtom : public MP4Atom {
|
|
156 public:
|
|
157 MP4Mp4vAtom();
|
|
158 void Generate();
|
|
159 };
|
|
160
|
|
161
|
|
162 class MP4S263Atom : public MP4Atom {
|
|
163 public:
|
|
164 MP4S263Atom();
|
|
165 void Generate();
|
|
166 };
|
|
167
|
|
168
|
|
169
|
|
170 /************************************************************************
|
|
171 * Specialized Atoms
|
|
172 ************************************************************************/
|
|
173
|
|
174 class MP4DataAtom : public MP4Atom {
|
|
175 public:
|
|
176 MP4DataAtom();
|
|
177 void Read();
|
|
178 };
|
|
179
|
|
180 class MP4DrefAtom : public MP4Atom {
|
|
181 public:
|
|
182 MP4DrefAtom();
|
|
183 void Read();
|
|
184 };
|
|
185
|
|
186 class MP4ElstAtom : public MP4Atom {
|
|
187 public:
|
|
188 MP4ElstAtom();
|
|
189 void Generate();
|
|
190 void Read();
|
|
191 protected:
|
|
192 void AddProperties(u_int8_t version);
|
|
193 };
|
|
194
|
|
195 class MP4FreeAtom : public MP4Atom {
|
|
196 public:
|
|
197 MP4FreeAtom();
|
|
198 void Read();
|
|
199 void Write();
|
|
200 };
|
|
201
|
|
202 class MP4FtypAtom : public MP4Atom {
|
|
203 public:
|
|
204 MP4FtypAtom();
|
|
205 void Generate();
|
|
206 void Read();
|
|
207 };
|
|
208
|
|
209 class MP4HdlrAtom : public MP4Atom {
|
|
210 public:
|
|
211 MP4HdlrAtom();
|
|
212 void Read();
|
|
213 };
|
|
214
|
|
215 class MP4HinfAtom : public MP4Atom {
|
|
216 public:
|
|
217 MP4HinfAtom();
|
|
218 void Generate();
|
|
219 };
|
|
220
|
|
221 class MP4HntiAtom : public MP4Atom {
|
|
222 public:
|
|
223 MP4HntiAtom();
|
|
224 void Read();
|
|
225 };
|
|
226
|
|
227
|
|
228 class MP4MdatAtom : public MP4Atom {
|
|
229 public:
|
|
230 MP4MdatAtom();
|
|
231 void Read();
|
|
232 void Write();
|
|
233 };
|
|
234
|
|
235 class MP4MdhdAtom : public MP4Atom {
|
|
236 public:
|
|
237 MP4MdhdAtom();
|
|
238 void Generate();
|
|
239 void Read();
|
|
240 protected:
|
|
241 void AddProperties(u_int8_t version);
|
|
242 };
|
|
243
|
|
244 class MP4MeanAtom : public MP4Atom {
|
|
245 public:
|
|
246 MP4MeanAtom();
|
|
247 void Read();
|
|
248 };
|
|
249
|
|
250
|
|
251 class MP4MvhdAtom : public MP4Atom {
|
|
252 public:
|
|
253 MP4MvhdAtom();
|
|
254 void Generate();
|
|
255 void Read();
|
|
256 protected:
|
|
257 void AddProperties(u_int8_t version);
|
|
258 };
|
|
259
|
|
260 class MP4NameAtom : public MP4Atom {
|
|
261 public:
|
|
262 MP4NameAtom();
|
|
263 void Read();
|
|
264 };
|
|
265
|
|
266 class MP4RtpAtom : public MP4Atom {
|
|
267 public:
|
|
268 MP4RtpAtom();
|
|
269 void Generate();
|
|
270 void Read();
|
|
271 void Write();
|
|
272
|
|
273 protected:
|
|
274 void AddPropertiesStsdType();
|
|
275 void AddPropertiesHntiType();
|
|
276
|
|
277 void GenerateStsdType();
|
|
278 void GenerateHntiType();
|
|
279
|
|
280 void ReadStsdType();
|
|
281 void ReadHntiType();
|
|
282
|
|
283 void WriteHntiType();
|
|
284 };
|
|
285
|
|
286 class MP4SdpAtom : public MP4Atom {
|
|
287 public:
|
|
288 MP4SdpAtom();
|
|
289 void Read();
|
|
290 void Write();
|
|
291 };
|
|
292
|
|
293 class MP4SmiAtom : public MP4Atom {
|
|
294 public:
|
|
295 MP4SmiAtom(void);
|
|
296 void Read();
|
|
297 };
|
|
298
|
|
299 class MP4StblAtom : public MP4Atom {
|
|
300 public:
|
|
301 MP4StblAtom();
|
|
302 void Generate();
|
|
303 };
|
|
304
|
|
305 class MP4StdpAtom : public MP4Atom {
|
|
306 public:
|
|
307 MP4StdpAtom();
|
|
308 void Read();
|
|
309 };
|
|
310
|
|
311 class MP4StscAtom : public MP4Atom {
|
|
312 public:
|
|
313 MP4StscAtom();
|
|
314 void Read();
|
|
315 };
|
|
316
|
|
317 class MP4StsdAtom : public MP4Atom {
|
|
318 public:
|
|
319 MP4StsdAtom();
|
|
320 void Read();
|
|
321 };
|
|
322
|
|
323 class MP4StszAtom : public MP4Atom {
|
|
324 public:
|
|
325 MP4StszAtom();
|
|
326 void Read();
|
|
327 void Write();
|
|
328 };
|
|
329
|
|
330 class MP4TfhdAtom : public MP4Atom {
|
|
331 public:
|
|
332 MP4TfhdAtom();
|
|
333 void Read();
|
|
334 protected:
|
|
335 void AddProperties(u_int32_t flags);
|
|
336 };
|
|
337
|
|
338 class MP4TkhdAtom : public MP4Atom {
|
|
339 public:
|
|
340 MP4TkhdAtom();
|
|
341 void Generate();
|
|
342 void Read();
|
|
343 protected:
|
|
344 void AddProperties(u_int8_t version);
|
|
345 };
|
|
346 class MP4TrunAtom : public MP4Atom {
|
|
347 public:
|
|
348 MP4TrunAtom();
|
|
349 void Read();
|
|
350 protected:
|
|
351 void AddProperties(u_int32_t flags);
|
|
352 };
|
|
353
|
|
354 class MP4UdtaAtom : public MP4Atom {
|
|
355 public:
|
|
356 MP4UdtaAtom();
|
|
357 void Read();
|
|
358 };
|
|
359
|
|
360 class MP4UrnAtom : public MP4Atom {
|
|
361 public:
|
|
362 MP4UrnAtom();
|
|
363 void Read();
|
|
364 };
|
|
365 class MP4VmhdAtom : public MP4Atom {
|
|
366 public:
|
|
367 MP4VmhdAtom();
|
|
368 void Generate();
|
|
369 };
|
|
370
|
|
371 class MP4HrefAtom : public MP4Atom {
|
|
372 public:
|
|
373 MP4HrefAtom();
|
|
374 void Generate(void);
|
|
375 };
|
|
376
|
|
377 #endif /* __MP4_ATOMS_INCLUDED__ */
|