A thread-safe, read-only, buffering stream wrapper.
Inheritance: Stream
Beispiel #1
0
        public VorbisReader(Stream stream, bool closeStreamOnDispose)
            : this()
        {
            var bufferedStream = new BufferedReadStream(stream);
            bufferedStream.CloseBaseStream = closeStreamOnDispose;

            // try Ogg first
            var oggContainer = new Ogg.ContainerReader(bufferedStream, closeStreamOnDispose);
            if (!LoadContainer(oggContainer))
            {
                // oops, not Ogg!
                // we don't support any other container types yet, so error out
                bufferedStream.Close();
                throw new InvalidDataException("Could not determine container type!");
            }
            _containerReader = oggContainer;

            if (_decoders.Count == 0) throw new InvalidDataException("No Vorbis data found!");
        }
Beispiel #2
0
        public VorbisReader(Stream stream, bool closeStreamOnDispose)
            : this()
        {
            BufferedReadStream bufferedReadStream = new BufferedReadStream(stream)
            {
                CloseBaseStream = closeStreamOnDispose
            };
            ContainerReader containerReader = new ContainerReader(bufferedReadStream, closeStreamOnDispose);

            if (!LoadContainer(containerReader))
            {
                bufferedReadStream.Dispose();
                throw new InvalidDataException("Could not determine container type!");
            }
            _containerReader = containerReader;
            if (_decoders.Count == 0)
            {
                throw new InvalidDataException("No Vorbis data found!");
            }
        }
Beispiel #3
0
        public VorbisReader(Stream stream, bool closeStreamOnDispose)
            : this()
        {
            var bufferedStream = new BufferedReadStream(stream);

            bufferedStream.CloseBaseStream = closeStreamOnDispose;

            // try Ogg first
            var oggContainer = new Ogg.ContainerReader(bufferedStream, closeStreamOnDispose);

            if (!LoadContainer(oggContainer))
            {
                // oops, not Ogg!
                // we don't support any other container types yet, so error out
                bufferedStream.Close();
                throw new InvalidDataException("Could not determine container type!");
            }
            _containerReader = oggContainer;

            if (_decoders.Count == 0)
            {
                throw new InvalidDataException("No Vorbis data found!");
            }
        }