Struct StreamBox

Source
pub struct StreamBox<'c> { /* private fields */ }

Implementations§

Source§

impl<'c> StreamBox<'c>

Source

pub fn new( core: &'c Core, name: &str, properties: PropertiesBox, ) -> Result<StreamBox<'c>, Error>

Create a StreamBox

Initialises a new stream with the given name and properties.

Source

pub fn new_cstr( core: &'c Core, name: &CStr, properties: PropertiesBox, ) -> Result<StreamBox<'c>, Error>

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

Source

pub unsafe fn from_raw(raw: NonNull<pw_stream>) -> StreamBox<'c>

Create a StreamBox by taking ownership of a raw pw_stream.

§Safety

The provided pointer must point to a valid, well aligned pw_stream.

The raw stream must not be manually destroyed or moved, as the new StreamBox takes ownership of it.

The lifetime of the returned box is unbounded. The caller is responsible to make sure that the core used with this stream outlives the stream.

Source

pub fn into_raw(self) -> NonNull<pw_stream>

Methods from Deref<Target = Stream>§

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 Self::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) -> &Properties

Get the properties of the stream.

Source

pub fn node_id(&self) -> u32

Get the node ID of the stream.

Trait Implementations§

Source§

impl<'c> Debug for StreamBox<'c>

Source§

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

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

impl<'c> Deref for StreamBox<'c>

Source§

type Target = Stream

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl<'c> Drop for StreamBox<'c>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'c> Freeze for StreamBox<'c>

§

impl<'c> RefUnwindSafe for StreamBox<'c>

§

impl<'c> !Send for StreamBox<'c>

§

impl<'c> !Sync for StreamBox<'c>

§

impl<'c> Unpin for StreamBox<'c>

§

impl<'c> UnwindSafe for StreamBox<'c>

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.