Example #1
0
 /// <summary>
 /// Opens the streams in the file using the specified <see cref="MediaOptions"/>.
 /// </summary>
 /// <param name="options">The <see cref="MediaOptions"/> object.</param>
 private void OpenStreams(MediaOptions options)
 {
     // if (options.StreamsToLoad != MediaMode.Audio)
     Video = DecoderFactory.OpenVideo(this, options);
     if (Video != null)
     {
         GetPacketFromStream(Video.Info.Index); // Requests for the first packet.
         canReusePacket = true;
     }
 }
Example #2
0
        /// <summary>
        /// Opens the streams in the file using the specified <see cref="MediaOptions"/>.
        /// </summary>
        /// <param name="options">The <see cref="MediaOptions"/> object.</param>
        private void OpenStreams(MediaOptions options)
        {
            for (int i = 0; i < Pointer->nb_streams; i++)
            {
                var stream = Pointer->streams[i];
                if (!options.ShouldLoadStreamsOfType(stream->codec->codec_type))
                {
                    continue;
                }

                try
                {
                    Decoders[i] = DecoderFactory.OpenStream(this, options, stream);
                    GetPacketFromStream(i);
                }
                catch (Exception)
                {
                    Decoders[i] = null;
                }
            }
        }