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. All Rights Reserved.
|
|
17 *
|
|
18 * Contributor(s):
|
|
19 * Dave Mackie dmackie@cisco.com
|
|
20 */
|
|
21
|
|
22 #include "mp4common.h"
|
|
23
|
|
24 MP4IODescriptor::MP4IODescriptor()
|
|
25 : MP4Descriptor(MP4FileIODescrTag)
|
|
26 {
|
|
27 /* N.B. other member functions depend on the property indicies */
|
|
28 AddProperty( /* 0 */
|
|
29 new MP4BitfieldProperty("objectDescriptorId", 10));
|
|
30 AddProperty( /* 1 */
|
|
31 new MP4BitfieldProperty("URLFlag", 1));
|
|
32 AddProperty( /* 2 */
|
|
33 new MP4BitfieldProperty("includeInlineProfileLevelFlag", 1));
|
|
34 AddProperty( /* 3 */
|
|
35 new MP4BitfieldProperty("reserved", 4));
|
|
36 AddProperty( /* 4 */
|
|
37 new MP4StringProperty("URL", Counted));
|
|
38 AddProperty( /* 5 */
|
|
39 new MP4Integer8Property("ODProfileLevelId"));
|
|
40 AddProperty( /* 6 */
|
|
41 new MP4Integer8Property("sceneProfileLevelId"));
|
|
42 AddProperty( /* 7 */
|
|
43 new MP4Integer8Property("audioProfileLevelId"));
|
|
44 AddProperty( /* 8 */
|
|
45 new MP4Integer8Property("visualProfileLevelId"));
|
|
46 AddProperty( /* 9 */
|
|
47 new MP4Integer8Property("graphicsProfileLevelId"));
|
|
48 AddProperty( /* 10 */
|
|
49 new MP4DescriptorProperty("esIds",
|
|
50 MP4ESIDIncDescrTag, 0, Required, Many));
|
|
51 AddProperty( /* 11 */
|
|
52 new MP4DescriptorProperty("ociDescr",
|
|
53 MP4OCIDescrTagsStart, MP4OCIDescrTagsEnd, Optional, Many));
|
|
54 AddProperty( /* 12 */
|
|
55 new MP4DescriptorProperty("ipmpDescrPtr",
|
|
56 MP4IPMPPtrDescrTag, 0, Optional, Many));
|
|
57 AddProperty( /* 13 */
|
|
58 new MP4DescriptorProperty("extDescr",
|
|
59 MP4ExtDescrTagsStart, MP4ExtDescrTagsEnd, Optional, Many));
|
|
60
|
|
61 SetReadMutate(2);
|
|
62 }
|
|
63
|
|
64 void MP4IODescriptor::Generate()
|
|
65 {
|
|
66 ((MP4BitfieldProperty*)m_pProperties[0])->SetValue(1);
|
|
67 ((MP4BitfieldProperty*)m_pProperties[3])->SetValue(0xF);
|
|
68 for (u_int32_t i = 5; i <= 9; i++) {
|
|
69 ((MP4Integer8Property*)m_pProperties[i])->SetValue(0xFF);
|
|
70 }
|
|
71 }
|
|
72
|
|
73 void MP4IODescriptor::Mutate()
|
|
74 {
|
|
75 bool urlFlag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue();
|
|
76
|
|
77 m_pProperties[4]->SetImplicit(!urlFlag);
|
|
78 for (u_int32_t i = 5; i <= 12; i++) {
|
|
79 m_pProperties[i]->SetImplicit(urlFlag);
|
|
80 }
|
|
81 }
|
|
82
|
|
83 MP4ODescriptor::MP4ODescriptor()
|
|
84 : MP4Descriptor(MP4FileODescrTag)
|
|
85 {
|
|
86 /* N.B. other member functions depend on the property indicies */
|
|
87 AddProperty( /* 0 */
|
|
88 new MP4BitfieldProperty("objectDescriptorId", 10));
|
|
89 AddProperty( /* 1 */
|
|
90 new MP4BitfieldProperty("URLFlag", 1));
|
|
91 AddProperty( /* 2 */
|
|
92 new MP4BitfieldProperty("reserved", 5));
|
|
93 AddProperty( /* 3 */
|
|
94 new MP4StringProperty("URL", Counted));
|
|
95 AddProperty( /* 4 */
|
|
96 new MP4DescriptorProperty("esIds",
|
|
97 MP4ESIDRefDescrTag, 0, Required, Many));
|
|
98 AddProperty( /* 5 */
|
|
99 new MP4DescriptorProperty("ociDescr",
|
|
100 MP4OCIDescrTagsStart, MP4OCIDescrTagsEnd, Optional, Many));
|
|
101 AddProperty( /* 6 */
|
|
102 new MP4DescriptorProperty("ipmpDescrPtr",
|
|
103 MP4IPMPPtrDescrTag, 0, Optional, Many));
|
|
104 AddProperty( /* 7 */
|
|
105 new MP4DescriptorProperty("extDescr",
|
|
106 MP4ExtDescrTagsStart, MP4ExtDescrTagsEnd, Optional, Many));
|
|
107
|
|
108 SetReadMutate(2);
|
|
109 }
|
|
110
|
|
111 void MP4ODescriptor::Generate()
|
|
112 {
|
|
113 ((MP4BitfieldProperty*)m_pProperties[2])->SetValue(0x1F);
|
|
114 }
|
|
115
|
|
116 void MP4ODescriptor::Mutate()
|
|
117 {
|
|
118 bool urlFlag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue();
|
|
119
|
|
120 m_pProperties[3]->SetImplicit(!urlFlag);
|
|
121 for (u_int32_t i = 4; i <= 6; i++) {
|
|
122 m_pProperties[i]->SetImplicit(urlFlag);
|
|
123 }
|
|
124 }
|
|
125
|
|
126 MP4ESIDIncDescriptor::MP4ESIDIncDescriptor()
|
|
127 : MP4Descriptor(MP4ESIDIncDescrTag)
|
|
128 {
|
|
129 AddProperty( /* 0 */
|
|
130 new MP4Integer32Property("id"));
|
|
131 }
|
|
132
|
|
133 MP4ESIDRefDescriptor::MP4ESIDRefDescriptor()
|
|
134 : MP4Descriptor(MP4ESIDRefDescrTag)
|
|
135 {
|
|
136 AddProperty( /* 0 */
|
|
137 new MP4Integer16Property("refIndex"));
|
|
138 }
|
|
139
|
|
140 MP4ESDescriptor::MP4ESDescriptor()
|
|
141 : MP4Descriptor(MP4ESDescrTag)
|
|
142 {
|
|
143 /* N.B. other class functions depend on the property indicies */
|
|
144 AddProperty( /* 0 */
|
|
145 new MP4Integer16Property("ESID"));
|
|
146 AddProperty( /* 1 */
|
|
147 new MP4BitfieldProperty("streamDependenceFlag", 1));
|
|
148 AddProperty( /* 2 */
|
|
149 new MP4BitfieldProperty("URLFlag", 1));
|
|
150 AddProperty( /* 3 */
|
|
151 new MP4BitfieldProperty("OCRstreamFlag", 1));
|
|
152 AddProperty( /* 4 */
|
|
153 new MP4BitfieldProperty("streamPriority", 5));
|
|
154 AddProperty( /* 5 */
|
|
155 new MP4Integer16Property("dependsOnESID"));
|
|
156 AddProperty( /* 6 */
|
|
157 new MP4StringProperty("URL", Counted));
|
|
158 AddProperty( /* 7 */
|
|
159 new MP4Integer16Property("OCRESID"));
|
|
160 AddProperty( /* 8 */
|
|
161 new MP4DescriptorProperty("decConfigDescr",
|
|
162 MP4DecConfigDescrTag, 0, Required, OnlyOne));
|
|
163 AddProperty( /* 9 */
|
|
164 new MP4DescriptorProperty("slConfigDescr",
|
|
165 MP4SLConfigDescrTag, 0, Required, OnlyOne));
|
|
166 AddProperty( /* 10 */
|
|
167 new MP4DescriptorProperty("ipiPtr",
|
|
168 MP4IPIPtrDescrTag, 0, Optional, OnlyOne));
|
|
169 AddProperty( /* 11 */
|
|
170 new MP4DescriptorProperty("ipIds",
|
|
171 MP4ContentIdDescrTag, MP4SupplContentIdDescrTag, Optional, Many));
|
|
172 AddProperty( /* 12 */
|
|
173 new MP4DescriptorProperty("ipmpDescrPtr",
|
|
174 MP4IPMPPtrDescrTag, 0, Optional, Many));
|
|
175 AddProperty( /* 13 */
|
|
176 new MP4DescriptorProperty("langDescr",
|
|
177 MP4LanguageDescrTag, 0, Optional, Many));
|
|
178 AddProperty( /* 14 */
|
|
179 new MP4DescriptorProperty("qosDescr",
|
|
180 MP4QosDescrTag, 0, Optional, OnlyOne));
|
|
181 AddProperty( /* 15 */
|
|
182 new MP4DescriptorProperty("regDescr",
|
|
183 MP4RegistrationDescrTag, 0, Optional, OnlyOne));
|
|
184 AddProperty( /* 16 */
|
|
185 new MP4DescriptorProperty("extDescr",
|
|
186 MP4ExtDescrTagsStart, MP4ExtDescrTagsEnd, Optional, Many));
|
|
187
|
|
188 SetReadMutate(5);
|
|
189 }
|
|
190
|
|
191 void MP4ESDescriptor::Mutate()
|
|
192 {
|
|
193 bool streamDependFlag =
|
|
194 ((MP4BitfieldProperty*)m_pProperties[1])->GetValue();
|
|
195 m_pProperties[5]->SetImplicit(!streamDependFlag);
|
|
196
|
|
197 bool urlFlag =
|
|
198 ((MP4BitfieldProperty*)m_pProperties[2])->GetValue();
|
|
199 m_pProperties[6]->SetImplicit(!urlFlag);
|
|
200
|
|
201 bool ocrFlag =
|
|
202 ((MP4BitfieldProperty*)m_pProperties[3])->GetValue();
|
|
203 m_pProperties[7]->SetImplicit(!ocrFlag);
|
|
204 }
|
|
205
|
|
206 MP4DecConfigDescriptor::MP4DecConfigDescriptor()
|
|
207 : MP4Descriptor(MP4DecConfigDescrTag)
|
|
208 {
|
|
209 AddProperty( /* 0 */
|
|
210 new MP4Integer8Property("objectTypeId"));
|
|
211 AddProperty( /* 1 */
|
|
212 new MP4BitfieldProperty("streamType", 6));
|
|
213 AddProperty( /* 2 */
|
|
214 new MP4BitfieldProperty("upStream", 1));
|
|
215 AddProperty( /* 3 */
|
|
216 new MP4BitfieldProperty("reserved", 1));
|
|
217 AddProperty( /* 4 */
|
|
218 new MP4BitfieldProperty("bufferSizeDB", 24));
|
|
219 AddProperty( /* 5 */
|
|
220 new MP4Integer32Property("maxBitrate"));
|
|
221 AddProperty( /* 6 */
|
|
222 new MP4Integer32Property("avgBitrate"));
|
|
223 AddProperty( /* 7 */
|
|
224 new MP4DescriptorProperty("decSpecificInfo",
|
|
225 MP4DecSpecificDescrTag, 0, Optional, OnlyOne));
|
|
226 AddProperty( /* 8 */
|
|
227 new MP4DescriptorProperty("profileLevelIndicationIndexDescr",
|
|
228 MP4ExtProfileLevelDescrTag, 0, Optional, Many));
|
|
229 }
|
|
230
|
|
231 void MP4DecConfigDescriptor::Generate()
|
|
232 {
|
|
233 ((MP4BitfieldProperty*)m_pProperties[3])->SetValue(1);
|
|
234 }
|
|
235
|
|
236 MP4DecSpecificDescriptor::MP4DecSpecificDescriptor()
|
|
237 : MP4Descriptor(MP4DecSpecificDescrTag)
|
|
238 {
|
|
239 AddProperty( /* 0 */
|
|
240 new MP4BytesProperty("info"));
|
|
241 }
|
|
242
|
|
243 void MP4DecSpecificDescriptor::Read(MP4File* pFile)
|
|
244 {
|
|
245 ReadHeader(pFile);
|
|
246
|
|
247 /* byte properties need to know how long they are before reading */
|
|
248 ((MP4BytesProperty*)m_pProperties[0])->SetValueSize(m_size);
|
|
249
|
|
250 ReadProperties(pFile);
|
|
251 }
|
|
252
|
|
253 MP4SLConfigDescriptor::MP4SLConfigDescriptor()
|
|
254 : MP4Descriptor(MP4SLConfigDescrTag)
|
|
255 {
|
|
256 AddProperty( /* 0 */
|
|
257 new MP4Integer8Property("predefined"));
|
|
258 AddProperty( /* 1 */
|
|
259 new MP4BitfieldProperty("useAccessUnitStartFlag", 1));
|
|
260 AddProperty( /* 2 */
|
|
261 new MP4BitfieldProperty("useAccessUnitEndFlag", 1));
|
|
262 AddProperty( /* 3 */
|
|
263 new MP4BitfieldProperty("useRandomAccessPointFlag", 1));
|
|
264 AddProperty( /* 4 */
|
|
265 new MP4BitfieldProperty("hasRandomAccessUnitsOnlyFlag", 1));
|
|
266 AddProperty( /* 5 */
|
|
267 new MP4BitfieldProperty("usePaddingFlag", 1));
|
|
268 AddProperty( /* 6 */
|
|
269 new MP4BitfieldProperty("useTimeStampsFlag", 1));
|
|
270 AddProperty( /* 7 */
|
|
271 new MP4BitfieldProperty("useIdleFlag", 1));
|
|
272 AddProperty( /* 8 */
|
|
273 new MP4BitfieldProperty("durationFlag", 1));
|
|
274 AddProperty( /* 9 */
|
|
275 new MP4Integer32Property("timeStampResolution"));
|
|
276 AddProperty( /* 10 */
|
|
277 new MP4Integer32Property("OCRResolution"));
|
|
278 AddProperty( /* 11 */
|
|
279 new MP4Integer8Property("timeStampLength"));
|
|
280 AddProperty( /* 12 */
|
|
281 new MP4Integer8Property("OCRLength"));
|
|
282 AddProperty( /* 13 */
|
|
283 new MP4Integer8Property("AULength"));
|
|
284 AddProperty( /* 14 */
|
|
285 new MP4Integer8Property("instantBitrateLength"));
|
|
286 AddProperty( /* 15 */
|
|
287 new MP4BitfieldProperty("degradationPriortyLength", 4));
|
|
288 AddProperty( /* 16 */
|
|
289 new MP4BitfieldProperty("AUSeqNumLength", 5));
|
|
290 AddProperty( /* 17 */
|
|
291 new MP4BitfieldProperty("packetSeqNumLength", 5));
|
|
292 AddProperty( /* 18 */
|
|
293 new MP4BitfieldProperty("reserved", 2));
|
|
294
|
|
295 // if durationFlag
|
|
296 AddProperty( /* 19 */
|
|
297 new MP4Integer32Property("timeScale"));
|
|
298 AddProperty( /* 20 */
|
|
299 new MP4Integer16Property("accessUnitDuration"));
|
|
300 AddProperty( /* 21 */
|
|
301 new MP4Integer16Property("compositionUnitDuration"));
|
|
302
|
|
303 // if !useTimeStampsFlag
|
|
304 AddProperty( /* 22 */
|
|
305 new MP4BitfieldProperty("startDecodingTimeStamp", 64));
|
|
306 AddProperty( /* 23 */
|
|
307 new MP4BitfieldProperty("startCompositionTimeStamp", 64));
|
|
308 }
|
|
309
|
|
310 void MP4SLConfigDescriptor::Generate()
|
|
311 {
|
|
312 // by default all tracks in an mp4 file
|
|
313 // use predefined SLConfig descriptor == 2
|
|
314 ((MP4Integer8Property*)m_pProperties[0])->SetValue(2);
|
|
315
|
|
316 // which implies UseTimestampsFlag = 1
|
|
317 ((MP4BitfieldProperty*)m_pProperties[6])->SetValue(1);
|
|
318
|
|
319 // reserved = 3
|
|
320 ((MP4BitfieldProperty*)m_pProperties[18])->SetValue(3);
|
|
321 }
|
|
322
|
|
323 void MP4SLConfigDescriptor::Read(MP4File* pFile)
|
|
324 {
|
|
325 ReadHeader(pFile);
|
|
326
|
|
327 // read the first property, 'predefined'
|
|
328 ReadProperties(pFile, 0, 1);
|
|
329
|
|
330 // if predefined == 0
|
|
331 if (((MP4Integer8Property*)m_pProperties[0])->GetValue() == 0) {
|
|
332
|
|
333 /* read the next 18 properties */
|
|
334 ReadProperties(pFile, 1, 18);
|
|
335 }
|
|
336
|
|
337 // now mutate
|
|
338 Mutate();
|
|
339
|
|
340 // and read the remaining properties
|
|
341 ReadProperties(pFile, 19);
|
|
342 }
|
|
343
|
|
344 void MP4SLConfigDescriptor::Mutate()
|
|
345 {
|
|
346 u_int32_t i;
|
|
347 u_int8_t predefined =
|
|
348 ((MP4Integer8Property*)m_pProperties[0])->GetValue();
|
|
349
|
|
350 if (predefined) {
|
|
351 // properties 1-18 are implicit
|
|
352 for (i = 1; i < m_pProperties.Size(); i++) {
|
|
353 m_pProperties[i]->SetImplicit(true);
|
|
354 }
|
|
355
|
|
356 if (predefined == 1) {
|
|
357 // UseTimestampsFlag = 0
|
|
358 ((MP4BitfieldProperty*)m_pProperties[6])->SetValue(0);
|
|
359
|
|
360 // TimestampResolution = 1000
|
|
361 ((MP4Integer32Property*)m_pProperties[9])->SetValue(1000);
|
|
362
|
|
363 // TimeStampLength = 32
|
|
364 ((MP4Integer8Property*)m_pProperties[11])->SetValue(32);
|
|
365
|
|
366 } else if (predefined == 2) {
|
|
367 // UseTimestampsFlag = 1
|
|
368 ((MP4BitfieldProperty*)m_pProperties[6])->SetValue(1);
|
|
369 }
|
|
370 } else {
|
|
371 #if 1
|
|
372 for (i = 1; i <= 18; i++) {
|
|
373 m_pProperties[i]->SetImplicit(false);
|
|
374 }
|
|
375 ((MP4BitfieldProperty*)m_pProperties[18])->SetValue(3);
|
|
376 #endif
|
|
377 }
|
|
378
|
|
379 bool durationFlag =
|
|
380 ((MP4BitfieldProperty*)m_pProperties[8])->GetValue();
|
|
381
|
|
382 for (i = 19; i <= 21; i++) {
|
|
383 m_pProperties[i]->SetImplicit(!durationFlag);
|
|
384 }
|
|
385
|
|
386 bool useTimeStampsFlag =
|
|
387 ((MP4BitfieldProperty*)m_pProperties[6])->GetValue();
|
|
388
|
|
389 for (i = 22; i <= 23; i++) {
|
|
390 m_pProperties[i]->SetImplicit(useTimeStampsFlag);
|
|
391
|
|
392 u_int8_t timeStampLength = MIN(64,
|
|
393 ((MP4Integer8Property*)m_pProperties[11])->GetValue());
|
|
394
|
|
395 ((MP4BitfieldProperty*)m_pProperties[i])->SetNumBits(timeStampLength);
|
|
396
|
|
397 // handle a nonsensical situation gracefully
|
|
398 if (timeStampLength == 0) {
|
|
399 m_pProperties[i]->SetImplicit(true);
|
|
400 }
|
|
401 }
|
|
402 }
|
|
403
|
|
404 MP4IPIPtrDescriptor::MP4IPIPtrDescriptor()
|
|
405 : MP4Descriptor(MP4IPIPtrDescrTag)
|
|
406 {
|
|
407 AddProperty( /* 0 */
|
|
408 new MP4Integer16Property("IPIESId"));
|
|
409 }
|
|
410
|
|
411 MP4ContentIdDescriptor::MP4ContentIdDescriptor()
|
|
412 : MP4Descriptor(MP4ContentIdDescrTag)
|
|
413 {
|
|
414 AddProperty( /* 0 */
|
|
415 new MP4BitfieldProperty("compatibility", 2));
|
|
416 AddProperty( /* 1 */
|
|
417 new MP4BitfieldProperty("contentTypeFlag", 1));
|
|
418 AddProperty( /* 2 */
|
|
419 new MP4BitfieldProperty("contentIdFlag", 1));
|
|
420 AddProperty( /* 3 */
|
|
421 new MP4BitfieldProperty("protectedContent", 1));
|
|
422 AddProperty( /* 4 */
|
|
423 new MP4BitfieldProperty("reserved", 3));
|
|
424 AddProperty( /* 5 */
|
|
425 new MP4Integer8Property("contentType"));
|
|
426 AddProperty( /* 6 */
|
|
427 new MP4Integer8Property("contentIdType"));
|
|
428 AddProperty( /* 7 */
|
|
429 new MP4BytesProperty("contentId"));
|
|
430 }
|
|
431
|
|
432 void MP4ContentIdDescriptor::Read(MP4File* pFile)
|
|
433 {
|
|
434 ReadHeader(pFile);
|
|
435
|
|
436 /* read the first property, 'compatiblity' */
|
|
437 ReadProperties(pFile, 0, 1);
|
|
438
|
|
439 /* if compatiblity != 0 */
|
|
440 if (((MP4Integer8Property*)m_pProperties[0])->GetValue() != 0) {
|
|
441 /* we don't understand it */
|
|
442 VERBOSE_READ(pFile->GetVerbosity(),
|
|
443 printf("incompatible content id descriptor\n"));
|
|
444 return;
|
|
445 }
|
|
446
|
|
447 /* read the next four properties */
|
|
448 ReadProperties(pFile, 1, 4);
|
|
449
|
|
450 /* which allows us to reconfigure ourselves */
|
|
451 Mutate();
|
|
452
|
|
453 /* read the remaining properties */
|
|
454 ReadProperties(pFile, 5);
|
|
455 }
|
|
456
|
|
457 void MP4ContentIdDescriptor::Mutate()
|
|
458 {
|
|
459 bool contentTypeFlag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue();
|
|
460 m_pProperties[5]->SetImplicit(!contentTypeFlag);
|
|
461
|
|
462 bool contentIdFlag = ((MP4BitfieldProperty*)m_pProperties[2])->GetValue();
|
|
463 m_pProperties[6]->SetImplicit(!contentIdFlag);
|
|
464 m_pProperties[7]->SetImplicit(!contentIdFlag);
|
|
465 }
|
|
466
|
|
467 MP4SupplContentIdDescriptor::MP4SupplContentIdDescriptor()
|
|
468 : MP4Descriptor(MP4SupplContentIdDescrTag)
|
|
469 {
|
|
470 AddProperty( /* 0 */
|
|
471 new MP4BytesProperty("languageCode", 3));
|
|
472 AddProperty( /* 1 */
|
|
473 new MP4StringProperty("title", Counted));
|
|
474 AddProperty( /* 2 */
|
|
475 new MP4StringProperty("value", Counted));
|
|
476 }
|
|
477
|
|
478 MP4IPMPPtrDescriptor::MP4IPMPPtrDescriptor()
|
|
479 : MP4Descriptor(MP4IPMPPtrDescrTag)
|
|
480 {
|
|
481 AddProperty( /* 0 */
|
|
482 new MP4Integer8Property("IPMPDescriptorId"));
|
|
483 }
|
|
484
|
|
485 MP4IPMPDescriptor::MP4IPMPDescriptor()
|
|
486 : MP4Descriptor(MP4IPMPDescrTag)
|
|
487 {
|
|
488 AddProperty( /* 0 */
|
|
489 new MP4Integer8Property("IPMPDescriptorId"));
|
|
490 AddProperty( /* 1 */
|
|
491 new MP4Integer16Property("IPMPSType"));
|
|
492 AddProperty( /* 2 */
|
|
493 new MP4BytesProperty("IPMPData"));
|
|
494 /* note: if IPMPSType == 0, IPMPData is an URL */
|
|
495 }
|
|
496
|
|
497 void MP4IPMPDescriptor::Read(MP4File* pFile)
|
|
498 {
|
|
499 ReadHeader(pFile);
|
|
500
|
|
501 /* byte properties need to know how long they are before reading */
|
|
502 ((MP4BytesProperty*)m_pProperties[2])->SetValueSize(m_size - 3);
|
|
503
|
|
504 ReadProperties(pFile);
|
|
505 }
|
|
506
|
|
507 MP4RegistrationDescriptor::MP4RegistrationDescriptor()
|
|
508 : MP4Descriptor(MP4RegistrationDescrTag)
|
|
509 {
|
|
510 AddProperty( /* 0 */
|
|
511 new MP4Integer32Property("formatIdentifier"));
|
|
512 AddProperty( /* 1 */
|
|
513 new MP4BytesProperty("additionalIdentificationInfo"));
|
|
514 }
|
|
515
|
|
516 void MP4RegistrationDescriptor::Read(MP4File* pFile)
|
|
517 {
|
|
518 ReadHeader(pFile);
|
|
519
|
|
520 /* byte properties need to know how long they are before reading */
|
|
521 ((MP4BytesProperty*)m_pProperties[1])->SetValueSize(m_size - 4);
|
|
522
|
|
523 ReadProperties(pFile);
|
|
524 }
|
|
525
|
|
526 MP4ExtProfileLevelDescriptor::MP4ExtProfileLevelDescriptor()
|
|
527 : MP4Descriptor(MP4ExtProfileLevelDescrTag)
|
|
528 {
|
|
529 AddProperty( /* 0 */
|
|
530 new MP4Integer8Property("profileLevelIndicationIndex"));
|
|
531 AddProperty( /* 1 */
|
|
532 new MP4Integer8Property("ODProfileLevelIndication"));
|
|
533 AddProperty( /* 2 */
|
|
534 new MP4Integer8Property("sceneProfileLevelIndication"));
|
|
535 AddProperty( /* 3 */
|
|
536 new MP4Integer8Property("audioProfileLevelIndication"));
|
|
537 AddProperty( /* 4 */
|
|
538 new MP4Integer8Property("visualProfileLevelIndication"));
|
|
539 AddProperty( /* 5 */
|
|
540 new MP4Integer8Property("graphicsProfileLevelIndication"));
|
|
541 AddProperty( /* 6 */
|
|
542 new MP4Integer8Property("MPEGJProfileLevelIndication"));
|
|
543 }
|
|
544
|
|
545 MP4ExtensionDescriptor::MP4ExtensionDescriptor()
|
|
546 : MP4Descriptor()
|
|
547 {
|
|
548 AddProperty( /* 0 */
|
|
549 new MP4BytesProperty("data"));
|
|
550 }
|
|
551
|
|
552 void MP4ExtensionDescriptor::Read(MP4File* pFile)
|
|
553 {
|
|
554 ReadHeader(pFile);
|
|
555
|
|
556 /* byte properties need to know how long they are before reading */
|
|
557 ((MP4BytesProperty*)m_pProperties[0])->SetValueSize(m_size);
|
|
558
|
|
559 ReadProperties(pFile);
|
|
560 }
|
|
561
|
|
562 MP4Descriptor* MP4DescriptorProperty::CreateDescriptor(u_int8_t tag)
|
|
563 {
|
|
564 MP4Descriptor* pDescriptor = NULL;
|
|
565
|
|
566 switch (tag) {
|
|
567 case MP4ESDescrTag:
|
|
568 pDescriptor = new MP4ESDescriptor();
|
|
569 break;
|
|
570 case MP4DecConfigDescrTag:
|
|
571 pDescriptor = new MP4DecConfigDescriptor();
|
|
572 break;
|
|
573 case MP4DecSpecificDescrTag:
|
|
574 pDescriptor = new MP4DecSpecificDescriptor();
|
|
575 break;
|
|
576 case MP4SLConfigDescrTag:
|
|
577 pDescriptor = new MP4SLConfigDescriptor();
|
|
578 break;
|
|
579 case MP4ContentIdDescrTag:
|
|
580 pDescriptor = new MP4ContentIdDescriptor();
|
|
581 break;
|
|
582 case MP4SupplContentIdDescrTag:
|
|
583 pDescriptor = new MP4SupplContentIdDescriptor();
|
|
584 break;
|
|
585 case MP4IPIPtrDescrTag:
|
|
586 pDescriptor = new MP4IPIPtrDescriptor();
|
|
587 break;
|
|
588 case MP4IPMPPtrDescrTag:
|
|
589 pDescriptor = new MP4IPMPPtrDescriptor();
|
|
590 break;
|
|
591 case MP4IPMPDescrTag:
|
|
592 pDescriptor = new MP4IPMPDescriptor();
|
|
593 break;
|
|
594 case MP4QosDescrTag:
|
|
595 pDescriptor = new MP4QosDescriptor();
|
|
596 break;
|
|
597 case MP4RegistrationDescrTag:
|
|
598 pDescriptor = new MP4RegistrationDescriptor();
|
|
599 break;
|
|
600 case MP4ESIDIncDescrTag:
|
|
601 pDescriptor = new MP4ESIDIncDescriptor();
|
|
602 break;
|
|
603 case MP4ESIDRefDescrTag:
|
|
604 pDescriptor = new MP4ESIDRefDescriptor();
|
|
605 break;
|
|
606 case MP4IODescrTag:
|
|
607 case MP4FileIODescrTag:
|
|
608 pDescriptor = new MP4IODescriptor();
|
|
609 pDescriptor->SetTag(tag);
|
|
610 break;
|
|
611 case MP4ODescrTag:
|
|
612 case MP4FileODescrTag:
|
|
613 pDescriptor = new MP4ODescriptor();
|
|
614 pDescriptor->SetTag(tag);
|
|
615 break;
|
|
616 case MP4ExtProfileLevelDescrTag:
|
|
617 pDescriptor = new MP4ExtProfileLevelDescriptor();
|
|
618 break;
|
|
619 }
|
|
620
|
|
621 if (pDescriptor == NULL) {
|
|
622 if (tag >= MP4OCIDescrTagsStart && tag <= MP4OCIDescrTagsEnd) {
|
|
623 pDescriptor = CreateOCIDescriptor(tag);
|
|
624 }
|
|
625
|
|
626 if (tag >= MP4ExtDescrTagsStart && tag <= MP4ExtDescrTagsEnd) {
|
|
627 pDescriptor = new MP4ExtensionDescriptor();
|
|
628 pDescriptor->SetTag(tag);
|
|
629 }
|
|
630 }
|
|
631
|
|
632 return pDescriptor;
|
|
633 }
|
|
634
|