The Segment Run Table (asrt) box can be used to locate a segment that contains a particular fragment. There may be several asrt boxes, each for different quality levels. The asrt box uses a compact encoding: - A Segment Run Table may represent fragment runs for several quality levels. - The Segment Run Table is compactly coded. Each entry gives the first segment number for a run of segments with the same count of fragments. The count of segments having this same count of fragments can be calculated by subtracting the first segment number in this entry from the first segment number in the next entry.
상속: F4VBox
예제 #1
0
        public F4VBox ReadBox()
        {
            if (currentHeader == null)
                ReadHeader();

            F4VBox box;
            switch (currentHeader.BoxType.ToString())
            {
                case "abst":
                    box = new BootstrapInfoBox();
                    break;
                case "asrt":
                    box = new SegmentRunTableBox();
                    break;
                case "afrt":
                    box = new FragmentRunTableBox();
                    break;
                case "mdat":
                    box = new MediaDataBox();
                    break;
                default:
                    box = new UnknownBox();
                    break;
            }
            box.BoxHeader = currentHeader;
            box.Parse(br);

            currentHeader = null;

            return box;
        }
        public override void Parse(ExtendedBinaryReader br)
        {
            base.Parse(br);

            Version = br.ReadByte();
            Flags = br.ReadUInt24();
            BootstrapinfoVersion = br.ReadUInt32();
            var b = br.ReadByte();
            Profile = (new byte[] { 0x80, 0x40 }).Select(i => (i & b) != 0).ToArray();
            Live = (0x02 & b) != 0;
            Update = (0x01 & b) != 0;
            Reserved = (new byte[] { 0x08, 0x04, 0x02, 0x01 }).Select(i => (i & b) != 0).ToArray();
            TimeScale = br.ReadUInt32();
            CurrentMediaTime = br.ReadUInt64();
            SmpteTimeCodeOffset = br.ReadUInt64();
            MovieIdentifier = br.ReadNullTerminatedString();
            ServerEntryCount = br.ReadByte();
            ServerEntryTable = new ServerEntry[ServerEntryCount];
            for (int i = 0; i < ServerEntryCount; i++)
                ServerEntryTable[i] = ServerEntry.Parse(br);
            QualityEntryCount = br.ReadByte();
            QualityEntryTable = new QualityEntry[QualityEntryCount];
            for (int i = 0; i < QualityEntryCount; i++)
                QualityEntryTable[i] = QualityEntry.Parse(br);
            DrmData = br.ReadNullTerminatedString();
            MetaData = br.ReadNullTerminatedString();
            SegmentRunTableCount = br.ReadByte();
            SegmentRunTableEntries = new SegmentRunTableBox[SegmentRunTableCount];
            for (int i = 0; i < SegmentRunTableCount; i++)
            {
                SegmentRunTableEntries[i] = new SegmentRunTableBox();
                SegmentRunTableEntries[i].Parse(br);
            }
            FragmentRunTableCount = br.ReadByte();
            FragmentRunTableEntries = new FragmentRunTableBox[FragmentRunTableCount];
            for (int i = 0; i < FragmentRunTableCount; i++)
            {
                FragmentRunTableEntries[i] = new FragmentRunTableBox();
                FragmentRunTableEntries[i].Parse(br);
            }
        }