#[repr(C)]
pub struct spa_node_methods {
Show 16 fields pub version: u32, pub add_listener: Option<unsafe extern "C" fn(object: *mut c_void, listener: *mut spa_hook, events: *const spa_node_events, data: *mut c_void) -> c_int>, pub set_callbacks: Option<unsafe extern "C" fn(object: *mut c_void, callbacks: *const spa_node_callbacks, data: *mut c_void) -> c_int>, pub sync: Option<unsafe extern "C" fn(object: *mut c_void, seq: c_int) -> c_int>, pub enum_params: Option<unsafe extern "C" fn(object: *mut c_void, seq: c_int, id: u32, start: u32, max: u32, filter: *const spa_pod) -> c_int>, pub set_param: Option<unsafe extern "C" fn(object: *mut c_void, id: u32, flags: u32, param: *const spa_pod) -> c_int>, pub set_io: Option<unsafe extern "C" fn(object: *mut c_void, id: u32, data: *mut c_void, size: usize) -> c_int>, pub send_command: Option<unsafe extern "C" fn(object: *mut c_void, command: *const spa_command) -> c_int>, pub add_port: Option<unsafe extern "C" fn(object: *mut c_void, direction: spa_direction, port_id: u32, props: *const spa_dict) -> c_int>, pub remove_port: Option<unsafe extern "C" fn(object: *mut c_void, direction: spa_direction, port_id: u32) -> c_int>, pub port_enum_params: Option<unsafe extern "C" fn(object: *mut c_void, seq: c_int, direction: spa_direction, port_id: u32, id: u32, start: u32, max: u32, filter: *const spa_pod) -> c_int>, pub port_set_param: Option<unsafe extern "C" fn(object: *mut c_void, direction: spa_direction, port_id: u32, id: u32, flags: u32, param: *const spa_pod) -> c_int>, pub port_use_buffers: Option<unsafe extern "C" fn(object: *mut c_void, direction: spa_direction, port_id: u32, flags: u32, buffers: *mut *mut spa_buffer, n_buffers: u32) -> c_int>, pub port_set_io: Option<unsafe extern "C" fn(object: *mut c_void, direction: spa_direction, port_id: u32, id: u32, data: *mut c_void, size: usize) -> c_int>, pub port_reuse_buffer: Option<unsafe extern "C" fn(object: *mut c_void, port_id: u32, buffer_id: u32) -> c_int>, pub process: Option<unsafe extern "C" fn(object: *mut c_void) -> c_int>,
}
Expand description

Node methods

Fields§

§version: u32§add_listener: Option<unsafe extern "C" fn(object: *mut c_void, listener: *mut spa_hook, events: *const spa_node_events, data: *mut c_void) -> c_int>

Adds an event listener on \a node.

Setting the events will trigger the info event and a port_info event for each managed port on the new listener.

\param node a #spa_node \param listener a listener \param events a struct \ref spa_node_events \param data data passed as first argument in functions of \a events \return 0 on success < 0 errno on error

§set_callbacks: Option<unsafe extern "C" fn(object: *mut c_void, callbacks: *const spa_node_callbacks, data: *mut c_void) -> c_int>

Set callbacks to on \a node. if \a callbacks is NULL, the current callbacks are removed.

This function must be called from the main thread.

All callbacks are called from the data thread.

\param node a spa_node \param callbacks callbacks to set \return 0 on success -EINVAL when node is NULL

§sync: Option<unsafe extern "C" fn(object: *mut c_void, seq: c_int) -> c_int>

Perform a sync operation.

This method will emit the result event with the given sequence number synchronously or with the returned async return value asynchronously.

Because all methods are serialized in the node, this can be used to wait for completion of all previous method calls.

\param seq a sequence number \return 0 on success -EINVAL when node is NULL an async result

§enum_params: Option<unsafe extern "C" fn(object: *mut c_void, seq: c_int, id: u32, start: u32, max: u32, filter: *const spa_pod) -> c_int>

Enumerate the parameters of a node.

Parameters are identified with an \a id. Some parameters can have multiple values, see the documentation of the parameter id.

Parameters can be filtered by passing a non-NULL \a filter.

The function will emit the result event up to \a max times with the result value. The seq in the result will either be the \a seq number when executed synchronously or the async return value of this function when executed asynchronously.

This function must be called from the main thread.

\param node a \ref spa_node \param seq a sequence number to pass to the result event when this method is executed synchronously. \param id the param id to enumerate \param start the index of enumeration, pass 0 for the first item \param max the maximum number of parameters to enumerate \param filter and optional filter to use

\return 0 when no more items can be iterated. -EINVAL when invalid arguments are given -ENOENT the parameter \a id is unknown -ENOTSUP when there are no parameters implemented on \a node an async return value when the result event will be emitted later.

§set_param: Option<unsafe extern "C" fn(object: *mut c_void, id: u32, flags: u32, param: *const spa_pod) -> c_int>

Set the configurable parameter in \a node.

Usually, \a param will be obtained from enum_params and then modified but it is also possible to set another spa_pod as long as its keys and types match a supported object.

Objects with property keys that are not known are ignored.

This function must be called from the main thread.

\param node a \ref spa_node \param id the parameter id to configure \param flags additional flags \param param the parameter to configure

\return 0 on success -EINVAL when node is NULL -ENOTSUP when there are no parameters implemented on \a node -ENOENT the parameter is unknown

§set_io: Option<unsafe extern "C" fn(object: *mut c_void, id: u32, data: *mut c_void, size: usize) -> c_int>

Configure the given memory area with \a id on \a node. This structure is allocated by the host and is used to exchange data and parameters with the node.

Setting an \a io of NULL will disable the node io.

This function must be called from the main thread.

\param id the id of the io area, the available ids can be enumerated with the node parameters. \param data a io area memory \param size the size of \a data \return 0 on success -EINVAL when invalid input is given -ENOENT when \a id is unknown -ENOSPC when \a size is too small

§send_command: Option<unsafe extern "C" fn(object: *mut c_void, command: *const spa_command) -> c_int>

Send a command to a node.

Upon completion, a command might change the state of a node.

This function must be called from the main thread.

\param node a spa_node \param command a spa_command \return 0 on success -EINVAL when node or command is NULL -ENOTSUP when this node can’t process commands -EINVAL \a command is an invalid command

§add_port: Option<unsafe extern "C" fn(object: *mut c_void, direction: spa_direction, port_id: u32, props: *const spa_dict) -> c_int>

Make a new port with \a port_id. The caller should use the lowest unused port id for the given \a direction.

Port ids should be between 0 and max_ports as obtained from the info event.

This function must be called from the main thread.

\param node a spa_node \param direction a enum \ref spa_direction \param port_id an unused port id \param props extra properties \return 0 on success -EINVAL when node is NULL

§remove_port: Option<unsafe extern "C" fn(object: *mut c_void, direction: spa_direction, port_id: u32) -> c_int>

Remove a port with \a port_id.

\param node a spa_node \param direction a enum \ref spa_direction \param port_id a port id \return 0 on success -EINVAL when node is NULL or when port_id is unknown or when the port can’t be removed.

§port_enum_params: Option<unsafe extern "C" fn(object: *mut c_void, seq: c_int, direction: spa_direction, port_id: u32, id: u32, start: u32, max: u32, filter: *const spa_pod) -> c_int>

Enumerate all possible parameters of \a id on \a port_id of \a node that are compatible with \a filter.

The result parameters can be queried and modified and ultimately be used to call port_set_param.

The function will emit the result event up to \a max times with the result value. The seq in the result event will either be the \a seq number when executed synchronously or the async return value of this function when executed asynchronously.

This function must be called from the main thread.

\param node a spa_node \param seq a sequence number to pass to the result event when this method is executed synchronously. \param direction an spa_direction \param port_id the port to query \param id the parameter id to query \param start the first index to query, 0 to get the first item \param max the maximum number of params to query \param filter a parameter filter or NULL for no filter

\return 0 when no more items can be iterated. -EINVAL when invalid parameters are given -ENOENT when \a id is unknown an async return value when the result event will be emitted later.

§port_set_param: Option<unsafe extern "C" fn(object: *mut c_void, direction: spa_direction, port_id: u32, id: u32, flags: u32, param: *const spa_pod) -> c_int>

Set a parameter on \a port_id of \a node.

When \a param is NULL, the parameter will be unset.

This function must be called from the main thread.

\param node a struct \ref spa_node \param direction a enum \ref spa_direction \param port_id the port to configure \param id the parameter id to set \param flags optional flags \param param a struct \ref spa_pod with the parameter to set \return 0 on success 1 on success, the value of \a param might have been changed depending on \a flags and the final value can be found by doing port_enum_params. -EINVAL when node is NULL or invalid arguments are given -ESRCH when one of the mandatory param properties is not specified and SPA_NODE_PARAM_FLAG_FIXATE was not set in \a flags. -ESRCH when the type or size of a property is not correct. -ENOENT when the param id is not found

§port_use_buffers: Option<unsafe extern "C" fn(object: *mut c_void, direction: spa_direction, port_id: u32, flags: u32, buffers: *mut *mut spa_buffer, n_buffers: u32) -> c_int>

Tell the port to use the given buffers

When \a flags contains SPA_NODE_BUFFERS_FLAG_ALLOC, the data in the buffers should point to an array of at least 1 data entry with the desired supported type that will be filled by this function.

The port should also have a spa_io_buffers io area configured to exchange the buffers with the port.

For an input port, all the buffers will remain dequeued. Once a buffer has been queued on a port in the spa_io_buffers, it should not be reused until the reuse_buffer callback is notified or when the buffer has been returned in the spa_io_buffers of the port.

For output ports, all buffers will be queued in the port. When process returns SPA_STATUS_HAVE_DATA, buffers are available in one or more of the spa_io_buffers areas.

When a buffer can be reused, port_reuse_buffer() should be called or the buffer_id should be placed in the spa_io_buffers area before calling process.

Passing NULL as \a buffers will remove the reference that the port has on the buffers.

When this function returns async, use the spa_node_sync operation to wait for completion.

This function must be called from the main thread.

\param object an object implementing the interface \param direction a port direction \param port_id a port id \param flags extra flags \param buffers an array of buffer pointers \param n_buffers number of elements in \a buffers \return 0 on success

§port_set_io: Option<unsafe extern "C" fn(object: *mut c_void, direction: spa_direction, port_id: u32, id: u32, data: *mut c_void, size: usize) -> c_int>

Configure the given memory area with \a id on \a port_id. This structure is allocated by the host and is used to exchange data and parameters with the port.

Setting an \a io of NULL will disable the port io.

This function must be called from the main thread.

\param direction a spa_direction \param port_id a port id \param id the id of the io area, the available ids can be enumerated with the port parameters. \param data a io area memory \param size the size of \a data \return 0 on success -EINVAL when invalid input is given -ENOENT when \a id is unknown -ENOSPC when \a size is too small

§port_reuse_buffer: Option<unsafe extern "C" fn(object: *mut c_void, port_id: u32, buffer_id: u32) -> c_int>

Tell an output port to reuse a buffer.

This function must be called from the data thread.

\param node a spa_node \param port_id a port id \param buffer_id a buffer id to reuse \return 0 on success -EINVAL when node is NULL

§process: Option<unsafe extern "C" fn(object: *mut c_void) -> c_int>

Process the node

This function must be called from the data thread.

Output io areas with SPA_STATUS_NEED_DATA will recycle the buffers if any.

Input areas with SPA_STATUS_HAVE_DATA are consumed if possible and the status is set to SPA_STATUS_NEED_DATA or SPA_STATUS_OK.

When the node has new output buffers, the SPA_STATUS_HAVE_DATA bit will be set.

When the node can accept new input in the next cycle, the SPA_STATUS_NEED_DATA bit will be set.

Note that the node might return SPA_STATUS_NEED_DATA even when no input ports have this status. This means that the amount of data still available on the input ports is likely not going to be enough for the next cycle and the host might need to prefetch data for the next cycle.

Trait Implementations§

source§

impl Clone for spa_node_methods

source§

fn clone(&self) -> spa_node_methods

Returns a copy 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 Debug for spa_node_methods

source§

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

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

impl PartialEq<spa_node_methods> for spa_node_methods

source§

fn eq(&self, other: &spa_node_methods) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for spa_node_methods

source§

impl Eq for spa_node_methods

source§

impl StructuralEq for spa_node_methods

source§

impl StructuralPartialEq for spa_node_methods

Auto Trait Implementations§

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> ToOwned for Twhere T: Clone,

§

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