ItemProtectionBox.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. /// Item Protection Box ("ipro")
  10. /// </summary>
  11. [Box("ipro", "Item Protection Box")]
  12. public class ItemProtectionBox : FullBox, ISuperBox
  13. {
  14. public ItemProtectionBox() : base() { }
  15. public ItemProtectionBox(Stream stream) : base(stream) { }
  16. internal override ulong CalculateSize()
  17. {
  18. return base.CalculateSize() + 2;
  19. }
  20. protected override void LoadFromStream(System.IO.Stream stream)
  21. {
  22. base.LoadFromStream(stream);
  23. ProtectionCount = stream.ReadBEUInt16();
  24. }
  25. protected override void SaveToStream(System.IO.Stream stream)
  26. {
  27. base.SaveToStream(stream);
  28. stream.WriteBEUInt16((ushort)Children.Count);
  29. }
  30. private IList<Box> _Children = Portability.CreateList<Box>();
  31. public IList<Box> Children
  32. {
  33. get { return _Children; }
  34. }
  35. public IEnumerator<Box> GetEnumerator()
  36. {
  37. return Children.GetEnumerator();
  38. }
  39. System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
  40. {
  41. return Children.GetEnumerator();
  42. }
  43. private ushort ProtectionCount { get; set; }
  44. /*
  45. public IEnumerable<ProtectionSchemeInfoBox> ProtectionInformation
  46. {
  47. get
  48. {
  49. return from c in Children
  50. where c is ProtectionSchemeInfoBox
  51. select (ProtectionSchemeInfoBox)c;
  52. }
  53. }
  54. */
  55. }
  56. }