private void InitEs()
        {
            try
            {
                ioContext           = ffmpegGlue.AllocIOContext(BufferSize, ReadPacket);
                ioContext.Seekable  = false;
                ioContext.WriteFlag = false;

                formatContext                    = ffmpegGlue.AllocFormatContext();
                formatContext.ProbeSize          = ProbeSize;
                formatContext.MaxAnalyzeDuration = MaxAnalyzeDuration;
                formatContext.AVIOContext        = ioContext;
                formatContext.Open();
            }
            catch (FFmpegException ex)
            {
                DeallocFFmpeg();

                // Report init errors resulting from reset as cancellation
                if (cancellationTokenSource.IsCancellationRequested)
                {
                    throw new TaskCanceledException();
                }

                Logger.Error(ex);
                throw new DemuxerException("Cannot open formatContext", ex);
            }
        }
示例#2
0
 private void InitUrl(string url)
 {
     try
     {
         formatContext                    = ffmpegGlue.AllocFormatContext();
         formatContext.ProbeSize          = ProbeSize;
         formatContext.MaxAnalyzeDuration = TimeSpan.FromSeconds(10);
         formatContext.Open(url);
     }
     catch (FFmpegException ex)
     {
         DeallocFFmpeg();
         Logger.Error(ex);
         throw new DemuxerException("Cannot open formatContext", ex);
     }
 }
        private void InitUrl(string url, IReadOnlyCollection <KeyValuePair <string, object> > options = null)
        {
            try
            {
                formatContext                    = ffmpegGlue.AllocFormatContext();
                formatContext.IoInterrupt        = () => _operationMonitor.CancelOrTimeout();
                formatContext.ProbeSize          = ProbeSize;
                formatContext.MaxAnalyzeDuration = TimeSpan.FromSeconds(10);

                formatContext.Open(url, options == null ? null : new AvDictionary(options));
            }
            catch (FFmpegException ex)
            {
                DeallocFFmpeg();
                Logger.Error(ex);
                throw new DemuxerException("Cannot open formatContext", ex);
            }
        }
示例#4
0
        private void InitEs()
        {
            try
            {
                ioContext           = ffmpegGlue.AllocIOContext(BufferSize, ReadPacket);
                ioContext.Seekable  = false;
                ioContext.WriteFlag = false;

                formatContext                    = ffmpegGlue.AllocFormatContext();
                formatContext.ProbeSize          = ProbeSize;
                formatContext.MaxAnalyzeDuration = MaxAnalyzeDuration;
                formatContext.AVIOContext        = ioContext;
                formatContext.Open();
            }
            catch (FFmpegException ex)
            {
                DeallocFFmpeg();
                Logger.Error(ex);
                throw new DemuxerException("Cannot open formatContext", ex);
            }
        }
示例#5
0
        private void InitEs()
        {
            try
            {
                const int bufferSize = 128 * 1024;
                ioContext           = ffmpegGlue.AllocIOContext(bufferSize, ReadPacket);
                ioContext.Seekable  = false;
                ioContext.WriteFlag = false;

                formatContext                    = ffmpegGlue.AllocFormatContext();
                formatContext.ProbeSize          = bufferSize;
                formatContext.MaxAnalyzeDuration = TimeSpan.FromSeconds(10);
                formatContext.AVIOContext        = ioContext;
                formatContext.Open();
            }
            catch (FFmpegException ex)
            {
                DeallocFFmpeg();
                Logger.Error(ex);
                throw new DemuxerException("Cannot open formatContext", ex);
            }
        }