mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
Improve enum_param
Add an argument to pass the result param to the caller instead of having the caller have to pick it up from the builder. Improve docs for node, clock and monitor Pass spa_pod everywhere instead of spa_pod_object. Pass result argument to spa_pod_filter to make things a little nicer.
This commit is contained in:
parent
cd5e697e9f
commit
440f681f4b
70 changed files with 872 additions and 858 deletions
|
|
@ -27,24 +27,17 @@ extern "C" {
|
|||
#define SPA_TYPE__Clock SPA_TYPE_INTERFACE_BASE "Clock"
|
||||
#define SPA_TYPE_CLOCK_BASE SPA_TYPE__Clock ":"
|
||||
|
||||
/**
|
||||
* spa_clock_state:
|
||||
* @SPA_CLOCK_STATE_STOPPED: the clock is stopped
|
||||
* @SPA_CLOCK_STATE_PAUSED: the clock is paused
|
||||
* @SPA_CLOCK_STATE_RUNNING: the clock is running
|
||||
*/
|
||||
/** The state of the clock */
|
||||
enum spa_clock_state {
|
||||
SPA_CLOCK_STATE_STOPPED,
|
||||
SPA_CLOCK_STATE_PAUSED,
|
||||
SPA_CLOCK_STATE_RUNNING,
|
||||
SPA_CLOCK_STATE_STOPPED, /*< the clock is stopped */
|
||||
SPA_CLOCK_STATE_PAUSED, /*< the clock is paused */
|
||||
SPA_CLOCK_STATE_RUNNING, /*< the clock is running */
|
||||
};
|
||||
|
||||
#include <spa/utils/defs.h>
|
||||
#include <spa/pod/builder.h>
|
||||
|
||||
/**
|
||||
* spa_clock:
|
||||
*
|
||||
* A time provider.
|
||||
*/
|
||||
struct spa_clock {
|
||||
|
|
@ -53,56 +46,70 @@ struct spa_clock {
|
|||
#define SPA_VERSION_CLOCK 0
|
||||
uint32_t version;
|
||||
|
||||
/** extra clock information */
|
||||
const struct spa_dict *info;
|
||||
/**
|
||||
* spa_clock::state:
|
||||
*
|
||||
* The current state of the clock
|
||||
*/
|
||||
|
||||
/** The current state of the clock */
|
||||
enum spa_clock_state state;
|
||||
/**
|
||||
* spa_clock::get_props:
|
||||
* @clock: a #spa_clock
|
||||
* Get the parameters of \a clock.
|
||||
*
|
||||
* Get the parameters of @clock.
|
||||
*
|
||||
* The returned @props is a snapshot of the current configuration and
|
||||
* The returned \a props is a snapshot of the current configuration and
|
||||
* can be modified. The modifications will take effect after a call
|
||||
* to spa_clock::set_props.
|
||||
* to set_props.
|
||||
*
|
||||
* Returns: 0 on success
|
||||
* -EINVAL when clock or props are %NULL
|
||||
* -ENOTSUP when there are no properties
|
||||
* implemented on @clock
|
||||
* \param clock a spa_clock
|
||||
* \param id the paramter id to enumerate
|
||||
* \param index state while iterating, 0 for the first param
|
||||
* \param param result parameter
|
||||
* \param builder builder for \a param
|
||||
* \return 1 on success
|
||||
* 0 when no more items are available
|
||||
* -EINVAL when invalid parameters are provided
|
||||
* -ENOTSUP when there are no parameters
|
||||
* implemented on \a clock
|
||||
* -ENOENT when the param with id is not supported
|
||||
*/
|
||||
int (*enum_params) (struct spa_clock *clock,
|
||||
uint32_t id, uint32_t *index,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder);
|
||||
/**
|
||||
* spa_clock::set_props:
|
||||
* @clock: a #spa_clock
|
||||
* @props: a #struct spa_props
|
||||
* Set the configurable properties in \a clock.
|
||||
*
|
||||
* Set the configurable properties in @clock.
|
||||
*
|
||||
* Usually, @props will be obtained from spa_clock::get_props and then
|
||||
* Usually, \a props will be obtained from spa_clock::get_props and then
|
||||
* modified but it is also possible to set another #struct spa_props object
|
||||
* as long as its keys and types match those of struct spa_props::get_props.
|
||||
*
|
||||
* Properties with keys that are not known are ignored.
|
||||
*
|
||||
* If @props is NULL, all the properties are reset to their defaults.
|
||||
* If \a props is NULL, all the properties are reset to their defaults.
|
||||
*
|
||||
* Returns: 0 on success
|
||||
* -EINVAL when clock is %NULL
|
||||
* -ENOTSUP when no properties can be
|
||||
* modified on @clock.
|
||||
* \param clock a spa_clock
|
||||
* \param id the paramter id to configure
|
||||
* \param flags extra parameter flags
|
||||
* \param param the parameter to configure
|
||||
* \return 0 on success
|
||||
* -EINVAL when invalid parameters are provided
|
||||
* -ENOTSUP when no parameters can be
|
||||
* modified on \a clock.
|
||||
* -ENOENT when the param with id is not supported
|
||||
*/
|
||||
int (*set_param) (struct spa_clock *clock,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param);
|
||||
const struct spa_pod *param);
|
||||
|
||||
/** Get the time of \a clock
|
||||
*
|
||||
* Get an atomic snapshot between the time of the monotonic clock and
|
||||
* the clock specific time expressed in ticks.
|
||||
*
|
||||
* \param clock the clock
|
||||
* \param rate result rate. This is the number of ticks per second
|
||||
* \param ticks result number of ticks. There are \a rate ticks per second.
|
||||
* \param monotonic_time the time of the monotonic clock when \a ticks was
|
||||
* obtained.
|
||||
*/
|
||||
int (*get_time) (struct spa_clock *clock,
|
||||
int32_t *rate,
|
||||
int64_t *ticks,
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ struct spa_monitor;
|
|||
#include <spa/utils/defs.h>
|
||||
#include <spa/utils/dict.h>
|
||||
#include <spa/pod/event.h>
|
||||
#include <spa/pod/builder.h>
|
||||
|
||||
#define SPA_TYPE_EVENT__Monitor SPA_TYPE_EVENT_BASE "Monitor"
|
||||
#define SPA_TYPE_EVENT_MONITOR_BASE SPA_TYPE_EVENT__Monitor ":"
|
||||
|
|
@ -39,9 +40,7 @@ struct spa_monitor;
|
|||
#define SPA_TYPE_EVENT_MONITOR__Removed SPA_TYPE_EVENT_MONITOR_BASE "Removed"
|
||||
#define SPA_TYPE_EVENT_MONITOR__Changed SPA_TYPE_EVENT_MONITOR_BASE "Changed"
|
||||
|
||||
struct spa_monitor_item {
|
||||
struct spa_pod_object object;
|
||||
};
|
||||
|
||||
#define SPA_TYPE__MonitorItem SPA_TYPE_POD_OBJECT_BASE "MonitorItem"
|
||||
#define SPA_TYPE_MONITOR_ITEM_BASE SPA_TYPE__MonitorItem ":"
|
||||
|
||||
|
|
@ -54,20 +53,20 @@ struct spa_monitor_item {
|
|||
#define SPA_TYPE_MONITOR_ITEM__factory SPA_TYPE_MONITOR_ITEM_BASE "factory"
|
||||
|
||||
struct spa_type_monitor {
|
||||
uint32_t Monitor;
|
||||
uint32_t Monitor; /*< the monitor object */
|
||||
|
||||
uint32_t Added;
|
||||
uint32_t Removed;
|
||||
uint32_t Changed;
|
||||
uint32_t Added; /*< item added event */
|
||||
uint32_t Removed; /*< item removed event */
|
||||
uint32_t Changed; /*< item changed event */
|
||||
|
||||
uint32_t MonitorItem;
|
||||
uint32_t id;
|
||||
uint32_t flags;
|
||||
uint32_t state;
|
||||
uint32_t name;
|
||||
uint32_t klass;
|
||||
uint32_t info;
|
||||
uint32_t factory;
|
||||
uint32_t MonitorItem; /*< monitor item object */
|
||||
uint32_t id; /*< item id property */
|
||||
uint32_t flags; /*< item flags property */
|
||||
uint32_t state; /*< item state property */
|
||||
uint32_t name; /*< item name property */
|
||||
uint32_t klass; /*< item klass property */
|
||||
uint32_t info; /*< item info property */
|
||||
uint32_t factory; /*< item factory property */
|
||||
};
|
||||
|
||||
static inline void spa_type_monitor_map(struct spa_type_map *map, struct spa_type_monitor *type)
|
||||
|
|
@ -92,16 +91,11 @@ enum spa_monitor_item_flags {
|
|||
SPA_MONITOR_ITEM_FLAG_NONE = 0,
|
||||
};
|
||||
|
||||
/**
|
||||
* spa_monitor_item_state:
|
||||
* @SPA_MONITOR_ITEM_STATE_AVAILABLE: The item is available
|
||||
* @SPA_MONITOR_ITEM_STATE_DISABLED: the item is disabled
|
||||
* @SPA_MONITOR_ITEM_STATE_UNAVAILABLE: the item is unavailable
|
||||
*/
|
||||
/** The monitor item state */
|
||||
enum spa_monitor_item_state {
|
||||
SPA_MONITOR_ITEM_STATE_AVAILABLE,
|
||||
SPA_MONITOR_ITEM_STATE_DISABLED,
|
||||
SPA_MONITOR_ITEM_STATE_UNAVAILABLE,
|
||||
SPA_MONITOR_ITEM_STATE_AVAILABLE, /*< The item is available */
|
||||
SPA_MONITOR_ITEM_STATE_DISABLED, /*< The item is disabled */
|
||||
SPA_MONITOR_ITEM_STATE_UNAVAILABLE, /*< The item is unavailable */
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -112,6 +106,7 @@ struct spa_monitor_callbacks {
|
|||
#define SPA_VERSION_MONITOR_CALLBACKS 0
|
||||
uint32_t version;
|
||||
|
||||
/** an item is added/removed/changed on the monitor */
|
||||
void (*event) (void *data, struct spa_event *event);
|
||||
};
|
||||
|
||||
|
|
@ -127,43 +122,40 @@ struct spa_monitor {
|
|||
uint32_t version;
|
||||
|
||||
/**
|
||||
* spa_monitor::info
|
||||
*
|
||||
* Extra information about the monitor
|
||||
*/
|
||||
const struct spa_dict *info;
|
||||
|
||||
/**
|
||||
* spa_monitor::set_callbacks:
|
||||
* @monitor: a #spa_monitor
|
||||
* @callback: a #callbacks
|
||||
*
|
||||
* Set callbacks to receive asynchronous notifications from
|
||||
* the monitor.
|
||||
*
|
||||
* Returns: 0 on success
|
||||
* -errno on error
|
||||
* \param monitor: a #spa_monitor
|
||||
* \param callback: a #callbacks
|
||||
* \return 0 on success
|
||||
* < 0 errno on error
|
||||
*/
|
||||
int (*set_callbacks) (struct spa_monitor *monitor,
|
||||
const struct spa_monitor_callbacks *callbacks,
|
||||
void *data);
|
||||
|
||||
/**
|
||||
* spa_monitor::enum_items:
|
||||
* @monitor: a #spa_monitor
|
||||
* @item: result item
|
||||
* @index: index of the item
|
||||
*
|
||||
* Get the next item of the monitor. \a index should contain 0 to get the
|
||||
* first item and is updated with an opaque value that should be passed
|
||||
* unmodified to get the next items.
|
||||
*
|
||||
* Returns: 1 when an item is available
|
||||
* \param monito: a spa_monitor
|
||||
* \param index state, use 0 for the first item
|
||||
* \param item result item
|
||||
* \param builder builder for \a item
|
||||
* \return 1 when an item is available
|
||||
* 0 when no more items are available
|
||||
* -errno on error
|
||||
* < 0 errno on error
|
||||
*/
|
||||
int (*enum_items) (struct spa_monitor *monitor,
|
||||
struct spa_monitor_item **item, uint32_t *index);
|
||||
uint32_t *index,
|
||||
struct spa_pod **item,
|
||||
struct spa_pod_builder *builder);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -65,9 +65,9 @@ struct spa_port_io {
|
|||
#define SPA_PORT_IO_INIT (struct spa_port_io) { SPA_STATUS_OK, SPA_ID_INVALID, }
|
||||
|
||||
/**
|
||||
* struct spa_port_info
|
||||
* @flags: extra port flags
|
||||
* @rate: rate of sequence number increment per second of media data
|
||||
* Port information structure
|
||||
*
|
||||
* Contains the basic port information.
|
||||
*/
|
||||
struct spa_port_info {
|
||||
#define SPA_PORT_INFO_FLAG_REMOVABLE (1<<0) /**< port can be removed */
|
||||
|
|
@ -89,20 +89,21 @@ struct spa_node_callbacks {
|
|||
#define SPA_VERSION_NODE_CALLBACKS 0
|
||||
uint32_t version; /**< version of this structure */
|
||||
|
||||
/** Emited when an async operation completed */
|
||||
/** Emited when an async operation completed.
|
||||
*
|
||||
* Will be called from the main thread. */
|
||||
void (*done) (void *data, int seq, int res);
|
||||
/**
|
||||
* struct spa_node_callbacks::event:
|
||||
* @node: a #struct spa_node
|
||||
* @event: the event that was emited
|
||||
* \param node a spa_node
|
||||
* \param event the event that was emited
|
||||
*
|
||||
* This will be called when an out-of-bound event is notified
|
||||
* on @node. the callback can be called from any thread.
|
||||
* on \a node. The callback will be called from the main thread.
|
||||
*/
|
||||
void (*event) (void *data, struct spa_event *event);
|
||||
|
||||
/**
|
||||
* struct spa_node_callbacks::need_input:
|
||||
* @node: a #struct spa_node
|
||||
* \param node a spa_node
|
||||
*
|
||||
* The node needs more input. This callback is called from the
|
||||
* data thread.
|
||||
|
|
@ -112,8 +113,7 @@ struct spa_node_callbacks {
|
|||
*/
|
||||
void (*need_input) (void *data);
|
||||
/**
|
||||
* struct spa_node_callbacks::have_output:
|
||||
* @node: a #struct spa_node
|
||||
* \param node a spa_node
|
||||
*
|
||||
* The node has output input. This callback is called from the
|
||||
* data thread.
|
||||
|
|
@ -122,17 +122,17 @@ struct spa_node_callbacks {
|
|||
* on the output ports.
|
||||
*/
|
||||
void (*have_output) (void *data);
|
||||
|
||||
/**
|
||||
* struct spa_node_callbacks::reuse_buffer:
|
||||
* @node: a #struct spa_node
|
||||
* @port_id: an input port_id
|
||||
* @buffer_id: the buffer id to be reused
|
||||
* \param node a spa_node
|
||||
* \param port_id an input port_id
|
||||
* \param buffer_id the buffer id to be reused
|
||||
*
|
||||
* The node has a buffer that can be reused. This callback is called
|
||||
* from the data thread.
|
||||
*
|
||||
* When this function is NULL, the buffers to reuse will be set in
|
||||
* the io area or the input ports.
|
||||
* the io area of the input ports.
|
||||
*/
|
||||
void (*reuse_buffer) (void *data,
|
||||
uint32_t port_id,
|
||||
|
|
@ -140,14 +140,16 @@ struct spa_node_callbacks {
|
|||
|
||||
};
|
||||
|
||||
#define SPA_NODE_PARAM_FLAG_TEST_ONLY (1 << 0) /* just check if the param is accepted */
|
||||
#define SPA_NODE_PARAM_FLAG_FIXATE (1 << 1) /* fixate the non-optional unset fields */
|
||||
#define SPA_NODE_PARAM_FLAG_NEAREST (1 << 2) /* allow set fields to be rounded to the
|
||||
/** flags that can be passed to set_param and port_set_param functions */
|
||||
enum spa_node_param_flags {
|
||||
SPA_NODE_PARAM_FLAG_TEST_ONLY = (1 << 0), /* just check if the param is accepted */
|
||||
SPA_NODE_PARAM_FLAG_FIXATE = (1 << 1), /* fixate the non-optional unset fields */
|
||||
SPA_NODE_PARAM_FLAG_NEAREST = (1 << 2), /* allow set fields to be rounded to the
|
||||
* nearest allowed field value. */
|
||||
};
|
||||
|
||||
/**
|
||||
* struct spa_node:
|
||||
*
|
||||
* A struct spa_node is a component that can consume and produce buffers.
|
||||
* A spa_node is a component that can consume and produce buffers.
|
||||
*
|
||||
*
|
||||
*
|
||||
|
|
@ -158,8 +160,6 @@ struct spa_node {
|
|||
#define SPA_VERSION_NODE 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* spa_node::info
|
||||
*
|
||||
* Extra information about the node
|
||||
*/
|
||||
const struct spa_dict *info;
|
||||
|
|
@ -178,24 +178,25 @@ struct spa_node {
|
|||
* \param index the index of enumeration, pass 0 for the first item and the
|
||||
* index is updated to retrieve the next item.
|
||||
* \param filter and optional filter to use
|
||||
* \param param builder for the result object.
|
||||
*
|
||||
* \return #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when node or builder are %NULL
|
||||
* #SPA_RESULT_UNKNOWN_PARAM the parameter \a id is unknown
|
||||
* #SPA_RESULT_ENUM_END when there are no more parameters to enumerate
|
||||
* #SPA_RESULT_NOT_IMPLEMENTED when there are no parameters
|
||||
* \param param result param or NULL
|
||||
* \param builder builder for the param object.
|
||||
* \return 1 on success and \a param contains the result
|
||||
* 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 node
|
||||
*/
|
||||
int (*enum_params) (struct spa_node *node,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder);
|
||||
/**
|
||||
* 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_object
|
||||
* 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.
|
||||
|
|
@ -207,67 +208,58 @@ struct spa_node {
|
|||
* \param flags additional flags
|
||||
* \param param the parameter to configure
|
||||
*
|
||||
* \return #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
|
||||
* #SPA_RESULT_NOT_IMPLEMENTED when there are no parameters
|
||||
* implemented on \a node
|
||||
* #SPA_RESULT_WRONG_PROPERTY_TYPE when a property has the wrong
|
||||
* type.
|
||||
* #SPA_RESULT_UNKNOWN_PARAM the parameter is unknown
|
||||
* \return 0 on success
|
||||
* -EINVAL when node is NULL
|
||||
* -ENOTSUP when there are no parameters implemented on \a node
|
||||
* -ENOENT the parameter is unknown
|
||||
*/
|
||||
int (*set_param) (struct spa_node *node,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param);
|
||||
const struct spa_pod *param);
|
||||
|
||||
/**
|
||||
* struct spa_node::send_command:
|
||||
* @node: a #struct spa_node
|
||||
* @command: a #spa_command
|
||||
*
|
||||
* Send a command to @node.
|
||||
* 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.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when node or command is %NULL
|
||||
* #SPA_RESULT_NOT_IMPLEMENTED when this node can't process commands
|
||||
* #SPA_RESULT_INVALID_COMMAND @command is an invalid command
|
||||
* #SPA_RESULT_ASYNC @command is executed asynchronously
|
||||
* \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
|
||||
*/
|
||||
int (*send_command) (struct spa_node *node, const struct spa_command *command);
|
||||
|
||||
/**
|
||||
* struct spa_node::set_event_callback:
|
||||
* @node: a #struct spa_node
|
||||
* @callbacks: callbacks to set
|
||||
*
|
||||
* Set callbacks to receive events and scheduling callbacks from @node.
|
||||
* if @callbacks is %NULL, the current callbacks are removed.
|
||||
* Set callbacks to receive events and scheduling callbacks from \a node.
|
||||
* if \a callbacks is NULL, the current callbacks are removed.
|
||||
*
|
||||
* This function must be called from the main thread.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
|
||||
* \param node a spa_node
|
||||
* \param callbacks callbacks to set
|
||||
* \return 0 on success
|
||||
* -EINVAL when node is NULL
|
||||
*/
|
||||
int (*set_callbacks) (struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
void *data);
|
||||
/**
|
||||
* struct spa_node::get_n_ports:
|
||||
* @node: a #struct spa_node
|
||||
* @n_input_ports: location to hold the number of input ports or %NULL
|
||||
* @max_input_ports: location to hold the maximum number of input ports or %NULL
|
||||
* @n_output_ports: location to hold the number of output ports or %NULL
|
||||
* @max_output_ports: location to hold the maximum number of output ports or %NULL
|
||||
*
|
||||
* Get the current number of input and output ports and also the maximum
|
||||
* number of ports.
|
||||
*
|
||||
* This function must be called from the main thread.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
|
||||
* \param node a spa_node
|
||||
* \param n_input_ports location to hold the number of input ports or NULL
|
||||
* \param max_input_ports location to hold the maximum number of input ports or NULL
|
||||
* \param n_output_ports location to hold the number of output ports or NULL
|
||||
* \param max_output_ports location to hold the maximum number of output ports or NULL
|
||||
* \return 0 on success
|
||||
* -EINVAL when node is NULL
|
||||
*/
|
||||
int (*get_n_ports) (struct spa_node *node,
|
||||
uint32_t *n_input_ports,
|
||||
|
|
@ -275,19 +267,17 @@ struct spa_node {
|
|||
uint32_t *n_output_ports,
|
||||
uint32_t *max_output_ports);
|
||||
/**
|
||||
* struct spa_node::get_port_ids:
|
||||
* @node: a #struct spa_node
|
||||
* @n_input_ports: size of the @input_ids array
|
||||
* @input_ids: array to store the input stream ids
|
||||
* @n_output_ports: size of the @output_ids array
|
||||
* @output_ids: array to store the output stream ids
|
||||
*
|
||||
* Get the ids of the currently available ports.
|
||||
*
|
||||
* This function must be called from the main thread.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
|
||||
* \param node a #struct spa_node
|
||||
* \param n_input_ports size of the \a input_ids array
|
||||
* \param input_ids array to store the input stream ids
|
||||
* \param n_output_ports size of the \a output_ids array
|
||||
* \param output_ids array to store the output stream ids
|
||||
* \return 0 on success
|
||||
* -EINVAL when node is NULL
|
||||
*/
|
||||
int (*get_port_ids) (struct spa_node *node,
|
||||
uint32_t n_input_ports,
|
||||
|
|
@ -296,22 +286,21 @@ struct spa_node {
|
|||
uint32_t *output_ids);
|
||||
|
||||
/**
|
||||
* struct spa_node::add_port:
|
||||
* @node: a #struct spa_node
|
||||
* @direction: a #enum spa_direction
|
||||
* @port_id: an unused port id
|
||||
*
|
||||
* Make a new port with @port_id. The called should use get_port_ids() to
|
||||
* find an unused id for the given @direction.
|
||||
* Make a new port with \a port_id. The caller should use get_port_ids() to
|
||||
* find an unused id for the given \a direction.
|
||||
*
|
||||
* Port ids should be between 0 and max_ports as obtained from get_n_ports().
|
||||
*
|
||||
* This function must be called from the main thread.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
|
||||
* \param node a spa_node
|
||||
* \param direction a #enum spa_direction
|
||||
* \param port_id an unused port id
|
||||
* \return 0 on success
|
||||
* -EINVAL when node is NULL
|
||||
*/
|
||||
int (*add_port) (struct spa_node *node, enum spa_direction direction, uint32_t port_id);
|
||||
|
||||
int (*remove_port) (struct spa_node *node, enum spa_direction direction, uint32_t port_id);
|
||||
|
||||
int (*port_get_info) (struct spa_node *node,
|
||||
|
|
@ -324,36 +313,37 @@ struct spa_node {
|
|||
* that are compatible with \a filter.
|
||||
*
|
||||
* Use \a index to retrieve the parameters one by one until the function
|
||||
* returns #SPA_RESULT_ENUM_END.
|
||||
* returns 0.
|
||||
*
|
||||
* The result parameters can be queried and modified and ultimately be used
|
||||
* to call struct spa_node::port_set_param.
|
||||
* to call port_set_param.
|
||||
*
|
||||
* This function must be called from the main thread.
|
||||
*
|
||||
* \param node a #struct spa_node
|
||||
* \param direction a #enum spa_direction
|
||||
* \param node a spa_node
|
||||
* \param direction an spa_direction
|
||||
* \param port_id the port to query
|
||||
* \param id the parameter id to query
|
||||
* \param index an index state variable, 0 to get the first item
|
||||
* \param filter a parameter filter or NULL for no filter
|
||||
* \param param result parameter
|
||||
* \param builder a builder for the result parameter object
|
||||
* \return #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when node or index or builder is %NULL
|
||||
* #SPA_RESULT_INVALID_PORT when port_id is not valid
|
||||
* #SPA_RESULT_ENUM_END when no more parameters exists
|
||||
* #SPA_RESULT_UNKNOWN_PARAM when \a id is unknown
|
||||
* \return 1 on success
|
||||
* 0 when no more parameters exists
|
||||
* -EINVAL when invalid parameters are given
|
||||
* -ENOENT when \a id is unknown
|
||||
*/
|
||||
int (*port_enum_params) (struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder);
|
||||
|
||||
/**
|
||||
* Set a parameter on \a port_id of \a node.
|
||||
*
|
||||
* When \a param is %NULL, the parameter will be unset.
|
||||
* When \a param is NULL, the parameter will be unset.
|
||||
*
|
||||
* This function must be called from the main thread.
|
||||
*
|
||||
|
|
@ -361,55 +351,50 @@ struct spa_node {
|
|||
* \param direction a #enum spa_direction
|
||||
* \param port_id the port to configure
|
||||
* \param flags optional flags
|
||||
* \param param a #struct spa_pod_object with the parameter to set
|
||||
* \return #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_OK_RECHECK on success, the value of \a param might have been
|
||||
* \param param a #struct 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 struct spa_node::enum_params.
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
|
||||
* #SPA_RESULT_INVALID_PORT when port_id is not valid
|
||||
* #SPA_RESULT_INVALID_PARAM_INCOMPLETE when one of the mandatory param
|
||||
* properties is not specified and #SPA_NODE_PARAM_FLAG_FIXATE was
|
||||
* 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.
|
||||
* #SPA_RESULT_WRONG_PROPERTY_TYPE when the type or size of a property
|
||||
* is not correct.
|
||||
* #SPA_RESULT_ASYNC the function is executed asynchronously
|
||||
* -ESRCH when the type or size of a property is not correct.
|
||||
* -ENOENT when the param id is not found
|
||||
*/
|
||||
int (*port_set_param) (struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param);
|
||||
const struct spa_pod *param);
|
||||
|
||||
/**
|
||||
* struct spa_node::port_use_buffers:
|
||||
* @node: a #struct spa_node
|
||||
* @direction: a #enum spa_direction
|
||||
* @port_id: a port id
|
||||
* @buffers: an array of buffer pointers
|
||||
* @n_buffers: number of elements in @buffers
|
||||
*
|
||||
* Tell the port to use the given buffers
|
||||
*
|
||||
* For an input port, all the buffers will remain dequeued. Once a buffer
|
||||
* has been pushed on a port with port_push_input, it should not be reused
|
||||
* until the REUSE_BUFFER event is notified.
|
||||
* until the reuse_buffer event is notified or when the buffer has been
|
||||
* returned in the spa_port_io of the port.
|
||||
*
|
||||
* For output ports, all buffers will be queued in the port. with
|
||||
* port_pull_output, a buffer can be dequeued. When a buffer can be reused,
|
||||
* port_reuse_buffer() should be called.
|
||||
* For output ports, all buffers will be queued in the port. When process_input
|
||||
* or process_output return SPA_STATUS_HAVE_BUFFER, buffers are available in
|
||||
* one or more of the spa_port_io areas.
|
||||
* When a buffer can be reused, port_reuse_buffer() should be called or the
|
||||
* buffer_id should be placed in the spa_port_io area before calling
|
||||
* process_output.
|
||||
*
|
||||
* Passing %NULL as @buffers will remove the reference that the port has
|
||||
* Passing NULL as \a buffers will remove the reference that the port has
|
||||
* on the buffers.
|
||||
*
|
||||
* Upon completion, this function might change the state of the
|
||||
* node to PAUSED, when the node has enough buffers on all ports, or READY
|
||||
* when @buffers are %NULL.
|
||||
*
|
||||
* This function must be called from the main thread.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_ASYNC the function is executed asynchronously
|
||||
* \param node an spa_node
|
||||
* \param direction an spa_direction
|
||||
* \param port_id a port id
|
||||
* \param buffers an array of buffer pointers
|
||||
* \param n_buffers number of elements in \a buffers
|
||||
* \return 0 on success
|
||||
*/
|
||||
int (*port_use_buffers) (struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
|
|
@ -417,18 +402,9 @@ struct spa_node {
|
|||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers);
|
||||
/**
|
||||
* struct spa_node::port_alloc_buffers:
|
||||
* @node: a #struct spa_node
|
||||
* @direction: a #enum spa_direction
|
||||
* @port_id: a port id
|
||||
* @params: allocation parameters
|
||||
* @n_params: number of elements in @params
|
||||
* @buffers: an array of buffer pointers
|
||||
* @n_buffers: number of elements in @buffers
|
||||
* Tell the port to allocate memory for \a buffers.
|
||||
*
|
||||
* Tell the port to allocate memory for @buffers.
|
||||
*
|
||||
* @buffers should contain an array of pointers to buffers. The data
|
||||
* \a buffers should contain an array of pointers to buffers. The data
|
||||
* in the buffers should point to an array of at least 1 SPA_DATA_TYPE_INVALID
|
||||
* data pointers that will be filled by this function.
|
||||
*
|
||||
|
|
@ -439,39 +415,42 @@ struct spa_node {
|
|||
* For output ports, the buffers remain queued. port_reuse_buffer() should
|
||||
* be called when a buffer can be reused.
|
||||
*
|
||||
* Upon completion, this function might change the state of the
|
||||
* node to PAUSED, when the node has enough buffers on all ports.
|
||||
*
|
||||
* Once the port has allocated buffers, the memory of the buffers can be
|
||||
* released again by calling struct spa_node::port_use_buffers with %NULL.
|
||||
* released again by calling struct port_use_buffers with NULL.
|
||||
*
|
||||
* This function must be called from the main thread.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_ERROR when the node already has allocated buffers.
|
||||
* #SPA_RESULT_ASYNC the function is executed asynchronously
|
||||
* \param node a spa_node
|
||||
* \param direction a spa_direction
|
||||
* \param port_id a port id
|
||||
* \param params allocation parameters
|
||||
* \param n_params number of elements in \a params
|
||||
* \param buffers an array of buffer pointers
|
||||
* \param n_buffers number of elements in \a buffers
|
||||
* \return 0 on success
|
||||
* -EBUSY when the node already has allocated buffers.
|
||||
*/
|
||||
int (*port_alloc_buffers) (struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod_object **params,
|
||||
struct spa_pod **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers);
|
||||
|
||||
/**
|
||||
* struct spa_node::port_set_io:
|
||||
* @direction: a #enum spa_direction
|
||||
* @port_id: a port id
|
||||
* @io: a #struct spa_port_io
|
||||
*
|
||||
* Configure the given io structure on @port_id. This
|
||||
* Configure the given io structure on \a port_id. This
|
||||
* structure is allocated by the host and is used to query the state
|
||||
* of the port and exchange buffers with the port.
|
||||
*
|
||||
* Setting an @io of %NULL will disable the port.
|
||||
* Setting an \a io of NULL will disable the port.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* This function must be called from the main thread.
|
||||
*
|
||||
* \param direction a spa_direction
|
||||
* \param port_id a port id
|
||||
* \param io a spa_port_io
|
||||
* \return 0 on success
|
||||
*/
|
||||
int (*port_set_io) (struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
|
|
@ -479,95 +458,108 @@ struct spa_node {
|
|||
struct spa_port_io *io);
|
||||
|
||||
/**
|
||||
* struct spa_node::port_reuse_buffer:
|
||||
* @node: a #struct spa_node
|
||||
* @port_id: a port id
|
||||
* @buffer_id: a buffer id to reuse
|
||||
*
|
||||
* Tell an output port to reuse a buffer.
|
||||
*
|
||||
* This function must be called from the data thread.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
|
||||
* \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
|
||||
*/
|
||||
int (*port_reuse_buffer) (struct spa_node *node, uint32_t port_id, uint32_t buffer_id);
|
||||
|
||||
/**
|
||||
* Send a command to a port
|
||||
*
|
||||
* This function must be called from the data thread.
|
||||
*
|
||||
* \param node a spa_node
|
||||
* \param direction a direction
|
||||
* \param port_id a port id
|
||||
* \param command a command to send
|
||||
* \return 0 on success
|
||||
* -EINVAL when node is NULL
|
||||
*/
|
||||
int (*port_send_command) (struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
const struct spa_command *command);
|
||||
/**
|
||||
* struct spa_node::process_input:
|
||||
* @node: a #struct spa_node
|
||||
*
|
||||
* Process the input area of the node.
|
||||
*
|
||||
* For synchronous nodes, this function is called to start processing data
|
||||
* or when process_output returned SPA_RESULT_NEED_BUFFER
|
||||
* or when process_output returned SPA_STATUS_NEED_BUFFER
|
||||
*
|
||||
* For Asynchronous node, this function is called when a NEED_INPUT event
|
||||
* For Asynchronous nodes, this function is called when a need_input event
|
||||
* is received from the node.
|
||||
*
|
||||
* Before calling this function, you must configure spa_port_io structures
|
||||
* configured on the input ports.
|
||||
* on the input ports you want to process data on.
|
||||
*
|
||||
* The node will loop through all spa_port_io structures and will
|
||||
* process the buffers. For each port, the port io will be used as:
|
||||
*
|
||||
* - if status is set to HAVE_BUFFER, buffer_id is read and processed.
|
||||
* - if status is set to SPA_STATUS_HAVE_BUFFER, buffer_id is read and processed.
|
||||
*
|
||||
* The spa_port_io of the port is then updated as follows.
|
||||
*
|
||||
* - buffer_id is set to a buffer id that should be reused. SPA_ID_INVALID
|
||||
* is set when there is no buffer to reuse
|
||||
*
|
||||
* - status is set to SPA_RESULT_OK when no new buffer is needed
|
||||
* - status is set to SPA_STATUS_OK when no new buffer is needed on the port
|
||||
*
|
||||
* - status is set to SPA_RESULT_NEED_BUFFER when a new buffer is needed
|
||||
* - status is set to SPA_STATUS_NEED_BUFFER when a new buffer is needed
|
||||
* on the port.
|
||||
*
|
||||
* - status is set to an error code when the buffer_id was invalid or any
|
||||
* processing error happened on the port.
|
||||
* - status is set to a negative errno style error code when the buffer_id
|
||||
* was invalid or any processing error happened on the port.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success or when the node is asynchronous
|
||||
* #SPA_RESULT_HAVE_BUFFER for synchronous nodes when output
|
||||
* This function must be called from the data thread.
|
||||
*
|
||||
* \param node a spa_node
|
||||
* \return SPA_STATUS_OK on success or when the node is asynchronous
|
||||
* SPA_STATUS_HAVE_BUFFER for synchronous nodes when output
|
||||
* can be consumed.
|
||||
* #SPA_RESULT_ERROR when one of the inputs is in error
|
||||
* < 0 for errno style errors. One or more of the spa_port_io
|
||||
* areas has an error.
|
||||
*/
|
||||
int (*process_input) (struct spa_node *node);
|
||||
|
||||
/**
|
||||
* struct spa_node::process_output:
|
||||
* @node: a #struct spa_node
|
||||
*
|
||||
* Tell the node that output is consumed.
|
||||
*
|
||||
* For synchronous nodes, this function can be called when process_input
|
||||
* returned #SPA_RESULT_HAVE_BUFFER.
|
||||
* returned SPA_STATUS_HAVE_BUFFER and the output on the spa_port_io
|
||||
* areas has been consumed.
|
||||
*
|
||||
* For Asynchronous node, this function is called when a HAVE_OUTPUT event
|
||||
* For Asynchronous node, this function is called when a have_output event
|
||||
* is received from the node.
|
||||
*
|
||||
* Before calling this function you must process the buffers
|
||||
* in each of the output ports spa_port_io structure as follows:
|
||||
*
|
||||
* - use the buffer_id from the io for all the ports where the status is
|
||||
* SPA_RESULT_HAVE_BUFFER
|
||||
* SPA_STATUS_HAVE_BUFFER
|
||||
*
|
||||
* - set buffer_id to a buffer_id you would like to reuse or SPA_ID_INVALID
|
||||
* when no buffer is to be reused.
|
||||
*
|
||||
* - set the status to SPA_RESULT_NEED_BUFFER for all port you want more
|
||||
* - set the status to SPA_STATUS_NEED_BUFFER for all port you want more
|
||||
* output from
|
||||
*
|
||||
* - set the status to SPA_RESULT_OK for the port you don't want more
|
||||
* - set the status to SPA_STATUS_OK for the port you don't want more
|
||||
* buffers from.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success or when the node is asynchronous
|
||||
* #SPA_RESULT_NEED_BUFFER for synchronous nodes when input
|
||||
* This function must be called from the data thread.
|
||||
*
|
||||
* \param node a spa_node
|
||||
* \return SPA_STATUS_OK on success or when the node is asynchronous
|
||||
* SPA_STATUS_NEED_BUFFER for synchronous nodes when input
|
||||
* is needed.
|
||||
* #SPA_RESULT_ERROR when one of the outputs is in error
|
||||
* < 0 for errno style errors. One or more of the spa_port_io
|
||||
* areas has an error.
|
||||
*/
|
||||
int (*process_output) (struct spa_node *node);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -51,12 +51,10 @@ spa_type_format_audio_map(struct spa_type_map *map, struct spa_type_format_audio
|
|||
}
|
||||
|
||||
static inline int
|
||||
spa_format_audio_raw_parse(const struct spa_pod_object *format,
|
||||
spa_format_audio_raw_parse(const struct spa_pod *format,
|
||||
struct spa_audio_info_raw *info, struct spa_type_format_audio *type)
|
||||
{
|
||||
struct spa_pod_parser prs;
|
||||
spa_pod_parser_pod(&prs, &format->pod);
|
||||
return spa_pod_parser_get(&prs,
|
||||
return spa_pod_object_parse(format,
|
||||
":",type->format, "I", &info->format,
|
||||
":",type->rate, "i", &info->rate,
|
||||
":",type->channels, "i", &info->channels,
|
||||
|
|
|
|||
|
|
@ -76,12 +76,10 @@ spa_type_format_video_map(struct spa_type_map *map, struct spa_type_format_video
|
|||
}
|
||||
|
||||
static inline int
|
||||
spa_format_video_raw_parse(const struct spa_pod_object *format,
|
||||
spa_format_video_raw_parse(const struct spa_pod *format,
|
||||
struct spa_video_info_raw *info, struct spa_type_format_video *type)
|
||||
{
|
||||
struct spa_pod_parser prs;
|
||||
spa_pod_parser_pod(&prs, &format->pod);
|
||||
return spa_pod_parser_get(&prs,
|
||||
return spa_pod_object_parse(format,
|
||||
":",type->format, "I", &info->format,
|
||||
":",type->size, "R", &info->size,
|
||||
":",type->framerate, "F", &info->framerate,
|
||||
|
|
@ -99,12 +97,10 @@ spa_format_video_raw_parse(const struct spa_pod_object *format,
|
|||
}
|
||||
|
||||
static inline int
|
||||
spa_format_video_h264_parse(const struct spa_pod_object *format,
|
||||
spa_format_video_h264_parse(const struct spa_pod *format,
|
||||
struct spa_video_info_h264 *info, struct spa_type_format_video *type)
|
||||
{
|
||||
struct spa_pod_parser prs;
|
||||
spa_pod_parser_pod(&prs, &format->pod);
|
||||
return spa_pod_parser_get(&prs,
|
||||
return spa_pod_object_parse(format,
|
||||
":",type->size, "?R", &info->size,
|
||||
":",type->framerate, "?F", &info->framerate,
|
||||
":",type->max_framerate, "?F", &info->max_framerate,
|
||||
|
|
@ -113,12 +109,10 @@ spa_format_video_h264_parse(const struct spa_pod_object *format,
|
|||
}
|
||||
|
||||
static inline int
|
||||
spa_format_video_mjpg_parse(const struct spa_pod_object *format,
|
||||
spa_format_video_mjpg_parse(const struct spa_pod *format,
|
||||
struct spa_video_info_mjpg *info, struct spa_type_format_video *type)
|
||||
{
|
||||
struct spa_pod_parser prs;
|
||||
spa_pod_parser_pod(&prs, &format->pod);
|
||||
return spa_pod_parser_get(&prs,
|
||||
return spa_pod_object_parse(format,
|
||||
":",type->size, "?R", &info->size,
|
||||
":",type->framerate, "?F", &info->framerate,
|
||||
":",type->max_framerate, "?F", &info->max_framerate, NULL);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <spa/pod/pod.h>
|
||||
|
|
@ -92,7 +93,7 @@ static inline struct spa_pod *spa_pod_next(const struct spa_pod *iter)
|
|||
(iter) = spa_pod_next(iter))
|
||||
|
||||
#define SPA_POD_OBJECT_FOREACH(obj, iter) \
|
||||
SPA_POD_OBJECT_BODY_FOREACH(&obj->body, SPA_POD_BODY_SIZE(obj), iter)
|
||||
SPA_POD_OBJECT_BODY_FOREACH(&(obj)->body, SPA_POD_BODY_SIZE(obj), iter)
|
||||
|
||||
#define SPA_POD_PROP_ALTERNATIVE_FOREACH(body, _size, iter) \
|
||||
for ((iter) = SPA_MEMBER((body), (body)->value.size + \
|
||||
|
|
@ -112,22 +113,33 @@ static inline struct spa_pod_prop *spa_pod_contents_find_prop(const struct spa_p
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static inline struct spa_pod_prop *spa_pod_object_find_prop(const struct spa_pod_object *obj,
|
||||
uint32_t key)
|
||||
static inline struct spa_pod_prop *spa_pod_find_prop(const struct spa_pod *pod, uint32_t key)
|
||||
{
|
||||
return spa_pod_contents_find_prop(&obj->pod, sizeof(struct spa_pod_object), key);
|
||||
uint32_t offset;
|
||||
|
||||
if (pod->type == SPA_POD_TYPE_OBJECT)
|
||||
offset = sizeof(struct spa_pod_object);
|
||||
else if (pod->type == SPA_POD_TYPE_STRUCT)
|
||||
offset = sizeof(struct spa_pod_struct);
|
||||
else
|
||||
return NULL;
|
||||
|
||||
return spa_pod_contents_find_prop(pod, offset, key);
|
||||
}
|
||||
|
||||
static inline struct spa_pod_prop *spa_pod_struct_find_prop(const struct spa_pod_struct *obj,
|
||||
uint32_t key)
|
||||
{
|
||||
return spa_pod_contents_find_prop(&obj->pod, sizeof(struct spa_pod_struct), key);
|
||||
}
|
||||
|
||||
static inline int spa_pod_object_fixate(struct spa_pod_object *obj)
|
||||
static inline int spa_pod_fixate(struct spa_pod *pod)
|
||||
{
|
||||
struct spa_pod *res;
|
||||
SPA_POD_OBJECT_FOREACH(obj, res) {
|
||||
uint32_t offset;
|
||||
|
||||
if (pod->type == SPA_POD_TYPE_OBJECT)
|
||||
offset = sizeof(struct spa_pod_object);
|
||||
else if (pod->type == SPA_POD_TYPE_STRUCT)
|
||||
offset = sizeof(struct spa_pod_struct);
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
SPA_POD_CONTENTS_FOREACH(pod, offset, res) {
|
||||
if (res->type == SPA_POD_TYPE_PROP)
|
||||
((struct spa_pod_prop *) res)->body.flags &= ~SPA_POD_PROP_FLAG_UNSET;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -249,13 +249,7 @@ static inline int spa_pod_parser_getv(struct spa_pod_parser *parser,
|
|||
uint32_t key = va_arg(args, uint32_t);
|
||||
const struct spa_pod *obj = parser->iter[parser->depth].data;
|
||||
|
||||
if (SPA_POD_TYPE(obj) == SPA_POD_TYPE_OBJECT)
|
||||
prop = spa_pod_object_find_prop((struct spa_pod_object*)obj, key);
|
||||
else if (SPA_POD_TYPE(obj) == SPA_POD_TYPE_STRUCT)
|
||||
prop = spa_pod_struct_find_prop((struct spa_pod_struct*)obj, key);
|
||||
else
|
||||
prop = NULL;
|
||||
|
||||
prop = spa_pod_find_prop(obj, key);
|
||||
if (prop != NULL && (prop->body.flags & SPA_POD_PROP_FLAG_UNSET) == 0)
|
||||
pod = &prop->body.value;
|
||||
else
|
||||
|
|
@ -269,12 +263,12 @@ static inline int spa_pod_parser_getv(struct spa_pod_parser *parser,
|
|||
case 'V':
|
||||
pod = (struct spa_pod *) prop;
|
||||
if (pod == NULL && required)
|
||||
return -ENOENT;
|
||||
return -ESRCH;
|
||||
goto collect;
|
||||
default:
|
||||
if (pod == NULL || !spa_pod_parser_can_collect(pod, *format)) {
|
||||
if (required)
|
||||
return -ENOENT;
|
||||
return -ESRCH;
|
||||
skip = true;
|
||||
}
|
||||
collect:
|
||||
|
|
@ -311,11 +305,10 @@ static inline int spa_pod_parser_get(struct spa_pod_parser *parser,
|
|||
return res;
|
||||
}
|
||||
|
||||
#define spa_pod_object_parse(object,...) \
|
||||
#define spa_pod_object_parse(pod,...) \
|
||||
({ \
|
||||
struct spa_pod_parser __p; \
|
||||
const struct spa_pod_object *__obj = object; \
|
||||
spa_pod_parser_pod(&__p, &__obj->pod); \
|
||||
spa_pod_parser_pod(&__p, pod); \
|
||||
spa_pod_parser_get(&__p, "<", ##__VA_ARGS__, NULL); \
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -177,12 +177,18 @@ struct spa_pod_object {
|
|||
struct spa_pod_object_body body;
|
||||
};
|
||||
|
||||
static inline bool spa_pod_is_object_type(struct spa_pod *pod, uint32_t type)
|
||||
static inline bool spa_pod_is_object_type(const struct spa_pod *pod, uint32_t type)
|
||||
{
|
||||
return (pod->type == SPA_POD_TYPE_OBJECT
|
||||
return (pod && pod->type == SPA_POD_TYPE_OBJECT
|
||||
&& ((struct spa_pod_object *) pod)->body.type == type);
|
||||
}
|
||||
|
||||
static inline bool spa_pod_is_object_id(const struct spa_pod *pod, uint32_t id)
|
||||
{
|
||||
return (pod && pod->type == SPA_POD_TYPE_OBJECT
|
||||
&& ((struct spa_pod_object *) pod)->body.id == id);
|
||||
}
|
||||
|
||||
struct spa_pod_pointer_body {
|
||||
uint32_t type;
|
||||
void *value;
|
||||
|
|
|
|||
|
|
@ -375,7 +375,7 @@ print_format_value(uint32_t size, uint32_t type, void *body)
|
|||
}
|
||||
}
|
||||
|
||||
static int spa_debug_format(const struct spa_pod_object *format)
|
||||
static int spa_debug_format(const struct spa_pod *format)
|
||||
{
|
||||
int i;
|
||||
const char *media_type;
|
||||
|
|
@ -383,7 +383,7 @@ static int spa_debug_format(const struct spa_pod_object *format)
|
|||
struct spa_pod *pod;
|
||||
uint32_t mtype, mstype;
|
||||
|
||||
if (format == NULL)
|
||||
if (format == NULL || SPA_POD_TYPE(format) != SPA_POD_TYPE_OBJECT)
|
||||
return -EINVAL;
|
||||
|
||||
if (spa_pod_object_parse(format, "I", &mtype,
|
||||
|
|
@ -396,7 +396,7 @@ static int spa_debug_format(const struct spa_pod_object *format)
|
|||
fprintf(stderr, "%-6s %s/%s\n", "", rindex(media_type, ':') + 1,
|
||||
rindex(media_subtype, ':') + 1);
|
||||
|
||||
SPA_POD_OBJECT_FOREACH(format, pod) {
|
||||
SPA_POD_OBJECT_FOREACH((struct spa_pod_object*)format, pod) {
|
||||
struct spa_pod_prop *prop;
|
||||
const char *key;
|
||||
|
||||
|
|
@ -459,7 +459,7 @@ int spa_debug_pod(const struct spa_pod *pod, uint32_t flags)
|
|||
int res = 0;
|
||||
|
||||
if (flags & SPA_DEBUG_FLAG_FORMAT)
|
||||
res = spa_debug_format((struct spa_pod_object*)pod);
|
||||
res = spa_debug_format(pod);
|
||||
else
|
||||
print_pod_value(pod->size, pod->type, SPA_POD_BODY(pod), 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -330,9 +330,7 @@ int pod_filter(struct spa_pod_builder *b,
|
|||
break;
|
||||
case SPA_POD_TYPE_OBJECT:
|
||||
if (pf != NULL) {
|
||||
struct spa_pod_object *p1;
|
||||
|
||||
p1 = (struct spa_pod_object *) pp;
|
||||
struct spa_pod_object *p1 = (struct spa_pod_object *) pp;
|
||||
|
||||
if (SPA_POD_TYPE(pf) != SPA_POD_TYPE_OBJECT)
|
||||
return -EINVAL;
|
||||
|
|
@ -394,18 +392,28 @@ int pod_filter(struct spa_pod_builder *b,
|
|||
|
||||
int
|
||||
spa_pod_filter(struct spa_pod_builder *b,
|
||||
struct spa_pod **result,
|
||||
const struct spa_pod *pod,
|
||||
const struct spa_pod *filter)
|
||||
{
|
||||
int res;
|
||||
uint32_t offset;
|
||||
|
||||
spa_return_val_if_fail(pod != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(b != NULL, -EINVAL);
|
||||
|
||||
if (filter == NULL) {
|
||||
spa_pod_builder_raw_padded(b, pod, SPA_POD_SIZE(pod));
|
||||
*result = spa_pod_builder_deref(b,
|
||||
spa_pod_builder_raw_padded(b, pod, SPA_POD_SIZE(pod)));
|
||||
return 0;
|
||||
}
|
||||
return pod_filter(b, pod, SPA_POD_SIZE(pod), filter, SPA_POD_SIZE(filter));
|
||||
|
||||
offset = b->state.offset;
|
||||
|
||||
if ((res = pod_filter(b, pod, SPA_POD_SIZE(pod), filter, SPA_POD_SIZE(filter))) == 0)
|
||||
*result = spa_pod_builder_deref(b, offset);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int pod_compare(const struct spa_pod *pod1,
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ extern "C" {
|
|||
#include <spa/pod/builder.h>
|
||||
|
||||
int spa_pod_filter(struct spa_pod_builder *b,
|
||||
struct spa_pod **result,
|
||||
const struct spa_pod *pod,
|
||||
const struct spa_pod *filter);
|
||||
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ struct impl {
|
|||
uint32_t index;
|
||||
struct udev_list_entry *devices;
|
||||
|
||||
uint8_t item_buffer[4096];
|
||||
struct spa_monitor_item *item;
|
||||
// uint8_t item_buffer[4096];
|
||||
// struct spa_monitor_item *item;
|
||||
|
||||
snd_ctl_t *ctl_hndl;
|
||||
struct udev_device *dev;
|
||||
|
|
@ -108,10 +108,10 @@ static const char *path_get_card_id(const char *path)
|
|||
}
|
||||
|
||||
static int
|
||||
fill_item(struct impl *this, snd_ctl_card_info_t *card_info, snd_pcm_info_t *dev_info, struct udev_device *dev)
|
||||
fill_item(struct impl *this, snd_ctl_card_info_t *card_info, snd_pcm_info_t *dev_info, struct udev_device *dev,
|
||||
struct spa_pod **item, struct spa_pod_builder *builder)
|
||||
{
|
||||
const char *str, *name, *klass = NULL;
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(this->item_buffer, sizeof(this->item_buffer));
|
||||
const struct spa_handle_factory *factory = NULL;
|
||||
char card_name[64];
|
||||
struct type *t = &this->type;
|
||||
|
|
@ -141,7 +141,7 @@ fill_item(struct impl *this, snd_ctl_card_info_t *card_info, snd_pcm_info_t *dev
|
|||
|
||||
snprintf(card_name, 64, "%s,%d", this->card_name, snd_pcm_info_get_device(dev_info));
|
||||
|
||||
spa_pod_builder_add(&b,
|
||||
spa_pod_builder_add(builder,
|
||||
"<", 0, t->monitor.MonitorItem,
|
||||
":", t->monitor.id, "s", name,
|
||||
":", t->monitor.flags, "i", 0,
|
||||
|
|
@ -150,10 +150,10 @@ fill_item(struct impl *this, snd_ctl_card_info_t *card_info, snd_pcm_info_t *dev
|
|||
":", t->monitor.klass, "s", klass,
|
||||
":", t->monitor.factory, "p", t->handle_factory, factory, NULL);
|
||||
|
||||
spa_pod_builder_add(&b,
|
||||
spa_pod_builder_add(builder,
|
||||
":", t->monitor.info, "[", NULL);
|
||||
|
||||
spa_pod_builder_add(&b,
|
||||
spa_pod_builder_add(builder,
|
||||
"s", "alsa.card", "s", card_name,
|
||||
"s", "alsa.card.id", "s", snd_ctl_card_info_get_id(card_info),
|
||||
"s", "alsa.card.components", "s", snd_ctl_card_info_get_components(card_info),
|
||||
|
|
@ -169,29 +169,29 @@ fill_item(struct impl *this, snd_ctl_card_info_t *card_info, snd_pcm_info_t *dev
|
|||
NULL);
|
||||
|
||||
if ((str = udev_device_get_property_value(dev, "SOUND_CLASS")) && *str) {
|
||||
spa_pod_builder_add(&b, "s", "device.class", "s", str, NULL);
|
||||
spa_pod_builder_add(builder, "s", "device.class", "s", str, NULL);
|
||||
}
|
||||
|
||||
str = udev_device_get_property_value(dev, "ID_PATH");
|
||||
if (!(str && *str))
|
||||
str = udev_device_get_syspath(dev);
|
||||
if (str && *str) {
|
||||
spa_pod_builder_add(&b, "s", "device.bus_path", "s", str, 0);
|
||||
spa_pod_builder_add(builder, "s", "device.bus_path", "s", str, 0);
|
||||
}
|
||||
if ((str = udev_device_get_syspath(dev)) && *str) {
|
||||
spa_pod_builder_add(&b, "s", "sysfs.path", "s", str, 0);
|
||||
spa_pod_builder_add(builder, "s", "sysfs.path", "s", str, 0);
|
||||
}
|
||||
if ((str = udev_device_get_property_value(dev, "ID_ID")) && *str) {
|
||||
spa_pod_builder_add(&b, "s", "udev.id", "s", str, 0);
|
||||
spa_pod_builder_add(builder, "s", "udev.id", "s", str, 0);
|
||||
}
|
||||
if ((str = udev_device_get_property_value(dev, "ID_BUS")) && *str) {
|
||||
spa_pod_builder_add(&b, "s", "device.bus", "s", str, 0);
|
||||
spa_pod_builder_add(builder, "s", "device.bus", "s", str, 0);
|
||||
}
|
||||
if ((str = udev_device_get_property_value(dev, "SUBSYSTEM")) && *str) {
|
||||
spa_pod_builder_add(&b, "s", "device.subsystem", "s", str, 0);
|
||||
spa_pod_builder_add(builder, "s", "device.subsystem", "s", str, 0);
|
||||
}
|
||||
if ((str = udev_device_get_property_value(dev, "ID_VENDOR_ID")) && *str) {
|
||||
spa_pod_builder_add(&b, "s", "device.vendor.id", "s", str, 0);
|
||||
spa_pod_builder_add(builder, "s", "device.vendor.id", "s", str, 0);
|
||||
}
|
||||
str = udev_device_get_property_value(dev, "ID_VENDOR_FROM_DATABASE");
|
||||
if (!(str && *str)) {
|
||||
|
|
@ -201,20 +201,20 @@ fill_item(struct impl *this, snd_ctl_card_info_t *card_info, snd_pcm_info_t *dev
|
|||
}
|
||||
}
|
||||
if (str && *str) {
|
||||
spa_pod_builder_add(&b, "s", "device.vendor.name", "s", str, 0);
|
||||
spa_pod_builder_add(builder, "s", "device.vendor.name", "s", str, 0);
|
||||
}
|
||||
if ((str = udev_device_get_property_value(dev, "ID_MODEL_ID")) && *str) {
|
||||
spa_pod_builder_add(&b, "s", "device.product.id", "s", str, 0);
|
||||
spa_pod_builder_add(builder, "s", "device.product.id", "s", str, 0);
|
||||
}
|
||||
spa_pod_builder_add(&b, "s", "device.product.name", "s", name, 0);
|
||||
spa_pod_builder_add(builder, "s", "device.product.name", "s", name, 0);
|
||||
|
||||
if ((str = udev_device_get_property_value(dev, "ID_SERIAL")) && *str) {
|
||||
spa_pod_builder_add(&b, "s", "device.serial", "s", str, 0);
|
||||
spa_pod_builder_add(builder, "s", "device.serial", "s", str, 0);
|
||||
}
|
||||
if ((str = udev_device_get_property_value(dev, "SOUND_FORM_FACTOR")) && *str) {
|
||||
spa_pod_builder_add(&b, "s", "device.form_factor", "s", str, 0);
|
||||
spa_pod_builder_add(builder, "s", "device.form_factor", "s", str, 0);
|
||||
}
|
||||
this->item = spa_pod_builder_add(&b, "]>", NULL);
|
||||
*item = spa_pod_builder_add(builder, "]>", NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -255,7 +255,8 @@ static int open_card(struct impl *this, struct udev_device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int get_next_device(struct impl *this, struct udev_device *dev)
|
||||
static int get_next_device(struct impl *this, struct udev_device *dev,
|
||||
struct spa_pod **item, struct spa_pod_builder *builder)
|
||||
{
|
||||
int err;
|
||||
snd_pcm_info_t *dev_info;
|
||||
|
|
@ -299,9 +300,7 @@ static int get_next_device(struct impl *this, struct udev_device *dev)
|
|||
if ((err = snd_ctl_pcm_info(this->ctl_hndl, dev_info)) < 0)
|
||||
goto again;
|
||||
|
||||
fill_item(this, card_info, dev_info, dev);
|
||||
|
||||
return 0;
|
||||
return fill_item(this, card_info, dev_info, dev, item, builder);
|
||||
}
|
||||
|
||||
static void impl_on_fd_events(struct spa_source *source)
|
||||
|
|
@ -332,11 +331,12 @@ static void impl_on_fd_events(struct spa_source *source)
|
|||
uint8_t buffer[4096];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
|
||||
struct spa_event *event;
|
||||
struct spa_pod *item;
|
||||
|
||||
if (get_next_device(this, dev) < 0)
|
||||
event = spa_pod_builder_object(&b, 0, type);
|
||||
if (get_next_device(this, dev, &item, &b) < 0)
|
||||
break;
|
||||
|
||||
event = spa_pod_builder_object(&b, 0, type, "P", this->item);
|
||||
this->callbacks->event(this->callbacks_data, event);
|
||||
}
|
||||
close_card(this);
|
||||
|
|
@ -384,8 +384,9 @@ impl_monitor_set_callbacks(struct spa_monitor *monitor,
|
|||
}
|
||||
|
||||
static int impl_monitor_enum_items(struct spa_monitor *monitor,
|
||||
struct spa_monitor_item **item,
|
||||
uint32_t *index)
|
||||
uint32_t *index,
|
||||
struct spa_pod **item,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
int res;
|
||||
struct impl *this;
|
||||
|
|
@ -428,7 +429,7 @@ static int impl_monitor_enum_items(struct spa_monitor *monitor,
|
|||
goto again;
|
||||
}
|
||||
}
|
||||
if (get_next_device(this, this->dev) < 0) {
|
||||
if (get_next_device(this, this->dev, item, builder) < 0) {
|
||||
udev_device_unref(this->dev);
|
||||
close_card(this);
|
||||
goto next;
|
||||
|
|
@ -437,8 +438,6 @@ static int impl_monitor_enum_items(struct spa_monitor *monitor,
|
|||
this->index++;
|
||||
(*index)++;
|
||||
|
||||
*item = this->item;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,8 @@ static void reset_props(struct props *props)
|
|||
|
||||
static int impl_node_enum_params(struct spa_node *node,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct state *this;
|
||||
|
|
@ -93,14 +94,14 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
(*index)++;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct state *this;
|
||||
struct type *t;
|
||||
|
|
@ -274,7 +275,8 @@ static int
|
|||
impl_node_port_enum_params(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
|
||||
|
|
@ -308,8 +310,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
else if (id == t->param.idEnumFormat) {
|
||||
printf("%d\n", *index);
|
||||
return spa_alsa_enum_format(this, index, filter, builder);
|
||||
return spa_alsa_enum_format(this, index, filter, result, builder);
|
||||
}
|
||||
else if (id == t->param.idFormat) {
|
||||
if (!this->have_format)
|
||||
|
|
@ -375,7 +376,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
(*index)++;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
return 1;
|
||||
|
|
@ -393,7 +394,7 @@ static int clear_buffers(struct state *this)
|
|||
static int port_set_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const struct spa_pod_object *format)
|
||||
const struct spa_pod *format)
|
||||
{
|
||||
struct state *this = SPA_CONTAINER_OF(node, struct state, node);
|
||||
int err;
|
||||
|
|
@ -438,7 +439,7 @@ static int
|
|||
impl_node_port_set_param(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct state *this;
|
||||
struct type *t;
|
||||
|
|
@ -509,7 +510,7 @@ static int
|
|||
impl_node_port_alloc_buffers(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod_object **params,
|
||||
struct spa_pod **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@ static void reset_props(struct props *props)
|
|||
|
||||
static int impl_node_enum_params(struct spa_node *node,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct state *this;
|
||||
|
|
@ -90,14 +91,14 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
(*index)++;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct state *this;
|
||||
struct type *t;
|
||||
|
|
@ -324,7 +325,8 @@ static int
|
|||
impl_node_port_enum_params(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct state *this;
|
||||
|
|
@ -358,7 +360,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
else if (id == t->param.idEnumFormat) {
|
||||
return spa_alsa_enum_format(this, index, filter, builder);
|
||||
return spa_alsa_enum_format(this, index, filter, result, builder);
|
||||
}
|
||||
else if (id == t->param.idFormat) {
|
||||
if ((res = port_get_format(node, direction, port_id, index, ¶m, builder)) <= 0)
|
||||
|
|
@ -399,7 +401,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
(*index)++;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
return 1;
|
||||
|
|
@ -417,7 +419,7 @@ static int clear_buffers(struct state *this)
|
|||
|
||||
static int port_set_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags, const struct spa_pod_object *format)
|
||||
uint32_t flags, const struct spa_pod *format)
|
||||
{
|
||||
struct state *this = SPA_CONTAINER_OF(node, struct state, node);
|
||||
int err;
|
||||
|
|
@ -460,7 +462,7 @@ static int
|
|||
impl_node_port_set_param(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct state *this;
|
||||
struct type *t;
|
||||
|
|
@ -529,7 +531,7 @@ static int
|
|||
impl_node_port_alloc_buffers(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod_object **params,
|
||||
struct spa_pod **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
|
|
@ -668,6 +670,7 @@ static const struct spa_node impl_node = {
|
|||
};
|
||||
|
||||
static int impl_clock_enum_params(struct spa_clock *clock, uint32_t id, uint32_t *index,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
|
|
@ -675,7 +678,7 @@ static int impl_clock_enum_params(struct spa_clock *clock, uint32_t id, uint32_t
|
|||
|
||||
static int impl_clock_set_param(struct spa_clock *clock,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,8 @@ static snd_pcm_format_t spa_alsa_format_to_alsa(struct type *map, uint32_t forma
|
|||
|
||||
int
|
||||
spa_alsa_enum_format(struct state *state, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
snd_pcm_t *hndl;
|
||||
|
|
@ -120,7 +121,7 @@ spa_alsa_enum_format(struct state *state, uint32_t *index,
|
|||
uint8_t buffer[4096];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
|
||||
struct spa_pod_prop *prop;
|
||||
struct spa_pod_object *fmt;
|
||||
struct spa_pod *fmt;
|
||||
int res;
|
||||
bool opened;
|
||||
|
||||
|
|
@ -193,7 +194,7 @@ spa_alsa_enum_format(struct state *state, uint32_t *index,
|
|||
|
||||
(*index)++;
|
||||
|
||||
if ((res = spa_pod_filter(builder, (struct spa_pod*)fmt, (struct spa_pod*)filter)) < 0)
|
||||
if ((res = spa_pod_filter(builder, result, fmt, filter)) < 0)
|
||||
goto next;
|
||||
|
||||
if (!opened)
|
||||
|
|
|
|||
|
|
@ -169,7 +169,8 @@ struct state {
|
|||
int
|
||||
spa_alsa_enum_format(struct state *state,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder);
|
||||
|
||||
int spa_alsa_set_format(struct state *state, struct spa_audio_info *info, uint32_t flags);
|
||||
|
|
|
|||
|
|
@ -137,14 +137,15 @@ struct impl {
|
|||
|
||||
static int impl_node_enum_params(struct spa_node *node,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
|
@ -380,7 +381,8 @@ static int
|
|||
impl_node_port_enum_params(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this;
|
||||
|
|
@ -472,7 +474,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
(*index)++;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
return 1;
|
||||
|
|
@ -492,7 +494,7 @@ static int port_set_format(struct spa_node *node,
|
|||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const struct spa_pod_object *format)
|
||||
const struct spa_pod *format)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct port *port;
|
||||
|
|
@ -556,7 +558,7 @@ static int
|
|||
impl_node_port_set_param(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct impl *this;
|
||||
struct type *t;
|
||||
|
|
@ -640,7 +642,7 @@ static int
|
|||
impl_node_port_alloc_buffers(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod_object **params,
|
||||
struct spa_pod **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
|
|
|
|||
|
|
@ -169,7 +169,8 @@ static void reset_props(struct impl *this, struct props *props)
|
|||
|
||||
static int impl_node_enum_params(struct spa_node *node,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this;
|
||||
|
|
@ -218,14 +219,14 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
(*index)++;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct impl *this;
|
||||
struct type *t;
|
||||
|
|
@ -572,7 +573,8 @@ static int
|
|||
impl_node_port_enum_params(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this;
|
||||
|
|
@ -661,7 +663,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
(*index)++;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
return 1;
|
||||
|
|
@ -684,7 +686,7 @@ port_set_format(struct impl *this,
|
|||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const struct spa_pod_object *format)
|
||||
const struct spa_pod *format)
|
||||
{
|
||||
struct type *t = &this->type;
|
||||
|
||||
|
|
@ -734,7 +736,7 @@ static int
|
|||
impl_node_port_set_param(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct impl *this;
|
||||
struct type *t;
|
||||
|
|
@ -801,7 +803,7 @@ static int
|
|||
impl_node_port_alloc_buffers(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod_object **params,
|
||||
struct spa_pod **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
|
|
@ -941,13 +943,13 @@ static const struct spa_node impl_node = {
|
|||
};
|
||||
|
||||
static int impl_clock_enum_params(struct spa_clock *clock, uint32_t id, uint32_t *index,
|
||||
struct spa_pod_builder *builder)
|
||||
struct spa_pod **param, struct spa_pod_builder *builder)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_clock_set_param(struct spa_clock *clock, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,8 @@ struct impl {
|
|||
|
||||
static int spa_ffmpeg_dec_node_enum_params(struct spa_node *node,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
|
|
@ -94,7 +95,7 @@ static int spa_ffmpeg_dec_node_enum_params(struct spa_node *node,
|
|||
|
||||
static int spa_ffmpeg_dec_node_set_param(struct spa_node *node,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
|
@ -218,9 +219,9 @@ spa_ffmpeg_dec_node_port_get_info(struct spa_node *node,
|
|||
static int port_enum_formats(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
struct spa_pod_builder *builder,
|
||||
struct spa_pod **param)
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
//struct impl *this;
|
||||
|
||||
|
|
@ -245,9 +246,9 @@ static int port_enum_formats(struct spa_node *node,
|
|||
static int port_get_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
struct spa_pod_builder *builder,
|
||||
struct spa_pod **param)
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct port *port;
|
||||
|
|
@ -270,7 +271,8 @@ static int
|
|||
spa_ffmpeg_dec_node_port_enum_params(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
|
@ -293,11 +295,11 @@ spa_ffmpeg_dec_node_port_enum_params(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
else if (id == t->param.idEnumFormat) {
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, filter, builder, ¶m)) <= 0)
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, filter, ¶m, builder)) <= 0)
|
||||
return res;
|
||||
}
|
||||
else if (id == t->param.idFormat) {
|
||||
if ((res = port_get_format(node, direction, port_id, index, filter, builder, ¶m)) <= 0)
|
||||
if ((res = port_get_format(node, direction, port_id, index, filter, ¶m, builder)) <= 0)
|
||||
return res;
|
||||
}
|
||||
else
|
||||
|
|
@ -306,7 +308,7 @@ spa_ffmpeg_dec_node_port_enum_params(struct spa_node *node,
|
|||
(*index)++;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
return 1;
|
||||
|
|
@ -315,7 +317,7 @@ spa_ffmpeg_dec_node_port_enum_params(struct spa_node *node,
|
|||
static int port_set_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const struct spa_pod_object *format)
|
||||
const struct spa_pod *format)
|
||||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
|
|
@ -360,7 +362,7 @@ static int
|
|||
spa_ffmpeg_dec_node_port_set_param(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct type *t = &this->type;
|
||||
|
|
@ -392,7 +394,7 @@ static int
|
|||
spa_ffmpeg_dec_node_port_alloc_buffers(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod_object **params,
|
||||
struct spa_pod **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
|
|
|
|||
|
|
@ -90,14 +90,15 @@ struct impl {
|
|||
|
||||
static int spa_ffmpeg_enc_node_enum_params(struct spa_node *node,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int spa_ffmpeg_enc_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
|
@ -219,9 +220,9 @@ spa_ffmpeg_enc_node_port_get_info(struct spa_node *node,
|
|||
static int port_enum_formats(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
struct spa_pod_builder *builder,
|
||||
struct spa_pod **param)
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
//struct impl *this = SPA_CONTAINER_OF (node, struct impl, node);
|
||||
//struct port *port;
|
||||
|
|
@ -241,9 +242,9 @@ static int port_enum_formats(struct spa_node *node,
|
|||
static int port_get_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
struct spa_pod_builder *builder,
|
||||
struct spa_pod **param)
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct port *port;
|
||||
|
|
@ -266,7 +267,8 @@ static int
|
|||
spa_ffmpeg_enc_node_port_enum_params(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
|
@ -289,11 +291,11 @@ spa_ffmpeg_enc_node_port_enum_params(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
else if (id == t->param.idEnumFormat) {
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, filter, builder, ¶m)) <= 0)
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, filter, ¶m, builder)) <= 0)
|
||||
return res;
|
||||
}
|
||||
else if (id == t->param.idFormat) {
|
||||
if ((res = port_get_format(node, direction, port_id, index, filter, builder, ¶m)) <= 0)
|
||||
if ((res = port_get_format(node, direction, port_id, index, filter, ¶m, builder)) <= 0)
|
||||
return res;
|
||||
}
|
||||
else
|
||||
|
|
@ -302,7 +304,7 @@ spa_ffmpeg_enc_node_port_enum_params(struct spa_node *node,
|
|||
(*index)++;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
return 1;
|
||||
|
|
@ -310,7 +312,7 @@ spa_ffmpeg_enc_node_port_enum_params(struct spa_node *node,
|
|||
|
||||
static int port_set_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags, const struct spa_pod_object *format)
|
||||
uint32_t flags, const struct spa_pod *format)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct port *port;
|
||||
|
|
@ -347,7 +349,7 @@ static int
|
|||
spa_ffmpeg_enc_node_port_set_param(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct type *t = &this->type;
|
||||
|
|
@ -378,7 +380,7 @@ static int
|
|||
spa_ffmpeg_enc_node_port_alloc_buffers(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod_object **params,
|
||||
struct spa_pod **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
|
|
|
|||
|
|
@ -130,7 +130,8 @@ static void reset_props(struct impl *this, struct props *props)
|
|||
|
||||
static int impl_node_enum_params(struct spa_node *node,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this;
|
||||
|
|
@ -169,14 +170,14 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
(*index)++;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct impl *this;
|
||||
struct type *t;
|
||||
|
|
@ -432,9 +433,9 @@ impl_node_port_get_info(struct spa_node *node,
|
|||
static int port_enum_formats(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
struct spa_pod_builder *builder,
|
||||
struct spa_pod **param)
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -442,9 +443,9 @@ static int port_enum_formats(struct spa_node *node,
|
|||
static int port_get_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
struct spa_pod_builder *builder,
|
||||
struct spa_pod **param)
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
|
|
@ -463,7 +464,8 @@ static int
|
|||
impl_node_port_enum_params(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this;
|
||||
|
|
@ -497,11 +499,11 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
else if (id == t->param.idEnumFormat) {
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, filter, builder, ¶m)) <= 0)
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, filter, ¶m, builder)) <= 0)
|
||||
return res;
|
||||
}
|
||||
else if (id == t->param.idFormat) {
|
||||
if ((res = port_get_format(node, direction, port_id, index, filter, builder, ¶m)) <= 0)
|
||||
if ((res = port_get_format(node, direction, port_id, index, filter, ¶m, builder)) <= 0)
|
||||
return res;
|
||||
}
|
||||
else if (id == t->param.idBuffers) {
|
||||
|
|
@ -534,7 +536,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
(*index)++;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
return 1;
|
||||
|
|
@ -555,7 +557,7 @@ static int clear_buffers(struct impl *this)
|
|||
static int port_set_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const struct spa_pod_object *format)
|
||||
const struct spa_pod *format)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
|
|
@ -575,7 +577,7 @@ static int
|
|||
impl_node_port_set_param(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct impl *this;
|
||||
struct type *t;
|
||||
|
|
@ -640,7 +642,7 @@ static int
|
|||
impl_node_port_alloc_buffers(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod_object **params,
|
||||
struct spa_pod **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
|
|
@ -756,13 +758,13 @@ static const struct spa_node impl_node = {
|
|||
};
|
||||
|
||||
static int impl_clock_enum_params(struct spa_clock *clock, uint32_t id, uint32_t *index,
|
||||
struct spa_pod_builder *builder)
|
||||
struct spa_pod **param, struct spa_pod_builder *builder)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_clock_set_param(struct spa_clock *clock, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,7 +136,8 @@ static void reset_props(struct impl *this, struct props *props)
|
|||
|
||||
static int impl_node_enum_params(struct spa_node *node,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this;
|
||||
|
|
@ -180,14 +181,14 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
(*index)++;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct impl *this;
|
||||
struct type *t;
|
||||
|
|
@ -448,9 +449,9 @@ impl_node_port_get_info(struct spa_node *node,
|
|||
static int port_enum_formats(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
struct spa_pod_builder *builder,
|
||||
struct spa_pod **param)
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -458,9 +459,9 @@ static int port_enum_formats(struct spa_node *node,
|
|||
static int port_get_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
struct spa_pod_builder *builder,
|
||||
struct spa_pod **param)
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
|
|
@ -478,7 +479,8 @@ static int
|
|||
impl_node_port_enum_params(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this;
|
||||
|
|
@ -512,11 +514,11 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
else if (id == t->param.idEnumFormat) {
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, filter, builder, ¶m)) <= 0)
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, filter, ¶m, builder)) <= 0)
|
||||
return res;
|
||||
}
|
||||
else if (id == t->param.idFormat) {
|
||||
if ((res = port_get_format(node, direction, port_id, index, filter, builder, ¶m)) <= 0)
|
||||
if ((res = port_get_format(node, direction, port_id, index, filter, ¶m, builder)) <= 0)
|
||||
return res;
|
||||
}
|
||||
else if (id == t->param.idBuffers) {
|
||||
|
|
@ -549,7 +551,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
(*index)++;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
return 1;
|
||||
|
|
@ -570,7 +572,7 @@ static int clear_buffers(struct impl *this)
|
|||
static int port_set_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const struct spa_pod_object *format)
|
||||
const struct spa_pod *format)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
|
|
@ -590,7 +592,7 @@ static int
|
|||
impl_node_port_set_param(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct impl *this;
|
||||
struct type *t;
|
||||
|
|
@ -657,7 +659,7 @@ static int
|
|||
impl_node_port_alloc_buffers(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod_object **params,
|
||||
struct spa_pod **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
|
|
@ -791,13 +793,13 @@ static const struct spa_node impl_node = {
|
|||
};
|
||||
|
||||
static int impl_clock_enum_params(struct spa_clock *clock, uint32_t id, uint32_t *index,
|
||||
struct spa_pod_builder *builder)
|
||||
struct spa_pod **param, struct spa_pod_builder *builder)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_clock_set_param(struct spa_clock *clock, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@
|
|||
extern const struct spa_handle_factory spa_v4l2_source_factory;
|
||||
|
||||
struct item {
|
||||
struct spa_monitor_item *item;
|
||||
struct udev_device *udevice;
|
||||
};
|
||||
|
||||
|
|
@ -70,7 +69,6 @@ struct impl {
|
|||
struct udev_enumerate *enumerate;
|
||||
uint32_t index;
|
||||
struct udev_list_entry *devices;
|
||||
uint8_t item_buffer[4096];
|
||||
|
||||
struct item uitem;
|
||||
|
||||
|
|
@ -89,10 +87,10 @@ static int impl_udev_open(struct impl *this)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void fill_item(struct impl *this, struct item *item, struct udev_device *udevice)
|
||||
static void fill_item(struct impl *this, struct item *item, struct udev_device *udevice,
|
||||
struct spa_pod **result, struct spa_pod_builder *builder)
|
||||
{
|
||||
const char *str, *name;
|
||||
struct spa_pod_builder b = { NULL, };
|
||||
struct type *t = &this->type;
|
||||
|
||||
if (item->udevice)
|
||||
|
|
@ -114,9 +112,7 @@ static void fill_item(struct impl *this, struct item *item, struct udev_device *
|
|||
if (!(name && *name))
|
||||
name = "Unknown";
|
||||
|
||||
spa_pod_builder_init(&b, this->item_buffer, sizeof(this->item_buffer));
|
||||
|
||||
spa_pod_builder_add(&b,
|
||||
spa_pod_builder_add(builder,
|
||||
"<", 0, t->monitor.MonitorItem,
|
||||
":", t->monitor.id, "s", udev_device_get_syspath(item->udevice),
|
||||
":", t->monitor.flags, "i", 0,
|
||||
|
|
@ -127,7 +123,7 @@ static void fill_item(struct impl *this, struct item *item, struct udev_device *
|
|||
":", t->monitor.info, "[",
|
||||
NULL);
|
||||
|
||||
spa_pod_builder_add(&b,
|
||||
spa_pod_builder_add(builder,
|
||||
"s", "udev-probed", "s", "1",
|
||||
"s", "device.api", "s", "v4l2",
|
||||
"s", "device.path", "s", udev_device_get_devnode(item->udevice),
|
||||
|
|
@ -137,22 +133,22 @@ static void fill_item(struct impl *this, struct item *item, struct udev_device *
|
|||
if (!(str && *str))
|
||||
str = udev_device_get_syspath(item->udevice);
|
||||
if (str && *str) {
|
||||
spa_pod_builder_add(&b, "s", "device.bus_path", "s", str, 0);
|
||||
spa_pod_builder_add(builder, "s", "device.bus_path", "s", str, 0);
|
||||
}
|
||||
if ((str = udev_device_get_syspath(item->udevice)) && *str) {
|
||||
spa_pod_builder_add(&b, "s", "sysfs.path", "s", str, 0);
|
||||
spa_pod_builder_add(builder, "s", "sysfs.path", "s", str, 0);
|
||||
}
|
||||
if ((str = udev_device_get_property_value(item->udevice, "ID_ID")) && *str) {
|
||||
spa_pod_builder_add(&b, "s", "udev.id", "s", str, 0);
|
||||
spa_pod_builder_add(builder, "s", "udev.id", "s", str, 0);
|
||||
}
|
||||
if ((str = udev_device_get_property_value(item->udevice, "ID_BUS")) && *str) {
|
||||
spa_pod_builder_add(&b, "s", "device.bus", "s", str, 0);
|
||||
spa_pod_builder_add(builder, "s", "device.bus", "s", str, 0);
|
||||
}
|
||||
if ((str = udev_device_get_property_value(item->udevice, "SUBSYSTEM")) && *str) {
|
||||
spa_pod_builder_add(&b, "s", "device.subsystem", "s", str, 0);
|
||||
spa_pod_builder_add(builder, "s", "device.subsystem", "s", str, 0);
|
||||
}
|
||||
if ((str = udev_device_get_property_value(item->udevice, "ID_VENDOR_ID")) && *str) {
|
||||
spa_pod_builder_add(&b, "s", "device.vendor.id", "s", str, 0);
|
||||
spa_pod_builder_add(builder, "s", "device.vendor.id", "s", str, 0);
|
||||
}
|
||||
str = udev_device_get_property_value(item->udevice, "ID_VENDOR_FROM_DATABASE");
|
||||
if (!(str && *str)) {
|
||||
|
|
@ -162,20 +158,20 @@ static void fill_item(struct impl *this, struct item *item, struct udev_device *
|
|||
}
|
||||
}
|
||||
if (str && *str) {
|
||||
spa_pod_builder_add(&b, "s", "device.vendor.name", "s", str, 0);
|
||||
spa_pod_builder_add(builder, "s", "device.vendor.name", "s", str, 0);
|
||||
}
|
||||
if ((str = udev_device_get_property_value(item->udevice, "ID_MODEL_ID")) && *str) {
|
||||
spa_pod_builder_add(&b, "s", "device.product.id", "s", str, 0);
|
||||
spa_pod_builder_add(builder, "s", "device.product.id", "s", str, 0);
|
||||
}
|
||||
spa_pod_builder_add(&b, "s", "device.product.name", "s", name, 0);
|
||||
spa_pod_builder_add(builder, "s", "device.product.name", "s", name, 0);
|
||||
if ((str = udev_device_get_property_value(item->udevice, "ID_SERIAL")) && *str) {
|
||||
spa_pod_builder_add(&b, "s", "device.serial", "s", str, 0);
|
||||
spa_pod_builder_add(builder, "s", "device.serial", "s", str, 0);
|
||||
}
|
||||
if ((str = udev_device_get_property_value(item->udevice, "ID_V4L_CAPABILITIES")) && *str) {
|
||||
spa_pod_builder_add(&b, "s", "device.capabilities", "s", str, 0);
|
||||
spa_pod_builder_add(builder, "s", "device.capabilities", "s", str, 0);
|
||||
}
|
||||
|
||||
item->item = spa_pod_builder_add(&b, "]>", NULL);
|
||||
*result = spa_pod_builder_add(builder, "]>", NULL);
|
||||
}
|
||||
|
||||
static void impl_on_fd_events(struct spa_source *source)
|
||||
|
|
@ -187,9 +183,9 @@ static void impl_on_fd_events(struct spa_source *source)
|
|||
uint32_t type;
|
||||
struct spa_pod_builder b = { NULL, };
|
||||
uint8_t buffer[4096];
|
||||
struct spa_pod *item;
|
||||
|
||||
dev = udev_monitor_receive_device(this->umonitor);
|
||||
fill_item(this, &this->uitem, dev);
|
||||
if (dev == NULL)
|
||||
return;
|
||||
|
||||
|
|
@ -206,7 +202,8 @@ static void impl_on_fd_events(struct spa_source *source)
|
|||
return;
|
||||
|
||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||
event = spa_pod_builder_object(&b, 0, type, "P", this->uitem.item);
|
||||
event = spa_pod_builder_object(&b, 0, type);
|
||||
fill_item(this, &this->uitem, dev, &item, &b);
|
||||
|
||||
this->callbacks->event(this->callbacks_data, event);
|
||||
}
|
||||
|
|
@ -253,7 +250,8 @@ impl_monitor_set_callbacks(struct spa_monitor *monitor,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_monitor_enum_items(struct spa_monitor *monitor, struct spa_monitor_item **item, uint32_t *index)
|
||||
impl_monitor_enum_items(struct spa_monitor *monitor, uint32_t *index,
|
||||
struct spa_pod **item, struct spa_pod_builder *builder)
|
||||
{
|
||||
int res;
|
||||
struct impl *this;
|
||||
|
|
@ -284,18 +282,16 @@ impl_monitor_enum_items(struct spa_monitor *monitor, struct spa_monitor_item **i
|
|||
this->index++;
|
||||
}
|
||||
if (this->devices == NULL) {
|
||||
fill_item(this, &this->uitem, NULL);
|
||||
fill_item(this, &this->uitem, NULL, item, builder);
|
||||
return 0;
|
||||
}
|
||||
|
||||
dev = udev_device_new_from_syspath(this->udev, udev_list_entry_get_name(this->devices));
|
||||
|
||||
fill_item(this, &this->uitem, dev);
|
||||
fill_item(this, &this->uitem, dev, item, builder);
|
||||
if (dev == NULL)
|
||||
return 0;
|
||||
|
||||
*item = this->uitem.item;
|
||||
|
||||
this->devices = udev_list_entry_get_next(this->devices);
|
||||
this->index++;
|
||||
(*index)++;
|
||||
|
|
|
|||
|
|
@ -170,7 +170,8 @@ struct impl {
|
|||
|
||||
static int impl_node_enum_params(struct spa_node *node,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this;
|
||||
|
|
@ -213,7 +214,7 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
(*index)++;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
return 1;
|
||||
|
|
@ -221,7 +222,7 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
|
||||
static int impl_node_set_param(struct spa_node *node,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct impl *this;
|
||||
struct type *t;
|
||||
|
|
@ -467,9 +468,9 @@ static int impl_node_port_get_info(struct spa_node *node,
|
|||
static int port_get_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
struct spa_pod_builder *builder,
|
||||
struct spa_pod **param)
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct type *t = &this->type;
|
||||
|
|
@ -512,7 +513,8 @@ static int impl_node_port_enum_params(struct spa_node *node,
|
|||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
|
||||
|
|
@ -550,10 +552,10 @@ static int impl_node_port_enum_params(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
else if (id == t->param.idEnumFormat) {
|
||||
return spa_v4l2_enum_format(this, index, filter, builder);
|
||||
return spa_v4l2_enum_format(this, index, filter, result, builder);
|
||||
}
|
||||
else if (id == t->param.idFormat) {
|
||||
if((res = port_get_format(node, direction, port_id, index, filter, builder, ¶m)) <= 0)
|
||||
if((res = port_get_format(node, direction, port_id, index, filter, ¶m, builder)) <= 0)
|
||||
return res;
|
||||
}
|
||||
else if (id == t->param.idBuffers) {
|
||||
|
|
@ -588,7 +590,7 @@ static int impl_node_port_enum_params(struct spa_node *node,
|
|||
(*index)++;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
return 1;
|
||||
|
|
@ -597,7 +599,7 @@ static int impl_node_port_enum_params(struct spa_node *node,
|
|||
static int port_set_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const struct spa_pod_object *format)
|
||||
const struct spa_pod *format)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct spa_video_info info;
|
||||
|
|
@ -672,7 +674,7 @@ static int port_set_format(struct spa_node *node,
|
|||
static int impl_node_port_set_param(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct impl *this;
|
||||
struct type *t;
|
||||
|
|
@ -728,7 +730,7 @@ static int
|
|||
impl_node_port_alloc_buffers(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod_object **params,
|
||||
struct spa_pod **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
|
|
@ -880,6 +882,7 @@ static const struct spa_node impl_node = {
|
|||
};
|
||||
|
||||
static int impl_clock_enum_params(struct spa_clock *clock, uint32_t id, uint32_t *index,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
|
|
@ -887,7 +890,7 @@ static int impl_clock_enum_params(struct spa_clock *clock, uint32_t id, uint32_t
|
|||
|
||||
static int impl_clock_set_param(struct spa_clock *clock,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -400,7 +400,7 @@ static const struct format_info *find_format_info_by_media_type(struct type *typ
|
|||
|
||||
static uint32_t
|
||||
enum_filter_format(struct type *type, uint32_t media_type, int32_t media_subtype,
|
||||
const struct spa_pod_object *filter, uint32_t index)
|
||||
const struct spa_pod *filter, uint32_t index)
|
||||
{
|
||||
uint32_t video_format = 0;
|
||||
|
||||
|
|
@ -411,7 +411,7 @@ enum_filter_format(struct type *type, uint32_t media_type, int32_t media_subtype
|
|||
uint32_t n_values;
|
||||
const uint32_t *values;
|
||||
|
||||
if (!(p = spa_pod_object_find_prop(filter, type->format_video.format)))
|
||||
if (!(p = spa_pod_find_prop(filter, type->format_video.format)))
|
||||
return type->video_format.UNKNOWN;
|
||||
|
||||
if (p->body.value.type != SPA_POD_TYPE_ID)
|
||||
|
|
@ -525,7 +525,8 @@ filter_framerate(struct v4l2_frmivalenum *frmival,
|
|||
static int
|
||||
spa_v4l2_enum_format(struct impl *this,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct port *port = &this->out_ports[0];
|
||||
|
|
@ -600,7 +601,7 @@ spa_v4l2_enum_format(struct impl *this,
|
|||
struct spa_pod_prop *p;
|
||||
|
||||
/* check if we have a fixed frame size */
|
||||
if (!(p = spa_pod_object_find_prop(filter, t->format_video.size)))
|
||||
if (!(p = spa_pod_find_prop(filter, t->format_video.size)))
|
||||
goto do_frmsize;
|
||||
|
||||
if (p->body.value.type != SPA_POD_TYPE_RECTANGLE)
|
||||
|
|
@ -634,7 +635,7 @@ spa_v4l2_enum_format(struct impl *this,
|
|||
uint32_t i, n_values;
|
||||
|
||||
/* check if we have a fixed frame size */
|
||||
if (!(p = spa_pod_object_find_prop(filter, t->format_video.size)))
|
||||
if (!(p = spa_pod_find_prop(filter, t->format_video.size)))
|
||||
goto have_size;
|
||||
|
||||
range = p->body.flags & SPA_POD_PROP_RANGE_MASK;
|
||||
|
|
@ -722,7 +723,7 @@ spa_v4l2_enum_format(struct impl *this,
|
|||
uint32_t i, n_values;
|
||||
const struct spa_fraction step = { 1, 1 }, *values;
|
||||
|
||||
if (!(p = spa_pod_object_find_prop(filter, t->format_video.framerate)))
|
||||
if (!(p = spa_pod_find_prop(filter, t->format_video.framerate)))
|
||||
goto have_framerate;
|
||||
|
||||
if (p->body.value.type != SPA_POD_TYPE_FRACTION)
|
||||
|
|
@ -790,7 +791,7 @@ spa_v4l2_enum_format(struct impl *this,
|
|||
prop->body.flags &= ~(SPA_POD_PROP_RANGE_MASK | SPA_POD_PROP_FLAG_UNSET);
|
||||
}
|
||||
spa_pod_builder_pop(builder);
|
||||
spa_pod_builder_pop(builder);
|
||||
*result = spa_pod_builder_pop(builder);
|
||||
|
||||
(*index)++;
|
||||
|
||||
|
|
@ -1031,7 +1032,7 @@ static int spa_v4l2_use_buffers(struct impl *this, struct spa_buffer **buffers,
|
|||
|
||||
static int
|
||||
mmap_init(struct impl *this,
|
||||
struct spa_pod_object **params,
|
||||
struct spa_pod **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
|
|
@ -1140,7 +1141,7 @@ static int read_init(struct impl *this)
|
|||
|
||||
static int
|
||||
spa_v4l2_alloc_buffers(struct impl *this,
|
||||
struct spa_pod_object **params,
|
||||
struct spa_pod **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
|
|
|
|||
|
|
@ -153,7 +153,8 @@ static void reset_props(struct impl *this, struct props *props)
|
|||
|
||||
static int impl_node_enum_params(struct spa_node *node,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this;
|
||||
|
|
@ -197,14 +198,14 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
(*index)++;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct impl *this;
|
||||
struct type *t;
|
||||
|
|
@ -458,9 +459,9 @@ impl_node_port_get_info(struct spa_node *node,
|
|||
static int port_enum_formats(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
struct spa_pod_builder *builder,
|
||||
struct spa_pod **param)
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct type *t = &this->type;
|
||||
|
|
@ -490,9 +491,9 @@ static int port_enum_formats(struct spa_node *node,
|
|||
static int port_get_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
struct spa_pod_builder *builder,
|
||||
struct spa_pod **param)
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct type *t = &this->type;
|
||||
|
|
@ -517,7 +518,8 @@ static int
|
|||
impl_node_port_enum_params(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this;
|
||||
|
|
@ -551,11 +553,11 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
else if (id == t->param.idEnumFormat) {
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, filter, builder, ¶m)) <= 0)
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, filter, ¶m, builder)) <= 0)
|
||||
return res;
|
||||
}
|
||||
else if (id == t->param.idFormat) {
|
||||
if ((res = port_get_format(node, direction, port_id, index, filter, builder, ¶m)) <= 0)
|
||||
if ((res = port_get_format(node, direction, port_id, index, filter, ¶m, builder)) <= 0)
|
||||
return res;
|
||||
}
|
||||
else if (id == t->param.idBuffers) {
|
||||
|
|
@ -596,7 +598,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
(*index)++;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
return 1;
|
||||
|
|
@ -617,7 +619,7 @@ static int clear_buffers(struct impl *this)
|
|||
static int port_set_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const struct spa_pod_object *format)
|
||||
const struct spa_pod *format)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
|
|
@ -661,7 +663,7 @@ static int
|
|||
impl_node_port_set_param(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct impl *this;
|
||||
struct type *t;
|
||||
|
|
@ -728,7 +730,7 @@ static int
|
|||
impl_node_port_alloc_buffers(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod_object **params,
|
||||
struct spa_pod **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
|
|
@ -868,13 +870,14 @@ static const struct spa_node impl_node = {
|
|||
};
|
||||
|
||||
static int impl_clock_enum_params(struct spa_clock *clock, uint32_t id, uint32_t *index,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_clock_set_param(struct spa_clock *clock, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,7 +140,8 @@ static void reset_props(struct props *props)
|
|||
|
||||
static int impl_node_enum_params(struct spa_node *node,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this;
|
||||
|
|
@ -183,14 +184,14 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
(*index)++;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct impl *this;
|
||||
struct type *t;
|
||||
|
|
@ -328,9 +329,9 @@ impl_node_port_get_info(struct spa_node *node,
|
|||
static int port_enum_formats(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
struct spa_pod_builder *builder,
|
||||
struct spa_pod **param)
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct type *t = &this->type;
|
||||
|
|
@ -356,9 +357,9 @@ static int port_enum_formats(struct spa_node *node,
|
|||
static int port_get_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
struct spa_pod_builder *builder,
|
||||
struct spa_pod **param)
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct port *port;
|
||||
|
|
@ -386,7 +387,8 @@ static int
|
|||
impl_node_port_enum_params(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this;
|
||||
|
|
@ -423,11 +425,11 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
else if (id == t->param.idEnumFormat) {
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, filter, builder, ¶m)) <= 0)
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, filter, ¶m, builder)) <= 0)
|
||||
return res;
|
||||
}
|
||||
else if (id == t->param.idFormat) {
|
||||
if ((res = port_get_format(node, direction, port_id, index, filter, builder, ¶m)) <= 0)
|
||||
if ((res = port_get_format(node, direction, port_id, index, filter, ¶m, builder)) <= 0)
|
||||
return res;
|
||||
}
|
||||
else if (id == t->param.idBuffers) {
|
||||
|
|
@ -464,7 +466,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
(*index)++;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
return 1;
|
||||
|
|
@ -483,7 +485,7 @@ static int clear_buffers(struct impl *this, struct port *port)
|
|||
static int port_set_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const struct spa_pod_object *format)
|
||||
const struct spa_pod *format)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct port *port;
|
||||
|
|
@ -519,7 +521,7 @@ static int
|
|||
impl_node_port_set_param(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct impl *this;
|
||||
struct type *t;
|
||||
|
|
@ -593,7 +595,7 @@ static int
|
|||
impl_node_port_alloc_buffers(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod_object **params,
|
||||
struct spa_pod **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ do_invoke(struct spa_loop *loop,
|
|||
static int make_nodes(struct data *data, const char *device)
|
||||
{
|
||||
int res;
|
||||
struct spa_pod_object *props;
|
||||
struct spa_pod *props;
|
||||
struct spa_pod_builder b = { 0 };
|
||||
uint8_t buffer[128];
|
||||
|
||||
|
|
@ -302,7 +302,7 @@ static int make_nodes(struct data *data, const char *device)
|
|||
":", data->type.props_device, "s", device ? device : "hw:0",
|
||||
":", data->type.props_min_latency, "i", MIN_LATENCY);
|
||||
|
||||
spa_debug_pod(&props->pod, 0);
|
||||
spa_debug_pod(props, 0);
|
||||
|
||||
if ((res = spa_node_set_param(data->sink, data->type.param.idProps, 0, props)) < 0)
|
||||
printf("got set_props error %d\n", res);
|
||||
|
|
@ -368,8 +368,8 @@ static int make_nodes(struct data *data, const char *device)
|
|||
|
||||
static int negotiate_formats(struct data *data)
|
||||
{
|
||||
int res, ref;
|
||||
struct spa_pod_object *format, *filter;
|
||||
int res;
|
||||
struct spa_pod *format, *filter;
|
||||
uint32_t state = 0;
|
||||
struct spa_pod_builder b = { 0 };
|
||||
uint8_t buffer[4096];
|
||||
|
|
@ -384,19 +384,16 @@ static int negotiate_formats(struct data *data)
|
|||
":", data->type.format_audio.rate, "i", 44100,
|
||||
":", data->type.format_audio.channels, "i", 2);
|
||||
|
||||
ref = b.state.offset;
|
||||
|
||||
spa_debug_pod(&filter->pod, 0);
|
||||
spa_debug_pod(filter, 0);
|
||||
|
||||
spa_log_debug(&default_log.log, "enum_params");
|
||||
if ((res = spa_node_port_enum_params(data->sink,
|
||||
SPA_DIRECTION_INPUT, 0,
|
||||
data->type.param.idEnumFormat, &state,
|
||||
filter, &b)) <= 0)
|
||||
filter, &format, &b)) <= 0)
|
||||
return -EBADF;
|
||||
|
||||
format = spa_pod_builder_deref(&b, ref);
|
||||
spa_debug_pod(&format->pod, 0);
|
||||
spa_debug_pod(format, 0);
|
||||
|
||||
spa_log_debug(&default_log.log, "sink set_param");
|
||||
if ((res = spa_node_port_set_param(data->sink,
|
||||
|
|
|
|||
|
|
@ -329,7 +329,7 @@ do_invoke(struct spa_loop *loop,
|
|||
static int make_nodes(struct data *data, const char *device)
|
||||
{
|
||||
int res;
|
||||
struct spa_pod_object *props;
|
||||
struct spa_pod *props;
|
||||
struct spa_pod_builder b = { 0 };
|
||||
uint8_t buffer[128];
|
||||
|
||||
|
|
@ -453,8 +453,8 @@ static int make_nodes(struct data *data, const char *device)
|
|||
static int negotiate_formats(struct data *data)
|
||||
{
|
||||
int res;
|
||||
struct spa_pod_object *format, *filter;
|
||||
uint32_t state = 0, ref;
|
||||
struct spa_pod *format, *filter;
|
||||
uint32_t state = 0;
|
||||
struct spa_pod_builder b = { 0 };
|
||||
uint8_t buffer[2048];
|
||||
|
||||
|
|
@ -468,17 +468,13 @@ static int negotiate_formats(struct data *data)
|
|||
":", data->type.format_audio.rate, "i", 44100,
|
||||
":", data->type.format_audio.channels, "i", 2);
|
||||
|
||||
ref = b.state.offset;
|
||||
|
||||
if ((res =
|
||||
spa_node_port_enum_params(data->sink,
|
||||
SPA_DIRECTION_INPUT, 0,
|
||||
data->type.param.idEnumFormat, &state,
|
||||
filter, &b)) <= 0)
|
||||
filter, &format, &b)) <= 0)
|
||||
return -EBADF;
|
||||
|
||||
format = spa_pod_builder_deref(&b, ref);
|
||||
|
||||
if ((res = spa_node_port_set_param(data->sink,
|
||||
SPA_DIRECTION_INPUT, 0,
|
||||
data->type.param.idFormat, 0,
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ static int make_nodes(struct data *data)
|
|||
static int negotiate_formats(struct data *data)
|
||||
{
|
||||
int res;
|
||||
struct spa_pod_object *format;
|
||||
struct spa_pod *format;
|
||||
struct spa_pod_builder b = { 0 };
|
||||
uint8_t buffer[256];
|
||||
|
||||
|
|
|
|||
|
|
@ -258,15 +258,15 @@ static void do_static_struct(struct spa_type_map *map)
|
|||
int res;
|
||||
struct spa_fraction frac = { -1, -1 };
|
||||
|
||||
res = spa_pod_object_parse(&test_format.fmt,
|
||||
res = spa_pod_object_parse(&test_format.fmt.pod,
|
||||
":",type.format_video.format, "I", &format,
|
||||
":",type.format_video.framerate, "F", &frac, NULL);
|
||||
|
||||
printf("%d format %d num %d denom %d\n", res, format, frac.num, frac.denom);
|
||||
|
||||
spa_pod_object_fixate(&test_format.fmt);
|
||||
spa_pod_fixate(&test_format.fmt.pod);
|
||||
|
||||
res = spa_pod_object_parse(&test_format.fmt,
|
||||
res = spa_pod_object_parse(&test_format.fmt.pod,
|
||||
":",type.format_video.format, "I", &format,
|
||||
":",type.format_video.framerate, "F", &frac, NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
spa_debug_pod(obj, 0);
|
||||
|
||||
struct spa_pod_prop *p = spa_pod_object_find_prop((struct spa_pod_object *) obj, 4);
|
||||
struct spa_pod_prop *p = spa_pod_find_prop(obj, 4);
|
||||
printf("%d %d\n", p->body.key, p->body.flags);
|
||||
spa_debug_pod(&p->body.value, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ do_invoke(struct spa_loop *loop,
|
|||
static int make_nodes(struct data *data, const char *device)
|
||||
{
|
||||
int res;
|
||||
struct spa_pod_object *props;
|
||||
struct spa_pod *props;
|
||||
struct spa_pod_builder b = { 0 };
|
||||
uint8_t buffer[128];
|
||||
|
||||
|
|
@ -317,8 +317,8 @@ static int make_nodes(struct data *data, const char *device)
|
|||
static int negotiate_formats(struct data *data)
|
||||
{
|
||||
int res;
|
||||
struct spa_pod_object *format, *filter;
|
||||
uint32_t state = 0, ref;
|
||||
struct spa_pod *format, *filter;
|
||||
uint32_t state = 0;
|
||||
struct spa_pod_builder b = { 0 };
|
||||
uint8_t buffer[4096];
|
||||
|
||||
|
|
@ -333,16 +333,12 @@ static int negotiate_formats(struct data *data)
|
|||
":", data->type.format_audio.rate, "i", 44100,
|
||||
":", data->type.format_audio.channels, "i", 2);
|
||||
|
||||
ref = b.state.offset;
|
||||
|
||||
if ((res = spa_node_port_enum_params(data->sink,
|
||||
SPA_DIRECTION_INPUT, 0,
|
||||
data->type.param.idEnumFormat, &state,
|
||||
filter, &b)) <= 0)
|
||||
filter, &format, &b)) <= 0)
|
||||
return -EBADF;
|
||||
|
||||
format = spa_pod_builder_deref(&b, ref);
|
||||
|
||||
if ((res = spa_node_port_set_param(data->sink,
|
||||
SPA_DIRECTION_INPUT, 0,
|
||||
data->type.param.idFormat, 0,
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ do_invoke(struct spa_loop *loop,
|
|||
static int make_nodes(struct data *data, const char *device)
|
||||
{
|
||||
int res;
|
||||
struct spa_pod_object *props;
|
||||
struct spa_pod *props;
|
||||
struct spa_pod_builder b = { 0 };
|
||||
uint8_t buffer[256];
|
||||
|
||||
|
|
@ -390,7 +390,7 @@ static int negotiate_formats(struct data *data)
|
|||
{
|
||||
int res;
|
||||
const struct spa_port_info *info;
|
||||
struct spa_pod_object *format;
|
||||
struct spa_pod *format;
|
||||
uint8_t buffer[256];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
|
||||
|
||||
|
|
|
|||
|
|
@ -64,18 +64,17 @@ inspect_node_params(struct data *data, struct spa_node *node)
|
|||
for (idx1 = 0;;) {
|
||||
uint32_t buffer[4096];
|
||||
struct spa_pod_builder b = { 0 };
|
||||
struct spa_pod_object *param;
|
||||
struct spa_pod *param;
|
||||
uint32_t id;
|
||||
|
||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||
if ((res = spa_node_enum_params(node,
|
||||
data->type.param.idList, &idx1,
|
||||
NULL, &b)) <= 0) {
|
||||
NULL, ¶m, &b)) <= 0) {
|
||||
if (res != 0)
|
||||
error(0, -res, "enum_params");
|
||||
break;
|
||||
}
|
||||
param = spa_pod_builder_deref(&b, 0);
|
||||
|
||||
spa_pod_object_parse(param,
|
||||
":", data->type.param.listId, "I", &id,
|
||||
|
|
@ -88,13 +87,12 @@ inspect_node_params(struct data *data, struct spa_node *node)
|
|||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||
if ((res = spa_node_enum_params(node,
|
||||
id, &idx2,
|
||||
NULL, &b)) <= 0) {
|
||||
NULL, ¶m, &b)) <= 0) {
|
||||
if (res != 0)
|
||||
error(0, -res, "enum_params %d", id);
|
||||
break;
|
||||
}
|
||||
param = spa_pod_builder_deref(&b, 0);
|
||||
spa_debug_pod(¶m->pod, flags);
|
||||
spa_debug_pod(param, flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -109,19 +107,18 @@ inspect_port_params(struct data *data, struct spa_node *node,
|
|||
for (idx1 = 0;;) {
|
||||
uint32_t buffer[4096];
|
||||
struct spa_pod_builder b = { 0 };
|
||||
struct spa_pod_object *param;
|
||||
struct spa_pod *param;
|
||||
uint32_t id;
|
||||
|
||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||
if ((res = spa_node_port_enum_params(node,
|
||||
direction, port_id,
|
||||
data->type.param.idList, &idx1,
|
||||
NULL, &b)) <= 0) {
|
||||
NULL, ¶m, &b)) <= 0) {
|
||||
if (res != 0)
|
||||
error(0, -res, "port_enum_params");
|
||||
break;
|
||||
}
|
||||
param = spa_pod_builder_deref(&b, 0);
|
||||
spa_pod_object_parse(param,
|
||||
":", data->type.param.listId, "I", &id,
|
||||
NULL);
|
||||
|
|
@ -134,15 +131,15 @@ inspect_port_params(struct data *data, struct spa_node *node,
|
|||
if ((res = spa_node_port_enum_params(node,
|
||||
direction, port_id,
|
||||
id, &idx2,
|
||||
NULL, &b)) <= 0) {
|
||||
NULL, ¶m, &b)) <= 0) {
|
||||
if (res != 0)
|
||||
error(0, -res, "port_enum_params");
|
||||
break;
|
||||
}
|
||||
param = spa_pod_builder_deref(&b, 0);
|
||||
if (param->body.type == data->type.format)
|
||||
|
||||
if (spa_pod_is_object_type(param, data->type.format))
|
||||
flags |= SPA_DEBUG_FLAG_FORMAT;
|
||||
spa_debug_pod(¶m->pod, flags);
|
||||
spa_debug_pod(param, flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,9 +58,9 @@ struct data {
|
|||
};
|
||||
|
||||
|
||||
static void inspect_item(struct data *data, struct spa_monitor_item *item)
|
||||
static void inspect_item(struct data *data, struct spa_pod *item)
|
||||
{
|
||||
spa_debug_pod(&item->object.pod, 0);
|
||||
spa_debug_pod(item, 0);
|
||||
}
|
||||
|
||||
static void on_monitor_event(void *_data, struct spa_event *event)
|
||||
|
|
@ -69,13 +69,13 @@ static void on_monitor_event(void *_data, struct spa_event *event)
|
|||
|
||||
if (SPA_EVENT_TYPE(event) == data->type.monitor.Added) {
|
||||
fprintf(stderr, "added:\n");
|
||||
inspect_item(data, (struct spa_monitor_item *) event);
|
||||
inspect_item(data, SPA_POD_CONTENTS(struct spa_event, event));
|
||||
} else if (SPA_EVENT_TYPE(event) == data->type.monitor.Removed) {
|
||||
fprintf(stderr, "removed:\n");
|
||||
inspect_item(data, (struct spa_monitor_item *) event);
|
||||
inspect_item(data, SPA_POD_CONTENTS(struct spa_event, event));
|
||||
} else if (SPA_EVENT_TYPE(event) == data->type.monitor.Changed) {
|
||||
fprintf(stderr, "changed:\n");
|
||||
inspect_item(data, (struct spa_monitor_item *) event);
|
||||
inspect_item(data, SPA_POD_CONTENTS(struct spa_event, event));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -113,9 +113,11 @@ static void handle_monitor(struct data *data, struct spa_monitor *monitor)
|
|||
spa_debug_dict(monitor->info);
|
||||
|
||||
for (index = 0;;) {
|
||||
struct spa_monitor_item *item;
|
||||
struct spa_pod *item;
|
||||
uint8_t buffer[4096];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
|
||||
|
||||
if ((res = spa_monitor_enum_items(monitor, &item, &index)) <= 0) {
|
||||
if ((res = spa_monitor_enum_items(monitor, &index, &item, &b)) <= 0) {
|
||||
if (res != 0)
|
||||
printf("spa_monitor_enum_items: %s\n", spa_strerror(res));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -239,7 +239,8 @@ static int impl_port_get_info(struct spa_node *node, enum spa_direction directio
|
|||
static int port_enum_formats(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
|
|
@ -284,7 +285,7 @@ static int port_enum_formats(struct spa_node *node,
|
|||
2, &SPA_FRACTION(0,1),
|
||||
&SPA_FRACTION(30,1),
|
||||
NULL);
|
||||
spa_pod_builder_pop(builder);
|
||||
*result = spa_pod_builder_pop(builder);
|
||||
|
||||
(*index)++;
|
||||
|
||||
|
|
@ -294,7 +295,8 @@ static int port_enum_formats(struct spa_node *node,
|
|||
static int port_get_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
|
|
@ -302,7 +304,7 @@ static int port_get_format(struct spa_node *node,
|
|||
if (*index != 0 || d->format.format == 0)
|
||||
return 0;
|
||||
|
||||
spa_pod_builder_object(builder,
|
||||
*result = spa_pod_builder_object(builder,
|
||||
d->t->param.idFormat, d->type.format,
|
||||
"I", d->type.media_type.video,
|
||||
"I", d->type.media_subtype.raw,
|
||||
|
|
@ -318,11 +320,13 @@ static int port_get_format(struct spa_node *node,
|
|||
static int impl_port_enum_params(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct pw_type *t = d->t;
|
||||
struct spa_pod *param;
|
||||
|
||||
if (id == t->param.idList) {
|
||||
uint32_t list[] = { t->param.idEnumFormat,
|
||||
|
|
@ -331,23 +335,23 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
t->param.idMeta };
|
||||
|
||||
if (*index < SPA_N_ELEMENTS(list))
|
||||
spa_pod_builder_object(builder,
|
||||
param = spa_pod_builder_object(builder,
|
||||
id, t->param.List,
|
||||
":", t->param.listId, "I", list[*index]);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else if (id == t->param.idEnumFormat) {
|
||||
return port_enum_formats(node, direction, port_id, index, filter, builder);
|
||||
return port_enum_formats(node, direction, port_id, index, filter, result, builder);
|
||||
}
|
||||
else if (id == t->param.idFormat) {
|
||||
return port_get_format(node, direction, port_id, index, filter, builder);
|
||||
return port_get_format(node, direction, port_id, index, filter, result, builder);
|
||||
}
|
||||
else if (id == t->param.idBuffers) {
|
||||
if (*index != 0)
|
||||
return 0;
|
||||
|
||||
spa_pod_builder_object(builder,
|
||||
param = spa_pod_builder_object(builder,
|
||||
id, t->param_buffers.Buffers,
|
||||
":", t->param_buffers.size, "i", d->stride * d->format.size.height,
|
||||
":", t->param_buffers.stride, "i", d->stride,
|
||||
|
|
@ -359,7 +363,7 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
if (*index != 0)
|
||||
return 0;
|
||||
|
||||
spa_pod_builder_object(builder,
|
||||
param = spa_pod_builder_object(builder,
|
||||
id, t->param_meta.Meta,
|
||||
":", t->param_meta.type, "I", t->meta.Header,
|
||||
":", t->param_meta.size, "i", sizeof(struct spa_meta_header));
|
||||
|
|
@ -369,12 +373,14 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
|
||||
(*index)++;
|
||||
|
||||
*result = param;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int port_set_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags, const struct spa_pod_object *format)
|
||||
uint32_t flags, const struct spa_pod *format)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
Uint32 sdl_format;
|
||||
|
|
@ -383,7 +389,7 @@ static int port_set_format(struct spa_node *node,
|
|||
if (format == NULL)
|
||||
return 0;
|
||||
|
||||
spa_debug_pod(&format->pod, SPA_DEBUG_FLAG_FORMAT);
|
||||
spa_debug_pod(format, SPA_DEBUG_FLAG_FORMAT);
|
||||
|
||||
spa_format_video_raw_parse(format, &d->format, &d->type.format_video);
|
||||
|
||||
|
|
@ -405,7 +411,7 @@ static int port_set_format(struct spa_node *node,
|
|||
static int impl_port_set_param(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct pw_type *t = d->t;
|
||||
|
|
|
|||
|
|
@ -156,7 +156,8 @@ static int impl_port_get_info(struct spa_node *node, enum spa_direction directio
|
|||
static int port_enum_formats(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
|
|
@ -164,7 +165,7 @@ static int port_enum_formats(struct spa_node *node,
|
|||
if (*index != 0)
|
||||
return 0;
|
||||
|
||||
spa_pod_builder_object(builder,
|
||||
*param = spa_pod_builder_object(builder,
|
||||
d->t->param.idEnumFormat, d->type.format,
|
||||
"I", d->type.media_type.audio,
|
||||
"I", d->type.media_subtype.raw,
|
||||
|
|
@ -180,7 +181,8 @@ static int port_enum_formats(struct spa_node *node,
|
|||
static int port_get_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
|
|
@ -191,7 +193,7 @@ static int port_get_format(struct spa_node *node,
|
|||
if (d->format.format == 0)
|
||||
return 0;
|
||||
|
||||
spa_pod_builder_object(builder,
|
||||
*param = spa_pod_builder_object(builder,
|
||||
d->t->param.idFormat, d->type.format,
|
||||
"I", d->type.media_type.audio,
|
||||
"I", d->type.media_subtype.raw,
|
||||
|
|
@ -207,11 +209,13 @@ static int port_get_format(struct spa_node *node,
|
|||
static int impl_port_enum_params(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct pw_type *t = d->t;
|
||||
struct spa_pod *param;
|
||||
|
||||
if (id == t->param.idList) {
|
||||
uint32_t list[] = { t->param.idEnumFormat,
|
||||
|
|
@ -220,23 +224,23 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
t->param.idMeta };
|
||||
|
||||
if (*index < SPA_N_ELEMENTS(list))
|
||||
spa_pod_builder_object(builder,
|
||||
param = spa_pod_builder_object(builder,
|
||||
id, t->param.List,
|
||||
":", t->param.listId, "I", list[*index]);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else if (id == t->param.idEnumFormat) {
|
||||
return port_enum_formats(node, direction, port_id, index, filter, builder);
|
||||
return port_enum_formats(node, direction, port_id, index, filter, result, builder);
|
||||
}
|
||||
else if (id == t->param.idFormat) {
|
||||
return port_get_format(node, direction, port_id, index, filter, builder);
|
||||
return port_get_format(node, direction, port_id, index, filter, result, builder);
|
||||
}
|
||||
else if (id == t->param.idBuffers) {
|
||||
if (*index > 0)
|
||||
return 0;
|
||||
|
||||
spa_pod_builder_object(builder,
|
||||
param = spa_pod_builder_object(builder,
|
||||
id, t->param_buffers.Buffers,
|
||||
":", t->param_buffers.size, "iru", 1024,
|
||||
2, 32, 4096,
|
||||
|
|
@ -248,13 +252,13 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
else if (id == t->param.idMeta) {
|
||||
switch (*index) {
|
||||
case 0:
|
||||
spa_pod_builder_object(builder,
|
||||
param = spa_pod_builder_object(builder,
|
||||
id, t->param_meta.Meta,
|
||||
":", t->param_meta.type, "I", t->meta.Header,
|
||||
":", t->param_meta.size, "i", sizeof(struct spa_meta_header));
|
||||
break;
|
||||
case 1:
|
||||
spa_pod_builder_object(builder,
|
||||
param = spa_pod_builder_object(builder,
|
||||
id, t->param_meta.Meta,
|
||||
":", t->param_meta.type, "I", t->meta.Ringbuffer,
|
||||
":", t->param_meta.size, "i", sizeof(struct spa_meta_ringbuffer),
|
||||
|
|
@ -272,13 +276,14 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
return -ENOENT;
|
||||
|
||||
(*index)++;
|
||||
*result = param;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int port_set_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags, const struct spa_pod_object *format)
|
||||
uint32_t flags, const struct spa_pod *format)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
|
||||
|
|
@ -287,7 +292,7 @@ static int port_set_format(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
|
||||
spa_debug_pod(&format->pod, SPA_DEBUG_FLAG_FORMAT);
|
||||
spa_debug_pod(format, SPA_DEBUG_FLAG_FORMAT);
|
||||
|
||||
if (spa_format_audio_raw_parse(format, &d->format, &d->type.format_audio) < 0)
|
||||
return -EINVAL;
|
||||
|
|
@ -301,7 +306,7 @@ static int port_set_format(struct spa_node *node,
|
|||
static int impl_port_set_param(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct pw_type *t = d->t;
|
||||
|
|
|
|||
|
|
@ -234,7 +234,8 @@ static int impl_port_get_info(struct spa_node *node, enum spa_direction directio
|
|||
static int port_enum_formats(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
|
|
@ -280,7 +281,7 @@ static int port_enum_formats(struct spa_node *node,
|
|||
2, &SPA_FRACTION(0,1),
|
||||
&SPA_FRACTION(30,1),
|
||||
NULL);
|
||||
spa_pod_builder_pop(builder);
|
||||
*result = spa_pod_builder_pop(builder);
|
||||
|
||||
(*index)++;
|
||||
|
||||
|
|
@ -290,20 +291,21 @@ static int port_enum_formats(struct spa_node *node,
|
|||
static int impl_port_enum_params(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct pw_type *t = d->t;
|
||||
|
||||
if (id == t->param.idEnumFormat) {
|
||||
return port_enum_formats(node, direction, port_id, index, filter, builder);
|
||||
return port_enum_formats(node, direction, port_id, index, filter, result, builder);
|
||||
}
|
||||
else if (id == t->param.idBuffers) {
|
||||
if (*index > 0)
|
||||
return 0;
|
||||
|
||||
spa_pod_builder_object(builder,
|
||||
*result = spa_pod_builder_object(builder,
|
||||
id, t->param_buffers.Buffers,
|
||||
":", t->param_buffers.size, "i", d->stride * d->format.size.height,
|
||||
":", t->param_buffers.stride, "i", d->stride,
|
||||
|
|
@ -315,7 +317,7 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
if (*index > 0)
|
||||
return 0;
|
||||
|
||||
spa_pod_builder_object(builder,
|
||||
*result = spa_pod_builder_object(builder,
|
||||
id, t->param_meta.Meta,
|
||||
":", t->param_meta.type, "I", t->meta.Header,
|
||||
":", t->param_meta.size, "i", sizeof(struct spa_meta_header));
|
||||
|
|
@ -328,7 +330,7 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int port_set_format(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags, const struct spa_pod_object *format)
|
||||
uint32_t flags, const struct spa_pod *format)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
Uint32 sdl_format;
|
||||
|
|
@ -337,7 +339,7 @@ static int port_set_format(struct spa_node *node, enum spa_direction direction,
|
|||
if (format == NULL)
|
||||
return 0;
|
||||
|
||||
spa_debug_pod(&format->pod, SPA_DEBUG_FLAG_FORMAT);
|
||||
spa_debug_pod(format, SPA_DEBUG_FLAG_FORMAT);
|
||||
|
||||
spa_format_video_raw_parse(format, &d->format, &d->type.format_video);
|
||||
|
||||
|
|
@ -359,7 +361,7 @@ static int port_set_format(struct spa_node *node, enum spa_direction direction,
|
|||
static int impl_port_set_param(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
struct pw_type *t = d->t;
|
||||
|
|
|
|||
|
|
@ -234,14 +234,14 @@ static Uint32 id_to_sdl_format(struct data *data, uint32_t id)
|
|||
}
|
||||
|
||||
static void
|
||||
on_stream_format_changed(void *_data, struct spa_pod_object *format)
|
||||
on_stream_format_changed(void *_data, struct spa_pod *format)
|
||||
{
|
||||
struct data *data = _data;
|
||||
struct pw_stream *stream = data->stream;
|
||||
struct pw_type *t = data->t;
|
||||
uint8_t params_buffer[1024];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(params_buffer, sizeof(params_buffer));
|
||||
struct spa_pod_object *params[2];
|
||||
struct spa_pod *params[2];
|
||||
Uint32 sdl_format;
|
||||
void *d;
|
||||
|
||||
|
|
@ -302,7 +302,7 @@ static void on_state_changed(void *_data, enum pw_remote_state old, enum pw_remo
|
|||
|
||||
case PW_REMOTE_STATE_CONNECTED:
|
||||
{
|
||||
const struct spa_pod_object *params[1];
|
||||
const struct spa_pod *params[1];
|
||||
uint8_t buffer[1024];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
|
||||
SDL_RendererInfo info;
|
||||
|
|
@ -351,7 +351,7 @@ static void on_state_changed(void *_data, enum pw_remote_state old, enum pw_remo
|
|||
params[0] = spa_pod_builder_pop(&b);
|
||||
|
||||
printf("supported formats:\n");
|
||||
spa_debug_pod(¶ms[0]->pod, SPA_DEBUG_FLAG_FORMAT);
|
||||
spa_debug_pod(params[0], SPA_DEBUG_FLAG_FORMAT);
|
||||
|
||||
pw_stream_add_listener(data->stream,
|
||||
&data->stream_listener,
|
||||
|
|
|
|||
|
|
@ -166,14 +166,14 @@ static void on_stream_state_changed(void *_data, enum pw_stream_state old, enum
|
|||
}
|
||||
|
||||
static void
|
||||
on_stream_format_changed(void *_data, struct spa_pod_object *format)
|
||||
on_stream_format_changed(void *_data, struct spa_pod *format)
|
||||
{
|
||||
struct data *data = _data;
|
||||
struct pw_stream *stream = data->stream;
|
||||
struct pw_type *t = data->t;
|
||||
uint8_t params_buffer[1024];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(params_buffer, sizeof(params_buffer));
|
||||
struct spa_pod_object *params[2];
|
||||
struct spa_pod *params[2];
|
||||
|
||||
if (format == NULL) {
|
||||
pw_stream_finish_format(stream, 0, 0, NULL);
|
||||
|
|
@ -218,7 +218,7 @@ static void on_state_changed(void *_data, enum pw_remote_state old, enum pw_remo
|
|||
|
||||
case PW_REMOTE_STATE_CONNECTED:
|
||||
{
|
||||
const struct spa_pod_object *params[1];
|
||||
const struct spa_pod *params[1];
|
||||
uint8_t buffer[1024];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
|
||||
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ struct pw_client_node_proxy_methods {
|
|||
uint32_t max_input_ports,
|
||||
uint32_t max_output_ports,
|
||||
uint32_t n_params,
|
||||
const struct spa_pod_object **params);
|
||||
const struct spa_pod **params);
|
||||
|
||||
/**
|
||||
* Update a node port
|
||||
|
|
@ -215,7 +215,7 @@ struct pw_client_node_proxy_methods {
|
|||
#define PW_CLIENT_NODE_PORT_UPDATE_INFO (1 << 1)
|
||||
uint32_t change_mask,
|
||||
uint32_t n_params,
|
||||
const struct spa_pod_object **params,
|
||||
const struct spa_pod **params,
|
||||
const struct spa_port_info *info);
|
||||
/**
|
||||
* Activate or deactivate the node
|
||||
|
|
@ -244,7 +244,7 @@ pw_client_node_proxy_update(struct pw_client_node_proxy *p,
|
|||
uint32_t max_input_ports,
|
||||
uint32_t max_output_ports,
|
||||
uint32_t n_params,
|
||||
const struct spa_pod_object **params)
|
||||
const struct spa_pod **params)
|
||||
{
|
||||
pw_proxy_do((struct pw_proxy*)p, struct pw_client_node_proxy_methods, update, change_mask,
|
||||
max_input_ports,
|
||||
|
|
@ -259,7 +259,7 @@ pw_client_node_proxy_port_update(struct pw_client_node_proxy *p,
|
|||
uint32_t port_id,
|
||||
uint32_t change_mask,
|
||||
uint32_t n_params,
|
||||
const struct spa_pod_object **params,
|
||||
const struct spa_pod **params,
|
||||
const struct spa_port_info *info)
|
||||
{
|
||||
pw_proxy_do((struct pw_proxy*)p, struct pw_client_node_proxy_methods, port_update, direction,
|
||||
|
|
@ -334,7 +334,7 @@ struct pw_client_node_proxy_events {
|
|||
*/
|
||||
void (*set_param) (void *object, uint32_t seq,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param);
|
||||
const struct spa_pod *param);
|
||||
/**
|
||||
* Receive an event from the client node
|
||||
* \param event the received event */
|
||||
|
|
@ -386,7 +386,7 @@ struct pw_client_node_proxy_events {
|
|||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param);
|
||||
const struct spa_pod *param);
|
||||
/**
|
||||
* Memory was added for a port
|
||||
*
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ new_node (GstPipeWireDeviceProvider *self, const struct pw_node_info *info, uint
|
|||
type = GST_PIPEWIRE_DEVICE_TYPE_SINK;
|
||||
|
||||
for (i = 0; i < info->n_input_params; i++) {
|
||||
if (info->input_params[i]->body.id != t->param.idEnumFormat)
|
||||
if (!spa_pod_is_object_id(info->input_params[i], t->param.idEnumFormat))
|
||||
continue;
|
||||
GstCaps *c1 = gst_caps_from_format (info->input_params[i], t->map);
|
||||
if (c1)
|
||||
|
|
@ -218,7 +218,7 @@ new_node (GstPipeWireDeviceProvider *self, const struct pw_node_info *info, uint
|
|||
else if (info->max_output_ports > 0 && info->max_input_ports == 0) {
|
||||
type = GST_PIPEWIRE_DEVICE_TYPE_SOURCE;
|
||||
for (i = 0; i < info->n_output_params; i++) {
|
||||
if (info->output_params[i]->body.id != t->param.idEnumFormat)
|
||||
if (!spa_pod_is_object_id(info->output_params[i], t->param.idEnumFormat))
|
||||
continue;
|
||||
GstCaps *c1 = gst_caps_from_format (info->output_params[i], t->map);
|
||||
if (c1)
|
||||
|
|
|
|||
|
|
@ -543,7 +543,7 @@ write_pod (struct spa_pod_builder *b, const void *data, uint32_t size)
|
|||
return ref;
|
||||
}
|
||||
|
||||
static struct spa_pod_object *
|
||||
static struct spa_pod *
|
||||
convert_1 (GstCapsFeatures *cf, GstStructure *cs)
|
||||
{
|
||||
ConvertData d;
|
||||
|
|
@ -568,15 +568,15 @@ convert_1 (GstCapsFeatures *cf, GstStructure *cs)
|
|||
|
||||
spa_pod_builder_pop (&d.b);
|
||||
|
||||
return SPA_MEMBER (d.b.data, 0, struct spa_pod_object);
|
||||
return SPA_MEMBER (d.b.data, 0, struct spa_pod);
|
||||
}
|
||||
|
||||
struct spa_pod_object *
|
||||
struct spa_pod *
|
||||
gst_caps_to_format (GstCaps *caps, guint index, struct spa_type_map *map)
|
||||
{
|
||||
GstCapsFeatures *f;
|
||||
GstStructure *s;
|
||||
struct spa_pod_object *res;
|
||||
struct spa_pod *res;
|
||||
|
||||
g_return_val_if_fail (GST_IS_CAPS (caps), NULL);
|
||||
g_return_val_if_fail (gst_caps_is_fixed (caps), NULL);
|
||||
|
|
@ -596,7 +596,7 @@ foreach_func (GstCapsFeatures *features,
|
|||
GstStructure *structure,
|
||||
GPtrArray *array)
|
||||
{
|
||||
struct spa_pod_object *fmt;
|
||||
struct spa_pod *fmt;
|
||||
|
||||
if ((fmt = convert_1 (features, structure)))
|
||||
g_ptr_array_insert (array, -1, fmt);
|
||||
|
|
@ -794,7 +794,7 @@ handle_fraction_prop (struct spa_pod_prop *prop, const char *key, GstCaps *res)
|
|||
}
|
||||
}
|
||||
GstCaps *
|
||||
gst_caps_from_format (const struct spa_pod_object *format, struct spa_type_map *map)
|
||||
gst_caps_from_format (const struct spa_pod *format, struct spa_type_map *map)
|
||||
{
|
||||
GstCaps *res = NULL;
|
||||
uint32_t media_type, media_subtype;
|
||||
|
|
@ -808,7 +808,7 @@ gst_caps_from_format (const struct spa_pod_object *format, struct spa_type_map *
|
|||
if (media_type == type.media_type.video) {
|
||||
if (media_subtype == type.media_subtype.raw) {
|
||||
res = gst_caps_new_empty_simple ("video/x-raw");
|
||||
if ((prop = spa_pod_object_find_prop (format, type.format_video.format))) {
|
||||
if ((prop = spa_pod_find_prop (format, type.format_video.format))) {
|
||||
handle_id_prop (prop, "format", res);
|
||||
}
|
||||
}
|
||||
|
|
@ -821,13 +821,13 @@ gst_caps_from_format (const struct spa_pod_object *format, struct spa_type_map *
|
|||
"alignment", G_TYPE_STRING, "au",
|
||||
NULL);
|
||||
}
|
||||
if ((prop = spa_pod_object_find_prop (format, type.format_video.size))) {
|
||||
if ((prop = spa_pod_find_prop (format, type.format_video.size))) {
|
||||
handle_rect_prop (prop, "width", "height", res);
|
||||
}
|
||||
if ((prop = spa_pod_object_find_prop (format, type.format_video.framerate))) {
|
||||
if ((prop = spa_pod_find_prop (format, type.format_video.framerate))) {
|
||||
handle_fraction_prop (prop, "framerate", res);
|
||||
}
|
||||
if ((prop = spa_pod_object_find_prop (format, type.format_video.max_framerate))) {
|
||||
if ((prop = spa_pod_find_prop (format, type.format_video.max_framerate))) {
|
||||
handle_fraction_prop (prop, "max-framerate", res);
|
||||
}
|
||||
} else if (media_type == type.media_type.audio) {
|
||||
|
|
@ -835,13 +835,13 @@ gst_caps_from_format (const struct spa_pod_object *format, struct spa_type_map *
|
|||
res = gst_caps_new_simple ("audio/x-raw",
|
||||
"layout", G_TYPE_STRING, "interleaved",
|
||||
NULL);
|
||||
if ((prop = spa_pod_object_find_prop (format, type.format_audio.format))) {
|
||||
if ((prop = spa_pod_find_prop (format, type.format_audio.format))) {
|
||||
handle_id_prop (prop, "format", res);
|
||||
}
|
||||
if ((prop = spa_pod_object_find_prop (format, type.format_audio.rate))) {
|
||||
if ((prop = spa_pod_find_prop (format, type.format_audio.rate))) {
|
||||
handle_int_prop (prop, "rate", res);
|
||||
}
|
||||
if ((prop = spa_pod_object_find_prop (format, type.format_audio.channels))) {
|
||||
if ((prop = spa_pod_find_prop (format, type.format_audio.channels))) {
|
||||
handle_int_prop (prop, "channels", res);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
struct spa_pod_object * gst_caps_to_format (GstCaps *caps, guint index, struct spa_type_map *map);
|
||||
struct spa_pod * gst_caps_to_format (GstCaps *caps, guint index, struct spa_type_map *map);
|
||||
GPtrArray * gst_caps_to_format_all (GstCaps *caps, struct spa_type_map *map);
|
||||
|
||||
GstCaps * gst_caps_from_format (const struct spa_pod_object *format, struct spa_type_map *map);
|
||||
GstCaps * gst_caps_from_format (const struct spa_pod *format, struct spa_type_map *map);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ pool_activated (GstPipeWirePool *pool, GstPipeWireSink *sink)
|
|||
guint size;
|
||||
guint min_buffers;
|
||||
guint max_buffers;
|
||||
struct spa_pod_object *port_params[3];
|
||||
struct spa_pod *port_params[3];
|
||||
struct spa_pod_builder b = { NULL };
|
||||
uint8_t buffer[1024];
|
||||
|
||||
|
|
@ -580,7 +580,7 @@ on_state_changed (void *data, enum pw_stream_state old, enum pw_stream_state sta
|
|||
}
|
||||
|
||||
static void
|
||||
on_format_changed (void *data, struct spa_pod_object *format)
|
||||
on_format_changed (void *data, struct spa_pod *format)
|
||||
{
|
||||
GstPipeWireSink *pwsink = data;
|
||||
|
||||
|
|
@ -618,7 +618,7 @@ gst_pipewire_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
|||
pwsink->path,
|
||||
flags,
|
||||
possible->len,
|
||||
(const struct spa_pod_object **) possible->pdata);
|
||||
(const struct spa_pod **) possible->pdata);
|
||||
|
||||
while (TRUE) {
|
||||
state = pw_stream_get_state (pwsink->stream, &error);
|
||||
|
|
|
|||
|
|
@ -663,7 +663,7 @@ gst_pipewire_src_negotiate (GstBaseSrc * basesrc)
|
|||
pwsrc->path,
|
||||
PW_STREAM_FLAG_AUTOCONNECT,
|
||||
possible->len,
|
||||
(const struct spa_pod_object **)possible->pdata);
|
||||
(const struct spa_pod **)possible->pdata);
|
||||
g_ptr_array_free (possible, TRUE);
|
||||
|
||||
while (TRUE) {
|
||||
|
|
@ -726,7 +726,7 @@ connect_error:
|
|||
|
||||
static void
|
||||
on_format_changed (void *data,
|
||||
struct spa_pod_object *format)
|
||||
struct spa_pod *format)
|
||||
{
|
||||
GstPipeWireSrc *pwsrc = data;
|
||||
GstCaps *caps;
|
||||
|
|
@ -746,7 +746,7 @@ on_format_changed (void *data,
|
|||
gst_caps_unref (caps);
|
||||
|
||||
if (res) {
|
||||
struct spa_pod_object *params[2];
|
||||
struct spa_pod *params[2];
|
||||
struct spa_pod_builder b = { NULL };
|
||||
uint8_t buffer[512];
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ struct proxy_port {
|
|||
|
||||
bool have_format;
|
||||
uint32_t n_params;
|
||||
struct spa_pod_object **params;
|
||||
struct spa_pod **params;
|
||||
struct spa_port_io *io;
|
||||
|
||||
uint32_t n_buffers;
|
||||
|
|
@ -111,7 +111,7 @@ struct proxy {
|
|||
struct proxy_port out_ports[MAX_OUTPUTS];
|
||||
|
||||
uint32_t n_params;
|
||||
struct spa_pod_object **params;
|
||||
struct spa_pod **params;
|
||||
|
||||
uint8_t format_buffer[1024];
|
||||
uint32_t seq;
|
||||
|
|
@ -152,7 +152,8 @@ static int clear_buffers(struct proxy *this, struct proxy_port *port)
|
|||
|
||||
static int spa_proxy_node_enum_params(struct spa_node *node,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct proxy *this;
|
||||
|
|
@ -167,17 +168,17 @@ static int spa_proxy_node_enum_params(struct spa_node *node,
|
|||
spa_pod_builder_get_state(builder, &state);
|
||||
|
||||
while (true) {
|
||||
struct spa_pod_object *param;
|
||||
struct spa_pod *param;
|
||||
|
||||
if (*index >= this->n_params)
|
||||
return 0;
|
||||
|
||||
param = this->params[(*index)++];
|
||||
|
||||
if (param->body.id != id)
|
||||
if (!spa_pod_is_object_id(param, id))
|
||||
continue;
|
||||
|
||||
if (spa_pod_filter(builder, ¶m->pod, &filter->pod) == 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) == 0)
|
||||
break;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
|
|
@ -186,7 +187,7 @@ static int spa_proxy_node_enum_params(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int spa_proxy_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct proxy *this;
|
||||
|
||||
|
|
@ -316,7 +317,7 @@ do_update_port(struct proxy *this,
|
|||
uint32_t port_id,
|
||||
uint32_t change_mask,
|
||||
uint32_t n_params,
|
||||
const struct spa_pod_object **params,
|
||||
const struct spa_pod **params,
|
||||
const struct spa_port_info *info)
|
||||
{
|
||||
struct proxy_port *port;
|
||||
|
|
@ -333,11 +334,11 @@ do_update_port(struct proxy *this,
|
|||
for (i = 0; i < port->n_params; i++)
|
||||
free(port->params[i]);
|
||||
port->n_params = n_params;
|
||||
port->params = realloc(port->params, port->n_params * sizeof(struct spa_pod_object *));
|
||||
port->params = realloc(port->params, port->n_params * sizeof(struct spa_pod *));
|
||||
|
||||
for (i = 0; i < port->n_params; i++) {
|
||||
port->params[i] = spa_pod_object_copy(params[i]);
|
||||
if (port->params[i]->body.id == t->param.idFormat)
|
||||
port->params[i] = pw_spa_pod_copy(params[i]);
|
||||
if (spa_pod_is_object_id(port->params[i], t->param.idFormat))
|
||||
port->have_format = true;
|
||||
}
|
||||
|
||||
|
|
@ -451,7 +452,8 @@ static int
|
|||
spa_proxy_node_port_enum_params(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct proxy *this;
|
||||
|
|
@ -471,17 +473,17 @@ spa_proxy_node_port_enum_params(struct spa_node *node,
|
|||
spa_pod_builder_get_state(builder, &state);
|
||||
|
||||
while (true) {
|
||||
struct spa_pod_object *param;
|
||||
struct spa_pod *param;
|
||||
|
||||
if (*index >= port->n_params)
|
||||
return 0;
|
||||
|
||||
param = port->params[(*index)++];
|
||||
|
||||
if (param->body.id != id)
|
||||
if (!spa_pod_is_object_id(param, id))
|
||||
continue;
|
||||
|
||||
if (spa_pod_filter(builder, ¶m->pod, &filter->pod) == 0)
|
||||
if (spa_pod_filter(builder, result, param, filter) == 0)
|
||||
break;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
|
|
@ -493,7 +495,7 @@ static int
|
|||
spa_proxy_node_port_set_param(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct proxy *this;
|
||||
|
||||
|
|
@ -652,7 +654,7 @@ static int
|
|||
spa_proxy_node_port_alloc_buffers(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod_object **params,
|
||||
struct spa_pod **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
|
|
@ -845,7 +847,7 @@ client_node_update(void *data,
|
|||
uint32_t max_input_ports,
|
||||
uint32_t max_output_ports,
|
||||
uint32_t n_params,
|
||||
const struct spa_pod_object **params)
|
||||
const struct spa_pod **params)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
struct proxy *this = &impl->proxy;
|
||||
|
|
@ -861,10 +863,10 @@ client_node_update(void *data,
|
|||
for (i = 0; i < this->n_params; i++)
|
||||
free(this->params[i]);
|
||||
this->n_params = n_params;
|
||||
this->params = realloc(this->params, this->n_params * sizeof(struct spa_pod_object *));
|
||||
this->params = realloc(this->params, this->n_params * sizeof(struct spa_pod *));
|
||||
|
||||
for (i = 0; i < this->n_params; i++)
|
||||
this->params[i] = spa_pod_object_copy(params[i]);
|
||||
this->params[i] = pw_spa_pod_copy(params[i]);
|
||||
}
|
||||
spa_log_info(this->log, "proxy %p: got node update max_in %u, max_out %u", this,
|
||||
this->max_inputs, this->max_outputs);
|
||||
|
|
@ -876,7 +878,7 @@ client_node_port_update(void *data,
|
|||
uint32_t port_id,
|
||||
uint32_t change_mask,
|
||||
uint32_t n_params,
|
||||
const struct spa_pod_object **params,
|
||||
const struct spa_pod **params,
|
||||
const struct spa_port_info *info)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ client_node_marshal_update(void *object,
|
|||
uint32_t max_input_ports,
|
||||
uint32_t max_output_ports,
|
||||
uint32_t n_params,
|
||||
const struct spa_pod_object **params)
|
||||
const struct spa_pod **params)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
|
@ -82,7 +82,7 @@ client_node_marshal_port_update(void *object,
|
|||
uint32_t port_id,
|
||||
uint32_t change_mask,
|
||||
uint32_t n_params,
|
||||
const struct spa_pod_object **params,
|
||||
const struct spa_pod **params,
|
||||
const struct spa_port_info *info)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
|
|
@ -188,7 +188,7 @@ static bool client_node_demarshal_set_param(void *object, void *data, size_t siz
|
|||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t seq, id, flags;
|
||||
const struct spa_pod_object *param = NULL;
|
||||
const struct spa_pod *param = NULL;
|
||||
|
||||
spa_pod_parser_init(&prs, data, size, 0);
|
||||
if (spa_pod_parser_get(&prs,
|
||||
|
|
@ -276,7 +276,7 @@ static bool client_node_demarshal_port_set_param(void *object, void *data, size_
|
|||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t seq, direction, port_id, id, flags;
|
||||
const struct spa_pod_object *param = NULL;
|
||||
const struct spa_pod *param = NULL;
|
||||
|
||||
spa_pod_parser_init(&prs, data, size, 0);
|
||||
if (spa_pod_parser_get(&prs,
|
||||
|
|
@ -432,7 +432,7 @@ static void client_node_marshal_transport(void *object, uint32_t node_id, int re
|
|||
|
||||
static void
|
||||
client_node_marshal_set_param(void *object, uint32_t seq, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
|
@ -514,7 +514,7 @@ client_node_marshal_port_set_param(void *object,
|
|||
uint32_t port_id,
|
||||
uint32_t id,
|
||||
uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
|
@ -652,7 +652,7 @@ static bool client_node_demarshal_update(void *object, void *data, size_t size)
|
|||
struct pw_resource *resource = object;
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t change_mask, max_input_ports, max_output_ports, n_params;
|
||||
const struct spa_pod_object **params;
|
||||
const struct spa_pod **params;
|
||||
int i;
|
||||
|
||||
spa_pod_parser_init(&prs, data, size, 0);
|
||||
|
|
@ -664,7 +664,7 @@ static bool client_node_demarshal_update(void *object, void *data, size_t size)
|
|||
"i", &n_params, NULL) < 0)
|
||||
return false;
|
||||
|
||||
params = alloca(n_params * sizeof(struct spa_pod_object *));
|
||||
params = alloca(n_params * sizeof(struct spa_pod *));
|
||||
for (i = 0; i < n_params; i++)
|
||||
if (spa_pod_parser_get(&prs, "O", ¶ms[i], NULL) < 0)
|
||||
return false;
|
||||
|
|
@ -682,7 +682,7 @@ static bool client_node_demarshal_port_update(void *object, void *data, size_t s
|
|||
struct pw_resource *resource = object;
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t i, direction, port_id, change_mask, n_params;
|
||||
const struct spa_pod_object **params = NULL;
|
||||
const struct spa_pod **params = NULL;
|
||||
struct spa_port_info info, *infop = NULL;
|
||||
struct spa_pod *ipod;
|
||||
|
||||
|
|
@ -695,7 +695,7 @@ static bool client_node_demarshal_port_update(void *object, void *data, size_t s
|
|||
"i", &n_params, NULL) < 0)
|
||||
return false;
|
||||
|
||||
params = alloca(n_params * sizeof(struct spa_pod_object *));
|
||||
params = alloca(n_params * sizeof(struct spa_pod *));
|
||||
for (i = 0; i < n_params; i++)
|
||||
if (spa_pod_parser_get(&prs, "O", ¶ms[i], NULL) < 0)
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -434,7 +434,7 @@ do_create_link(void *data,
|
|||
uint32_t output_port_id,
|
||||
uint32_t input_node_id,
|
||||
uint32_t input_port_id,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
const struct spa_dict *props,
|
||||
uint32_t new_id)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1297,6 +1297,7 @@ static bool on_global(void *data, struct pw_global *global)
|
|||
uint32_t index = 0;
|
||||
uint8_t buf[2048];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buf, sizeof(buf));
|
||||
struct spa_pod *props;
|
||||
|
||||
if (pw_global_get_type(global) != impl->t->node)
|
||||
return true;
|
||||
|
|
@ -1328,9 +1329,8 @@ static bool on_global(void *data, struct pw_global *global)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (spa_node_enum_params(node->node, SPA_ID_INVALID, &index, NULL, &b) == 1) {
|
||||
if (spa_node_enum_params(node->node, impl->t->param.idProps, &index, NULL, &props, &b) == 1) {
|
||||
int min_latency = -1;
|
||||
struct spa_pod_object *props = spa_pod_builder_deref(&b, 0);
|
||||
|
||||
spa_pod_object_parse(props,
|
||||
":", impl->prop_min_latency, "?i", &min_latency, NULL);
|
||||
|
|
|
|||
|
|
@ -125,7 +125,8 @@ struct port_data {
|
|||
|
||||
static int node_enum_params(struct spa_node *node,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
|
|
@ -133,7 +134,7 @@ static int node_enum_params(struct spa_node *node,
|
|||
|
||||
static int node_set_param(struct spa_node *node,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
|
@ -395,9 +396,9 @@ static int port_get_info(struct spa_node *node, enum spa_direction direction, ui
|
|||
static int port_enum_formats(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
struct spa_pod_builder *builder,
|
||||
struct spa_pod **param)
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct node_data *nd = SPA_CONTAINER_OF(node, struct node_data, node_impl);
|
||||
struct port_data *pd = nd->port_data[direction][port_id];
|
||||
|
|
@ -441,7 +442,8 @@ static int port_enum_formats(struct spa_node *node,
|
|||
static int port_enum_params(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct node_data *nd = SPA_CONTAINER_OF(node, struct node_data, node_impl);
|
||||
|
|
@ -454,11 +456,11 @@ static int port_enum_params(struct spa_node *node,
|
|||
|
||||
next:
|
||||
if (id == t->param.idEnumFormat) {
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, filter, builder, ¶m)) <= 0)
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, filter, ¶m, builder)) <= 0)
|
||||
return res;
|
||||
}
|
||||
else if (id == t->param.idFormat) {
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, filter, builder, ¶m)) <= 0)
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, filter, ¶m, builder)) <= 0)
|
||||
return res;
|
||||
}
|
||||
else
|
||||
|
|
@ -467,7 +469,7 @@ static int port_enum_params(struct spa_node *node,
|
|||
(*index)++;
|
||||
|
||||
spa_pod_builder_reset(builder, &state);
|
||||
if ((res = spa_pod_filter(builder, param, (struct spa_pod*)filter)) < 0)
|
||||
if ((res = spa_pod_filter(builder, result, param, filter)) < 0)
|
||||
goto next;
|
||||
|
||||
return 1;
|
||||
|
|
@ -476,7 +478,7 @@ static int port_enum_params(struct spa_node *node,
|
|||
static int port_set_param(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -515,7 +517,7 @@ static int port_use_buffers(struct spa_node *node, enum spa_direction direction,
|
|||
}
|
||||
|
||||
static int port_alloc_buffers(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
struct spa_pod_object **params, uint32_t n_params,
|
||||
struct spa_pod **params, uint32_t n_params,
|
||||
struct spa_buffer **buffers, uint32_t *n_buffers)
|
||||
{
|
||||
struct node_data *nd = SPA_CONTAINER_OF(node, struct node_data, node_impl);
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ core_marshal_create_link(void *object,
|
|||
uint32_t output_port_id,
|
||||
uint32_t input_node_id,
|
||||
uint32_t input_port_id,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
const struct spa_dict *props,
|
||||
uint32_t new_id)
|
||||
{
|
||||
|
|
@ -463,7 +463,7 @@ static bool core_demarshal_create_link(void *object, void *data, size_t size)
|
|||
struct spa_pod_parser prs;
|
||||
uint32_t new_id, i;
|
||||
uint32_t output_node_id, output_port_id, input_node_id, input_port_id;
|
||||
struct spa_pod_object *filter = NULL;
|
||||
struct spa_pod *filter = NULL;
|
||||
struct spa_dict props;
|
||||
|
||||
spa_pod_parser_init(&prs, data, size, 0);
|
||||
|
|
@ -751,7 +751,7 @@ static bool node_demarshal_info(void *object, void *data, size_t size)
|
|||
"i", &info.n_input_params, NULL) < 0)
|
||||
return false;
|
||||
|
||||
info.input_params = alloca(info.n_input_params * sizeof(struct spa_pod_object *));
|
||||
info.input_params = alloca(info.n_input_params * sizeof(struct spa_pod *));
|
||||
for (i = 0; i < info.n_input_params; i++)
|
||||
if (spa_pod_parser_get(&prs, "P", &info.input_params[i], NULL) < 0)
|
||||
return false;
|
||||
|
|
@ -762,7 +762,7 @@ static bool node_demarshal_info(void *object, void *data, size_t size)
|
|||
"i", &info.n_output_params, NULL) < 0)
|
||||
return false;
|
||||
|
||||
info.output_params = alloca(info.n_output_params * sizeof(struct spa_pod_object *));
|
||||
info.output_params = alloca(info.n_output_params * sizeof(struct spa_pod *));
|
||||
for (i = 0; i < info.n_output_params; i++)
|
||||
if (spa_pod_parser_get(&prs, "P", &info.output_params[i], NULL) < 0)
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ struct impl {
|
|||
struct spa_list item_list;
|
||||
};
|
||||
|
||||
static void add_item(struct pw_spa_monitor *this, struct spa_monitor_item *item)
|
||||
static void add_item(struct pw_spa_monitor *this, struct spa_pod *item)
|
||||
{
|
||||
struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
|
||||
int res;
|
||||
|
|
@ -72,7 +72,7 @@ static void add_item(struct pw_spa_monitor *this, struct spa_monitor_item *item)
|
|||
const struct spa_support *support;
|
||||
uint32_t n_support;
|
||||
|
||||
if (spa_pod_object_parse(&item->object,
|
||||
if (spa_pod_object_parse(item,
|
||||
":",t->monitor.name, "s", &name,
|
||||
":",t->monitor.id, "s", &id,
|
||||
":",t->monitor.klass, "s", &klass,
|
||||
|
|
@ -147,14 +147,14 @@ void destroy_item(struct monitor_item *mitem)
|
|||
free(mitem);
|
||||
}
|
||||
|
||||
static void remove_item(struct pw_spa_monitor *this, struct spa_monitor_item *item)
|
||||
static void remove_item(struct pw_spa_monitor *this, struct spa_pod *item)
|
||||
{
|
||||
struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
|
||||
struct monitor_item *mitem;
|
||||
const char *name, *id;
|
||||
struct pw_type *t = pw_core_get_type(impl->core);
|
||||
|
||||
if (spa_pod_object_parse(&item->object,
|
||||
if (spa_pod_object_parse(item,
|
||||
":",t->monitor.name, "s", &name,
|
||||
":",t->monitor.id, "s", &id, NULL) < 0)
|
||||
return;
|
||||
|
|
@ -172,16 +172,16 @@ static void on_monitor_event(void *data, struct spa_event *event)
|
|||
struct pw_type *t = pw_core_get_type(impl->core);
|
||||
|
||||
if (SPA_EVENT_TYPE(event) == t->monitor.Added) {
|
||||
struct spa_monitor_item *item = SPA_POD_CONTENTS(struct spa_event, event);
|
||||
struct spa_pod *item = SPA_POD_CONTENTS(struct spa_event, event);
|
||||
add_item(this, item);
|
||||
} else if (SPA_EVENT_TYPE(event) == t->monitor.Removed) {
|
||||
struct spa_monitor_item *item = SPA_POD_CONTENTS(struct spa_event, event);
|
||||
struct spa_pod *item = SPA_POD_CONTENTS(struct spa_event, event);
|
||||
remove_item(this, item);
|
||||
} else if (SPA_EVENT_TYPE(event) == t->monitor.Changed) {
|
||||
struct spa_monitor_item *item = SPA_POD_CONTENTS(struct spa_event, event);
|
||||
struct spa_pod *item = SPA_POD_CONTENTS(struct spa_event, event);
|
||||
const char *name;
|
||||
|
||||
if (spa_pod_object_parse(&item->object,
|
||||
if (spa_pod_object_parse(item,
|
||||
":",t->monitor.name, "s", &name, NULL) < 0)
|
||||
return;
|
||||
|
||||
|
|
@ -295,10 +295,12 @@ struct pw_spa_monitor *pw_spa_monitor_load(struct pw_core *core,
|
|||
spa_list_init(&impl->item_list);
|
||||
|
||||
for (index = 0;;) {
|
||||
struct spa_monitor_item *item;
|
||||
struct spa_pod *item;
|
||||
uint8_t buffer[4096];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
|
||||
int res;
|
||||
|
||||
if ((res = spa_monitor_enum_items(this->monitor, &item, &index)) <= 0) {
|
||||
if ((res = spa_monitor_enum_items(this->monitor, &index, &item, &b)) <= 0) {
|
||||
if (res != 0)
|
||||
pw_log_debug("spa_monitor_enum_items: %s\n", spa_strerror(res));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ static int
|
|||
setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_properties *pw_props)
|
||||
{
|
||||
int res;
|
||||
struct spa_pod_object *props;
|
||||
struct spa_pod *props;
|
||||
void *state = NULL;
|
||||
const char *key;
|
||||
struct pw_type *t = pw_core_get_type(core);
|
||||
|
|
@ -163,11 +163,10 @@ setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_propertie
|
|||
uint8_t buf[2048];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buf, sizeof(buf));
|
||||
|
||||
if ((res = spa_node_enum_params(spa_node, t->param.idProps, &index, NULL, &b)) <= 0) {
|
||||
if ((res = spa_node_enum_params(spa_node, t->param.idProps, &index, NULL, &props, &b)) <= 0) {
|
||||
pw_log_debug("spa_node_get_props failed: %d", res);
|
||||
return res;
|
||||
}
|
||||
props = spa_pod_builder_deref(&b, 0);
|
||||
|
||||
while ((key = pw_properties_iterate(pw_props, &state))) {
|
||||
struct spa_pod_prop *prop;
|
||||
|
|
@ -180,7 +179,7 @@ setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_propertie
|
|||
if (id == SPA_ID_INVALID)
|
||||
continue;
|
||||
|
||||
if ((prop = spa_pod_object_find_prop(props, id))) {
|
||||
if ((prop = spa_pod_find_prop(props, id))) {
|
||||
const char *value = pw_properties_get(pw_props, key);
|
||||
|
||||
pw_log_info("configure prop %s", key);
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ core_create_link(void *object,
|
|||
uint32_t output_port_id,
|
||||
uint32_t input_node_id,
|
||||
uint32_t input_port_id,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
const struct spa_dict *props,
|
||||
uint32_t new_id)
|
||||
{
|
||||
|
|
@ -625,7 +625,7 @@ struct pw_port *pw_core_find_port(struct pw_core *core,
|
|||
uint32_t id,
|
||||
struct pw_properties *props,
|
||||
uint32_t n_format_filters,
|
||||
struct spa_pod_object **format_filters,
|
||||
struct spa_pod **format_filters,
|
||||
char **error)
|
||||
{
|
||||
struct pw_port *best = NULL;
|
||||
|
|
@ -660,6 +660,7 @@ struct pw_port *pw_core_find_port(struct pw_core *core,
|
|||
struct pw_port *p, *pin, *pout;
|
||||
uint8_t buf[4096];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buf, sizeof(buf));
|
||||
struct spa_pod *dummy;
|
||||
|
||||
p = pw_node_get_free_port(n, pw_direction_reverse(other_port->direction));
|
||||
if (p == NULL)
|
||||
|
|
@ -679,6 +680,7 @@ struct pw_port *pw_core_find_port(struct pw_core *core,
|
|||
props,
|
||||
n_format_filters,
|
||||
format_filters,
|
||||
&dummy,
|
||||
&b,
|
||||
error) < 0) {
|
||||
free(*error);
|
||||
|
|
@ -714,7 +716,8 @@ int pw_core_find_format(struct pw_core *core,
|
|||
struct pw_port *input,
|
||||
struct pw_properties *props,
|
||||
uint32_t n_format_filters,
|
||||
struct spa_pod_object **format_filters,
|
||||
struct spa_pod **format_filters,
|
||||
struct spa_pod **format,
|
||||
struct spa_pod_builder *builder,
|
||||
char **error)
|
||||
{
|
||||
|
|
@ -739,7 +742,7 @@ int pw_core_find_format(struct pw_core *core,
|
|||
if ((res = spa_node_port_enum_params(output->node->node,
|
||||
output->direction, output->port_id,
|
||||
t->param.idFormat, &oidx,
|
||||
NULL, builder)) <= 0) {
|
||||
NULL, format, builder)) <= 0) {
|
||||
if (res == 0)
|
||||
res = -EBADF;
|
||||
asprintf(error, "error get output format: %s", spa_strerror(res));
|
||||
|
|
@ -750,7 +753,7 @@ int pw_core_find_format(struct pw_core *core,
|
|||
if ((res = spa_node_port_enum_params(input->node->node,
|
||||
input->direction, input->port_id,
|
||||
t->param.idFormat, &iidx,
|
||||
NULL, builder)) <= 0) {
|
||||
NULL, format, builder)) <= 0) {
|
||||
if (res == 0)
|
||||
res = -EBADF;
|
||||
asprintf(error, "error get input format: %s", spa_strerror(res));
|
||||
|
|
@ -759,7 +762,7 @@ int pw_core_find_format(struct pw_core *core,
|
|||
} else if (in_state == PW_PORT_STATE_CONFIGURE && out_state == PW_PORT_STATE_CONFIGURE) {
|
||||
struct spa_pod_builder fb = { 0 };
|
||||
uint8_t fbuf[4096];
|
||||
struct spa_pod_object *format;
|
||||
struct spa_pod *filter;
|
||||
again:
|
||||
/* both ports need a format */
|
||||
pw_log_debug("core %p: do enum input %d", core, iidx);
|
||||
|
|
@ -767,7 +770,7 @@ int pw_core_find_format(struct pw_core *core,
|
|||
if ((res = spa_node_port_enum_params(input->node->node,
|
||||
input->direction, input->port_id,
|
||||
t->param.idEnumFormat, &iidx,
|
||||
NULL, &fb)) <= 0) {
|
||||
NULL, &filter, &fb)) <= 0) {
|
||||
if (res == 0 && iidx == 0) {
|
||||
asprintf(error, "error input enum formats: %s", spa_strerror(res));
|
||||
goto error;
|
||||
|
|
@ -775,15 +778,14 @@ int pw_core_find_format(struct pw_core *core,
|
|||
asprintf(error, "no more input formats");
|
||||
goto error;
|
||||
}
|
||||
format = spa_pod_builder_deref(&fb, 0);
|
||||
pw_log_debug("enum output %d with filter: %p", oidx, format);
|
||||
pw_log_debug("enum output %d with filter: %p", oidx, filter);
|
||||
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
||||
spa_debug_pod(&format->pod, SPA_DEBUG_FLAG_FORMAT);
|
||||
spa_debug_pod(filter, SPA_DEBUG_FLAG_FORMAT);
|
||||
|
||||
if ((res = spa_node_port_enum_params(output->node->node,
|
||||
output->direction, output->port_id,
|
||||
t->param.idEnumFormat, &oidx,
|
||||
format, builder)) <= 0) {
|
||||
filter, format, builder)) <= 0) {
|
||||
if (res == 0) {
|
||||
oidx = 0;
|
||||
goto again;
|
||||
|
|
@ -791,11 +793,10 @@ int pw_core_find_format(struct pw_core *core,
|
|||
asprintf(error, "error output enum formats: %d", res);
|
||||
goto error;
|
||||
}
|
||||
format = spa_pod_builder_deref(builder, 0);
|
||||
|
||||
pw_log_debug("Got filtered:");
|
||||
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
||||
spa_debug_pod(&format->pod, SPA_DEBUG_FLAG_FORMAT);
|
||||
spa_debug_pod(*format, SPA_DEBUG_FLAG_FORMAT);
|
||||
} else {
|
||||
res = -EBADF;
|
||||
asprintf(error, "error node state");
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ struct pw_core_proxy_methods {
|
|||
uint32_t output_port_id,
|
||||
uint32_t input_node_id,
|
||||
uint32_t input_port_id,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
const struct spa_dict *props,
|
||||
uint32_t new_id);
|
||||
};
|
||||
|
|
@ -207,7 +207,7 @@ pw_core_proxy_create_link(struct pw_core_proxy *core,
|
|||
uint32_t output_port_id,
|
||||
uint32_t input_node_id,
|
||||
uint32_t input_port_id,
|
||||
const struct spa_pod_object *filter,
|
||||
const struct spa_pod *filter,
|
||||
const struct spa_dict *prop,
|
||||
size_t user_data_size)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -206,13 +206,13 @@ struct pw_node_info *pw_node_info_update(struct pw_node_info *info,
|
|||
if (info->n_input_params)
|
||||
info->input_params =
|
||||
realloc(info->input_params,
|
||||
info->n_input_params * sizeof(struct spa_pod_object *));
|
||||
info->n_input_params * sizeof(struct spa_pod *));
|
||||
else {
|
||||
free(info->input_params);
|
||||
info->input_params = NULL;
|
||||
}
|
||||
for (i = 0; i < info->n_input_params; i++) {
|
||||
info->input_params[i] = spa_pod_object_copy(update->input_params[i]);
|
||||
info->input_params[i] = pw_spa_pod_copy(update->input_params[i]);
|
||||
}
|
||||
}
|
||||
if (update->change_mask & PW_NODE_CHANGE_MASK_OUTPUT_PORTS) {
|
||||
|
|
@ -226,13 +226,13 @@ struct pw_node_info *pw_node_info_update(struct pw_node_info *info,
|
|||
if (info->n_output_params)
|
||||
info->output_params =
|
||||
realloc(info->output_params,
|
||||
info->n_output_params * sizeof(struct spa_pod_object *));
|
||||
info->n_output_params * sizeof(struct spa_pod *));
|
||||
else {
|
||||
free(info->output_params);
|
||||
info->output_params = NULL;
|
||||
}
|
||||
for (i = 0; i < info->n_output_params; i++) {
|
||||
info->output_params[i] = spa_pod_object_copy(update->output_params[i]);
|
||||
info->output_params[i] = pw_spa_pod_copy(update->output_params[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -414,7 +414,7 @@ struct pw_link_info *pw_link_info_update(struct pw_link_info *info,
|
|||
if (update->change_mask & PW_LINK_CHANGE_MASK_FORMAT) {
|
||||
if (info->format)
|
||||
free(info->format);
|
||||
info->format = spa_pod_object_copy(update->format);
|
||||
info->format = pw_spa_pod_copy(update->format);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,11 +153,11 @@ struct pw_node_info {
|
|||
uint32_t max_input_ports; /**< maximum number of inputs */
|
||||
uint32_t n_input_ports; /**< number of inputs */
|
||||
uint32_t n_input_params; /**< number of input params */
|
||||
struct spa_pod_object **input_params; /**< array of input params */
|
||||
struct spa_pod **input_params; /**< array of input params */
|
||||
uint32_t max_output_ports; /**< maximum number of outputs */
|
||||
uint32_t n_output_ports; /**< number of outputs */
|
||||
uint32_t n_output_params; /**< number of output params */
|
||||
struct spa_pod_object **output_params; /**< array of output params */
|
||||
struct spa_pod **output_params; /**< array of output params */
|
||||
enum pw_node_state state; /**< the current state of the node */
|
||||
const char *error; /**< an error reason if \a state is error */
|
||||
struct spa_dict *props; /**< the properties of the node */
|
||||
|
|
@ -200,7 +200,7 @@ struct pw_link_info {
|
|||
uint32_t output_port_id; /**< output port id */
|
||||
uint32_t input_node_id; /**< server side input node id */
|
||||
uint32_t input_port_id; /**< input port id */
|
||||
struct spa_pod_object *format; /**< format over link */
|
||||
struct spa_pod *format; /**< format over link */
|
||||
struct spa_dict *props; /**< the properties of the link */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ struct impl {
|
|||
|
||||
struct pw_work_queue *work;
|
||||
|
||||
struct spa_pod_object *format_filter;
|
||||
struct spa_pod *format_filter;
|
||||
struct pw_properties *properties;
|
||||
|
||||
struct spa_hook input_port_listener;
|
||||
|
|
@ -115,7 +115,7 @@ static int do_negotiate(struct pw_link *this, uint32_t in_state, uint32_t out_st
|
|||
{
|
||||
struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
|
||||
int res = -EIO, res2;
|
||||
struct spa_pod_object *format = NULL, *current;
|
||||
struct spa_pod *format = NULL, *current;
|
||||
char *error = NULL;
|
||||
struct pw_resource *resource;
|
||||
bool changed = true;
|
||||
|
|
@ -133,24 +133,23 @@ static int do_negotiate(struct pw_link *this, uint32_t in_state, uint32_t out_st
|
|||
input = this->input;
|
||||
output = this->output;
|
||||
|
||||
if ((res = pw_core_find_format(this->core, output, input, NULL, 0, NULL, &b, &error)) < 0)
|
||||
if ((res = pw_core_find_format(this->core, output, input, NULL, 0, NULL, &format, &b, &error)) < 0)
|
||||
goto error;
|
||||
|
||||
format = spa_pod_object_copy(spa_pod_builder_deref(&b, 0));
|
||||
spa_pod_object_fixate(format);
|
||||
format = pw_spa_pod_copy(format);
|
||||
spa_pod_fixate(format);
|
||||
|
||||
if (out_state > PW_PORT_STATE_CONFIGURE && output->node->info.state == PW_NODE_STATE_IDLE) {
|
||||
if ((res = spa_node_port_enum_params(output->node->node,
|
||||
output->direction, output->port_id,
|
||||
t->param.idFormat, &index,
|
||||
NULL, &b)) <= 0) {
|
||||
NULL, ¤t, &b)) <= 0) {
|
||||
if (res == 0)
|
||||
res = -EBADF;
|
||||
asprintf(&error, "error get output format: %s", spa_strerror(res));
|
||||
goto error;
|
||||
}
|
||||
current = spa_pod_builder_deref(&b, 0);
|
||||
if (spa_pod_compare((struct spa_pod*)current, (struct spa_pod*)format) != 0) {
|
||||
if (spa_pod_compare(current, format) != 0) {
|
||||
pw_log_debug("link %p: output format change, renegotiate", this);
|
||||
pw_node_set_state(output->node, PW_NODE_STATE_SUSPENDED);
|
||||
out_state = PW_PORT_STATE_CONFIGURE;
|
||||
|
|
@ -164,14 +163,13 @@ static int do_negotiate(struct pw_link *this, uint32_t in_state, uint32_t out_st
|
|||
if ((res = spa_node_port_enum_params(input->node->node,
|
||||
input->direction, input->port_id,
|
||||
t->param.idFormat, &index,
|
||||
NULL, &b)) <= 0) {
|
||||
NULL, ¤t, &b)) <= 0) {
|
||||
if (res == 0)
|
||||
res = -EBADF;
|
||||
asprintf(&error, "error get input format: %s", spa_strerror(res));
|
||||
goto error;
|
||||
}
|
||||
current = spa_pod_builder_deref(&b, 0);
|
||||
if (spa_pod_compare((struct spa_pod*)current, (struct spa_pod*)format) != 0) {
|
||||
if (spa_pod_compare(current, format) != 0) {
|
||||
pw_log_debug("link %p: input format change, renegotiate", this);
|
||||
pw_node_set_state(input->node, PW_NODE_STATE_SUSPENDED);
|
||||
in_state = PW_PORT_STATE_CONFIGURE;
|
||||
|
|
@ -184,7 +182,7 @@ static int do_negotiate(struct pw_link *this, uint32_t in_state, uint32_t out_st
|
|||
|
||||
pw_log_debug("link %p: doing set format %p", this, format);
|
||||
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
||||
spa_debug_pod(&format->pod, SPA_DEBUG_FLAG_FORMAT);
|
||||
spa_debug_pod(format, SPA_DEBUG_FLAG_FORMAT);
|
||||
|
||||
if (out_state == PW_PORT_STATE_CONFIGURE) {
|
||||
pw_log_debug("link %p: doing set format on output", this);
|
||||
|
|
@ -233,25 +231,24 @@ static int do_negotiate(struct pw_link *this, uint32_t in_state, uint32_t out_st
|
|||
return res;
|
||||
}
|
||||
|
||||
static struct spa_pod_object *find_param(struct spa_pod_object **params, int n_params, uint32_t type)
|
||||
static struct spa_pod *find_param(struct spa_pod **params, int n_params, uint32_t type)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < n_params; i++) {
|
||||
if (spa_pod_is_object_type(¶ms[i]->pod, type))
|
||||
if (spa_pod_is_object_type(params[i], type))
|
||||
return params[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct spa_pod_object *find_meta(struct pw_core *core, struct spa_pod_object **params,
|
||||
static struct spa_pod *find_meta(struct pw_core *core, struct spa_pod **params,
|
||||
int n_params, uint32_t type)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < n_params; i++) {
|
||||
if (spa_pod_is_object_type
|
||||
(¶ms[i]->pod, core->type.param_meta.Meta)) {
|
||||
if (spa_pod_is_object_type (params[i], core->type.param_meta.Meta)) {
|
||||
uint32_t qtype;
|
||||
|
||||
if (spa_pod_object_parse(params[i],
|
||||
|
|
@ -268,7 +265,7 @@ static struct spa_pod_object *find_meta(struct pw_core *core, struct spa_pod_obj
|
|||
static struct spa_buffer **alloc_buffers(struct pw_link *this,
|
||||
uint32_t n_buffers,
|
||||
uint32_t n_params,
|
||||
struct spa_pod_object **params,
|
||||
struct spa_pod **params,
|
||||
uint32_t n_datas,
|
||||
size_t *data_sizes,
|
||||
ssize_t *data_strides,
|
||||
|
|
@ -298,8 +295,7 @@ static struct spa_buffer **alloc_buffers(struct pw_link *this,
|
|||
|
||||
/* collect metadata */
|
||||
for (i = 0; i < n_params; i++) {
|
||||
if (spa_pod_is_object_type
|
||||
(¶ms[i]->pod, this->core->type.param_meta.Meta)) {
|
||||
if (spa_pod_is_object_type (params[i], this->core->type.param_meta.Meta)) {
|
||||
uint32_t type, size;
|
||||
|
||||
if (spa_pod_object_parse(params[i],
|
||||
|
|
@ -405,35 +401,29 @@ param_filter(struct pw_link *this,
|
|||
{
|
||||
uint8_t ibuf[4096];
|
||||
struct spa_pod_builder ib = { 0 };
|
||||
struct spa_pod_object *oparam, *iparam;
|
||||
struct spa_pod *oparam, *iparam;
|
||||
uint32_t iidx, oidx, num = 0;
|
||||
|
||||
for (iidx = 0;;) {
|
||||
spa_pod_builder_init(&ib, ibuf, sizeof(ibuf));
|
||||
pw_log_debug("iparam %d", iidx);
|
||||
if (spa_node_port_enum_params(in_port->node->node, in_port->direction, in_port->port_id,
|
||||
id, &iidx, NULL, &ib) <= 0)
|
||||
id, &iidx, NULL, &iparam, &ib) <= 0)
|
||||
break;
|
||||
iparam = spa_pod_builder_deref(&ib, 0);
|
||||
|
||||
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
||||
spa_debug_pod(&iparam->pod, 0);
|
||||
spa_debug_pod(iparam, 0);
|
||||
|
||||
for (oidx = 0;;) {
|
||||
uint32_t offset;
|
||||
|
||||
offset = result->state.offset;
|
||||
|
||||
pw_log_debug("oparam %d %d", oidx, offset);
|
||||
pw_log_debug("oparam %d", oidx);
|
||||
if (spa_node_port_enum_params(out_port->node->node, out_port->direction,
|
||||
out_port->port_id, id, &oidx,
|
||||
iparam, result) <= 0) {
|
||||
iparam, &oparam, result) <= 0) {
|
||||
break;
|
||||
}
|
||||
oparam = spa_pod_builder_deref(result, offset);
|
||||
|
||||
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
||||
spa_debug_pod(&oparam->pod, 0);
|
||||
spa_debug_pod(oparam, 0);
|
||||
|
||||
num++;
|
||||
}
|
||||
|
|
@ -520,7 +510,7 @@ static int do_allocation(struct pw_link *this, uint32_t in_state, uint32_t out_s
|
|||
}
|
||||
|
||||
if (this->buffers == NULL) {
|
||||
struct spa_pod_object **params, *param;
|
||||
struct spa_pod **params, *param;
|
||||
uint8_t buffer[4096];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
|
||||
int i, offset, n_params;
|
||||
|
|
@ -530,13 +520,13 @@ static int do_allocation(struct pw_link *this, uint32_t in_state, uint32_t out_s
|
|||
n_params = param_filter(this, input, output, t->param.idBuffers, &b);
|
||||
n_params += param_filter(this, input, output, t->param.idMeta, &b);
|
||||
|
||||
params = alloca(n_params * sizeof(struct spa_pod_object *));
|
||||
params = alloca(n_params * sizeof(struct spa_pod *));
|
||||
for (i = 0, offset = 0; i < n_params; i++) {
|
||||
params[i] = SPA_MEMBER(buffer, offset, struct spa_pod_object);
|
||||
spa_pod_object_fixate(params[i]);
|
||||
params[i] = SPA_MEMBER(buffer, offset, struct spa_pod);
|
||||
spa_pod_fixate(params[i]);
|
||||
pw_log_debug("fixated param %d:", i);
|
||||
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
||||
spa_debug_pod(¶ms[i]->pod, 0);
|
||||
spa_debug_pod(params[i], 0);
|
||||
offset += SPA_ROUND_UP_N(SPA_POD_SIZE(params[i]), 8);
|
||||
}
|
||||
|
||||
|
|
@ -1064,7 +1054,7 @@ static const struct pw_node_events output_node_events = {
|
|||
struct pw_link *pw_link_new(struct pw_core *core,
|
||||
struct pw_port *output,
|
||||
struct pw_port *input,
|
||||
struct spa_pod_object *format_filter,
|
||||
struct spa_pod *format_filter,
|
||||
struct pw_properties *properties,
|
||||
char **error,
|
||||
size_t user_data_size)
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ struct pw_link *
|
|||
pw_link_new(struct pw_core *core, /**< the core object */
|
||||
struct pw_port *output, /**< an output port */
|
||||
struct pw_port *input, /**< an input port */
|
||||
struct spa_pod_object *format_filter, /**< an optional format filter */
|
||||
struct spa_pod *format_filter, /**< an optional format filter */
|
||||
struct pw_properties *properties /**< extra properties */,
|
||||
char **error, /**< error string when result is NULL */
|
||||
size_t user_data_size /**< extra user data size */);
|
||||
|
|
|
|||
|
|
@ -231,20 +231,19 @@ update_info(struct pw_node *this)
|
|||
uint32_t state = 0;
|
||||
|
||||
for (this->info.n_input_params = 0;; this->info.n_input_params++) {
|
||||
struct spa_pod_object *fmt;
|
||||
struct spa_pod *fmt;
|
||||
|
||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||
if (spa_node_port_enum_params(port->node->node,
|
||||
port->direction, port->port_id,
|
||||
this->core->type.param.idEnumFormat, &state,
|
||||
NULL, &b) <= 0)
|
||||
NULL, &fmt, &b) <= 0)
|
||||
break;
|
||||
fmt = spa_pod_builder_deref(&b, 0);
|
||||
|
||||
this->info.input_params =
|
||||
realloc(this->info.input_params,
|
||||
sizeof(struct spa_pod_object *) * (this->info.n_input_params + 1));
|
||||
this->info.input_params[this->info.n_input_params] = spa_pod_object_copy(fmt);
|
||||
sizeof(struct spa_pod *) * (this->info.n_input_params + 1));
|
||||
this->info.input_params[this->info.n_input_params] = pw_spa_pod_copy(fmt);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -254,20 +253,19 @@ update_info(struct pw_node *this)
|
|||
uint32_t state = 0;
|
||||
|
||||
for (this->info.n_output_params = 0;; this->info.n_output_params++) {
|
||||
struct spa_pod_object *fmt;
|
||||
struct spa_pod *fmt;
|
||||
|
||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||
if (spa_node_port_enum_params(port->node->node,
|
||||
port->direction, port->port_id,
|
||||
this->core->type.param.idEnumFormat, &state,
|
||||
NULL, &b) <= 0)
|
||||
NULL, &fmt, &b) <= 0)
|
||||
break;
|
||||
fmt = spa_pod_builder_deref(&b, 0);
|
||||
|
||||
this->info.output_params =
|
||||
realloc(this->info.output_params,
|
||||
sizeof(struct spa_pod_object *) * (this->info.n_output_params + 1));
|
||||
this->info.output_params[this->info.n_output_params] = spa_pod_object_copy(fmt);
|
||||
sizeof(struct spa_pod *) * (this->info.n_output_params + 1));
|
||||
this->info.output_params[this->info.n_output_params] = pw_spa_pod_copy(fmt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -365,7 +365,7 @@ do_port_pause(struct spa_loop *loop,
|
|||
}
|
||||
|
||||
int pw_port_set_param(struct pw_port *port, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
int res;
|
||||
|
||||
|
|
@ -426,7 +426,7 @@ int pw_port_use_buffers(struct pw_port *port, struct spa_buffer **buffers, uint3
|
|||
}
|
||||
|
||||
int pw_port_alloc_buffers(struct pw_port *port,
|
||||
struct spa_pod_object **params, uint32_t n_params,
|
||||
struct spa_pod **params, uint32_t n_params,
|
||||
struct spa_buffer **buffers, uint32_t *n_buffers)
|
||||
{
|
||||
int res;
|
||||
|
|
|
|||
|
|
@ -395,7 +395,8 @@ int pw_core_find_format(struct pw_core *core,
|
|||
struct pw_port *input,
|
||||
struct pw_properties *props,
|
||||
uint32_t n_format_filters,
|
||||
struct spa_pod_object **format_filters,
|
||||
struct spa_pod **format_filters,
|
||||
struct spa_pod **format,
|
||||
struct spa_pod_builder *builder,
|
||||
char **error);
|
||||
|
||||
|
|
@ -406,7 +407,7 @@ pw_core_find_port(struct pw_core *core,
|
|||
uint32_t id,
|
||||
struct pw_properties *props,
|
||||
uint32_t n_format_filters,
|
||||
struct spa_pod_object **format_filters,
|
||||
struct spa_pod **format_filters,
|
||||
char **error);
|
||||
|
||||
/** Create a new port \memberof pw_port
|
||||
|
|
@ -428,14 +429,14 @@ void pw_port_destroy(struct pw_port *port);
|
|||
|
||||
/** Set a param on a port \memberof pw_port */
|
||||
int pw_port_set_param(struct pw_port *port, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param);
|
||||
const struct spa_pod *param);
|
||||
|
||||
/** Use buffers on a port \memberof pw_port */
|
||||
int pw_port_use_buffers(struct pw_port *port, struct spa_buffer **buffers, uint32_t n_buffers);
|
||||
|
||||
/** Allocate memory for buffers on a port \memberof pw_port */
|
||||
int pw_port_alloc_buffers(struct pw_port *port,
|
||||
struct spa_pod_object **params, uint32_t n_params,
|
||||
struct spa_pod **params, uint32_t n_params,
|
||||
struct spa_buffer **buffers, uint32_t *n_buffers);
|
||||
|
||||
/** Change the state of the node */
|
||||
|
|
|
|||
|
|
@ -643,7 +643,7 @@ static void add_port_update(struct pw_proxy *proxy, struct pw_port *port, uint32
|
|||
const struct spa_port_info *port_info = NULL;
|
||||
struct spa_port_info pi;
|
||||
uint32_t n_params = 0;
|
||||
struct spa_pod_object **params = NULL;
|
||||
struct spa_pod **params = NULL;
|
||||
|
||||
if (change_mask & PW_CLIENT_NODE_PORT_UPDATE_PARAMS) {
|
||||
uint32_t idx1, idx2, id;
|
||||
|
|
@ -651,15 +651,14 @@ static void add_port_update(struct pw_proxy *proxy, struct pw_port *port, uint32
|
|||
struct spa_pod_builder b = { 0 };
|
||||
|
||||
for (idx1 = 0;;) {
|
||||
struct spa_pod_object *param;
|
||||
struct spa_pod *param;
|
||||
|
||||
spa_pod_builder_init(&b, buf, sizeof(buf));
|
||||
if (spa_node_port_enum_params(port->node->node,
|
||||
port->direction, port->port_id,
|
||||
data->t->param.idList, &idx1,
|
||||
NULL, &b) <= 0)
|
||||
NULL, ¶m, &b) <= 0)
|
||||
break;
|
||||
param = spa_pod_builder_deref(&b, 0);
|
||||
|
||||
spa_pod_object_parse(param,
|
||||
":", data->t->param.listId, "I", &id, NULL);
|
||||
|
|
@ -669,12 +668,11 @@ static void add_port_update(struct pw_proxy *proxy, struct pw_port *port, uint32
|
|||
if (spa_node_port_enum_params(port->node->node,
|
||||
port->direction, port->port_id,
|
||||
id, &idx2,
|
||||
NULL, &b) <= 0)
|
||||
NULL, ¶m, &b) <= 0)
|
||||
break;
|
||||
param = spa_pod_builder_deref(&b, 0);
|
||||
|
||||
params = realloc(params, sizeof(struct spa_pod_object *) * (n_params + 1));
|
||||
params[n_params] = spa_pod_object_copy(param);
|
||||
params = realloc(params, sizeof(struct spa_pod *) * (n_params + 1));
|
||||
params[n_params] = pw_spa_pod_copy(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -689,7 +687,7 @@ static void add_port_update(struct pw_proxy *proxy, struct pw_port *port, uint32
|
|||
port->port_id,
|
||||
change_mask,
|
||||
n_params,
|
||||
(const struct spa_pod_object **)params,
|
||||
(const struct spa_pod **)params,
|
||||
&pi);
|
||||
if (params) {
|
||||
while (n_params > 0)
|
||||
|
|
@ -700,7 +698,7 @@ static void add_port_update(struct pw_proxy *proxy, struct pw_port *port, uint32
|
|||
|
||||
static void
|
||||
client_node_set_param(void *object, uint32_t seq, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
pw_log_warn("set param not implemented");
|
||||
}
|
||||
|
|
@ -806,7 +804,7 @@ client_node_port_set_param(void *object,
|
|||
uint32_t seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct node_data *data = proxy->user_data;
|
||||
|
|
|
|||
|
|
@ -65,12 +65,12 @@ struct stream {
|
|||
uint32_t type_client_node;
|
||||
|
||||
uint32_t n_init_params;
|
||||
struct spa_pod_object **init_params;
|
||||
struct spa_pod **init_params;
|
||||
|
||||
uint32_t n_params;
|
||||
struct spa_pod_object **params;
|
||||
struct spa_pod **params;
|
||||
|
||||
struct spa_pod_object *format;
|
||||
struct spa_pod *format;
|
||||
|
||||
struct spa_port_info port_info;
|
||||
enum spa_direction direction;
|
||||
|
|
@ -309,7 +309,7 @@ static void unhandle_socket(struct pw_stream *stream)
|
|||
static void
|
||||
set_init_params(struct pw_stream *stream,
|
||||
int n_init_params,
|
||||
const struct spa_pod_object **init_params)
|
||||
const struct spa_pod **init_params)
|
||||
{
|
||||
struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this);
|
||||
int i;
|
||||
|
|
@ -322,13 +322,13 @@ set_init_params(struct pw_stream *stream,
|
|||
}
|
||||
impl->n_init_params = n_init_params;
|
||||
if (n_init_params > 0) {
|
||||
impl->init_params = malloc(n_init_params * sizeof(struct spa_pod_object *));
|
||||
impl->init_params = malloc(n_init_params * sizeof(struct spa_pod *));
|
||||
for (i = 0; i < n_init_params; i++)
|
||||
impl->init_params[i] = spa_pod_object_copy(init_params[i]);
|
||||
impl->init_params[i] = pw_spa_pod_copy(init_params[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void set_params(struct pw_stream *stream, int n_params, struct spa_pod_object **params)
|
||||
static void set_params(struct pw_stream *stream, int n_params, struct spa_pod **params)
|
||||
{
|
||||
struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this);
|
||||
int i;
|
||||
|
|
@ -341,9 +341,9 @@ static void set_params(struct pw_stream *stream, int n_params, struct spa_pod_ob
|
|||
}
|
||||
impl->n_params = n_params;
|
||||
if (n_params > 0) {
|
||||
impl->params = malloc(n_params * sizeof(struct spa_pod_object *));
|
||||
impl->params = malloc(n_params * sizeof(struct spa_pod *));
|
||||
for (i = 0; i < n_params; i++)
|
||||
impl->params[i] = spa_pod_object_copy(params[i]);
|
||||
impl->params[i] = pw_spa_pod_copy(params[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -405,18 +405,18 @@ static void add_port_update(struct pw_stream *stream, uint32_t change_mask)
|
|||
{
|
||||
struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this);
|
||||
uint32_t n_params;
|
||||
struct spa_pod_object **params;
|
||||
struct spa_pod **params;
|
||||
int i, j;
|
||||
|
||||
n_params = impl->n_params + impl->n_init_params;
|
||||
if (impl->format)
|
||||
n_params += 1;
|
||||
|
||||
params = alloca(n_params * sizeof(struct spa_pod_object *));
|
||||
params = alloca(n_params * sizeof(struct spa_pod *));
|
||||
|
||||
j = 0;
|
||||
for (i = 0; i < impl->n_init_params; i++)
|
||||
params[j++] = (struct spa_pod_object *)impl->init_params[i];
|
||||
params[j++] = impl->init_params[i];
|
||||
if (impl->format)
|
||||
params[j++] = impl->format;
|
||||
for (i = 0; i < impl->n_params; i++)
|
||||
|
|
@ -427,7 +427,7 @@ static void add_port_update(struct pw_stream *stream, uint32_t change_mask)
|
|||
impl->port_id,
|
||||
change_mask,
|
||||
n_params,
|
||||
(const struct spa_pod_object **) params,
|
||||
(const struct spa_pod **) params,
|
||||
&impl->port_info);
|
||||
}
|
||||
|
||||
|
|
@ -659,7 +659,7 @@ static void handle_socket(struct pw_stream *stream, int rtreadfd, int rtwritefd)
|
|||
|
||||
static void
|
||||
client_node_set_param(void *data, uint32_t seq, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
pw_log_warn("set param not implemented");
|
||||
}
|
||||
|
|
@ -746,7 +746,7 @@ client_node_port_set_param(void *data,
|
|||
uint32_t seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct stream *impl = data;
|
||||
struct pw_stream *stream = &impl->this;
|
||||
|
|
@ -757,9 +757,10 @@ client_node_port_set_param(void *data,
|
|||
|
||||
if (impl->format)
|
||||
free(impl->format);
|
||||
if (param) {
|
||||
impl->format = spa_pod_object_copy(param);
|
||||
impl->format->body.id = id;
|
||||
|
||||
if (spa_pod_is_object_type(param, t->spa_format)) {
|
||||
impl->format = pw_spa_pod_copy(param);
|
||||
((struct spa_pod_object*)impl->format)->body.id = id;
|
||||
}
|
||||
else
|
||||
impl->format = NULL;
|
||||
|
|
@ -988,7 +989,7 @@ pw_stream_connect(struct pw_stream *stream,
|
|||
const char *port_path,
|
||||
enum pw_stream_flags flags,
|
||||
uint32_t n_params,
|
||||
const struct spa_pod_object **params)
|
||||
const struct spa_pod **params)
|
||||
{
|
||||
struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this);
|
||||
|
||||
|
|
@ -1034,7 +1035,7 @@ void
|
|||
pw_stream_finish_format(struct pw_stream *stream,
|
||||
int res,
|
||||
uint32_t n_params,
|
||||
struct spa_pod_object **params)
|
||||
struct spa_pod **params)
|
||||
{
|
||||
struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this);
|
||||
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ struct pw_stream_events {
|
|||
/** when the format changed. The listener should call
|
||||
* pw_stream_finish_format() from within this callback or later to complete
|
||||
* the format negotiation and start the buffer negotiation. */
|
||||
void (*format_changed) (void *data, struct spa_pod_object *format);
|
||||
void (*format_changed) (void *data, struct spa_pod *format);
|
||||
|
||||
/** when a new buffer was created for this stream */
|
||||
void (*add_buffer) (void *data, uint32_t id);
|
||||
|
|
@ -265,7 +265,7 @@ pw_stream_connect(struct pw_stream *stream, /**< a \ref pw_stream */
|
|||
* to let the server choose a port */
|
||||
enum pw_stream_flags flags, /**< stream flags */
|
||||
uint32_t n_params, /**< number of items in \a params */
|
||||
const struct spa_pod_object **params /**< an array with params. The params
|
||||
const struct spa_pod **params /**< an array with params. The params
|
||||
* should ideally contain supported
|
||||
* formats. */);
|
||||
|
||||
|
|
@ -287,7 +287,7 @@ void
|
|||
pw_stream_finish_format(struct pw_stream *stream, /**< a \ref pw_stream */
|
||||
int res, /**< a result code */
|
||||
uint32_t n_params, /**< number of elements in \a params */
|
||||
struct spa_pod_object **params /**< an array of params. The params should
|
||||
struct spa_pod **params /**< an array of params. The params should
|
||||
* ideally contain parameters for doing
|
||||
* buffer allocation. */);
|
||||
|
||||
|
|
|
|||
|
|
@ -54,12 +54,6 @@ pw_spa_pod_copy(const struct spa_pod *pod)
|
|||
return pod ? memcpy(malloc(SPA_POD_SIZE(pod)), pod, SPA_POD_SIZE(pod)) : NULL;
|
||||
}
|
||||
|
||||
static inline struct spa_pod_object *
|
||||
spa_pod_object_copy(const struct spa_pod_object *pod)
|
||||
{
|
||||
return (struct spa_pod_object*) pw_spa_pod_copy(&pod->pod);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -533,18 +533,18 @@ static void info_node(struct proxy_data *pd)
|
|||
fprintf(stdout, "%c\tinput params:\n", MARK_CHANGE(2));
|
||||
for (i = 0; i < info->n_input_params; i++) {
|
||||
uint32_t flags = 0;
|
||||
if (info->input_params[i]->body.type == t->spa_format)
|
||||
if (spa_pod_is_object_type(info->input_params[i], t->spa_format))
|
||||
flags |= SPA_DEBUG_FLAG_FORMAT;
|
||||
spa_debug_pod(&info->input_params[i]->pod, flags);
|
||||
spa_debug_pod(info->input_params[i], flags);
|
||||
}
|
||||
|
||||
fprintf(stdout, "%c\toutput ports: %u/%u\n", MARK_CHANGE(3), info->n_output_ports, info->max_output_ports);
|
||||
fprintf(stdout, "%c\toutput params:\n", MARK_CHANGE(4));
|
||||
for (i = 0; i < info->n_output_params; i++) {
|
||||
uint32_t flags = 0;
|
||||
if (info->output_params[i]->body.type == t->spa_format)
|
||||
if (spa_pod_is_object_type(info->output_params[i], t->spa_format))
|
||||
flags |= SPA_DEBUG_FLAG_FORMAT;
|
||||
spa_debug_pod(&info->output_params[i]->pod, flags);
|
||||
spa_debug_pod(info->output_params[i], flags);
|
||||
}
|
||||
fprintf(stdout, "%c\tstate: \"%s\"", MARK_CHANGE(5), pw_node_state_as_string(info->state));
|
||||
if (info->state == PW_NODE_STATE_ERROR && info->error)
|
||||
|
|
@ -587,7 +587,7 @@ static void info_link(struct proxy_data *pd)
|
|||
fprintf(stdout, "%c\tinput-port-id: %u\n", MARK_CHANGE(1), info->input_port_id);
|
||||
fprintf(stdout, "%c\tformat:\n", MARK_CHANGE(2));
|
||||
if (info->format)
|
||||
spa_debug_pod(&info->format->pod, SPA_DEBUG_FLAG_FORMAT);
|
||||
spa_debug_pod(info->format, SPA_DEBUG_FLAG_FORMAT);
|
||||
else
|
||||
fprintf(stdout, "\t\tnone\n");
|
||||
print_properties(info->props, MARK_CHANGE(3));
|
||||
|
|
|
|||
|
|
@ -156,18 +156,18 @@ static void node_event_info(void *object, struct pw_node_info *info)
|
|||
printf("%c\tinput params:\n", MARK_CHANGE(2));
|
||||
for (i = 0; i < info->n_input_params; i++) {
|
||||
uint32_t flags = 0;
|
||||
if (info->input_params[i]->body.type == t->spa_format)
|
||||
if (spa_pod_is_object_type(info->input_params[i], t->spa_format))
|
||||
flags |= SPA_DEBUG_FLAG_FORMAT;
|
||||
spa_debug_pod(&info->input_params[i]->pod, flags);
|
||||
spa_debug_pod(info->input_params[i], flags);
|
||||
}
|
||||
|
||||
printf("%c\toutput ports: %u/%u\n", MARK_CHANGE(3), info->n_output_ports, info->max_output_ports);
|
||||
printf("%c\toutput params:\n", MARK_CHANGE(4));
|
||||
for (i = 0; i < info->n_output_params; i++) {
|
||||
uint32_t flags = 0;
|
||||
if (info->output_params[i]->body.type == t->spa_format)
|
||||
if (spa_pod_is_object_type(info->output_params[i], t->spa_format))
|
||||
flags |= SPA_DEBUG_FLAG_FORMAT;
|
||||
spa_debug_pod(&info->output_params[i]->pod, flags);
|
||||
spa_debug_pod(info->output_params[i], flags);
|
||||
}
|
||||
|
||||
printf("%c\tstate: \"%s\"", MARK_CHANGE(5), pw_node_state_as_string(info->state));
|
||||
|
|
@ -283,7 +283,7 @@ static void link_event_info(void *object, struct pw_link_info *info)
|
|||
printf("%c\tinput-port-id: %u\n", MARK_CHANGE(1), info->input_port_id);
|
||||
printf("%c\tformat:\n", MARK_CHANGE(2));
|
||||
if (info->format)
|
||||
spa_debug_pod(&info->format->pod, SPA_DEBUG_FLAG_FORMAT);
|
||||
spa_debug_pod(info->format, SPA_DEBUG_FLAG_FORMAT);
|
||||
else
|
||||
printf("\t\tnone\n");
|
||||
print_properties(info->props, MARK_CHANGE(3));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue