Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public override void Parse(BoxInfo bi, HDSBinaryReader br)
 {
     base.Parse(bi, br);
     data = br.ReadBytes((int)(Size - Length));
 }