atom_hinf.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. MP4HinfAtom::MP4HinfAtom()
  23. : MP4Atom("hinf")
  24. {
  25. ExpectChildAtom("trpy", Optional, OnlyOne);
  26. ExpectChildAtom("nump", Optional, OnlyOne);
  27. ExpectChildAtom("tpyl", Optional, OnlyOne);
  28. ExpectChildAtom("maxr", Optional, Many);
  29. ExpectChildAtom("dmed", Optional, OnlyOne);
  30. ExpectChildAtom("dimm", Optional, OnlyOne);
  31. ExpectChildAtom("drep", Optional, OnlyOne);
  32. ExpectChildAtom("tmin", Optional, OnlyOne);
  33. ExpectChildAtom("tmax", Optional, OnlyOne);
  34. ExpectChildAtom("pmax", Optional, OnlyOne);
  35. ExpectChildAtom("dmax", Optional, OnlyOne);
  36. ExpectChildAtom("payt", Optional, OnlyOne);
  37. }
  38. void MP4HinfAtom::Generate()
  39. {
  40. // hinf is special in that although all it's child atoms
  41. // are optional (on read), if we generate it for writing
  42. // we really want all the children
  43. for (u_int32_t i = 0; i < m_pChildAtomInfos.Size(); i++) {
  44. MP4Atom* pChildAtom =
  45. CreateAtom(m_pChildAtomInfos[i]->m_name);
  46. AddChildAtom(pChildAtom);
  47. // and ask it to self generate
  48. pChildAtom->Generate();
  49. }
  50. }