UserDataBox.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6. namespace MatrixIO.IO.Bmff.Boxes
  7. {
  8. /// <summary>
  9. /// User Data Box ("udta")
  10. /// </summary>
  11. [Box("udta", "User Data Box")]
  12. public class UserDataBox : Box, ISuperBox
  13. {
  14. public UserDataBox() : base() { }
  15. public UserDataBox(Stream stream) : base(stream) { }
  16. private IList<Box> _Children = Portability.CreateList<Box>();
  17. public IList<Box> Children
  18. {
  19. get { return _Children; }
  20. }
  21. internal override ulong CalculateSize()
  22. {
  23. return base.CalculateSize() + 4; // Fix for legacy trailing 0x0000000
  24. }
  25. protected override void SaveChildrenToStream(Stream stream)
  26. {
  27. base.SaveChildrenToStream(stream);
  28. stream.WriteBEUInt32(0);
  29. }
  30. public IEnumerator<Box> GetEnumerator()
  31. {
  32. return Children.GetEnumerator();
  33. }
  34. System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
  35. {
  36. return Children.GetEnumerator();
  37. }
  38. }
  39. }