private unsafe void Initialize() { FfmpegCalls.AvFormatFindStreamInfo(_formatContext); BestAudioStreamIndex = FfmpegCalls.AvFindBestStreamInfo(_formatContext); _stream = new AvStream((IntPtr)_formatContext->streams[BestAudioStreamIndex]); Metadata = new Dictionary <string, string>(); if (_formatContext->metadata != null) { var metadata = _formatContext->metadata->Elements; foreach (var element in metadata) { Metadata.Add(element.Key, element.Value); } } }
public unsafe void Dispose() { GC.SuppressFinalize(this); if (SelectedStream != null) { SelectedStream.Dispose(); _stream = null; } if (_formatContext != null) { fixed(AVFormatContext **pformatContext = &_formatContext) { FfmpegCalls.AvformatCloseInput(pformatContext); } _formatContext = null; BestAudioStreamIndex = 0; } }
private unsafe void Initialize() { FfmpegCalls.AvFormatFindStreamInfo(_formatContext); BestAudioStreamIndex = FfmpegCalls.AvFindBestStreamInfo(_formatContext); _stream = new AvStream((IntPtr)_formatContext->streams[BestAudioStreamIndex]); }