The Fragment Run Table (afrt) box can be used to find the fragment that contains a sample corresponding to a given time. Fragments are individually identifiable by the URL scheme. Fragments may vary both in duration and in number of samples. The Durations of the Fragments are stored in the afrt box. The afrt box uses a compact encoding: - A Fragment Run Table may represent fragments for more than one quality level - The Fragment Run Table is compactly coded, as each entry gives the first fragment number for a run of fragments with the same duration. The count of fragments having this same duration can be calculated by subtracting the first fragment number in this entry from the first fragment number in the next entry. There may be several Fragment Run Table boxes in one Bootstrap Info box, each for different quality levels.
Наследование: 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);
            }
        }