internal static unsafe void AvFormatSeekFile(AvFormatContext formatContext, double time) { int result = ffmpeg.avformat_seek_file((AVFormatContext *)formatContext.FormatPtr, formatContext.BestAudioStreamIndex, long.MinValue, (long)time, (long)time, 0); FfmpegException.Try(result, "avformat_seek_file"); }
/// <summary> /// Initializes a new instance of the <see cref="FfmpegDecoder" /> class based on a <see cref="Stream" />. /// </summary> /// <param name="stream">The stream.</param> /// <exception cref="FfmpegException">Any ffmpeg error.</exception> /// <exception cref="System.ArgumentNullException">stream</exception> /// <exception cref="ArgumentException">Stream is not readable.</exception> /// <exception cref="System.OutOfMemoryException">Could not allocate FormatContext.</exception> /// <exception cref="System.NotSupportedException"> /// DBL format is not supported. /// or /// Audio Sample Format not supported. /// </exception> public FfmpegDecoder(Stream stream) { if (stream == null) { throw new ArgumentNullException("stream"); } _ffmpegStream = new FfmpegStream(stream); _formatContext = new AvFormatContext(_ffmpegStream); Initialize(); }
/// <summary> /// Releases unmanaged and - optionally - managed resources. /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> protected void Dispose(bool disposing) { GC.SuppressFinalize(this); if (disposing) { if (_formatContext != null) { _formatContext.Dispose(); _formatContext = null; } if (_ffmpegStream != null) { _ffmpegStream.Dispose(); _ffmpegStream = null; } } }
public unsafe AvFrame(AvFormatContext formatContext) { _formatContext = formatContext; _frame = FfmpegCalls.AvFrameAlloc(); }
internal static unsafe bool AvReadFrame(AvFormatContext formatContext, AVPacket *packet) { int result = ffmpeg.av_read_frame((AVFormatContext *)formatContext.FormatPtr, packet); return(result >= 0); }
/// <summary> /// Initializes a new instance of the <see cref="FfmpegDecoder" /> class based on a specified filename or url. /// </summary> /// <param name="url">A url containing a filename or web url. </param> /// <exception cref="FfmpegException"> /// Any ffmpeg error. /// </exception> /// <exception cref="System.NotSupportedException"> /// DBL format is not supported. /// or /// Audio Sample Format not supported. /// </exception> /// <exception cref="ArgumentNullException">uri</exception> public FfmpegDecoder(string url) { _uri = new Uri(url); _formatContext = new AvFormatContext(url); Initialize(); }