/// <summary> /// Seeks stream to the specified target timestamp. /// </summary> /// <param name="targetTs">The target timestamp in the default stream time base.</param> public void SeekFile(long targetTs) { ffmpeg.av_seek_frame(Pointer, Video.Info.Index, targetTs, ffmpeg.AVSEEK_FLAG_BACKWARD).ThrowIfError($"Seek to {targetTs} failed."); IsAtEndOfFile = false; Video.ClearQueue(); Video.FlushBuffers(); AddPacket(MediaType.Video); Video.AdjustPackets(targetTs); }
/// <summary> /// Seeks stream by skipping next packets in the file. Useful to seek few frames forward. /// </summary> /// <param name="targetTs">The target timestamp in the default stream time base.</param> public void SeekForward(long targetTs) => Video.AdjustPackets(targetTs);