コード例 #1
0
ファイル: Mp4File.cs プロジェクト: Ocrosoft/Mp4Explorer
        public Mp4File(Mp4Stream stream, Mp4BoxFactory factory, bool moovOnly)
        {
            this.Boxes = new List <Mp4Box>();
            bool flag = true;

            while (flag)
            {
                long   position = stream.Position;
                Mp4Box item     = factory.Read(stream);
                if (item != null)
                {
                    this.Boxes.Add(item);
                    if (item.Type == Mp4BoxType.MOOV)
                    {
                        this.Movie = new Mp4Movie((Mp4MoovBox)item, stream);
                        if (moovOnly)
                        {
                            flag = false;
                        }
                    }
                    else if (item.Type == Mp4BoxType.FTYP)
                    {
                        this.FileType = (Mp4FtypBox)item;
                    }
                    else if ((item.Type == Mp4BoxType.MDAT) && (this.Movie == null))
                    {
                        this.MoovIsBeforeMdat = false;
                    }
                }
                else
                {
                    flag = false;
                }
            }
        }
コード例 #2
0
        public void ReadChildren(Mp4Stream stream, Mp4BoxFactory factory, long size)
        {
            this.Children = new List <Mp4Box>();
            Mp4Box item           = null;
            long   bytesAvailable = size;

            factory.PushContext(base.Type);
            while ((bytesAvailable > 0L) && ((item = factory.Read(stream, ref bytesAvailable)) != null))
            {
                item.Parent = this;
                this.Children.Add(item);
            }
            factory.PopContext();
        }
コード例 #3
0
        public Mp4DrefBox(uint size, Mp4Stream stream, Mp4BoxFactory factory) : base(size, Mp4BoxType.DREF, 0L, stream)
        {
            uint num = stream.ReadUInt32();

            this.Entries = new List <Mp4Box>((int)num);
            uint num2           = num;
            long bytesAvailable = (size - 12) - 4;

            while (num2-- > 0)
            {
                Mp4Box item = null;
                while ((item = factory.Read(stream, ref bytesAvailable)) != null)
                {
                    this.Entries.Add(item);
                }
            }
        }
コード例 #4
0
ファイル: Mp4StsdBox.cs プロジェクト: Ocrosoft/Mp4Explorer
        public Mp4StsdBox(uint size, Mp4Stream stream, Mp4BoxFactory factory) : base(size, Mp4BoxType.STSD, 0L, stream)
        {
            uint num = stream.ReadUInt32();

            factory.PushContext(base.Type);
            long bytesAvailable = (size - 12) - 4;

            this.Entries = new List <Mp4Box>((int)num);
            for (int i = 0; i < num; i++)
            {
                Mp4Box item = factory.Read(stream, ref bytesAvailable);
                if (item != null)
                {
                    this.Entries.Add(item);
                }
            }
            factory.PopContext();
        }