pub struct ManagedTransition { /* private fields */ }Expand description
Managed controller around an OBS transition source.
The destination is retained while native transition work is active. Self::begin_to is the
non-blocking form for editor/event-loop integrations: initiate a transition, optionally interrupt
it with Self::force_stop, and call Self::wait_for_completion when a bounded synchronous
wait is appropriate. Self::start_to_with_timeout combines begin + wait for simpler workflows.
If a bounded wait times out, the destination remains retained in in_flight until a later wait,
Self::reconcile, or Self::force_stop resolves native state. Timeout therefore never claims
to cancel libobs work or releases the destination prematurely.
Implementations§
Source§impl ManagedTransition
impl ManagedTransition
pub fn new(transition: ObsSourceRef) -> Result<Self, ObsError>
pub fn source(&self) -> &ObsSourceRef
pub fn current_source(&self) -> Result<Option<ObsSourceRef>, ObsError>
pub fn set_current_source(&self, source: ObsSourceRef) -> Result<(), ObsError>
pub fn is_active(&self) -> Result<bool, ObsError>
pub fn start_to( &self, destination: ObsSourceRef, duration: Duration, ) -> Result<(), ObsError>
Sourcepub fn begin_to(
&self,
destination: ObsSourceRef,
duration: Duration,
) -> Result<(), ObsError>
pub fn begin_to( &self, destination: ObsSourceRef, duration: Duration, ) -> Result<(), ObsError>
Starts an automatic transition without blocking the caller.
Active transitions are rejected rather than implicitly interrupted. This form is intended
for GUI/event-loop code that needs to remain responsive and possibly call Self::force_stop
before later waiting or reconciling.
Sourcepub fn wait_for_completion(&self, timeout: Duration) -> Result<(), ObsError>
pub fn wait_for_completion(&self, timeout: Duration) -> Result<(), ObsError>
Waits for the transition initiated by Self::begin_to.
A timeout leaves both destination and completion subscription retained so callers can retry the wait or reconcile native state later. Calling this on the OBS actor thread is rejected because it would prevent libobs from making progress.
Sourcepub fn start_to_with_timeout(
&self,
destination: ObsSourceRef,
duration: Duration,
timeout: Duration,
) -> Result<(), ObsError>
pub fn start_to_with_timeout( &self, destination: ObsSourceRef, duration: Duration, timeout: Duration, ) -> Result<(), ObsError>
Starts an automatic transition and waits for transition_stop.
Sourcepub fn force_stop(&self) -> Result<(), ObsError>
pub fn force_stop(&self) -> Result<(), ObsError>
Interrupts a managed transition and deterministically snaps to its requested destination.
libobs’s obs_transition_force_stop invokes plugin-specific stop hooks/signals but does not
by itself reset generic transition source state. We therefore follow it with
obs_transition_set, retaining the destination through the actor call and making the native
transition inactive before returning.