atom_video.cpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. 2004. All Rights Reserved.
  17. *
  18. * Contributor(s):
  19. * Bill May [email protected]
  20. */
  21. #include "mp4common.h"
  22. MP4VideoAtom::MP4VideoAtom (const char *type)
  23. : MP4Atom(type)
  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. AddProperty(/* 7 */
  40. new MP4Integer16Property("depth"));
  41. AddProperty(/* 8 */
  42. new MP4Integer16Property("colorTableId"));
  43. ExpectChildAtom("smi ", Optional, OnlyOne);
  44. }
  45. void MP4VideoAtom::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. // depth and color table id values - should be set later
  61. // as far as depth - color table is most likely 0xff
  62. ((MP4IntegerProperty *)m_pProperties[7])->SetValue(0x18);
  63. ((MP4IntegerProperty *)m_pProperties[8])->SetValue(0xffff);
  64. }