#[repr(transparent)]
pub struct FilterRef<T> { /* private fields */ }
Expand description

Wrapper for the external pw_sys::pw_filter value. The filter object provides a convenient way to implement processing filters.

Implementations§

source§

impl<T> FilterRef<T>

source

pub fn get_state_and_error(&self) -> (FilterState, Option<CString>)

source

pub fn get_state(&self) -> FilterState

source

pub fn get_error(&self) -> Option<CString>

source

pub fn get_name(&self) -> Option<&CStr>

source

pub fn get_core(&self) -> &CoreRef

source

pub fn connect(&self, flags: FilterFlags, params: &[&PodRef]) -> Result<()>

Connect a filter for processing.

source

pub fn get_node_id(&self) -> u32

source

pub fn disconnect(&self) -> Result<()>

Disconnect the filter and stop processing.

source

pub unsafe fn add_port( &self, direction: Direction, flags: PortFlags, props: Properties, params: Option<&[&PodRef]> ) -> Result<*mut *mut T>

Add port to the filter.

Arguments
  • direction - port direction
  • flags - port flags
  • props - port properties
  • params - port parameters

Returns a mut pointer to user data.

Safety

Result is the pointer to the port structure and it should not be modified.

source

pub unsafe fn remove_port(&self, port: *mut *mut T) -> Result<()>

Remove the port.

Safety

port is a pointer to the port structure and it should not be modified.

source

pub unsafe fn get_properties(&self, port: *mut *mut T) -> &PropertiesRef

Get port properties or global properties when port is null

Safety

port is a pointer to the port structure and it should not be modified.

source

pub unsafe fn update_properties( &self, port: *mut *mut T, properties: &DictRef ) -> i32

Update port properties or global properties when port is null.

Safety

port is a pointer to the port structure and it should not be modified.

source

pub fn set_error(&self, res: i32, error: &CStr)

source

pub unsafe fn update_params( &self, port: *mut *mut T, params: &[&PodRef] ) -> Result<()>

Update port parameters or global parameters when port is null.

Safety

port is a pointer to the port structure and it should not be modified.

source

pub unsafe fn dequeue_buffer(&self, port: *mut *mut T) -> Option<&mut BufferRef>

Get a buffer that can be filled for output ports or consumed for input ports.

Safety

port is a pointer to the port structure and it should not be modified.

source

pub unsafe fn queue_buffer( &self, port: *mut *mut T, buffer: &BufferRef ) -> Result<()>

Submit a buffer for playback or recycle a buffer for capture.

Safety

port is a pointer to the port structure and it should not be modified.

source

pub unsafe fn get_dsp_buffer<S: Sized>( &self, port: *mut *mut T, n_samples: u32 ) -> Result<&mut [S]>

Get a data pointer to the buffer data.

Safety

port is a pointer to the port structure and it should not be modified.

source

pub fn set_active(&self, active: bool) -> Result<()>

Activate or deactivate the filter

source

pub fn flush(&self, drain: bool) -> Result<()>

Flush a filter. When drain is true, the drained callback will be called when all data is played or recorded

Trait Implementations§

source§

impl<'a, T: 'a> AddListener<'a> for FilterRef<T>

§

type Events = FilterEvents<'a, T>

Events listener struct
source§

fn add_listener(&self, events: Pin<Box<Self::Events>>) -> Pin<Box<Self::Events>>

Register listener and return it. Read more
source§

impl<'a, T> AsMut<FilterRef<T>> for Filter<'a, T>

source§

fn as_mut(&mut self) -> &mut <Self as Wrapper>::RawWrapperType

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<'a, T> AsRef<FilterRef<T>> for Filter<'a, T>

source§

fn as_ref(&self) -> &<Self as Wrapper>::RawWrapperType

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<T: Debug> Debug for FilterRef<T>

source§

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

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

impl<T> From<FilterRef<T>> for pw_filter

source§

fn from(value: FilterRef<T>) -> Self

Converts to this type from the input type.
source§

impl<T> From<pw_filter> for FilterRef<T>

source§

fn from(value: pw_filter) -> Self

Converts to this type from the input type.
source§

impl<T> RawWrapper for FilterRef<T>

§

type CType = pw_filter

External type
source§

fn as_raw_ptr(&self) -> *mut Self::CType

Raw ptr to the external type
source§

fn as_raw(&self) -> &Self::CType

Wrapped external value
source§

fn from_raw(raw: Self::CType) -> Self

Creates wrapper from the external value, can be use when external type has no raw pointers.
source§

unsafe fn mut_from_raw_ptr<'lft>(raw: *mut Self::CType) -> &'lft mut Self

Cast external pointer to the borrowed mutable wrapper. Panic when pointer is null. Lifetime is not reliable and should be guaranteed explicitly. Read more
source§

unsafe fn from_raw_ptr<'a>(raw: *const Self::CType) -> &'a Self

Cast external pointer to the borrowed wrapper. Panic when pointer is null. Lifetime is not reliable and should be guaranteed explicitly. Read more
source§

fn as_ptr(&self) -> *mut Self

Raw mutable pointer to Self

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for FilterRef<T>where T: RefUnwindSafe,

§

impl<T> Send for FilterRef<T>where T: Send,

§

impl<T> Sync for FilterRef<T>where T: Sync,

§

impl<T> Unpin for FilterRef<T>where T: Unpin,

§

impl<T> UnwindSafe for FilterRef<T>where T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.