SampleDescriptionBox.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6. using System.Diagnostics;
  7. namespace MatrixIO.IO.Bmff.Boxes
  8. {
  9. /// <summary>
  10. /// Sample Description Box ("stsd")
  11. /// </summary>
  12. [Box("stsd", "Sample Description Box")]
  13. public class SampleDescriptionBox : FullBox, ISuperBox
  14. {
  15. public SampleDescriptionBox() : base() { }
  16. public SampleDescriptionBox(Stream stream) : base(stream) { }
  17. internal override ulong CalculateSize()
  18. {
  19. return base.CalculateSize() + 4;
  20. }
  21. protected override void LoadFromStream(Stream stream)
  22. {
  23. base.LoadFromStream(stream);
  24. _EntryCount = stream.ReadBEUInt32();
  25. }
  26. protected override void SaveToStream(Stream stream)
  27. {
  28. base.SaveToStream(stream);
  29. stream.WriteBEUInt32((uint)_Children.Count);
  30. }
  31. private uint _EntryCount;
  32. private IList<Box> _Children = Portability.CreateList<Box>();
  33. public IList<Box> Children
  34. {
  35. get { return _Children; }
  36. }
  37. public IEnumerator<Box> GetEnumerator()
  38. {
  39. return Children.GetEnumerator();
  40. }
  41. System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
  42. {
  43. return Children.GetEnumerator();
  44. }
  45. }
  46. }