private void ParseStreamType(AviParser parser)
        {
            byte streamTypeByte0 = parser.GetByte();
            byte streamTypeByte1 = parser.GetByte();

            StreamType = (InformationType)(((short)streamTypeByte0 << 8) | streamTypeByte1);

            parser.AddAttribute(new FormattedAttribute <Attribute, InformationType>(Attribute.InformationType, StreamType));
        }
        private bool ParseChannel(AviParser parser)
        {
            byte AsciiValueOfCharacterZero = Convert.ToByte('0');
            byte channelByte0 = parser.GetByte();
            byte channelByte1 = parser.GetByte();

            if (!((char)channelByte0).IsHexDigit() || !((char)channelByte1).IsHexDigit())
            {
                this.Valid = false;
                return(this.Valid);
            }

            Channel = (byte)((16 * (channelByte0 - AsciiValueOfCharacterZero)) + (channelByte1 - AsciiValueOfCharacterZero));

            parser.AddAttribute(new FormattedAttribute <Attribute, byte>(Attribute.Channel, Channel));

            return(true);
        }
        public override bool Parse(AviParser parser)
        {
            if (!base.Parse(parser))
            {
                return(false);
            }

            if ((uint)Size > MaxUnparsedBytes)
            {
                return(false);
            }

            // Put the position back to the beginning of the header.
            // We want to be able the read the channel property.
            parser.Position -= 8;

            // Read the channel property (first 2 bytes of fourcc)
            if (!ParseChannel(parser))
            {
                return(false);
            }

            // Read the information type property (last 2 bytes of fourcc)
            ParseStreamType(parser);

            // Skip the 'Size' bytes
            parser.Position += 4;

            ulong size = Math.Min(Size, parser.BytesRemaining);

            if (size > 0)
            {
                StreamData = parser.GetDataPacket(parser.Position, (long)size);
            }

            // Show the number of bytes that go to the codec detector
            parser.AddAttribute(new FormattedAttribute <Attribute, ulong>(Attribute.NumberOfBytesForCodecDetector, parser.BytesRemaining));

            // Prevent AviChunk.ParseEnd() from displaying the unparsed bytes as hex dump
            parser.Position += (long)parser.BytesRemaining;

            return(Valid);
        }