/// <summary> /// Seek the decoder to the given timestamp. This will fail if <see cref="CanSeek"/> is false. /// </summary> /// <param name="targetTimestamp">The timestamp to seek to.</param> public void Seek(double targetTimestamp) { if (!CanSeek) { throw new InvalidOperationException("This decoder cannot seek because the underlying stream used to decode the video does not support seeking."); } decoderCommands.Enqueue(() => { ffmpeg.av_seek_frame(formatContext, stream->index, (long)(targetTimestamp / timeBaseInSeconds / 1000.0), AGffmpeg.AVSEEK_FLAG_BACKWARD); skipOutputUntilTime = targetTimestamp; }); }