示例#1
0
        internal VorbisStreamDecoder(IPacketProvider packetProvider)
        {
            _packetProvider = packetProvider;

            _pagesSeen = new List<int>();
            _lastPageSeen = -1;
        }
示例#2
0
 public VorbisReader(IPacketProvider packetProvider)
     : this()
 {
     var ea = new NewStreamEventArgs(packetProvider);
     NewStream(this, ea);
     if (ea.IgnoreStream) throw new InvalidDataException("No Vorbis data found!");
 }
示例#3
0
        public VorbisReader(Stream stream, bool closeStreamOnDispose)
        {
            _decoders = new List<VorbisStreamDecoder>();
            _serials = new List<int>();

            if (stream.CanSeek)
            {
                // TODO: need to check the first byte(s) for Matroska

                _packetProvider = new Ogg.ContainerReader(stream, NewStream);

                // NewStream will populate our decoder list...
            }
            else
            {
                // RTP???
                throw new NotSupportedException("The specified stream is not seekable.");
            }

            _packetProvider.Init();

            _sourceStream = stream;
            _closeSourceOnDispose = closeStreamOnDispose;

            // TODO: check the skeleton to see if we need to find a particular stream serial
            //       to start decoding

            // by this point, the container init should have found at least one vorbis stream...
            if (_decoders.Count == 0) throw new InvalidDataException("No Vorbis data is available in the specified file.");

            _streamIdx = 0;
        }
示例#4
0
        internal VorbisStreamDecoder(IPacketProvider packetProvider)
        {
            _packetProvider = packetProvider;
            _packetProvider.ParameterChange += SetParametersChanging;

            _pagesSeen = new List<int>();
            _lastPageSeen = -1;
        }
示例#5
0
 VorbisAudioStream(IPacketProvider packetProvider)
     : this(new VorbisReader(packetProvider))
 {
 }
示例#6
0
        /// <summary>
        /// Creates a new instance of <see cref="NewStreamEventArgs"/> with the specified <see cref="IPacketProvider"/>.
        /// </summary>
        /// <param name="packetProvider">An <see cref="IPacketProvider"/> instance.</param>
        public NewStreamEventArgs(IPacketProvider packetProvider)
        {
            if (packetProvider == null) throw new ArgumentNullException("packetProvider");

            PacketProvider = packetProvider;
        }
示例#7
0
 public void Dispose()
 {
     if (_packetProvider != null)
     {
         var temp = _packetProvider;
         _packetProvider = null;
         temp.Dispose();
     }
 }
示例#8
0
 public void Dispose()
 {
     if (_packetProvider != null)
     {
         var temp = _packetProvider;
         _packetProvider = null;
         temp.ParameterChange -= SetParametersChanging;
         temp.Dispose();
     }
 }
示例#9
0
 public void Dispose()
 {
   if (this._packetProvider != null)
   {
     this._packetProvider.Dispose();
     this._packetProvider = (IPacketProvider) null;
   }
   if (this._closeSourceOnDispose)
     this._sourceStream.Close();
   this._sourceStream = (Stream) null;
 }
示例#10
0
 public VorbisReader(Stream stream, bool closeStreamOnDispose)
 {
   this._decoders = new List<VorbisStreamDecoder>();
   this._serials = new List<int>();
   if (!stream.CanSeek)
     throw new NotSupportedException("The specified stream is not seekable.");
   this._packetProvider = (IPacketProvider) new ContainerReader(stream, new Action<int>(this.NewStream));
   this._packetProvider.Init();
   this._sourceStream = stream;
   this._closeSourceOnDispose = closeStreamOnDispose;
   if (this._decoders.Count == 0)
     throw new InvalidDataException("No Vorbis data is available in the specified file.");
   this._streamIdx = 0;
 }
示例#11
0
        public void Dispose()
        {
            if (_packetProvider != null)
            {
                _packetProvider.Dispose();
                _packetProvider = null;
            }

            if (_closeSourceOnDispose)
            {
                _sourceStream.Close();
            }

            _sourceStream = null;
        }