Recurity.Swf.TagHandler.SoundStreamBlock.TryParseSoundData C# (CSharp) Method

TryParseSoundData() private method

private TryParseSoundData ( Stream input ) : void
input Stream
return void
        private void TryParseSoundData(Stream input)
        {
            Byte[] b = new Byte[(Int32)(input.Length - input.Position)];
            Int64 position = this._dataStream.Position;
            input.Read(b, 0, b.Length);
            input.Seek(position, SeekOrigin.Begin);

            if (_soundstreamhead != null)
            {
                switch (this._soundstreamhead.StreamCompression)
                {
                    case SoundEncoding.uncompressed_native:
                        RawSoundData rawDataN = new RawSoundData(b, false);
                        this._soundData = rawDataN;
                        break;
                    case SoundEncoding.Uncompressed_little_endian:
                        RawSoundData rawDataL = new RawSoundData(b, true);
                        this._soundData = rawDataL;
                        break;
                    case SoundEncoding.ADPCM:
                        AdpcmSoundData ADPCMData = new AdpcmSoundData();
                        ADPCMData.Parse(input, this._soundstreamhead.StreamType);
                        this._soundData = ADPCMData;
                        break;
                    case SoundEncoding.MP3:
                        Mp3SoundData mp3Data = new Mp3SoundData();
                        mp3Data.Parse(input);
                        this._soundData = mp3Data;
                        break;
                    case SoundEncoding.Nellymoser:
                        NellymoserSoundData nellySound = new NellymoserSoundData(b);
                        this._soundData = nellySound;
                        break;
                    case SoundEncoding.Nellymoser8kHz:
                        Nellymoser8SoundData nelly8Sound = new Nellymoser8SoundData(b);
                        this._soundData = nelly8Sound;
                        break;
                    case SoundEncoding.Nellymoser16kHz:
                        Nellymoser16SoundData nelly16Sound = new Nellymoser16SoundData(b);
                        this._soundData = nelly16Sound;
                        break;
                    default:
                        SwfFormatException e = new SwfFormatException("Unsupported sound encoding found in sound stream block.");
                        Log.Error(this, e.Message);
                        throw e;
                }
            }
            else
            {
                this._soundData = new RawSoundData(b);
            }
        }