pub struct Options { /* private fields */ }std or alloc only.Expand description
Options for the intensity-threshold scene detector. See the module docs for how each parameter shapes the algorithm.
Implementations§
Source§impl Options
impl Options
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a new Options with default values.
Defaults: threshold = 12, method = Floor, fade_bias = 0.0,
add_final_scene = false, min_duration = 1 s.
Sourcepub const fn threshold(&self) -> u8
pub const fn threshold(&self) -> u8
Returns the mean-intensity threshold used for fade detection.
Interpreted as an 8-bit brightness value in [0, 255]. Frames with a
mean below this (for Method::Floor) are considered “dark”.
Sourcepub const fn with_threshold(self, val: u8) -> Self
pub const fn with_threshold(self, val: u8) -> Self
Set the threshold.
Sourcepub const fn set_threshold(&mut self, val: u8) -> &mut Self
pub const fn set_threshold(&mut self, val: u8) -> &mut Self
Set the threshold in place.
Sourcepub const fn with_method(self, val: Method) -> Self
pub const fn with_method(self, val: Method) -> Self
Set the method.
Sourcepub const fn set_method(&mut self, val: Method) -> &mut Self
pub const fn set_method(&mut self, val: Method) -> &mut Self
Set the method in place.
Sourcepub const fn fade_bias(&self) -> f64
pub const fn fade_bias(&self) -> f64
Returns the fade bias, clamped to [-1.0, 1.0] at use time.
Controls cut placement between the fade-out and fade-in frames:
-1 = at fade-out, 0 = midpoint (default), +1 = at fade-in.
Sourcepub const fn with_fade_bias(self, val: f64) -> Self
pub const fn with_fade_bias(self, val: f64) -> Self
Set the fade bias.
Sourcepub const fn set_fade_bias(&mut self, val: f64) -> &mut Self
pub const fn set_fade_bias(&mut self, val: f64) -> &mut Self
Set the fade bias in place.
Sourcepub const fn add_final_scene(&self) -> bool
pub const fn add_final_scene(&self) -> bool
Returns whether Detector::finish will emit a final cut when the
stream ends in the Out state.
Sourcepub const fn with_add_final_scene(self, val: bool) -> Self
pub const fn with_add_final_scene(self, val: bool) -> Self
Set whether to emit a final cut at end-of-stream when in Out state.
Sourcepub const fn set_add_final_scene(&mut self, val: bool) -> &mut Self
pub const fn set_add_final_scene(&mut self, val: bool) -> &mut Self
Set whether to emit a final cut at end-of-stream in place.
Sourcepub const fn min_duration(&self) -> Duration
pub const fn min_duration(&self) -> Duration
Returns the minimum scene duration.
Sourcepub const fn with_min_duration(self, val: Duration) -> Self
pub const fn with_min_duration(self, val: Duration) -> Self
Set the minimum scene duration.
Sourcepub const fn set_min_duration(&mut self, val: Duration) -> &mut Self
pub const fn set_min_duration(&mut self, val: Duration) -> &mut Self
Set the minimum scene duration in place.
Sourcepub const fn with_min_frames(self, frames: u32, fps: Timebase) -> Self
pub const fn with_min_frames(self, frames: u32, fps: Timebase) -> Self
Set the minimum scene length as a number of frames at a given frame rate.
See crate::histogram::Options::with_min_frames for the semantics.
Sourcepub const fn set_min_frames(&mut self, frames: u32, fps: Timebase) -> &mut Self
pub const fn set_min_frames(&mut self, frames: u32, fps: Timebase) -> &mut Self
In-place form of Self::with_min_frames.
Sourcepub const fn initial_cut(&self) -> bool
pub const fn initial_cut(&self) -> bool
Whether the first detected cut is allowed to fire immediately.
true(default): the first complete fade cycle emits a cut as soon as the min-duration gate is satisfied relative to stream start.false: suppresses cuts until the stream has actually run for at leastSelf::min_duration. Matches PySceneDetect’s default.
Sourcepub const fn with_initial_cut(self, val: bool) -> Self
pub const fn with_initial_cut(self, val: bool) -> Self
Sets whether the first detected cut may fire immediately.
Sourcepub const fn set_initial_cut(&mut self, val: bool) -> &mut Self
pub const fn set_initial_cut(&mut self, val: bool) -> &mut Self
Sets initial_cut in place.