Struct SourceContext

Source
pub struct SourceContext { /* private fields */ }
Expand description

Context wrapping an OBS source - video / audio elements which are displayed to the screen.

See OBS documentation

Implementations§

Source§

impl SourceContext

Source

pub unsafe fn from_raw(source: *mut obs_source_t) -> Self

§Safety

Must call with a valid pointer.

Source§

impl SourceContext

Source

pub fn do_with_target<F: FnOnce(&mut SourceContext)>(&mut self, func: F)

Run a function on the next source in the filter chain.

Note: only works with sources that are filters.

Source

pub fn id(&self) -> usize

Return a unique id for the filter

Source

pub fn get_base_width(&self) -> u32

Source

pub fn get_base_height(&self) -> u32

Source

pub fn showing(&self) -> bool

Source

pub fn active(&self) -> bool

Source

pub fn enabled(&self) -> bool

Source

pub fn set_enabled(&mut self, enabled: bool)

Source

pub fn source_id(&self) -> Option<&str>

Source

pub fn name(&self) -> Option<&str>

Source

pub fn set_name(&mut self, name: &str)

Source

pub fn width(&self) -> u32

Source

pub fn height(&self) -> u32

Source

pub fn media_play_pause(&mut self, pause: bool)

Source

pub fn media_restart(&mut self)

Source

pub fn media_stop(&mut self)

Source

pub fn media_next(&mut self)

Source

pub fn media_previous(&mut self)

Source

pub fn media_duration(&self) -> i64

Source

pub fn media_time(&self) -> i64

Source

pub fn media_set_time(&mut self, ms: i64)

Source

pub fn media_state(&self) -> MediaState

Source

pub fn media_started(&mut self)

Source

pub fn media_ended(&mut self)

Source

pub fn skip_video_filter(&mut self)

Skips the video filter if it’s invalid

Source

pub fn process_filter<F: FnOnce(&mut GraphicsEffectContext, &mut GraphicsEffect)>( &mut self, _render: &mut VideoRenderContext, effect: &mut GraphicsEffect, (cx, cy): (u32, u32), format: GraphicsColorFormat, direct: GraphicsAllowDirectRendering, func: F, )

Run a function to do drawing - if the source is a filter. This function is wrapped by calls that automatically handle effect-based filter processing.

See OBS documentation

Note: only works with sources that are filters.

Source

pub fn process_filter_tech<F: FnOnce(&mut GraphicsEffectContext, &mut GraphicsEffect)>( &mut self, _render: &mut VideoRenderContext, effect: &mut GraphicsEffect, (cx, cy): (u32, u32), format: GraphicsColorFormat, direct: GraphicsAllowDirectRendering, technique: ObsString, func: F, )

Source

pub fn update_source_settings(&mut self, settings: &mut DataObj<'_>)

Update the source settings based on a settings context.

Trait Implementations§

Source§

impl Clone for SourceContext

Source§

fn clone(&self) -> Self

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 Drop for SourceContext

Source§

fn drop(&mut self)

Executes the destructor for this type. 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.