mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-11 13:30:07 -05:00
Use types with known sizes where we can, easier to serialize
Add iterator for POD and use it to implement some demarshalling.
This commit is contained in:
parent
23d09d5b60
commit
f92b68c3c3
77 changed files with 839 additions and 695 deletions
|
|
@ -72,11 +72,11 @@ typedef struct {
|
|||
bool valid;
|
||||
SpaPortInfo *info;
|
||||
SpaFormat *format;
|
||||
unsigned int n_formats;
|
||||
uint32_t n_formats;
|
||||
SpaFormat **formats;
|
||||
void *io;
|
||||
|
||||
unsigned int n_buffers;
|
||||
uint32_t n_buffers;
|
||||
ProxyBuffer buffers[MAX_BUFFERS];
|
||||
|
||||
uint32_t buffer_mem_id;
|
||||
|
|
@ -101,10 +101,10 @@ struct _SpaProxy
|
|||
|
||||
SpaSource data_source;
|
||||
|
||||
unsigned int max_inputs;
|
||||
unsigned int n_inputs;
|
||||
unsigned int max_outputs;
|
||||
unsigned int n_outputs;
|
||||
uint32_t max_inputs;
|
||||
uint32_t n_inputs;
|
||||
uint32_t max_outputs;
|
||||
uint32_t n_outputs;
|
||||
SpaProxyPort in_ports[MAX_INPUTS];
|
||||
SpaProxyPort out_ports[MAX_OUTPUTS];
|
||||
|
||||
|
|
@ -254,10 +254,10 @@ spa_proxy_node_set_event_callback (SpaNode *node,
|
|||
|
||||
static SpaResult
|
||||
spa_proxy_node_get_n_ports (SpaNode *node,
|
||||
unsigned int *n_input_ports,
|
||||
unsigned int *max_input_ports,
|
||||
unsigned int *n_output_ports,
|
||||
unsigned int *max_output_ports)
|
||||
uint32_t *n_input_ports,
|
||||
uint32_t *max_input_ports,
|
||||
uint32_t *n_output_ports,
|
||||
uint32_t *max_output_ports)
|
||||
{
|
||||
SpaProxy *this;
|
||||
|
||||
|
|
@ -280,9 +280,9 @@ spa_proxy_node_get_n_ports (SpaNode *node,
|
|||
|
||||
static SpaResult
|
||||
spa_proxy_node_get_port_ids (SpaNode *node,
|
||||
unsigned int n_input_ports,
|
||||
uint32_t n_input_ports,
|
||||
uint32_t *input_ids,
|
||||
unsigned int n_output_ports,
|
||||
uint32_t n_output_ports,
|
||||
uint32_t *output_ids)
|
||||
{
|
||||
SpaProxy *this;
|
||||
|
|
@ -313,14 +313,14 @@ do_update_port (SpaProxy *this,
|
|||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t change_mask,
|
||||
unsigned int n_possible_formats,
|
||||
uint32_t n_possible_formats,
|
||||
const SpaFormat **possible_formats,
|
||||
const SpaFormat *format,
|
||||
const SpaProps *props,
|
||||
const SpaPortInfo *info)
|
||||
{
|
||||
SpaProxyPort *port;
|
||||
unsigned int i;
|
||||
uint32_t i;
|
||||
size_t size;
|
||||
|
||||
if (direction == SPA_DIRECTION_INPUT) {
|
||||
|
|
@ -459,7 +459,7 @@ spa_proxy_node_port_enum_formats (SpaNode *node,
|
|||
uint32_t port_id,
|
||||
SpaFormat **format,
|
||||
const SpaFormat *filter,
|
||||
unsigned int index)
|
||||
uint32_t index)
|
||||
{
|
||||
SpaProxy *this;
|
||||
SpaProxyPort *port;
|
||||
|
|
@ -630,7 +630,7 @@ spa_proxy_node_port_use_buffers (SpaNode *node,
|
|||
{
|
||||
SpaProxy *this;
|
||||
SpaProxyPort *port;
|
||||
unsigned int i, j;
|
||||
uint32_t i, j;
|
||||
size_t n_mem;
|
||||
PinosClientNodeBuffer *mb;
|
||||
SpaMetaShared *msh;
|
||||
|
|
@ -886,8 +886,8 @@ handle_node_event (SpaProxy *this,
|
|||
static void
|
||||
client_node_update (void *object,
|
||||
uint32_t change_mask,
|
||||
unsigned int max_input_ports,
|
||||
unsigned int max_output_ports,
|
||||
uint32_t max_input_ports,
|
||||
uint32_t max_output_ports,
|
||||
const SpaProps *props)
|
||||
{
|
||||
PinosResource *resource = object;
|
||||
|
|
@ -909,7 +909,7 @@ client_node_port_update (void *object,
|
|||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t change_mask,
|
||||
unsigned int n_possible_formats,
|
||||
uint32_t n_possible_formats,
|
||||
const SpaFormat **possible_formats,
|
||||
const SpaFormat *format,
|
||||
const SpaProps *props,
|
||||
|
|
@ -1044,9 +1044,9 @@ static SpaResult
|
|||
proxy_init (SpaProxy *this,
|
||||
SpaDict *info,
|
||||
const SpaSupport *support,
|
||||
unsigned int n_support)
|
||||
uint32_t n_support)
|
||||
{
|
||||
unsigned int i;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
if (strcmp (support[i].uri, SPA_LOG_URI) == 0)
|
||||
|
|
@ -1114,7 +1114,7 @@ on_global_added (PinosListener *listener,
|
|||
static SpaResult
|
||||
proxy_clear (SpaProxy *this)
|
||||
{
|
||||
unsigned int i;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < MAX_INPUTS; i++) {
|
||||
if (this->in_ports[i].valid)
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ pinos_client_update_properties (PinosClient *client,
|
|||
if (dict)
|
||||
client->properties = pinos_properties_new_dict (dict);
|
||||
} else {
|
||||
unsigned int i;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < dict->n_items; i++)
|
||||
pinos_properties_set (client->properties,
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@ pinos_core_update_properties (PinosCore *core,
|
|||
if (dict)
|
||||
core->properties = pinos_properties_new_dict (dict);
|
||||
} else if (dict != &core->properties->dict) {
|
||||
unsigned int i;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < dict->n_items; i++)
|
||||
pinos_properties_set (core->properties,
|
||||
|
|
@ -456,7 +456,7 @@ pinos_core_find_port (PinosCore *core,
|
|||
PinosPort *other_port,
|
||||
uint32_t id,
|
||||
PinosProperties *props,
|
||||
unsigned int n_format_filters,
|
||||
uint32_t n_format_filters,
|
||||
SpaFormat **format_filters,
|
||||
char **error)
|
||||
{
|
||||
|
|
@ -520,14 +520,14 @@ pinos_core_find_format (PinosCore *core,
|
|||
PinosPort *output,
|
||||
PinosPort *input,
|
||||
PinosProperties *props,
|
||||
unsigned int n_format_filters,
|
||||
uint32_t n_format_filters,
|
||||
SpaFormat **format_filterss,
|
||||
char **error)
|
||||
{
|
||||
SpaNodeState out_state, in_state;
|
||||
SpaResult res;
|
||||
SpaFormat *filter = NULL, *format;
|
||||
unsigned int iidx = 0, oidx = 0;
|
||||
uint32_t iidx = 0, oidx = 0;
|
||||
|
||||
out_state = output->node->node->state;
|
||||
in_state = input->node->node->state;
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ struct _PinosCore {
|
|||
PinosDataLoop *data_loop;
|
||||
|
||||
SpaSupport *support;
|
||||
unsigned int n_support;
|
||||
uint32_t n_support;
|
||||
|
||||
PINOS_SIGNAL (destroy_signal, (PinosListener *listener,
|
||||
PinosCore *core));
|
||||
|
|
@ -122,7 +122,7 @@ SpaFormat * pinos_core_find_format (PinosCore *core,
|
|||
PinosPort *output,
|
||||
PinosPort *input,
|
||||
PinosProperties *props,
|
||||
unsigned int n_format_filters,
|
||||
uint32_t n_format_filters,
|
||||
SpaFormat **format_filters,
|
||||
char **error);
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ PinosPort * pinos_core_find_port (PinosCore *core,
|
|||
PinosPort *other_port,
|
||||
uint32_t id,
|
||||
PinosProperties *props,
|
||||
unsigned int n_format_filters,
|
||||
uint32_t n_format_filters,
|
||||
SpaFormat **format_filters,
|
||||
char **error);
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ typedef struct
|
|||
bool allocated;
|
||||
PinosMemblock buffer_mem;
|
||||
SpaBuffer **buffers;
|
||||
unsigned int n_buffers;
|
||||
uint32_t n_buffers;
|
||||
} PinosLinkImpl;
|
||||
|
||||
static void
|
||||
|
|
@ -142,7 +142,7 @@ error:
|
|||
static void *
|
||||
find_param (const SpaPortInfo *info, SpaAllocParamType type)
|
||||
{
|
||||
unsigned int i;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < info->n_params; i++) {
|
||||
if (info->params[i]->type == type)
|
||||
|
|
@ -154,7 +154,7 @@ find_param (const SpaPortInfo *info, SpaAllocParamType type)
|
|||
static void *
|
||||
find_meta_enable (const SpaPortInfo *info, SpaMetaType type)
|
||||
{
|
||||
unsigned int i;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < info->n_params; i++) {
|
||||
if (info->params[i]->type == SPA_ALLOC_PARAM_TYPE_META_ENABLE &&
|
||||
|
|
@ -167,20 +167,20 @@ find_meta_enable (const SpaPortInfo *info, SpaMetaType type)
|
|||
|
||||
static SpaBuffer **
|
||||
alloc_buffers (PinosLink *this,
|
||||
unsigned int n_buffers,
|
||||
unsigned int n_params,
|
||||
uint32_t n_buffers,
|
||||
uint32_t n_params,
|
||||
SpaAllocParam **params,
|
||||
unsigned int n_datas,
|
||||
uint32_t n_datas,
|
||||
size_t *data_sizes,
|
||||
ssize_t *data_strides,
|
||||
PinosMemblock *mem)
|
||||
{
|
||||
SpaBuffer **buffers, *bp;
|
||||
unsigned int i;
|
||||
uint32_t i;
|
||||
size_t skel_size, data_size, meta_size;
|
||||
SpaChunk *cdp;
|
||||
void *ddp;
|
||||
unsigned int n_metas;
|
||||
uint32_t n_metas;
|
||||
SpaMeta *metas;
|
||||
|
||||
n_metas = data_size = meta_size = 0;
|
||||
|
|
@ -382,7 +382,7 @@ do_allocation (PinosLink *this, SpaNodeState in_state, SpaNodeState out_state)
|
|||
if (impl->buffers == NULL) {
|
||||
SpaAllocParamBuffers *in_alloc, *out_alloc;
|
||||
SpaAllocParamMetaEnableRingbuffer *in_me, *out_me;
|
||||
unsigned int max_buffers;
|
||||
uint32_t max_buffers;
|
||||
size_t minsize, stride, blocks;
|
||||
|
||||
in_me = find_meta_enable (iinfo, SPA_META_TYPE_RINGBUFFER);
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ struct _PinosLink {
|
|||
PinosPort *port));
|
||||
|
||||
struct {
|
||||
unsigned int in_ready;
|
||||
uint32_t in_ready;
|
||||
PinosPort *input;
|
||||
PinosPort *output;
|
||||
SpaList input_link;
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ update_port_ids (PinosNode *node, bool create)
|
|||
{
|
||||
PinosNodeImpl *impl = SPA_CONTAINER_OF (node, PinosNodeImpl, this);
|
||||
uint32_t *input_port_ids, *output_port_ids;
|
||||
unsigned int n_input_ports, n_output_ports, max_input_ports, max_output_ports;
|
||||
unsigned int i;
|
||||
uint32_t n_input_ports, n_output_ports, max_input_ports, max_output_ports;
|
||||
uint32_t i;
|
||||
SpaList *ports;
|
||||
|
||||
if (node->node == NULL)
|
||||
|
|
@ -524,7 +524,7 @@ pinos_node_new (PinosCore *core,
|
|||
spa_list_init (&this->output_ports);
|
||||
|
||||
if (this->node->info) {
|
||||
unsigned int i;
|
||||
uint32_t i;
|
||||
|
||||
if (this->properties == NULL)
|
||||
this->properties = pinos_properties_new (NULL, NULL);
|
||||
|
|
@ -681,7 +681,7 @@ PinosPort *
|
|||
pinos_node_get_free_port (PinosNode *node,
|
||||
PinosDirection direction)
|
||||
{
|
||||
unsigned int n_ports, max_ports;
|
||||
uint32_t n_ports, max_ports;
|
||||
SpaList *ports;
|
||||
PinosPort *port = NULL, *p;
|
||||
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@ struct _PinosNode {
|
|||
PinosPort **input_port_map;
|
||||
PinosPort **output_port_map;
|
||||
|
||||
unsigned int n_used_output_links;
|
||||
unsigned int n_used_input_links;
|
||||
uint32_t n_used_output_links;
|
||||
uint32_t n_used_input_links;
|
||||
|
||||
PinosTransport *transport;
|
||||
PINOS_SIGNAL (transport_changed, (PinosListener *listener,
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ struct _PinosPort {
|
|||
bool allocated;
|
||||
PinosMemblock buffer_mem;
|
||||
SpaBuffer **buffers;
|
||||
unsigned int n_buffers;
|
||||
uint32_t n_buffers;
|
||||
|
||||
SpaList links;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ typedef struct {
|
|||
PinosConnection *connection;
|
||||
} Builder;
|
||||
|
||||
static off_t
|
||||
write_pod (SpaPODBuilder *b, off_t ref, const void *data, size_t size)
|
||||
static uint32_t
|
||||
write_pod (SpaPODBuilder *b, uint32_t ref, const void *data, uint32_t size)
|
||||
{
|
||||
if (ref == -1)
|
||||
ref = b->offset;
|
||||
|
|
@ -512,7 +512,7 @@ static void
|
|||
client_node_marshal_set_property (void *object,
|
||||
uint32_t seq,
|
||||
uint32_t id,
|
||||
size_t size,
|
||||
uint32_t size,
|
||||
const void *value)
|
||||
{
|
||||
PinosResource *resource = object;
|
||||
|
|
@ -537,8 +537,8 @@ client_node_marshal_add_mem (void *object,
|
|||
SpaDataType type,
|
||||
int memfd,
|
||||
uint32_t flags,
|
||||
off_t offset,
|
||||
size_t size)
|
||||
uint32_t offset,
|
||||
uint32_t size)
|
||||
{
|
||||
PinosResource *resource = object;
|
||||
PinosConnection *connection = resource->client->protocol_private;
|
||||
|
|
@ -564,7 +564,7 @@ client_node_marshal_use_buffers (void *object,
|
|||
uint32_t seq,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
unsigned int n_buffers,
|
||||
uint32_t n_buffers,
|
||||
PinosClientNodeBuffer *buffers)
|
||||
{
|
||||
PinosResource *resource = object;
|
||||
|
|
@ -645,8 +645,8 @@ client_node_marshal_port_command (void *object,
|
|||
static void
|
||||
client_node_marshal_transport (void *object,
|
||||
int memfd,
|
||||
off_t offset,
|
||||
size_t size)
|
||||
uint32_t offset,
|
||||
uint32_t size)
|
||||
{
|
||||
PinosResource *resource = object;
|
||||
PinosConnection *connection = resource->client->protocol_private;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue