예제 #1
0
        public void Dispose()
        {
            HasEndOfStream = true;

            if (_container != null)
            {
                _container.DisposePacketReader(this);
            }
            _container = null;

            _current = null;

            if (_first != null)
            {
                var node = _first;
                _first = null;
                while (node.Next != null)
                {
                    var temp = node.Next;
                    node.Next = null;
                    node      = temp;
                    node.Prev = null;
                }
                node = null;
            }

            _last = null;
        }
예제 #2
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
                // TODO: Add Matroska fallback
                bufferedStream.Close();
                throw new InvalidDataException("Could not determine container type!");
            }
            _containerReader = oggContainer;

            if (_decoders.Count == 0)
            {
                throw new InvalidDataException("No Vorbis data found!");
            }
        }
예제 #3
0
 internal PacketReader(ContainerReader container, int streamSerial)
 {
     _container   = container;
     StreamSerial = streamSerial;
 }