public void SelectStream(AVMediaType type) { this.type = type; streamIndex = ffmpeg.av_find_best_stream(formatContext, type, -1, -1, null, 0); if (streamIndex < 0) { throw new FFmpegException(streamIndex, "Failed to find stream for type " + type.ToString()); } SetupCodecContext(formatContext->streams[streamIndex]); }