using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace MatrixIO.IO.Bmff.Boxes { /// /// Movie Data Box ("mdat") /// [Box("mdat", "Movie Data Box")] public class MovieDataBox : Box, IContentBox { public MovieDataBox() : base() { } /// /// Reads an 'mdat' box from a given stream /// /// public MovieDataBox(Stream stream) : base(stream) { } /// /// Constructs a new box with content from the given stream /// /// Stream containing box content. /// Offset of box content. /// Length of box content. public MovieDataBox(Stream contentStream, ulong contentOffset, ulong? contentSize) { if (!contentStream.CanSeek) throw new NotSupportedException("The underlying Box.ToStream() does not presently support reading source content from an unseekable stream."); if (contentSize == null) { throw new NotSupportedException("The underlying Box.ToStream() does not presently support unknown length content."); //this.Size = 0; } else if (contentSize + 8 > uint.MaxValue) { this.Size = 1; this.LargeSize = (contentSize + 8); } else { this.Size = (uint)(contentSize + 16); } this.ContentOffset = contentOffset; this._SourceStream = contentStream; } } }