1
0

atom_encv.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. * Alix Marchandise-Franquet [email protected]
  21. */
  22. #include "mp4common.h"
  23. MP4EncvAtom::MP4EncvAtom()
  24. : MP4Atom("encv")
  25. {
  26. AddReserved("reserved1", 6); /* 0 */
  27. AddProperty( /* 1 */
  28. new MP4Integer16Property("dataReferenceIndex"));
  29. AddReserved("reserved2", 16); /* 2 */
  30. AddProperty( /* 3 */
  31. new MP4Integer16Property("width"));
  32. AddProperty( /* 4 */
  33. new MP4Integer16Property("height"));
  34. AddReserved("reserved3", 14); /* 5 */
  35. MP4StringProperty* pProp =
  36. new MP4StringProperty("compressorName");
  37. pProp->SetFixedLength(32);
  38. pProp->SetValue("");
  39. AddProperty(pProp); /* 6 */
  40. AddReserved("reserved4", 4); /* 7 */
  41. ExpectChildAtom("esds", Required, OnlyOne);
  42. ExpectChildAtom("sinf", Required, OnlyOne);
  43. ExpectChildAtom("avcC", Optional, OnlyOne);
  44. }
  45. void MP4EncvAtom::Generate()
  46. {
  47. MP4Atom::Generate();
  48. ((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
  49. // property reserved3 has non-zero fixed values
  50. static u_int8_t reserved3[14] = {
  51. 0x00, 0x48, 0x00, 0x00,
  52. 0x00, 0x48, 0x00, 0x00,
  53. 0x00, 0x00, 0x00, 0x00,
  54. 0x00, 0x01,
  55. };
  56. m_pProperties[5]->SetReadOnly(false);
  57. ((MP4BytesProperty*)m_pProperties[5])->
  58. SetValue(reserved3, sizeof(reserved3));
  59. m_pProperties[5]->SetReadOnly(true);
  60. // property reserved4 has non-zero fixed values
  61. static u_int8_t reserved4[4] = {
  62. 0x00, 0x18, 0xFF, 0xFF,
  63. };
  64. m_pProperties[7]->SetReadOnly(false);
  65. ((MP4BytesProperty*)m_pProperties[7])->
  66. SetValue(reserved4, sizeof(reserved4));
  67. m_pProperties[7]->SetReadOnly(true);
  68. }