Skip to main content

ManagedTransition

Struct ManagedTransition 

Source
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

Source

pub fn new(transition: ObsSourceRef) -> Result<Self, ObsError>

Source

pub fn source(&self) -> &ObsSourceRef

Source

pub fn current_source(&self) -> Result<Option<ObsSourceRef>, ObsError>

Source

pub fn set_current_source(&self, source: ObsSourceRef) -> Result<(), ObsError>

Source

pub fn is_active(&self) -> Result<bool, ObsError>

Source

pub fn start_to( &self, destination: ObsSourceRef, duration: Duration, ) -> Result<(), ObsError>

Source

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.

Source

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.

Source

pub fn start_to_with_timeout( &self, destination: ObsSourceRef, duration: Duration, timeout: Duration, ) -> Result<(), ObsError>

Starts an automatic transition and waits for transition_stop.

Source

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.

Source

pub fn reconcile(&self) -> Result<(), ObsError>

Reconciles retained in-flight state after a timeout/late completion.

Trait Implementations§

Source§

impl Debug for ManagedTransition

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for ManagedTransition

§

impl !RefUnwindSafe for ManagedTransition

§

impl !UnwindSafe for ManagedTransition

§

impl Forget for ManagedTransition

§

impl Move for ManagedTransition

§

impl Send for ManagedTransition
where Arc<ObsSourceSignals>: Send, BoxRaw<[u8]>: Send, Arc<RwLock<ImmutableObsData>>: Send, Arc<RwLock<Vec<ObsFilterGuardPair>>>: Send, Arc<Sender<ObsCommand>>: Send, Arc<Sender<Box<dyn FnOnce() + Send>>>: Send, Arc<Atomic<u8>>: Send, Arc<NativeObjectRegistry>: Send, NonZero<u64>: Send, Arc<_ObsRuntimeGuard>: Send, Arc<NativeHandleLease>: Send, Mutex<TransitionState>: Send, Mutex<()>: Send,

§

impl Sync for ManagedTransition
where Arc<ObsSourceSignals>: Sync, BoxRaw<[u8]>: Sync, Arc<RwLock<ImmutableObsData>>: Sync, Arc<RwLock<Vec<ObsFilterGuardPair>>>: Sync, Arc<Sender<ObsCommand>>: Sync, Arc<Sender<Box<dyn FnOnce() + Send>>>: Sync, Arc<Atomic<u8>>: Sync, Arc<NativeObjectRegistry>: Sync, NonZero<u64>: Sync, Arc<_ObsRuntimeGuard>: Sync, Arc<NativeHandleLease>: Sync, Mutex<TransitionState>: Sync, Mutex<()>: Sync,

§

impl Unpin for ManagedTransition
where Arc<ObsSourceSignals>: Unpin, Box<[u8]>: Unpin, Arc<RwLock<ImmutableObsData>>: Unpin, Arc<RwLock<Vec<ObsFilterGuardPair>>>: Unpin, Arc<Sender<ObsCommand>>: Unpin, Arc<Sender<Box<dyn FnOnce() + Send>>>: Unpin, Arc<Atomic<u8>>: Unpin, Arc<NativeObjectRegistry>: Unpin, NonZero<u64>: Unpin, Arc<_ObsRuntimeGuard>: Unpin, Arc<NativeHandleLease>: Unpin, Align1<u8>: Unpin, *mut Counter<Channel<()>>: Unpin, *mut Counter<Channel<()>>: Unpin, *mut Counter<Channel<()>>: Unpin, Arc<Channel>: Unpin, Arc<Channel>: Unpin,

§

impl UnsafeUnpin for ManagedTransition
where *const ArcInner<ObsSourceSignals> is !null: UnsafeUnpin, PhantomData<ArcInner<ObsSourceSignals>>: UnsafeUnpin, *const [u8] is !null: UnsafeUnpin, PhantomData<[u8]>: UnsafeUnpin, *const ArcInner<RwLock<ImmutableObsData>> is !null: UnsafeUnpin, PhantomData<ArcInner<RwLock<ImmutableObsData>>>: UnsafeUnpin, *const ArcInner<RwLock<Vec<ObsFilterGuardPair>>> is !null: UnsafeUnpin, PhantomData<ArcInner<RwLock<Vec<ObsFilterGuardPair>>>>: UnsafeUnpin, *const ArcInner<Sender<ObsCommand>> is !null: UnsafeUnpin, PhantomData<ArcInner<Sender<ObsCommand>>>: UnsafeUnpin, *const ArcInner<Sender<Box<dyn FnOnce() + Send>>> is !null: UnsafeUnpin, PhantomData<ArcInner<Sender<Box<dyn FnOnce() + Send>>>>: UnsafeUnpin, *const ArcInner<Atomic<u8>> is !null: UnsafeUnpin, PhantomData<ArcInner<Atomic<u8>>>: UnsafeUnpin, *const ArcInner<NativeObjectRegistry> is !null: UnsafeUnpin, PhantomData<ArcInner<NativeObjectRegistry>>: UnsafeUnpin, NonZeroU64Inner: UnsafeUnpin, *const ArcInner<_ObsRuntimeGuard> is !null: UnsafeUnpin, PhantomData<ArcInner<_ObsRuntimeGuard>>: UnsafeUnpin, *const ArcInner<NativeHandleLease> is !null: UnsafeUnpin, PhantomData<ArcInner<NativeHandleLease>>: UnsafeUnpin, PhantomData<fn() -> *mut obs_source>: UnsafeUnpin, Align1<u8>: UnsafeUnpin, *mut Counter<Channel<()>>: UnsafeUnpin, *mut Counter<Channel<()>>: UnsafeUnpin, *mut Counter<Channel<()>>: UnsafeUnpin, *const ArcInner<Channel> is !null: UnsafeUnpin, PhantomData<ArcInner<Channel>>: UnsafeUnpin, *const ArcInner<Channel> is !null: UnsafeUnpin, PhantomData<ArcInner<Channel>>: UnsafeUnpin, PhantomData<()>: UnsafeUnpin,

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.