atom_mp4v.cpp 2.1 KB

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