pub trait ObsOutputTrait: ObsOutputTraitSealed + ObsObjectTrait<Native = *mut obs_output_t> {
Show 36 methods
// Required method
fn signals(&self) -> &Arc<ObsOutputSignals> ⓘ;
// Provided methods
fn attached_video_encoder(
&self,
) -> Result<Option<Arc<ObsVideoEncoder>>, ObsError> { ... }
fn attached_audio_encoder(
&self,
slot: usize,
) -> Result<Option<Arc<ObsAudioEncoder>>, ObsError> { ... }
fn attached_audio_encoder_at_slot(
&self,
slot: AudioEncoderSlot,
) -> Result<Option<Arc<ObsAudioEncoder>>, ObsError> { ... }
fn attached_audio_encoders(
&self,
) -> Result<HashMap<usize, Arc<ObsAudioEncoder>>, ObsError> { ... }
fn attached_service(&self) -> Result<Option<Arc<ObsServiceRef>>, ObsError> { ... }
fn get_current_video_encoder(
&self,
) -> Result<Option<Arc<ObsVideoEncoder>>, ObsError> { ... }
fn get_current_audio_encoder(
&self,
mixer_idx: usize,
) -> Result<Option<Arc<ObsAudioEncoder>>, ObsError> { ... }
fn get_current_audio_encoders(
&self,
) -> Result<HashMap<usize, Arc<ObsAudioEncoder>>, ObsError> { ... }
fn get_current_service(
&self,
) -> Result<Option<Arc<ObsServiceRef>>, ObsError> { ... }
fn current_composition(&self) -> Result<ObsOutputComposition, ObsError> { ... }
fn set_service(&self, service: Arc<ObsServiceRef>) -> Result<(), ObsError> { ... }
fn apply_composition(
&self,
composition: ObsOutputComposition,
) -> Result<(), ObsError> { ... }
fn clear_video_encoder(&self) -> Result<(), ObsError> { ... }
fn clear_audio_encoder(&self, mixer_idx: usize) -> Result<(), ObsError> { ... }
fn clear_audio_encoder_at_slot(
&self,
slot: AudioEncoderSlot,
) -> Result<(), ObsError> { ... }
fn clear_service(&self) -> Result<(), ObsError> { ... }
fn create_and_set_video_encoder(
&self,
info: VideoEncoderInfo,
) -> Result<Arc<ObsVideoEncoder>, ObsError> { ... }
fn set_video_encoder(
&self,
encoder: Arc<ObsVideoEncoder>,
) -> Result<(), ObsError> { ... }
fn create_and_set_audio_encoder(
&self,
info: AudioEncoderInfo,
index: usize,
) -> Result<Arc<ObsAudioEncoder>, ObsError> { ... }
fn create_and_set_audio_encoder_for_mix_at_slot(
&self,
info: AudioEncoderInfo,
mix: AudioMixIndex,
slot: AudioEncoderSlot,
) -> Result<Arc<ObsAudioEncoder>, ObsError> { ... }
fn set_audio_encoder(
&self,
encoder: Arc<ObsAudioEncoder>,
mixer_idx: usize,
) -> Result<(), ObsError> { ... }
fn set_audio_encoder_at_slot(
&self,
encoder: Arc<ObsAudioEncoder>,
slot: AudioEncoderSlot,
) -> Result<(), ObsError> { ... }
fn start(&self) -> Result<(), ObsError> { ... }
fn set_paused_with_timeout(
&self,
should_pause: bool,
timeout: Duration,
) -> Result<(), ObsError> { ... }
fn pause(&self) -> Result<(), ObsError> { ... }
fn pause_with_timeout(&self, timeout: Duration) -> Result<(), ObsError> { ... }
fn unpause(&self) -> Result<(), ObsError> { ... }
fn unpause_with_timeout(&self, timeout: Duration) -> Result<(), ObsError> { ... }
fn stop(&self) -> Result<(), ObsError> { ... }
fn stop_with_timeout(&self, timeout: Duration) -> Result<(), ObsError> { ... }
fn force_stop(&self) -> Result<(), ObsError> { ... }
fn force_stop_with_timeout(&self, timeout: Duration) -> Result<(), ObsError> { ... }
fn is_active(&self) -> Result<bool, ObsError> { ... }
fn is_paused(&self) -> Result<bool, ObsError> { ... }
fn is_reconnecting(&self) -> Result<bool, ObsError> { ... }
}Required Methods§
fn signals(&self) -> &Arc<ObsOutputSignals> ⓘ
Provided Methods§
Sourcefn attached_video_encoder(
&self,
) -> Result<Option<Arc<ObsVideoEncoder>>, ObsError>
fn attached_video_encoder( &self, ) -> Result<Option<Arc<ObsVideoEncoder>>, ObsError>
Returns the video encoder currently attached to this output, if any.
Sourcefn attached_audio_encoder(
&self,
slot: usize,
) -> Result<Option<Arc<ObsAudioEncoder>>, ObsError>
fn attached_audio_encoder( &self, slot: usize, ) -> Result<Option<Arc<ObsAudioEncoder>>, ObsError>
Returns the audio encoder attached at the requested mixer index, if any.
Compatibility helper: slot is the output attachment slot, not an audio mix.
fn attached_audio_encoder_at_slot( &self, slot: AudioEncoderSlot, ) -> Result<Option<Arc<ObsAudioEncoder>>, ObsError>
Sourcefn attached_audio_encoders(
&self,
) -> Result<HashMap<usize, Arc<ObsAudioEncoder>>, ObsError>
fn attached_audio_encoders( &self, ) -> Result<HashMap<usize, Arc<ObsAudioEncoder>>, ObsError>
Returns a snapshot of all managed audio encoder attachments keyed by mixer index.
Sourcefn attached_service(&self) -> Result<Option<Arc<ObsServiceRef>>, ObsError>
fn attached_service(&self) -> Result<Option<Arc<ObsServiceRef>>, ObsError>
Returns the streaming service attached to this output, if any.
fn get_current_video_encoder( &self, ) -> Result<Option<Arc<ObsVideoEncoder>>, ObsError>
Use attached_video_encoder
fn get_current_audio_encoder( &self, mixer_idx: usize, ) -> Result<Option<Arc<ObsAudioEncoder>>, ObsError>
Use attached_audio_encoder
fn get_current_audio_encoders( &self, ) -> Result<HashMap<usize, Arc<ObsAudioEncoder>>, ObsError>
Use attached_audio_encoders
fn get_current_service(&self) -> Result<Option<Arc<ObsServiceRef>>, ObsError>
Use attached_service
Sourcefn current_composition(&self) -> Result<ObsOutputComposition, ObsError>
fn current_composition(&self) -> Result<ObsOutputComposition, ObsError>
Returns an owned, coherent snapshot of the currently managed encoder/service wiring.
Sourcefn set_service(&self, service: Arc<ObsServiceRef>) -> Result<(), ObsError>
fn set_service(&self, service: Arc<ObsServiceRef>) -> Result<(), ObsError>
Attaches a streaming service to this output. Fails while the output is active.
Sourcefn apply_composition(
&self,
composition: ObsOutputComposition,
) -> Result<(), ObsError>
fn apply_composition( &self, composition: ObsOutputComposition, ) -> Result<(), ObsError>
Replaces the complete managed output wiring in one actor command.
This is the preferred API when constructing an output from discovered capabilities: it validates all runtime affinities before touching libobs, detaches omitted components, and updates the Rust-side ownership graph only after the native calls complete.
Sourcefn clear_video_encoder(&self) -> Result<(), ObsError>
fn clear_video_encoder(&self) -> Result<(), ObsError>
Detaches the current video encoder while the output is inactive.
Sourcefn clear_audio_encoder(&self, mixer_idx: usize) -> Result<(), ObsError>
fn clear_audio_encoder(&self, mixer_idx: usize) -> Result<(), ObsError>
Detaches the audio encoder at an output attachment slot while inactive. The historical parameter name was “mixer index”; it never selected the encoder’s source mix.
fn clear_audio_encoder_at_slot( &self, slot: AudioEncoderSlot, ) -> Result<(), ObsError>
Sourcefn clear_service(&self) -> Result<(), ObsError>
fn clear_service(&self) -> Result<(), ObsError>
Detaches the current streaming service while the output is inactive.
Sourcefn create_and_set_video_encoder(
&self,
info: VideoEncoderInfo,
) -> Result<Arc<ObsVideoEncoder>, ObsError>
fn create_and_set_video_encoder( &self, info: VideoEncoderInfo, ) -> Result<Arc<ObsVideoEncoder>, ObsError>
Creates and attaches a new video encoder to this output.
Fails if the output is active.
Sourcefn set_video_encoder(
&self,
encoder: Arc<ObsVideoEncoder>,
) -> Result<(), ObsError>
fn set_video_encoder( &self, encoder: Arc<ObsVideoEncoder>, ) -> Result<(), ObsError>
Attaches an existing video encoder to this output.
Fails if the output is active.
Sourcefn create_and_set_audio_encoder(
&self,
info: AudioEncoderInfo,
index: usize,
) -> Result<Arc<ObsAudioEncoder>, ObsError>
fn create_and_set_audio_encoder( &self, info: AudioEncoderInfo, index: usize, ) -> Result<Arc<ObsAudioEncoder>, ObsError>
Compatibility helper that historically used one integer for both concepts.
It creates an encoder reading native mix index and also attaches it at output slot
index. New code should use Self::create_and_set_audio_encoder_for_mix_at_slot.
Sourcefn create_and_set_audio_encoder_for_mix_at_slot(
&self,
info: AudioEncoderInfo,
mix: AudioMixIndex,
slot: AudioEncoderSlot,
) -> Result<Arc<ObsAudioEncoder>, ObsError>
fn create_and_set_audio_encoder_for_mix_at_slot( &self, info: AudioEncoderInfo, mix: AudioMixIndex, slot: AudioEncoderSlot, ) -> Result<Arc<ObsAudioEncoder>, ObsError>
Creates an encoder for mix and attaches it independently at output slot.
Sourcefn set_audio_encoder(
&self,
encoder: Arc<ObsAudioEncoder>,
mixer_idx: usize,
) -> Result<(), ObsError>
fn set_audio_encoder( &self, encoder: Arc<ObsAudioEncoder>, mixer_idx: usize, ) -> Result<(), ObsError>
Compatibility helper: mixer_idx is actually an output attachment slot.
Sourcefn set_audio_encoder_at_slot(
&self,
encoder: Arc<ObsAudioEncoder>,
slot: AudioEncoderSlot,
) -> Result<(), ObsError>
fn set_audio_encoder_at_slot( &self, encoder: Arc<ObsAudioEncoder>, slot: AudioEncoderSlot, ) -> Result<(), ObsError>
Attaches an existing audio encoder at an output slot. The encoder retains its own,
independently selected AudioMixIndex.
Sourcefn start(&self) -> Result<(), ObsError>
fn start(&self) -> Result<(), ObsError>
Starts the output, wiring encoders to global contexts and invoking obs_output_start.
Lifecycle requests are serialized per output. Starting an already-active output keeps the
historical OutputAlreadyActive error so accidental duplicate starts remain visible.
Sourcefn set_paused_with_timeout(
&self,
should_pause: bool,
timeout: Duration,
) -> Result<(), ObsError>
fn set_paused_with_timeout( &self, should_pause: bool, timeout: Duration, ) -> Result<(), ObsError>
Pauses/resumes with an explicit completion deadline.
Repeating the state already in effect is idempotent and returns immediately. Concurrent
lifecycle requests are serialized so one request cannot consume another request’s signal.
A timeout does not cancel the native pause request; query Self::is_paused before
retrying.
Sourcefn pause(&self) -> Result<(), ObsError>
fn pause(&self) -> Result<(), ObsError>
Pauses the output with DEFAULT_OUTPUT_OPERATION_TIMEOUT.
Sourcefn pause_with_timeout(&self, timeout: Duration) -> Result<(), ObsError>
fn pause_with_timeout(&self, timeout: Duration) -> Result<(), ObsError>
Pauses the output and waits at most timeout for native completion.
Sourcefn unpause(&self) -> Result<(), ObsError>
fn unpause(&self) -> Result<(), ObsError>
Resumes the output with DEFAULT_OUTPUT_OPERATION_TIMEOUT.
Sourcefn unpause_with_timeout(&self, timeout: Duration) -> Result<(), ObsError>
fn unpause_with_timeout(&self, timeout: Duration) -> Result<(), ObsError>
Resumes the output and waits at most timeout for native completion.
Sourcefn stop(&self) -> Result<(), ObsError>
fn stop(&self) -> Result<(), ObsError>
Stops the output with DEFAULT_OUTPUT_OPERATION_TIMEOUT.
Stop is idempotent: if the output is already inactive and not reconnecting, this returns
Ok(()). A timeout only bounds this caller’s wait; libobs may complete later. The managed
output continues retaining its encoder/service graph. Re-query Self::is_active and
Self::is_reconnecting before changing or releasing that graph.
Sourcefn stop_with_timeout(&self, timeout: Duration) -> Result<(), ObsError>
fn stop_with_timeout(&self, timeout: Duration) -> Result<(), ObsError>
Requests a graceful stop and waits at most one overall timeout for both the stop and
deactivate completion signals. Time spent waiting behind another lifecycle/configuration
operation consumes the same deadline.
Sourcefn force_stop(&self) -> Result<(), ObsError>
fn force_stop(&self) -> Result<(), ObsError>
Requests libobs’s force-stop recovery path and waits for normal stop/deactivate completion.
obs_output_force_stop asks the output to stop immediately without waiting for queued data;
it is appropriate after a graceful stop deadline when data loss is preferable to waiting.
It is not cancellation and still uses the same bounded completion semantics here.
Sourcefn force_stop_with_timeout(&self, timeout: Duration) -> Result<(), ObsError>
fn force_stop_with_timeout(&self, timeout: Duration) -> Result<(), ObsError>
Force-stop variant with an explicit overall deadline.
Sourcefn is_reconnecting(&self) -> Result<bool, ObsError>
fn is_reconnecting(&self) -> Result<bool, ObsError>
Returns whether the output is currently reconnecting.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".