Exemplo n.º 1
0
        internal SoundStreamHeadTag(SwfReader r)
            : base(TagType.SoundStreamHead2)
        {
            SoundId = soundIdCounter++;

            r.GetBits(4);             // reserved

            PlaybackSoundRate      = rates[r.GetBits(2)];
            PlaybackSoundSize      = r.GetBit() ? 16u : 0u;
            IsStereo               = r.GetBit();
            StreamSoundCompression = (SoundCompressionType)r.GetBits(4);             // Mp3 == 2

            StreamSoundRate = rates[r.GetBits(2)];
            StreamSoundSize = r.GetBit() ? 16u : 8u;
            StreamIsStereo  = r.GetBit();

            r.Align();

            StreamSoundSampleCount = r.GetUI16();

            if (StreamSoundCompression == SoundCompressionType.MP3)
            {
                LatencySeek = r.GetUI16();
            }
        }
Exemplo n.º 2
0
        internal DefineSoundTag(SwfReader r, uint tagLen)
            : base(TagType.DefineSound)
        {
            SoundId     = r.GetUI16();
            SoundFormat = (SoundCompressionType)r.GetBits(4);
            uint sr = r.GetBits(2);

            switch (sr)
            {
            case 0:
                SoundRate = 5512;                         // ?
                break;

            case 1:
                SoundRate = 11025;
                break;

            case 2:
                SoundRate = 22050;
                break;

            case 3:
                SoundRate = 44100;
                break;
            }
            SoundSize = r.GetBit() ? 16U : 8U;
            IsStereo  = r.GetBit();
            r.Align();

            SoundSampleCount = r.GetUI32();
            // todo: this needs to decompress if mp3 etc
            SoundData = r.GetBytes(tagLen - 7);
        }
Exemplo n.º 3
0
        public DefineSoundTag(SwfReader r, uint tagLen)
        {
            SoundId = r.GetUI16();
            SoundFormat = (SoundCompressionType)r.GetBits(4);
            uint sr = r.GetBits(2);
            switch (sr)
            {
                case 0:
                    SoundRate = 5512; // ?
                    break;
                case 1:
                    SoundRate = 11025;
                    break;
                case 2:
                    SoundRate = 22050;
                    break;
                case 3:
                    SoundRate = 44100;
                    break;
            }
            SoundSize = r.GetBit() ? 16U : 8U;
            IsStereo = r.GetBit();
            r.Align();

            SoundSampleCount = r.GetUI32();
            // todo: this needs to decompress if mp3 etc
            SoundData = r.GetBytes(tagLen - 7);
        }
Exemplo n.º 4
0
        public SoundStreamHeadTag(SwfReader r)
        {
            SoundId = soundIdCounter++;

            r.GetBits(4); // reserved

            PlaybackSoundRate = rates[r.GetBits(2)];
            PlaybackSoundSize = r.GetBit() ? 16u : 0u;
            IsStereo = r.GetBit();
            StreamSoundCompression = (SoundCompressionType)r.GetBits(4); // Mp3 == 2

            StreamSoundRate = rates[r.GetBits(2)];
            StreamSoundSize = r.GetBit() ? 16u : 8u;
            StreamIsStereo = r.GetBit();

            r.Align();

            StreamSoundSampleCount = r.GetUI16();

            if (StreamSoundCompression == SoundCompressionType.MP3)
            {
                LatencySeek = r.GetUI16();
            }
        }