Use int counters for iterating items

Use counters instead of void* to iterate items. This simplifies some
things and makes it easier to do over the wire.
Add format description to NodeInfo and use this to add format
descriptions to pinos devices.
Small fixes to fix leaks and crashes.
This commit is contained in:
Wim Taymans 2017-02-01 08:58:21 +01:00
parent 8b84d8fde6
commit b38ecafe81
38 changed files with 363 additions and 330 deletions

View file

@ -126,7 +126,7 @@ struct _SpaMonitor {
SpaResult (*enum_items) (SpaMonitor *monitor,
SpaMonitorItem **item,
void **state);
unsigned int index);
};

View file

@ -325,12 +325,12 @@ struct _SpaNode {
* @port_id: the port to query
* @format: pointer to a format
* @filter: a format filter
* @state: a state variable, %NULL to get the first item
* @index: an index variable, 0 to get the first item
*
* Enumerate all possible formats on @port_id of @node that are compatible
* with @filter..
*
* Use @state to retrieve the formats one by one until the function
* Use @index to retrieve the formats one by one until the function
* returns #SPA_RESULT_ENUM_END.
*
* The result format can be queried and modified and ultimately be used
@ -348,7 +348,7 @@ struct _SpaNode {
uint32_t port_id,
SpaFormat **format,
const SpaFormat *filter,
void **state);
unsigned int index);
/**
* SpaNode::port_set_format:
* @node: a #SpaNode

View file

@ -136,7 +136,7 @@ struct _SpaHandleFactory {
* SpaHandle::enum_interface_info:
* @factory: a #SpaHandleFactory
* @info: result to hold SpaInterfaceInfo.
* @state: state to keep track of the enumeration, %NULL for first item
* @index: index to keep track of the enumeration, 0 for first item
*
* Enumerate the interface information for @factory.
*
@ -147,7 +147,7 @@ struct _SpaHandleFactory {
*/
SpaResult (*enum_interface_info) (const SpaHandleFactory *factory,
const SpaInterfaceInfo **info,
void **state);
unsigned int index);
};
#define spa_handle_factory_init(h,...) (h)->init((h),__VA_ARGS__)
@ -156,7 +156,7 @@ struct _SpaHandleFactory {
/**
* SpaEnumHandleFactoryFunc:
* @factory: a location to hold the factory result
* @state: state to keep track of the enumeration
* @index: index to keep track of the enumeration
*
* The function signature of the entry point in a plugin.
*
@ -165,12 +165,12 @@ struct _SpaHandleFactory {
* #SPA_RESULT_ENUM_END when there are no more factories
*/
typedef SpaResult (*SpaEnumHandleFactoryFunc) (const SpaHandleFactory **factory,
void **state);
unsigned int index);
/**
* spa_enum_handle_factory:
* @factory: a location to hold the factory result
* @state: state to keep track of the enumeration
* @index: index to keep track of the enumeration
*
* The entry point in a plugin.
*
@ -179,7 +179,7 @@ typedef SpaResult (*SpaEnumHandleFactoryFunc) (const SpaHandleFactory **factory,
* #SPA_RESULT_ENUM_END when there are no more factories
*/
SpaResult spa_enum_handle_factory (const SpaHandleFactory **factory,
void **state);
unsigned int index);
#ifdef __cplusplus
} /* extern "C" */