Struct libspa_sys::spa_device_methods
source · #[repr(C)]pub struct spa_device_methods {
pub version: u32,
pub add_listener: Option<unsafe extern "C" fn(object: *mut c_void, listener: *mut spa_hook, events: *const spa_device_events, 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, index: 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>,
}
Expand description
spa_device_methods:
Fields§
§version: u32
§add_listener: Option<unsafe extern "C" fn(object: *mut c_void, listener: *mut spa_hook, events: *const spa_device_events, data: *mut c_void) -> c_int>
Set events to receive asynchronous notifications from the device.
Setting the events will trigger the info event and an object_info event for each managed object on the new listener.
\param object a \ref spa_device \param listener a listener \param events a struct \ref spa_device_events \param data data passed as first argument in functions of \a events \return 0 on success < 0 errno on error
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 device, 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, index: u32, max: u32, filter: *const spa_pod) -> c_int>
Enumerate the parameters of a device.
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 result callback will be called at most \a max times with a struct spa_result_device_params as the result.
This function must be called from the main thread.
\param device a \ref spa_device \param seq a sequence number to pass to the result function \param id the param id to enumerate \param index the index of enumeration, pass 0 for the first item. \param max the maximum number of items to iterate \param filter and optional filter to use \return 0 when there are no more parameters to enumerate -EINVAL when invalid arguments are given -ENOENT the parameter \a id is unknown -ENOTSUP when there are no parameters implemented on \a device
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 device.
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 object \ref spa_device \param id the parameter id to configure \param flags additional flags \param param the parameter to configure
\return 0 on success -EINVAL when invalid arguments are given -ENOTSUP when there are no parameters implemented on \a device -ENOENT the parameter is unknown
Trait Implementations§
source§impl Clone for spa_device_methods
impl Clone for spa_device_methods
source§fn clone(&self) -> spa_device_methods
fn clone(&self) -> spa_device_methods
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for spa_device_methods
impl Debug for spa_device_methods
source§impl PartialEq for spa_device_methods
impl PartialEq for spa_device_methods
source§fn eq(&self, other: &spa_device_methods) -> bool
fn eq(&self, other: &spa_device_methods) -> bool
self
and other
values to be equal, and is used
by ==
.