Struct pipewire::stream::StreamRef

source ·
pub struct StreamRef(/* private fields */);

Implementations§

source§

impl StreamRef

source

pub fn as_raw(&self) -> &pw_stream

source

pub fn as_raw_ptr(&self) -> *mut pw_stream

source

pub fn add_local_listener_with_user_data<D>( &self, user_data: D ) -> ListenerLocalBuilder<'_, D>

Add a local listener builder

source

pub fn add_local_listener<D: Default>(&self) -> ListenerLocalBuilder<'_, D>

Add a local listener builder. User data is initialized with its default value

source

pub fn connect( &self, direction: Direction, id: Option<u32>, flags: StreamFlags, params: &mut [&Pod] ) -> Result<(), Error>

Connect the stream

Tries to connect to the node id in the given direction. If no node is provided then any suitable node will be used.

source

pub fn update_params(&self, params: &mut [&Pod]) -> Result<(), Error>

Update Parameters

Call from the param_changed callback to negotiate a new set of parameters for the stream.

source

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

Activate or deactivate the stream

source

pub unsafe fn dequeue_raw_buffer(&self) -> *mut pw_buffer

Take a Buffer from the Stream

Removes a buffer from the stream. If this is an input stream the buffer will contain data ready to process. If this is an output stream it can be filled.

§Safety

The pointer returned could be NULL if no buffer is available. The buffer should be returned to the stream once processing is complete.

source

pub fn dequeue_buffer(&self) -> Option<Buffer<'_>>

source

pub unsafe fn queue_raw_buffer(&self, buffer: *mut pw_buffer)

Return a Buffer to the Stream

Give back a buffer once processing is complete. Use this to queue up a frame for an output stream, or return the buffer to the pool ready to receive new data for an input stream.

§Safety

The buffer pointer should be one obtained from this stream instance by a call to StreamRef::dequeue_raw_buffer().

source

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

Disconnect the stream

source

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

Set the stream in error state

§Panics

Will panic if error contains a 0 byte.

source

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

Set the stream in error state with CStr

§Panics

Will panic if error contains a 0 byte.

source

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

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

source

pub fn set_control(&self, id: u32, values: &[f32]) -> Result<(), Error>

source

pub fn name(&self) -> String

Get the name of the stream.

source

pub fn state(&self) -> StreamState

Get the current state of the stream.

source

pub fn properties(&self) -> &PropertiesRef

Get the properties of the stream.

source

pub fn node_id(&self) -> u32

Get the node ID of the stream.

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> 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>,

§

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>,

§

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.