#[repr(u8)]pub enum SeekMode {
Keyframe = 0,
Exact = 1,
Backward = 2,
}Expand description
Seek mode for positioning the decoder.
This enum determines how seeking is performed when navigating through a media file.
§Performance Considerations
Keyframeis fastest but may land slightly before or after the targetExactis slower but guarantees landing on the exact frameBackwardis useful for editing workflows where the previous keyframe is needed
§Examples
use ff_decode::SeekMode;
// Default is Keyframe mode
let mode = SeekMode::default();
assert_eq!(mode, SeekMode::Keyframe);
// Use exact mode for frame-accurate positioning
let exact = SeekMode::Exact;
assert_eq!(format!("{:?}", exact), "Exact");Variants§
Keyframe = 0
Seek to nearest keyframe (fast, may have small offset).
This mode seeks to the closest keyframe to the target position. It’s the fastest option but the actual position may differ from the requested position by up to the GOP (Group of Pictures) size.
Exact = 1
Seek to exact frame (slower but precise).
This mode first seeks to the previous keyframe, then decodes frames until reaching the exact target position. This guarantees frame-accurate positioning but is slower, especially for long GOPs.
Backward = 2
Seek to keyframe at or before the target position.
Similar to Keyframe, but guarantees the resulting
position is at or before the target. Useful for editing workflows
where you need to start decoding before a specific point.