Skip to main content

Options

Struct Options 

Source
pub struct Options { /* private fields */ }
Available on crate features 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

Source

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.

Source

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”.

Source

pub const fn with_threshold(self, val: u8) -> Self

Set the threshold.

Source

pub const fn set_threshold(&mut self, val: u8) -> &mut Self

Set the threshold in place.

Source

pub const fn method(&self) -> Method

Returns the fade-detection Method.

Source

pub const fn with_method(self, val: Method) -> Self

Set the method.

Source

pub const fn set_method(&mut self, val: Method) -> &mut Self

Set the method in place.

Source

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.

Source

pub const fn with_fade_bias(self, val: f64) -> Self

Set the fade bias.

Source

pub const fn set_fade_bias(&mut self, val: f64) -> &mut Self

Set the fade bias in place.

Source

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.

Source

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.

Source

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.

Source

pub const fn min_duration(&self) -> Duration

Returns the minimum scene duration.

Source

pub const fn with_min_duration(self, val: Duration) -> Self

Set the minimum scene duration.

Source

pub const fn set_min_duration(&mut self, val: Duration) -> &mut Self

Set the minimum scene duration in place.

Source

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.

Source

pub const fn set_min_frames(&mut self, frames: u32, fps: Timebase) -> &mut Self

In-place form of Self::with_min_frames.

Source

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 least Self::min_duration. Matches PySceneDetect’s default.
Source

pub const fn with_initial_cut(self, val: bool) -> Self

Sets whether the first detected cut may fire immediately.

Source

pub const fn set_initial_cut(&mut self, val: bool) -> &mut Self

Sets initial_cut in place.

Trait Implementations§

Source§

impl Clone for Options

Source§

fn clone(&self) -> Options

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Options

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Options

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Options

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Options

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,