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 MP4ODUpdateDescriptor::MP4ODUpdateDescriptor()
|
|
25 : MP4Descriptor(MP4ODUpdateODCommandTag)
|
|
26 {
|
|
27 // just a container for ObjectDescriptors
|
|
28 AddProperty( /* 0 */
|
|
29 new MP4DescriptorProperty(NULL,
|
|
30 MP4FileODescrTag, 0, Required, Many));
|
|
31 }
|
|
32
|
|
33 MP4ODRemoveDescriptor::MP4ODRemoveDescriptor()
|
|
34 : MP4Descriptor(MP4ODRemoveODCommandTag)
|
|
35 {
|
|
36 MP4Integer32Property* pCount =
|
|
37 new MP4Integer32Property("entryCount");
|
|
38 pCount->SetImplicit();
|
|
39 AddProperty(pCount); /* 0 */
|
|
40
|
|
41 MP4TableProperty* pTable =
|
|
42 new MP4TableProperty("entries", pCount);
|
|
43 AddProperty(pTable); /* 1 */
|
|
44
|
|
45 pTable->AddProperty( /* 1, 0 */
|
|
46 new MP4BitfieldProperty("objectDescriptorId", 10));
|
|
47 }
|
|
48
|
|
49 void MP4ODRemoveDescriptor::Read(MP4File* pFile)
|
|
50 {
|
|
51 // table entry count computed from descriptor size
|
|
52 ((MP4Integer32Property*)m_pProperties[0])->SetReadOnly(false);
|
|
53 ((MP4Integer32Property*)m_pProperties[0])->SetValue((m_size * 8) / 10);
|
|
54 ((MP4Integer32Property*)m_pProperties[0])->SetReadOnly(true);
|
|
55
|
|
56 MP4Descriptor::Read(pFile);
|
|
57 }
|
|
58
|
|
59 MP4ESUpdateDescriptor::MP4ESUpdateDescriptor()
|
|
60 : MP4Descriptor(MP4ESUpdateODCommandTag)
|
|
61 {
|
|
62 AddProperty( /* 0 */
|
|
63 new MP4BitfieldProperty("objectDescriptorId", 10));
|
|
64 AddProperty( /* 1 */
|
|
65 new MP4BitfieldProperty("pad", 6));
|
|
66 AddProperty( /* 2 */
|
|
67 new MP4DescriptorProperty("esIdRefs",
|
|
68 MP4ESIDRefDescrTag, 0, Required, Many));
|
|
69 }
|
|
70
|
|
71 // LATER might be able to combine with ESUpdateDescriptor
|
|
72 MP4ESRemoveDescriptor::MP4ESRemoveDescriptor()
|
|
73 : MP4Descriptor(MP4ESRemoveODCommandTag)
|
|
74 {
|
|
75 AddProperty( /* 0 */
|
|
76 new MP4BitfieldProperty("objectDescriptorId", 10));
|
|
77 AddProperty( /* 1 */
|
|
78 new MP4BitfieldProperty("pad", 6));
|
|
79 AddProperty( /* 2 */
|
|
80 new MP4DescriptorProperty("esIdRefs",
|
|
81 MP4ESIDRefDescrTag, 0, Required, Many));
|
|
82 }
|
|
83
|
|
84 MP4Descriptor* CreateODCommand(u_int8_t tag)
|
|
85 {
|
|
86 MP4Descriptor* pDescriptor = NULL;
|
|
87
|
|
88 switch (tag) {
|
|
89 case MP4ODUpdateODCommandTag:
|
|
90 pDescriptor = new MP4ODUpdateDescriptor();
|
|
91 break;
|
|
92 case MP4ODRemoveODCommandTag:
|
|
93 pDescriptor = new MP4ODRemoveDescriptor();
|
|
94 break;
|
|
95 case MP4ESUpdateODCommandTag:
|
|
96 pDescriptor = new MP4ESUpdateDescriptor();
|
|
97 break;
|
|
98 case MP4ESRemoveODCommandTag:
|
|
99 pDescriptor = new MP4ESRemoveDescriptor();
|
|
100 break;
|
|
101 }
|
|
102 return pDescriptor;
|
|
103 }
|
|
104
|