### Usage examples for __builder_add__ Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa/macro.__builder_add__.html Examples demonstrating how to use the macro to add various types to a builder. Note that Pointer usage requires an unsafe block. ```rust builder_add!(<&mut libspa::pod::builder::Builder>, Bool()); builder_add!(<&mut libspa::pod::builder::Builder>, Id()); builder_add!(<&mut libspa::pod::builder::Builder>, Int()); builder_add!(<&mut libspa::pod::builder::Builder>, Long()); builder_add!(<&mut libspa::pod::builder::Builder>, Float()); builder_add!(<&mut libspa::pod::builder::Builder>, Double()); builder_add!(<&mut libspa::pod::builder::Builder>, Bytes(<&[u8]>)); // Macro using `Pointer` can only be called in `unsafe` block. // Safety rules from `Builder::add_pointer()` apply. builder_add!(<&mut libspa::pod::builder::Builder>, Pointer(<*const c_void>)); builder_add!(<&mut libspa::pod::builder::Builder>, Fd()); builder_add!(<&mut libspa::pod::builder::Builder>, Rectangle()); builder_add!(<&mut libspa::pod::builder::Builder>, Fraction()); builder_add!(<&mut libspa::pod::builder::Builder>, Struct { // 0 to n fields, e.g.: Struct { Int(), Float(), }, Bytes(<&[u8]>), } ); builder_add!(<&mut libspa::pod::builder::Builder>, Object( , ) { // 0 to n properties of format // ` => ` // e.g. 0 => Bool(false), 313 => String("313"), } ); ``` -------------------------------- ### Usage examples for parser_get! Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa/macro.__parser_get__.html Examples demonstrating how to use the parser_get! macro to extract specific types from a parser, including nested structures. ```rust parser_get!(<&mut libspa::pod::parser::Parser>, Bool(<&mut bool>)); parser_get!(<&mut libspa::pod::parser::Parser>, Id(<&mut libspa::utils::Id>)); parser_get!(<&mut libspa::pod::parser::Parser>, Int(<&mut i32>)); parser_get!(<&mut libspa::pod::parser::Parser>, Long(<&mut i64>)); parser_get!(<&mut libspa::pod::parser::Parser>, Float(<&mut f32>)); parser_get!(<&mut libspa::pod::parser::Parser>, Double(<&mut f64>)); parser_get!(<&mut libspa::pod::parser::Parser>, Bytes(<&mut &[u8]>)); parser_get!(<&mut libspa::pod::parser::Parser>, Pointer(<&mut *const c_void>)); parser_get!(<&mut libspa::pod::parser::Parser>, Fd(<&mut i64>)); parser_get!(<&mut libspa::pod::parser::Parser>, Rectangle(<&mut libspa::utils::Rectangle>)); parser_get!(<&mut libspa::pod::parser::Parser>, Fraction(<&mut libspa::utils::Fraction>)); parser_get!(<&mut libspa::pod::parser::Parser>, Pod(<&mut &libspa::pod::Pod>)); parser_get!(<&mut libspa::pod::parser::Parser>, Struct { // 0 to n fields, e.g.: Struct { Int(<&mut i32>), Float(<&mut f32>), }, Bytes(<&mut &[u8]), } ); ``` -------------------------------- ### Define SPA_FORMAT_START_Application constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_FORMAT_START_Application.html Represents the starting value for application-specific SPA formats. ```rust pub const SPA_FORMAT_START_Application: spa_format = 393216; ``` -------------------------------- ### Define SPA_PARAM_PROFILE_START constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_PARAM_PROFILE_START.html Represents the starting value for SPA profile parameters. ```rust pub const SPA_PARAM_PROFILE_START: spa_param_profile = 0; ``` -------------------------------- ### Define SPA_DBUS_TYPE_STARTER constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_DBUS_TYPE_STARTER.html Represents the bus that started the process, if applicable. ```rust pub const SPA_DBUS_TYPE_STARTER: spa_dbus_type = 2; ``` -------------------------------- ### Define SPA_PARAM_IO_START constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_PARAM_IO_START.html Represents the starting value for SPA IO parameters. ```rust pub const SPA_PARAM_IO_START: spa_param_io = 0; ``` -------------------------------- ### Define SPA_PARAM_META_START constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_PARAM_META_START.html Represents the starting index for meta parameters in the SPA framework. ```rust pub const SPA_PARAM_META_START: spa_param_meta = 0; ``` -------------------------------- ### Define SPA_PROP_START_Other constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_PROP_START_Other.html Represents the starting point for other SPA properties. ```rust pub const SPA_PROP_START_Other: spa_prop = 524288; ``` -------------------------------- ### Define SPA_PARAM_ROUTE_START constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_PARAM_ROUTE_START.html Represents the starting index for SPA route parameters. ```rust pub const SPA_PARAM_ROUTE_START: spa_param_route = 0; ``` -------------------------------- ### Define SPA_FORMAT_START_Audio constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_FORMAT_START_Audio.html Represents the starting index for audio formats in the SPA system. ```rust pub const SPA_FORMAT_START_Audio: spa_format = 65536; ``` -------------------------------- ### Calling a sync method on a pw_core object Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa/macro.spa_interface_call_method.html Example demonstrating the invocation of the sync method on a pipewire_sys::pw_core object using the macro. ```rust use pipewire_sys as pw_sys; use libspa as spa; struct Core { ptr: *mut pw_sys::pw_core } impl Core { fn sync(&self, seq: i32) -> i32 { unsafe { spa::spa_interface_call_method!( &self.ptr, pw_sys::pw_core_methods, sync, pipewire::core::PW_ID_CORE, seq ) } } } ``` -------------------------------- ### Define SPA_AUDIO_CHANNEL_START_Custom constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_AUDIO_CHANNEL_START_Custom.html Represents the starting index for custom audio channel definitions. ```rust pub const SPA_AUDIO_CHANNEL_START_Custom: spa_audio_channel = 65536; ``` -------------------------------- ### Define SPA_MEDIA_SUBTYPE_START_Audio constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_MEDIA_SUBTYPE_START_Audio.html Represents the starting integer value for audio media subtypes. ```rust pub const SPA_MEDIA_SUBTYPE_START_Audio: spa_media_subtype = 65536; ``` -------------------------------- ### Define SPA_FORMAT_START_Video constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_FORMAT_START_Video.html Represents the starting constant for video formats in the SPA system. ```rust pub const SPA_FORMAT_START_Video: spa_format = 131072; ``` -------------------------------- ### Serialize into a String pod Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa/pod/serialize/trait.PodSerialize.html Example implementation for a custom string-based type. ```rust use std::io; use libspa::pod::serialize::{GenError, PodSerialize, PodSerializer, SerializeSuccess}; struct StringNewtype(String); impl PodSerialize for StringNewtype { fn serialize( &self, serializer: PodSerializer, ) -> Result, GenError> { serializer.serialize_string(self.0.as_str()) } } ``` -------------------------------- ### Define SPA_IO_POSITION_STATE_STARTING constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_IO_POSITION_STATE_STARTING.html Represents the starting state for an IO position in the SPA framework. ```rust pub const SPA_IO_POSITION_STATE_STARTING: spa_io_position_state = 1; ``` -------------------------------- ### Define SPA_TYPE_COMMAND_START constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_TYPE_COMMAND_START.html Represents the starting integer value for SPA commands. ```rust pub const SPA_TYPE_COMMAND_START: _bindgen_ty_10 = 196608; ``` -------------------------------- ### Define SPA_EVENT_NODE_START constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_EVENT_NODE_START.html Represents the start event for an SPA node. ```rust pub const SPA_EVENT_NODE_START: spa_event_node = 0; ``` -------------------------------- ### Define SPA_AUDIO_CHANNEL_START_Aux constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_AUDIO_CHANNEL_START_Aux.html Represents the starting value for auxiliary audio channels. ```rust pub const SPA_AUDIO_CHANNEL_START_Aux: spa_audio_channel = 4096; ``` -------------------------------- ### Define SPA_AUDIO_FORMAT_START_Other constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_AUDIO_FORMAT_START_Other.html Represents the starting index for non-standard audio formats in the SPA framework. ```rust pub const SPA_AUDIO_FORMAT_START_Other: spa_audio_format = 1024; ``` -------------------------------- ### Define SPA_MEDIA_SUBTYPE_START_Application constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_MEDIA_SUBTYPE_START_Application.html Represents the starting integer value for application media subtypes. Available since version 0.3.68. ```rust pub const SPA_MEDIA_SUBTYPE_START_Application: spa_media_subtype = 393216; ``` -------------------------------- ### spa_strstartswith Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_strstartswith.html Checks if a string starts with a given prefix. ```APIDOC ## spa_strstartswith ### Description Checks if the string `s` starts with the specified `prefix`. Returns true if it matches, false otherwise. ### Signature `pub unsafe extern "C" fn spa_strstartswith(s: *const c_char, prefix: *const c_char) -> bool` ### Parameters - **s** (*const c_char) - The string to check. If NULL, the function returns false. - **prefix** (*const c_char) - The prefix to look for. A NULL value is considered a bug in the caller. ### Returns - **bool** - Returns true if `s` starts with `prefix`, false otherwise. ``` -------------------------------- ### Define SPA_PROFILER_START_CUSTOM constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_PROFILER_START_CUSTOM.html Represents the custom start value for the SPA profiler. ```rust pub const SPA_PROFILER_START_CUSTOM: spa_profiler = 16777216; ``` -------------------------------- ### Define SPA_NODE_COMMAND_Start constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_NODE_COMMAND_Start.html Represents the command to start a node, causing it to emit scheduling events. ```rust pub const SPA_NODE_COMMAND_Start: spa_node_command = 2; ``` -------------------------------- ### Define SPA_PROP_START constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_PROP_START.html Defines the starting value for SPA properties as zero. ```rust pub const SPA_PROP_START: spa_prop = 0; ``` -------------------------------- ### Define SPA_EVENT_DEVICE_START constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_EVENT_DEVICE_START.html Represents the device start event identifier in the SPA system. ```rust pub const SPA_EVENT_DEVICE_START: spa_event_device = 0; ``` -------------------------------- ### Define SPA_FORMAT_START_Image constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_FORMAT_START_Image.html Represents the constant integer value for image format starting point. ```rust pub const SPA_FORMAT_START_Image: spa_format = 196608; ``` -------------------------------- ### Define SPA_TYPE_OBJECT_START constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_TYPE_OBJECT_START.html Represents the starting value for SPA object types. ```rust pub const SPA_TYPE_OBJECT_START: _bindgen_ty_10 = 262144; ``` -------------------------------- ### Deserialize a String pod Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa/pod/deserialize/trait.PodDeserialize.html Example implementation for deserializing a string without copying. ```rust use std::io; use libspa::pod::deserialize::{PodDeserialize, PodDeserializer, DeserializeError, DeserializeSuccess, StringVisitor}; struct ContainsStr<'s>(&'s str); impl<'de> PodDeserialize<'de> for ContainsStr<'de> { fn deserialize( deserializer: PodDeserializer<'de>, ) -> Result<(Self, DeserializeSuccess<'de>), DeserializeError<&'de [u8]>> where Self: Sized, { deserializer.deserialize_str(StringVisitor).map(|(s, success)| (ContainsStr(s), success)) } } ``` -------------------------------- ### spa_json_start Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_json_start.html Initializes a sub-iterator for a JSON object or array starting at the specified position. ```APIDOC ## spa_json_start ### Description Initializes a sub-iterator (`sub`) from a parent iterator (`iter`) starting at the position defined by `pos`. ### Signature `pub unsafe extern "C" fn spa_json_start(iter: *mut spa_json, sub: *mut spa_json, pos: *const c_char)` ### Parameters - **iter** (*mut spa_json) - The parent JSON iterator. - **sub** (*mut spa_json) - The sub-iterator to be initialized. - **pos** (*const c_char) - The starting position within the JSON data. ``` -------------------------------- ### Serialize into an Array pod Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa/pod/serialize/trait.PodSerialize.html Example implementation for a collection type using an array serializer. ```rust use std::io; use libspa::pod::serialize::{GenError, PodSerialize, PodSerializer, SerializeSuccess}; struct Numbers(Vec); impl PodSerialize for Numbers { fn serialize( &self, serializer: PodSerializer, ) -> Result, GenError> { let mut array_serializer = serializer.serialize_array(self.0.len() as u32)?; for element in self.0.iter() { array_serializer.serialize_element(element)?; } array_serializer.end() } } ``` -------------------------------- ### Define SPA_AUDIO_FORMAT_START_Planar constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_AUDIO_FORMAT_START_Planar.html Represents the starting index for planar audio formats in the spa_audio_format enumeration. ```rust pub const SPA_AUDIO_FORMAT_START_Planar: spa_audio_format = 512; ``` -------------------------------- ### Define SPA_FORMAT_START_Stream constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_FORMAT_START_Stream.html Represents the starting value for stream formats in the SPA library. ```rust pub const SPA_FORMAT_START_Stream: spa_format = 327680; ``` -------------------------------- ### Parse dictionary values Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa/utils/dict/struct.DictRef.html Example demonstrating how to use the parse method to convert dictionary values into specific types. ```rust use libspa::{utils::dict::StaticDict, static_dict}; static DICT: StaticDict = static_dict! { "true" => "true", "ten" => "10", "pi" => "3.14159265359", "pointer" => "pointer:0xdeadbeef" }; assert_eq!(DICT.parse("true"), Some(Ok(true))); assert_eq!(DICT.parse("ten"), Some(Ok(10))); assert_eq!(DICT.parse("ten"), Some(Ok(10.0))); assert_eq!(DICT.parse("pi"), Some(Ok(3.14159265359))); let ptr = DICT.parse::<*const i32>("pointer").unwrap().unwrap(); assert!(!ptr.is_null()); ``` -------------------------------- ### Deserialize an Array pod Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa/pod/deserialize/trait.PodDeserialize.html Example implementation for deserializing an array of integers using a Visitor. ```rust use std::io; use std::io::Cursor; use libspa::pod::deserialize::{PodDeserialize, PodDeserializer, DeserializeError, DeserializeSuccess, Visitor}; use libspa::pod::serialize::PodSerializer; struct Numbers(Vec); impl<'de> PodDeserialize<'de> for Numbers { fn deserialize( deserializer: PodDeserializer<'de>, ) -> Result<(Self, DeserializeSuccess<'de>), DeserializeError<&'de [u8]>> where Self: Sized, { struct NumbersVisitor; impl<'de> Visitor<'de> for NumbersVisitor { type Value = Numbers; type ArrayElem = i32; fn visit_array( &self, elements: Vec, ) -> Result> { Ok(Numbers(elements)) } } deserializer.deserialize_array(NumbersVisitor) } } ``` -------------------------------- ### Define SPA_MEDIA_SUBTYPE_START_Video constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_MEDIA_SUBTYPE_START_Video.html Represents the starting integer value for video media subtypes, available since version 0.3.68. ```rust pub const SPA_MEDIA_SUBTYPE_START_Video: spa_media_subtype = 131072; ``` -------------------------------- ### spa_thread_utils_create Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_thread_utils_create.html Creates a new thread using the provided thread utilities, properties, and start routine. ```APIDOC ## spa_thread_utils_create ### Description Creates a new thread using the specified thread utility interface, properties, and a start routine. ### Signature `pub unsafe extern "C" fn spa_thread_utils_create(o: *mut spa_thread_utils, props: *const spa_dict, start_routine: Option *mut c_void>, arg: *mut c_void) -> *mut spa_thread` ### Parameters - **o** (*mut spa_thread_utils) - Pointer to the thread utility structure. - **props** (*const spa_dict) - Pointer to the dictionary of properties for the thread. - **start_routine** (Option *mut c_void>) - The function to be executed by the new thread. - **arg** (*mut c_void) - Argument to be passed to the start routine. ### Returns - ***mut spa_thread** - A pointer to the created thread object. ``` -------------------------------- ### Create and access a StaticDict Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa/utils/dict/struct.StaticDict.html Demonstrates initializing a StaticDict using the static_dict! macro and retrieving values by key. ```rust use libspa::{utils::dict::StaticDict, static_dict}; static DICT: StaticDict = static_dict!{ "Key" => "Value", "OtherKey" => "OtherValue" }; assert_eq!(Some("Value"), DICT.get("Key")); assert_eq!(Some("OtherValue"), DICT.get("OtherKey")); ``` -------------------------------- ### Define SPA_TYPE_EVENT_START constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_TYPE_EVENT_START.html Represents the starting value for SPA event types in the system bindings. ```rust pub const SPA_TYPE_EVENT_START: _bindgen_ty_10 = 131072; ``` -------------------------------- ### Define SPA_PARAM_PORT_CONFIG_START Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_PARAM_PORT_CONFIG_START.html Represents the initial value for port configuration parameters. ```rust pub const SPA_PARAM_PORT_CONFIG_START: spa_param_port_config = 0; ``` -------------------------------- ### spa_pod_builder_bytes_start Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_pod_builder_bytes_start.html Initializes a byte sequence in the provided SPA pod builder. ```APIDOC ## spa_pod_builder_bytes_start ### Description Initializes a byte sequence within the specified SPA pod builder. This function is part of the libspa system interface. ### Signature `pub unsafe extern "C" fn spa_pod_builder_bytes_start(builder: *mut spa_pod_builder) -> u32` ### Parameters - **builder** (*mut spa_pod_builder) - A pointer to the spa_pod_builder structure to initialize. ### Returns - **u32** - Returns an offset or identifier for the started byte sequence. ``` -------------------------------- ### Serialize into a Struct pod Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa/pod/serialize/trait.PodSerialize.html Example implementation for a struct type, noting that u8 must be cast to i32 for Int pod compatibility. ```rust use std::io; use libspa::pod::serialize::{GenError, PodSerialize, PodSerializer, SerializeSuccess}; struct Animal { name: String, feet: u8, can_fly: bool, } impl PodSerialize for Animal { fn serialize( &self, serializer: PodSerializer, ) -> Result, GenError> { let mut struct_serializer = serializer.serialize_struct()?; struct_serializer.serialize_field(self.name.as_str())?; // No pod exists for u8, we need to use an `Int` type pod by casting to `i32`. struct_serializer.serialize_field(&(self.feet as i32))?; struct_serializer.serialize_field(&self.can_fly)?; struct_serializer.end() } } ``` -------------------------------- ### Define SPA_PROP_START_Device constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_PROP_START_Device.html Represents the base index for device properties within the SPA system. ```rust pub const SPA_PROP_START_Device: spa_prop = 256; ``` -------------------------------- ### Define SPA_AUDIO_FORMAT_START_Interleaved constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_AUDIO_FORMAT_START_Interleaved.html Represents the starting index for interleaved audio formats in the spa_audio_format enumeration. ```rust pub const SPA_AUDIO_FORMAT_START_Interleaved: spa_audio_format = 256; ``` -------------------------------- ### Define SPA_PROP_START_Audio constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_PROP_START_Audio.html Represents the base index for audio properties within the SPA framework. ```rust pub const SPA_PROP_START_Audio: spa_prop = 65536; ``` -------------------------------- ### spa_pod_builder_init Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_pod_builder_init.html Initializes a spa_pod_builder structure with a memory buffer. ```APIDOC ## spa_pod_builder_init ### Description Initializes a `spa_pod_builder` structure using the provided memory buffer and size. ### Signature `pub unsafe extern "C" fn spa_pod_builder_init(builder: *mut spa_pod_builder, data: *mut c_void, size: u32)` ### Parameters - **builder** (*mut spa_pod_builder) - Pointer to the builder structure to initialize. - **data** (*mut c_void) - Pointer to the memory buffer to be used by the builder. - **size** (u32) - The size of the memory buffer. ``` -------------------------------- ### Create a StaticDict Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa/macro.static_dict.html Initialize a static StaticDict using the static_dict macro. ```rust use libspa::{utils::dict::StaticDict, static_dict}; static PROPS: StaticDict = static_dict!{ "Key1" => "Value1", "Key2" => "Value2", }; ``` -------------------------------- ### spa_format_audio_mp3_build Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_format_audio_mp3_build.html Builds an MP3 audio format POD structure. ```APIDOC ## spa_format_audio_mp3_build ### Description Constructs an MP3 audio format POD (Plain Old Data) structure using the specified builder and MP3 audio information. ### Signature `pub unsafe extern "C" fn spa_format_audio_mp3_build(builder: *mut spa_pod_builder, id: u32, info: *const spa_audio_info_mp3) -> *mut spa_pod` ### Parameters - **builder** (*mut spa_pod_builder) - Pointer to the POD builder instance. - **id** (u32) - The identifier for the format. - **info** (*const spa_audio_info_mp3) - Pointer to the structure containing MP3 audio information. ### Returns - ***mut spa_pod** - A pointer to the constructed spa_pod structure. ``` -------------------------------- ### Define SPA_PROP_START_Video constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_PROP_START_Video.html Represents the base index for video properties in the SPA framework. ```rust pub const SPA_PROP_START_Video: spa_prop = 131072; ``` -------------------------------- ### spa_format_audio_ape_build Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_format_audio_ape_build.html Constructs an APE audio format POD structure. ```APIDOC ## spa_format_audio_ape_build ### Description Constructs an APE audio format POD structure using the provided builder and audio information. ### Signature `pub unsafe extern "C" fn spa_format_audio_ape_build(builder: *mut spa_pod_builder, id: u32, info: *const spa_audio_info_ape) -> *mut spa_pod` ### Parameters - **builder** (*mut spa_pod_builder) - The POD builder instance. - **id** (u32) - The identifier for the format. - **info** (*const spa_audio_info_ape) - Pointer to the APE audio information structure. ### Returns - ***mut spa_pod** - A pointer to the constructed spa_pod structure. ``` -------------------------------- ### spa_format_audio_wma_build Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_format_audio_wma_build.html Builds a WMA audio format POD structure. ```APIDOC ## spa_format_audio_wma_build ### Description Builds a WMA audio format POD using the specified builder and audio information. ### Signature `pub unsafe extern "C" fn spa_format_audio_wma_build(builder: *mut spa_pod_builder, id: u32, info: *const spa_audio_info_wma) -> *mut spa_pod` ### Parameters - **builder** (*mut spa_pod_builder) - Pointer to the spa_pod_builder instance. - **id** (u32) - The identifier for the format. - **info** (*const spa_audio_info_wma) - Pointer to the spa_audio_info_wma structure containing WMA format details. ### Returns - ***mut spa_pod** - A pointer to the constructed spa_pod structure. ``` -------------------------------- ### spa_format_audio_raw_build Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_format_audio_raw_build.html Constructs a SPA POD for raw audio format using the provided builder and audio information. ```APIDOC ## spa_format_audio_raw_build ### Description Constructs a SPA POD representing raw audio format information using a provided builder and audio info structure. ### Signature `pub unsafe extern "C" fn spa_format_audio_raw_build(builder: *mut spa_pod_builder, id: u32, info: *const spa_audio_info_raw) -> *mut spa_pod` ### Parameters - **builder** (*mut spa_pod_builder) - Pointer to the SPA POD builder. - **id** (u32) - The identifier for the format. - **info** (*const spa_audio_info_raw) - Pointer to the raw audio information structure. ### Returns - ***mut spa_pod** - A pointer to the constructed SPA POD. ``` -------------------------------- ### Deserialize a Struct pod Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa/pod/deserialize/trait.PodDeserialize.html Example implementation for deserializing a custom struct from a Struct pod. ```rust use std::{convert::TryInto, io}; use libspa::pod::deserialize::{PodDeserialize, PodDeserializer, DeserializeError, DeserializeSuccess, Visitor, StructPodDeserializer}; struct Animal { name: String, feet: u8, can_fly: bool, } impl<'de> PodDeserialize<'de> for Animal { fn deserialize( deserializer: PodDeserializer<'de>, ) -> Result<(Self, DeserializeSuccess<'de>), DeserializeError<&'de [u8]>> where Self: Sized, { struct AnimalVisitor; impl<'de> Visitor<'de> for AnimalVisitor { type Value = Animal; type ArrayElem = std::convert::Infallible; fn visit_struct( &self, struct_deserializer: &mut StructPodDeserializer<'de>, ) -> Result> { Ok(Animal { name: struct_deserializer .deserialize_field()? .expect("Input has too few fields"), feet: struct_deserializer .deserialize_field::()? .expect("Input has too few fields") .try_into() .expect("Animal is a millipede, has too many feet for a u8."), can_fly: struct_deserializer .deserialize_field()? .expect("Input has too few fields"), }) } } deserializer.deserialize_struct(AnimalVisitor) } } ``` -------------------------------- ### spa_ringbuffer_read_data Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_ringbuffer_read_data.html Reads a specified number of bytes from a ring buffer starting at a given offset. ```APIDOC ## spa_ringbuffer_read_data ### Description Reads `len` bytes from `rbuf` starting at `offset`. The `offset` must be taken modulo `size` and `len` should be smaller than `size`. ### Signature `pub unsafe extern "C" fn spa_ringbuffer_read_data(rbuf: *mut spa_ringbuffer, buffer: *const c_void, size: u32, offset: u32, data: *mut c_void, len: u32)` ### Parameters - **rbuf** (*mut spa_ringbuffer) - A pointer to the ring buffer structure. - **buffer** (*const c_void) - The memory to read from. - **size** (u32) - The size of the buffer. - **offset** (u32) - The offset in the buffer to start reading from. - **data** (*mut c_void) - The destination memory where data will be copied. - **len** (u32) - The number of bytes to read. ``` -------------------------------- ### Define SPA_TYPE_POINTER_START constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_TYPE_POINTER_START.html Represents the starting index for pointer-related types in the SPA system. ```rust pub const SPA_TYPE_POINTER_START: _bindgen_ty_10 = 65536; ``` -------------------------------- ### Initialize spa_command with spa_node_command_init Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_node_command_init.html Initializes a spa_command structure using the provided node ID. ```rust pub unsafe extern "C" fn spa_node_command_init(id: u32) -> spa_command ``` -------------------------------- ### spa_list_init Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_list_init.html Initializes a list head for a SPA linked list. ```APIDOC ## spa_list_init ### Description Initializes the provided `spa_list` structure. This function must be called to prepare a list head before it can be used in list operations. ### Signature `pub unsafe extern "C" fn spa_list_init(list: *mut spa_list)` ### Parameters - **list** (*mut spa_list) - A pointer to the `spa_list` structure to be initialized. ``` -------------------------------- ### spa_format_audio_dsp_build Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_format_audio_dsp_build.html Builds a SPA POD representing an audio DSP format using the provided builder and audio information. ```APIDOC ## spa_format_audio_dsp_build ### Signature `pub unsafe extern "C" fn spa_format_audio_dsp_build(builder: *mut spa_pod_builder, id: u32, info: *const spa_audio_info_dsp) -> *mut spa_pod` ### Description Constructs a SPA POD object for audio DSP configurations. This function is part of the low-level libspa system interface. ### Parameters - **builder** (*mut spa_pod_builder) - A pointer to the SPA POD builder instance. - **id** (u32) - The identifier for the format. - **info** (*const spa_audio_info_dsp) - A pointer to the audio DSP information structure. ### Returns - ***mut spa_pod** - A pointer to the resulting SPA POD structure. ``` -------------------------------- ### spa_format_audio_build Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_format_audio_build.html Constructs an audio format POD using the specified builder and audio info structure. ```APIDOC ## spa_format_audio_build ### Description Constructs an audio format POD (Plain Old Data) structure. This function is part of the libspa_sys library and is intended for low-level audio format manipulation. ### Signature `pub unsafe extern "C" fn spa_format_audio_build(builder: *mut spa_pod_builder, id: u32, info: *const spa_audio_info) -> *mut spa_pod` ### Parameters - **builder** (*mut spa_pod_builder) - A pointer to the POD builder instance. - **id** (u32) - The identifier for the format. - **info** (*const spa_audio_info) - A pointer to the audio information structure containing format details. ### Returns - ***mut spa_pod** - A pointer to the constructed spa_pod structure. ``` -------------------------------- ### Define SPA_PARAM_TAG_START constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_PARAM_TAG_START.html Represents the initial value for spa_param_tag. ```rust pub const SPA_PARAM_TAG_START: spa_param_tag = 0; ``` -------------------------------- ### Define SPA_PROP_INFO_START constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_PROP_INFO_START.html Represents the initial value for property information in the SPA system. ```rust pub const SPA_PROP_INFO_START: spa_prop_info = 0; ``` -------------------------------- ### Get bytes from SPA POD parser Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_pod_parser_get_bytes.html Retrieves a pointer to the data and its length from the parser. ```rust pub unsafe extern "C" fn spa_pod_parser_get_bytes( parser: *mut spa_pod_parser, value: *mut *const c_void, len: *mut u32, ) -> c_int ``` -------------------------------- ### spa_format_audio_flac_build Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_format_audio_flac_build.html Builds a FLAC audio format POD structure. ```APIDOC ## spa_format_audio_flac_build ### Description Builds a FLAC audio format POD structure using the provided builder and audio information. ### Signature `pub unsafe extern "C" fn spa_format_audio_flac_build(builder: *mut spa_pod_builder, id: u32, info: *const spa_audio_info_flac) -> *mut spa_pod` ### Parameters - **builder** (*mut spa_pod_builder) - The POD builder instance. - **id** (u32) - The format ID. - **info** (*const spa_audio_info_flac) - Pointer to the FLAC audio information structure. ### Returns - ***mut spa_pod** - A pointer to the constructed POD structure. ``` -------------------------------- ### spa_format_video_mjpg_build Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_format_video_mjpg_build.html Builds a video MJPG format POD. ```APIDOC ## spa_format_video_mjpg_build ### Description Builds a video MJPG format POD using the specified builder and video information. ### Signature `pub unsafe extern "C" fn spa_format_video_mjpg_build(builder: *mut spa_pod_builder, id: u32, info: *const spa_video_info_mjpg) -> *mut spa_pod` ### Parameters - **builder** (*mut spa_pod_builder) - The POD builder instance. - **id** (u32) - The format ID. - **info** (*const spa_video_info_mjpg) - Pointer to the MJPG video information structure. ### Returns - ***mut spa_pod** - A pointer to the constructed spa_pod. ``` -------------------------------- ### spa_handle_factory_init Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_handle_factory_init.html Initializes a SPA handle using the specified factory and support parameters. ```APIDOC ## spa_handle_factory_init ### Description Initializes a SPA handle using the provided factory and support structures. ### Signature `pub unsafe extern "C" fn spa_handle_factory_init(object: *const spa_handle_factory, handle: *mut spa_handle, info: *const spa_dict, support: *const spa_support, n_support: u32) -> c_int` ### Parameters - **object** (*const spa_handle_factory) - Pointer to the handle factory. - **handle** (*mut spa_handle) - Pointer to the handle to be initialized. - **info** (*const spa_dict) - Pointer to the dictionary containing initialization information. - **support** (*const spa_support) - Pointer to the support structures. - **n_support** (u32) - Number of support structures provided. ### Returns - **c_int** - Returns 0 on success, or a negative error code on failure. ``` -------------------------------- ### spa_format_video_dsp_build Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_format_video_dsp_build.html Builds a SPA POD for a DSP video format. ```APIDOC ## spa_format_video_dsp_build ### Description Builds a SPA POD representing a DSP video format using the provided builder and video information. ### Signature `pub unsafe extern "C" fn spa_format_video_dsp_build(builder: *mut spa_pod_builder, id: u32, info: *const spa_video_info_dsp) -> *mut spa_pod` ### Parameters - **builder** (*mut spa_pod_builder) - The builder instance used to construct the POD. - **id** (u32) - The identifier for the format. - **info** (*const spa_video_info_dsp) - Pointer to the spa_video_info_dsp structure containing video format details. ### Returns - ***mut spa_pod** - A pointer to the constructed spa_pod structure. ``` -------------------------------- ### Implementing FixedSizedPod for a Newtype Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa/pod/trait.FixedSizedPod.html Example of implementing the trait for a wrapper type by mapping it to an i32 canonical representation. ```rust use libspa::pod::FixedSizedPod; struct Newtype(i32); impl FixedSizedPod for Newtype { // The pod we want to serialize into is a `Int` type pod, which has `i32` as it's canonical representation. type CanonicalType = i32; fn as_canonical_type(&self) -> Self::CanonicalType { // Convert self to the canonical type. self.0 } fn from_canonical_type(canonical: &Self::CanonicalType) -> Self { // Create a new Self instance from the canonical type. Newtype(*canonical) } } ``` -------------------------------- ### spa_json_container_len Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_json_container_len.html Returns the length of a container at the current position, starting at the provided value. The length includes the enclosing {} or []. ```APIDOC ## spa_json_container_len ### Description Returns the length of a container at the current position, starting at the specified value. The returned length includes the enclosing {} or [] characters. ### Signature `pub unsafe extern "C" fn spa_json_container_len(iter: *mut spa_json, value: *const c_char, len: c_int) -> c_int` ### Parameters - **iter** (*mut spa_json) - The iterator pointing to the current position. - **value** (*const c_char) - The starting value of the container. - **len** (c_int) - The length of the value string. ### Returns - **c_int** - The length of the container including {} or [], or 0 on error. ``` -------------------------------- ### spa_log_topic_init Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_log_topic_init.html Initializes a logging topic using the provided log and topic pointers. ```APIDOC ## spa_log_topic_init ### Description Initializes a logging topic for the SPA logging system. ### Signature `pub unsafe extern "C" fn spa_log_topic_init(log: *mut spa_log, topic: *mut spa_log_topic)` ### Parameters - **log** (*mut spa_log) - Pointer to the spa_log instance. - **topic** (*mut spa_log_topic) - Pointer to the spa_log_topic structure to initialize. ``` -------------------------------- ### spa_format_audio_vorbis_build Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_format_audio_vorbis_build.html Builds a Vorbis audio format POD structure. ```APIDOC ## spa_format_audio_vorbis_build ### Description Builds a Vorbis audio format POD structure using the provided builder and audio information. ### Signature `pub unsafe extern "C" fn spa_format_audio_vorbis_build(builder: *mut spa_pod_builder, id: u32, info: *const spa_audio_info_vorbis) -> *mut spa_pod` ### Parameters - **builder** (*mut spa_pod_builder) - The POD builder instance. - **id** (u32) - The format ID. - **info** (*const spa_audio_info_vorbis) - Pointer to the Vorbis audio information structure. ### Returns - ***mut spa_pod** - A pointer to the constructed POD structure. ``` -------------------------------- ### spa_pod_builder_bytes_start function signature Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_pod_builder_bytes_start.html The function signature for spa_pod_builder_bytes_start as defined in the C API. ```rust pub unsafe extern "C" fn spa_pod_builder_bytes_start( builder: *mut spa_pod_builder, ) -> u32 ``` -------------------------------- ### Get or insert value Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/type.spa_handle_factory_enum_func_t.html Inserts a value if the Option is None, otherwise returns a mutable reference to the existing value. ```rust let mut x = None; { let y: &mut u32 = x.get_or_insert(5); assert_eq!(y, &5); *y = 7; } assert_eq!(x, Some(7)); ``` -------------------------------- ### spa_format_audio_iec958_build Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_format_audio_iec958_build.html Builds an IEC958 audio format POD. ```APIDOC ## spa_format_audio_iec958_build ### Description Builds an IEC958 audio format POD using the specified builder, ID, and audio information. ### Signature `pub unsafe extern "C" fn spa_format_audio_iec958_build(builder: *mut spa_pod_builder, id: u32, info: *const spa_audio_info_iec958) -> *mut spa_pod` ### Parameters - **builder** (*mut spa_pod_builder) - The POD builder instance. - **id** (u32) - The format ID. - **info** (*const spa_audio_info_iec958) - Pointer to the IEC958 audio information structure. ### Returns - ***mut spa_pod** - A pointer to the constructed POD. ``` -------------------------------- ### Get SPA POD parser state Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_pod_parser_get_state.html Retrieves the current state of the provided parser into the specified state structure. ```rust pub unsafe extern "C" fn spa_pod_parser_get_state( parser: *mut spa_pod_parser, state: *mut spa_pod_parser_state, ) ``` -------------------------------- ### Retrieve CPU count using spa_cpu_get_count Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_cpu_get_count.html This function is used to get the number of CPUs from the provided spa_cpu pointer. ```rust pub unsafe extern "C" fn spa_cpu_get_count(c: *mut spa_cpu) -> u32 ``` -------------------------------- ### spa_format_video_build Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_format_video_build.html Constructs a video format POD structure using the provided builder and video information. ```APIDOC ## spa_format_video_build ### Description Constructs a video format POD structure using the provided builder and video information. ### Signature `pub unsafe extern "C" fn spa_format_video_build(builder: *mut spa_pod_builder, id: u32, info: *const spa_video_info) -> *mut spa_pod` ### Parameters - **builder** (*mut spa_pod_builder) - Pointer to the spa_pod_builder instance. - **id** (u32) - The identifier for the format. - **info** (*const spa_video_info) - Pointer to the spa_video_info structure containing video details. ### Returns - ***mut spa_pod** - A pointer to the constructed spa_pod structure. ``` -------------------------------- ### Resampled Sample Calculation Formula Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/struct.spa_io_rate_match.html Formula for calculating the first resampled sample timestamp relative to the graph cycle start. ```unparsed first_resampled_sample_nsec = first_original_sample_nsec * (rate_match->delay * SPA_NSEC_PER_SEC + rate_match->delay_frac) / node_rate ``` -------------------------------- ### Initialize a logging topic Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_log_topic_init.html Initializes a spa_log_topic structure using the provided spa_log instance. ```rust pub unsafe extern "C" fn spa_log_topic_init( log: *mut spa_log, topic: *mut spa_log_topic, ) ``` -------------------------------- ### spa_format_video_raw_build Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_format_video_raw_build.html Builds a raw video format POD structure. ```APIDOC ## spa_format_video_raw_build ### Description Constructs a raw video format POD structure using the specified builder and video information. ### Signature `pub unsafe extern "C" fn spa_format_video_raw_build(builder: *mut spa_pod_builder, id: u32, info: *const spa_video_info_raw) -> *mut spa_pod` ### Parameters - **builder** (*mut spa_pod_builder) - The POD builder instance. - **id** (u32) - The format ID. - **info** (*const spa_video_info_raw) - Pointer to the raw video information structure. ### Returns - ***mut spa_pod** - A pointer to the constructed POD structure. ``` -------------------------------- ### Get or insert with closure Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/type.spa_handle_factory_enum_func_t.html Inserts a value computed from a closure if the Option is None, returning a mutable reference to the contained value. ```rust let mut x = None; { let y: &mut u32 = x.get_or_insert_with(|| 5); assert_eq!(y, &5); *y = 7; } assert_eq!(x, Some(7)); ``` -------------------------------- ### spa_command_init Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_command_init.html Initializes a spa_command structure using the specified type and ID. ```APIDOC ## spa_command_init ### Description Initializes a spa_command structure with the given type and identifier. ### Signature `pub unsafe extern "C" fn spa_command_init(type_: u32, id: u32) -> spa_command` ### Parameters - **type_** (u32) - The type value for the command. - **id** (u32) - The identifier for the command. ### Returns - **spa_command** - The initialized command structure. ``` -------------------------------- ### Get or insert default value Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/type.spa_handle_factory_enum_func_t.html Inserts the default value if the Option is None, returning a mutable reference to the contained value. ```rust let mut x = None; { let y: &mut u32 = x.get_or_insert_default(); assert_eq!(y, &0); *y = 7; } assert_eq!(x, Some(7)); ``` -------------------------------- ### spa_pod_parser_init Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_pod_parser_init.html Initializes a spa_pod_parser structure to begin parsing a SPA pod. ```APIDOC ## spa_pod_parser_init ### Description Initializes a `spa_pod_parser` structure with a pointer to the data buffer and its size. This function is used to prepare a parser for reading SPA pod data. ### Signature `pub unsafe extern "C" fn spa_pod_parser_init(parser: *mut spa_pod_parser, data: *const c_void, size: u32)` ### Parameters - **parser** (*mut spa_pod_parser) - A pointer to the parser structure to initialize. - **data** (*const c_void) - A pointer to the data buffer containing the SPA pod. - **size** (u32) - The size of the data buffer in bytes. ``` -------------------------------- ### Define SPA_PARAM_BUFFERS_START constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_PARAM_BUFFERS_START.html Represents the initial index for buffer-related parameters. ```rust pub const SPA_PARAM_BUFFERS_START: spa_param_buffers = 0; ``` -------------------------------- ### Minimal event loop control usage Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/struct.spa_loop_control_methods.html A pseudo-code example demonstrating the basic lifecycle of entering, iterating, and leaving an event loop. ```c spa_loop_control_enter(loop); while (running) { spa_loop_control_iterate(loop, -1); } spa_loop_control_leave(loop); ``` -------------------------------- ### Get video format from short name Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_type_video_format_from_short_name.html Retrieves the numeric video format identifier corresponding to the provided short name string. ```rust pub unsafe extern "C" fn spa_type_video_format_from_short_name( name: *const c_char, ) -> u32 ``` -------------------------------- ### Initialize a hook list Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_hook_list_init.html Initializes a hook list to the empty list. ```rust pub unsafe extern "C" fn spa_hook_list_init(list: *mut spa_hook_list) ``` -------------------------------- ### spa_hook_list_init Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_hook_list_init.html Initializes a hook list to the empty list. ```APIDOC ## spa_hook_list_init ### Description Initializes a hook list to the empty list. ### Signature `pub unsafe extern "C" fn spa_hook_list_init(list: *mut spa_hook_list)` ### Parameters - **list** (*mut spa_hook_list) - A pointer to the hook list to be initialized. ``` -------------------------------- ### Get video format short name Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_type_video_format_to_short_name.html Retrieves a pointer to a C-style string representing the short name of the given video format type. ```rust pub unsafe extern "C" fn spa_type_video_format_to_short_name( type_: u32, ) -> *const c_char ``` -------------------------------- ### spa_ringbuffer_write_data Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_ringbuffer_write_data.html Writes len bytes to the buffer starting at the specified offset. The offset is taken modulo the buffer size, and the length must be smaller than the buffer size. ```APIDOC ## spa_ringbuffer_write_data ### Description Writes len bytes to a buffer starting at a specific offset. The offset is treated as modulo the buffer size. ### Signature `pub unsafe extern "C" fn spa_ringbuffer_write_data(rbuf: *mut spa_ringbuffer, buffer: *mut c_void, size: u32, offset: u32, data: *const c_void, len: u32)` ### Parameters - **rbuf** (*mut spa_ringbuffer) - A pointer to the spa_ringbuffer structure. - **buffer** (*mut c_void) - The destination memory buffer. - **size** (u32) - The total size of the destination buffer. - **offset** (u32) - The offset within the buffer to begin writing. - **data** (*const c_void) - The source memory containing the data to write. - **len** (u32) - The number of bytes to write. ``` -------------------------------- ### spa_format_audio_ra_build Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_format_audio_ra_build.html Builds a SPA POD for RA audio formats. ```APIDOC ## spa_format_audio_ra_build ### Description Builds a SPA POD representing an RA audio format using the provided builder and audio information. ### Signature `pub unsafe extern "C" fn spa_format_audio_ra_build(builder: *mut spa_pod_builder, id: u32, info: *const spa_audio_info_ra) -> *mut spa_pod` ### Parameters - **builder** (*mut spa_pod_builder) - The builder instance used to construct the POD. - **id** (u32) - The identifier for the format. - **info** (*const spa_audio_info_ra) - A pointer to the RA audio information structure. ### Returns - ***mut spa_pod** - A pointer to the constructed SPA POD. ``` -------------------------------- ### spa_format_audio_dsd_build Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/fn.spa_format_audio_dsd_build.html Builds a DSD audio format POD structure. ```APIDOC ## spa_format_audio_dsd_build ### Description Builds a DSD audio format POD structure using the provided builder and audio information. ### Signature `pub unsafe extern "C" fn spa_format_audio_dsd_build(builder: *mut spa_pod_builder, id: u32, info: *const spa_audio_info_dsd) -> *mut spa_pod` ### Parameters - **builder** (*mut spa_pod_builder) - The POD builder instance. - **id** (u32) - The identifier for the format. - **info** (*const spa_audio_info_dsd) - Pointer to the DSD audio information structure. ### Returns - ***mut spa_pod** - A pointer to the constructed POD structure. ``` -------------------------------- ### Define SPA_FORMAT_START constant Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/constant.SPA_FORMAT_START.html Represents the initial value for SPA format types. ```rust pub const SPA_FORMAT_START: spa_format = 0; ``` -------------------------------- ### Define spa_param_port_config_mode Source: https://pipewire.pages.freedesktop.org/pipewire-rs/libspa_sys/type.spa_param_port_config_mode.html Represents the port configuration mode as an unsigned integer. ```rust pub type spa_param_port_config_mode = c_uint; ```