1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "src/impl.h"
namespace mp4v2 {
namespace impl {
///////////////////////////////////////////////////////////////////////////////
#if 1
MP4QosDescriptorBase::MP4QosDescriptorBase (MP4Atom& parentAtom, uint8_t tag)
: MP4Descriptor(parentAtom, tag)
{
switch (tag) {
case MP4QosDescrTag:
AddProperty( /* 0 */
new MP4Integer8Property(parentAtom, "predefined"));
AddProperty( /* 1 */
new MP4QosQualifierProperty(parentAtom, "qualifiers",
MP4QosTagsStart,
MP4QosTagsEnd, Optional, Many));
break;
case MP4MaxDelayQosTag:
AddProperty( /* 0 */
new MP4Integer32Property(parentAtom, "maxDelay"));
break;
case MP4PrefMaxDelayQosTag:
AddProperty( /* 0 */
new MP4Integer32Property(parentAtom, "prefMaxDelay"));
break;
case MP4LossProbQosTag:
AddProperty( /* 0 */
new MP4Float32Property(parentAtom, "lossProb"));
break;
case MP4MaxGapLossQosTag:
AddProperty( /* 0 */
new MP4Integer32Property(parentAtom, "maxGapLoss"));
break;
case MP4MaxAUSizeQosTag:
AddProperty( /* 0 */
new MP4Integer32Property(parentAtom, "maxAUSize"));
break;
case MP4AvgAUSizeQosTag:
AddProperty( /* 0 */
new MP4Integer32Property(parentAtom, "avgAUSize"));
break;
case MP4MaxAURateQosTag:
AddProperty( /* 0 */
new MP4Integer32Property(parentAtom, "maxAURate"));
break;
}
}
#else
MP4QosDescriptor::MP4QosDescriptor(MP4Atom &parentAtom)
: MP4Descriptor(parentAtom, MP4QosDescrTag)
{
AddProperty( /* 0 */
new MP4Integer8Property(parentAtom, "predefined"));
AddProperty( /* 1 */
new MP4QosQualifierProperty(parentAtom, "qualifiers",
MP4QosTagsStart, MP4QosTagsEnd, Optional, Many));
}
MP4MaxDelayQosQualifier::MP4MaxDelayQosQualifier(MP4Atom &parentAtom)
: MP4QosQualifier(parentAtom, MP4MaxDelayQosTag)
{
AddProperty( /* 0 */
new MP4Integer32Property(parentAtom, "maxDelay"));
}
MP4PrefMaxDelayQosQualifier::MP4PrefMaxDelayQosQualifier(MP4Atom &parentAtom)
: MP4QosQualifier(parentAtom, MP4PrefMaxDelayQosTag)
{
AddProperty( /* 0 */
new MP4Integer32Property(parentAtom, "prefMaxDelay"));
}
MP4LossProbQosQualifier::MP4LossProbQosQualifier(MP4Atom &parentAtom)
: MP4QosQualifier(parentAtom, MP4LossProbQosTag)
{
AddProperty( /* 0 */
new MP4Float32Property(parentAtom, "lossProb"));
}
MP4MaxGapLossQosQualifier::MP4MaxGapLossQosQualifier(MP4Atom &parentAtom)
: MP4QosQualifier(parentAtom, MP4MaxGapLossQosTag)
{
AddProperty( /* 0 */
new MP4Integer32Property(parentAtom, "maxGapLoss"));
}
MP4MaxAUSizeQosQualifier::MP4MaxAUSizeQosQualifier(MP4Atom &parentAtom)
: MP4QosQualifier(parentAtom, MP4MaxAUSizeQosTag)
{
AddProperty( /* 0 */
new MP4Integer32Property(parentAtom, "maxAUSize"));
}
MP4AvgAUSizeQosQualifier::MP4AvgAUSizeQosQualifier(MP4Atom &parentAtom)
: MP4QosQualifier(parentAtom, MP4AvgAUSizeQosTag)
{
AddProperty( /* 0 */
new MP4Integer32Property(parentAtom, "avgAUSize"));
}
MP4MaxAURateQosQualifier::MP4MaxAURateQosQualifier(MP4Atom &parentAtom)
: MP4QosQualifier(parentAtom, MP4MaxAURateQosTag)
{
AddProperty( /* 0 */
new MP4Integer32Property(parentAtom, "maxAURate"));
}
#endif
MP4UnknownQosQualifier::MP4UnknownQosQualifier(MP4Atom &parentAtom)
: MP4Descriptor(parentAtom)
{
AddProperty( /* 0 */
new MP4BytesProperty(parentAtom, "data"));
}
void MP4UnknownQosQualifier::Read(MP4File& file)
{
ReadHeader(file);
/* byte properties need to know how long they are before reading */
((MP4BytesProperty*)m_pProperties[0])->SetValueSize(m_size);
ReadProperties(file);
}
MP4Descriptor* MP4QosQualifierProperty::CreateDescriptor(MP4Atom &parentAtom, uint8_t tag)
{
MP4Descriptor* pDescriptor = NULL;
switch (tag) {
case MP4MaxDelayQosTag:
case MP4PrefMaxDelayQosTag:
case MP4LossProbQosTag:
case MP4MaxGapLossQosTag:
case MP4MaxAUSizeQosTag:
case MP4AvgAUSizeQosTag:
case MP4MaxAURateQosTag:
pDescriptor = new MP4QosDescriptorBase(parentAtom, tag);
break;
default:
pDescriptor = new MP4UnknownQosQualifier(parentAtom);
pDescriptor->SetTag(tag);
}
return pDescriptor;
}
///////////////////////////////////////////////////////////////////////////////
}
} // namespace mp4v2::impl
|