Example #1
0
 public static FLVTag Parse(ExtendedBinaryReader br)
 {
     var b = br.ReadByte();
     var tag = new FLVTag
     {
         Reserved = (byte)(b & 0xc0),
         Filter = (b & 0x20) == 0,
         TagType = (TagType)(b & 0x1f),
         DataSize = br.ReadUInt24(),
         TimeStamp = br.ReadUInt24(),
         TimestampExtended = br.ReadByte(),
         StreamID = br.ReadUInt24()
     };
     tag.HeaderAndBody = br.ReadBytes((tag.TimestampExtended << 24) + (int)tag.TimeStamp);
     return tag;
 }
        public override void Parse(ExtendedBinaryReader br)
        {
            base.Parse(br);

            Version = br.ReadByte();
            Flags = br.ReadUInt24();
            TimeScale = br.ReadUInt32();
            QualityEntryCount = br.ReadByte();
            QualitySegmentUrlModifiers = Enumerable.Range(0, QualityEntryCount).Select(i => br.ReadNullTerminatedString()).ToArray();
            FragmentRunEntryCount = br.ReadUInt32();
            FragmentRunEntryTable = new FragmentRunEntry[FragmentRunEntryCount];
            for (uint i = 0; i < FragmentRunEntryCount; i++)
                FragmentRunEntryTable[i] = FragmentRunEntry.Parse(br);
        }
        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);
            }
        }