1
0

qosqualifiers.cpp 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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 [email protected]
  20. */
  21. #include "mp4common.h"
  22. #if 1
  23. MP4QosDescriptorBase::MP4QosDescriptorBase (u_int8_t tag)
  24. : MP4Descriptor(tag)
  25. {
  26. switch (tag) {
  27. case MP4QosDescrTag:
  28. AddProperty( /* 0 */
  29. new MP4Integer8Property("predefined"));
  30. AddProperty( /* 1 */
  31. new MP4QosQualifierProperty("qualifiers",
  32. MP4QosTagsStart,
  33. MP4QosTagsEnd, Optional, Many));
  34. break;
  35. case MP4MaxDelayQosTag:
  36. AddProperty( /* 0 */
  37. new MP4Integer32Property("maxDelay"));
  38. break;
  39. case MP4PrefMaxDelayQosTag:
  40. AddProperty( /* 0 */
  41. new MP4Integer32Property("prefMaxDelay"));
  42. break;
  43. case MP4LossProbQosTag:
  44. AddProperty( /* 0 */
  45. new MP4Float32Property("lossProb"));
  46. break;
  47. case MP4MaxGapLossQosTag:
  48. AddProperty( /* 0 */
  49. new MP4Integer32Property("maxGapLoss"));
  50. break;
  51. case MP4MaxAUSizeQosTag:
  52. AddProperty( /* 0 */
  53. new MP4Integer32Property("maxAUSize"));
  54. break;
  55. case MP4AvgAUSizeQosTag:
  56. AddProperty( /* 0 */
  57. new MP4Integer32Property("avgAUSize"));
  58. break;
  59. case MP4MaxAURateQosTag:
  60. AddProperty( /* 0 */
  61. new MP4Integer32Property("maxAURate"));
  62. break;
  63. }
  64. }
  65. #else
  66. MP4QosDescriptor::MP4QosDescriptor()
  67. : MP4Descriptor(MP4QosDescrTag)
  68. {
  69. AddProperty( /* 0 */
  70. new MP4Integer8Property("predefined"));
  71. AddProperty( /* 1 */
  72. new MP4QosQualifierProperty("qualifiers",
  73. MP4QosTagsStart, MP4QosTagsEnd, Optional, Many));
  74. }
  75. MP4MaxDelayQosQualifier::MP4MaxDelayQosQualifier()
  76. : MP4QosQualifier(MP4MaxDelayQosTag)
  77. {
  78. AddProperty( /* 0 */
  79. new MP4Integer32Property("maxDelay"));
  80. }
  81. MP4PrefMaxDelayQosQualifier::MP4PrefMaxDelayQosQualifier()
  82. : MP4QosQualifier(MP4PrefMaxDelayQosTag)
  83. {
  84. AddProperty( /* 0 */
  85. new MP4Integer32Property("prefMaxDelay"));
  86. }
  87. MP4LossProbQosQualifier::MP4LossProbQosQualifier()
  88. : MP4QosQualifier(MP4LossProbQosTag)
  89. {
  90. AddProperty( /* 0 */
  91. new MP4Float32Property("lossProb"));
  92. }
  93. MP4MaxGapLossQosQualifier::MP4MaxGapLossQosQualifier()
  94. : MP4QosQualifier(MP4MaxGapLossQosTag)
  95. {
  96. AddProperty( /* 0 */
  97. new MP4Integer32Property("maxGapLoss"));
  98. }
  99. MP4MaxAUSizeQosQualifier::MP4MaxAUSizeQosQualifier()
  100. : MP4QosQualifier(MP4MaxAUSizeQosTag)
  101. {
  102. AddProperty( /* 0 */
  103. new MP4Integer32Property("maxAUSize"));
  104. }
  105. MP4AvgAUSizeQosQualifier::MP4AvgAUSizeQosQualifier()
  106. : MP4QosQualifier(MP4AvgAUSizeQosTag)
  107. {
  108. AddProperty( /* 0 */
  109. new MP4Integer32Property("avgAUSize"));
  110. }
  111. MP4MaxAURateQosQualifier::MP4MaxAURateQosQualifier()
  112. : MP4QosQualifier(MP4MaxAURateQosTag)
  113. {
  114. AddProperty( /* 0 */
  115. new MP4Integer32Property("maxAURate"));
  116. }
  117. #endif
  118. MP4UnknownQosQualifier::MP4UnknownQosQualifier()
  119. : MP4Descriptor()
  120. {
  121. AddProperty( /* 0 */
  122. new MP4BytesProperty("data"));
  123. }
  124. void MP4UnknownQosQualifier::Read(MP4File* pFile)
  125. {
  126. ReadHeader(pFile);
  127. /* byte properties need to know how long they are before reading */
  128. ((MP4BytesProperty*)m_pProperties[0])->SetValueSize(m_size);
  129. ReadProperties(pFile);
  130. }
  131. MP4Descriptor* MP4QosQualifierProperty::CreateDescriptor(u_int8_t tag)
  132. {
  133. MP4Descriptor* pDescriptor = NULL;
  134. switch (tag) {
  135. #if 0
  136. case MP4MaxDelayQosTag:
  137. pDescriptor = new MP4MaxDelayQosQualifier();
  138. break;
  139. case MP4PrefMaxDelayQosTag:
  140. pDescriptor = new MP4PrefMaxDelayQosQualifier();
  141. break;
  142. case MP4LossProbQosTag:
  143. pDescriptor = new MP4LossProbQosQualifier();
  144. break;
  145. case MP4MaxGapLossQosTag:
  146. pDescriptor = new MP4MaxGapLossQosQualifier();
  147. break;
  148. case MP4MaxAUSizeQosTag:
  149. pDescriptor = new MP4MaxAUSizeQosQualifier();
  150. break;
  151. case MP4AvgAUSizeQosTag:
  152. pDescriptor = new MP4AvgAUSizeQosQualifier();
  153. break;
  154. case MP4MaxAURateQosTag:
  155. pDescriptor = new MP4MaxAURateQosQualifier();
  156. break;
  157. #else
  158. case MP4MaxDelayQosTag:
  159. case MP4PrefMaxDelayQosTag:
  160. case MP4LossProbQosTag:
  161. case MP4MaxGapLossQosTag:
  162. case MP4MaxAUSizeQosTag:
  163. case MP4AvgAUSizeQosTag:
  164. case MP4MaxAURateQosTag:
  165. pDescriptor = new MP4QosDescriptorBase(tag);
  166. break;
  167. #endif
  168. default:
  169. pDescriptor = new MP4UnknownQosQualifier();
  170. pDescriptor->SetTag(tag);
  171. }
  172. return pDescriptor;
  173. }