Struct pipewire::stream::Stream

source ·
pub struct Stream { /* private fields */ }
Expand description

A wrapper around the pipewire stream interface. Streams are a higher level abstraction around nodes in the graph. A stream can be used to send or receive frames of audio or video data by connecting it to another node. D is the user data, to allow passing extra context to the callbacks.

Implementations§

source§

impl Stream

source

pub fn new( core: &Core, name: &str, properties: Properties ) -> Result<Self, Error>

Create a Stream

Initialises a new stream with the given name and properties.

source

pub fn new_cstr( core: &Core, name: &CStr, properties: Properties ) -> Result<Self, Error>

Initialises a new stream with the given name as Cstr and properties.

source

pub fn into_raw(self) -> *mut pw_stream

Methods from Deref<Target = 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 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.

Trait Implementations§

source§

impl Debug for Stream

source§

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

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

impl Deref for Stream

§

type Target = StreamRef

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl Drop for Stream

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Stream

§

impl !Send for Stream

§

impl !Sync for Stream

§

impl Unpin for Stream

§

impl !UnwindSafe for Stream

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.