public static FLVTag Parse(HDSBinaryReader br) { if (!br.BaseStream.CanRead || (br.BytesAvailable <= TAG_HEADER_BYTE_COUNT)) { return(null); } FLVTag tag; byte b = br.ReadByte(); TagType type = (TagType)(b & 0x1f); switch (type) { case TagType.AUDIO: case TagType.AKAMAI_ENC_AUDIO: tag = new FLVTagAudio(type); break; case TagType.VIDEO: case TagType.AKAMAI_ENC_VIDEO: tag = new FLVTagVideo(type); break; default: tag = new FLVTag(type); break; } tag.Filter = (b & 0x20) > 0; uint dataSize = br.ReadUInt24(); tag.Timestamp = br.ReadUInt24() + (uint)(br.ReadByte() << 24); uint StreamID = br.ReadUInt24(); tag.Data = br.ReadBytes((int)dataSize); if (br.BytesAvailable > 3) { tag.SizeOfPreviousPacket = br.ReadUInt32(); } return(tag); }
public override void Parse(BoxInfo bi, HDSBinaryReader br) { base.Parse(bi, br); uint sizes = br.ReadByte(); bool longIdFields = ((sizes & AFRA_MASK_LONG_ID) > 0); bool longOffsetFields = ((sizes & AFRA_MASK_LONG_OFFSET) > 0); bool globalEntries = ((sizes & AFRA_MASK_GLOBAL_ENTRIES) > 0); timeScale = br.ReadUInt32(); localRandomAccessEntries.Clear(); uint entryCount = br.ReadUInt32(); for (uint i = 0; i < entryCount; i++) { LocalRandomAccessEntry lrae = new LocalRandomAccessEntry(); lrae.Parse(br, longOffsetFields); localRandomAccessEntries.Add(lrae); } globalRandomAccessEntries.Clear(); if (globalEntries) { entryCount = br.ReadUInt32(); for (int i = 0; i < entryCount; i++) { GlobalRandomAccessEntry grae = new GlobalRandomAccessEntry(); grae.Parse(br, longIdFields, longOffsetFields); globalRandomAccessEntries.Add(grae); } } }
public void Parse(HDSBinaryReader br) { firstFragment = br.ReadUInt32(); durationAccrued = br.ReadUInt64(); duration = br.ReadUInt32(); if (duration == 0) { discontinuityIndicator = br.ReadByte(); } }
public override void Parse(BoxInfo bi, HDSBinaryReader br) { base.Parse(bi, br); qualitySegmentURLModifiers.Clear(); uint qualityEntryCount = br.ReadByte(); for (uint i = 0; i < qualityEntryCount; i++) { qualitySegmentURLModifiers.Add(br.ReadString()); } uint entryCount = br.ReadUInt32(); for (uint i = 0; i < entryCount; i++) { addSegmentFragmentPair(new SegmentFragmentPair(br.ReadUInt32(), br.ReadUInt32())); } }
public override void Parse(BoxInfo bi, HDSBinaryReader br) { base.Parse(bi, br); timeScale = br.ReadUInt32(); qualitySegmentURLModifiers.Clear(); uint qualityEntryCount = br.ReadByte(); for (uint i = 0; i < qualityEntryCount; i++) { qualitySegmentURLModifiers.Add(br.ReadString()); } uint entryCount = br.ReadUInt32(); for (uint i = 0; i < entryCount; i++) { FragmentDurationPair fdp = new FragmentDurationPair(); fdp.Parse(br); fragmentDurationPairs.Add(fdp); } }
public override void Parse(BoxInfo bi, HDSBinaryReader br) { base.Parse(bi, br); Version = br.ReadByte(); Flags = br.ReadUInt24(); }
public override void Parse(BoxInfo bi, HDSBinaryReader br) { base.Parse(bi, br); bootstrapVersion = br.ReadUInt32(); byte temp = br.ReadByte(); profile = (uint)(temp >> 6); live = ((temp & 0x20) > 0); update = ((temp & 0x01) > 0); timeScale = br.ReadUInt32(); currentMediaTime = br.ReadUInt64(); smpteTimeCodeOffset = br.ReadUInt64(); movieIdentifier = br.ReadString(); serverBaseURLs.Clear(); int serverEntryCount = br.ReadByte(); for (int i = 0; i < serverEntryCount; i++) { serverBaseURLs.Add(br.ReadString()); } qualitySegmentURLModifiers.Clear(); int qualityEntryCount = br.ReadByte(); for (int i = 0; i < qualityEntryCount; i++) { qualitySegmentURLModifiers.Add(br.ReadString()); } drmData = br.ReadString(); metadata = br.ReadString(); segmentRunTables.Clear(); uint segmentRunTableCount = br.ReadByte(); for (uint i = 0; i < segmentRunTableCount; i++) { BoxInfo boxInfo = BoxInfo.getNextBoxInfo(br); if (boxInfo == null) { break; } if (boxInfo.Type == F4FConstants.BOX_TYPE_ASRT) { AdobeSegmentRunTable asrt = new AdobeSegmentRunTable(); asrt.Parse(boxInfo, br); segmentRunTables.Add(asrt); } } fragmentRunTables.Clear(); uint fragmentRunTableCount = br.ReadByte(); for (uint i = 0; i < fragmentRunTableCount; i++) { BoxInfo boxInfo = BoxInfo.getNextBoxInfo(br); if (boxInfo == null) { break; } if (boxInfo.Type == F4FConstants.BOX_TYPE_AFRT) { AdobeFragmentRunTable afrt = new AdobeFragmentRunTable(); afrt.Parse(boxInfo, br); fragmentRunTables.Add(afrt); } } // Check if live stream is still live if (live && (fragmentRunTables.Count > 0) && ContentComplete()) { live = false; RemoveLastFragment(); } }