mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-24 07:00:05 -05:00
Rework serialization
Move serialization to the protocol, we now just send blocks of bytes over the connection and let the protocol deserialize them.
This commit is contained in:
parent
842d73ca4b
commit
41399b0b25
26 changed files with 1617 additions and 2501 deletions
|
|
@ -314,8 +314,8 @@ do_update_port (SpaProxy *this,
|
|||
uint32_t port_id,
|
||||
uint32_t change_mask,
|
||||
unsigned int n_possible_formats,
|
||||
SpaFormat **possible_formats,
|
||||
SpaFormat *format,
|
||||
const SpaFormat **possible_formats,
|
||||
const SpaFormat *format,
|
||||
const SpaProps *props,
|
||||
const SpaPortInfo *info)
|
||||
{
|
||||
|
|
@ -340,15 +340,13 @@ do_update_port (SpaProxy *this,
|
|||
port->formats = NULL;
|
||||
}
|
||||
for (i = 0; i < port->n_formats; i++) {
|
||||
size = pinos_serialize_format_get_size (possible_formats[i]);
|
||||
port->formats[i] = size ? pinos_serialize_format_copy_into (malloc (size), possible_formats[i]) : NULL;
|
||||
port->formats[i] = spa_format_copy (possible_formats[i]);
|
||||
}
|
||||
}
|
||||
if (change_mask & PINOS_MESSAGE_PORT_UPDATE_FORMAT) {
|
||||
if (port->format)
|
||||
free (port->format);
|
||||
size = pinos_serialize_format_get_size (format);
|
||||
port->format = size ? pinos_serialize_format_copy_into (malloc (size), format) : NULL;
|
||||
port->format = spa_format_copy (format);
|
||||
}
|
||||
|
||||
if (change_mask & PINOS_MESSAGE_PORT_UPDATE_PROPS) {
|
||||
|
|
@ -912,8 +910,8 @@ client_node_port_update (void *object,
|
|||
uint32_t port_id,
|
||||
uint32_t change_mask,
|
||||
unsigned int n_possible_formats,
|
||||
SpaFormat **possible_formats,
|
||||
SpaFormat *format,
|
||||
const SpaFormat **possible_formats,
|
||||
const SpaFormat *format,
|
||||
const SpaProps *props,
|
||||
const SpaPortInfo *info)
|
||||
{
|
||||
|
|
@ -961,8 +959,8 @@ client_node_state_change (void *object,
|
|||
}
|
||||
|
||||
static void
|
||||
client_node_event (void *object,
|
||||
SpaNodeEvent *event)
|
||||
client_node_event (void *object,
|
||||
SpaNodeEvent *event)
|
||||
{
|
||||
PinosResource *resource = object;
|
||||
PinosClientNode *node = resource->object;
|
||||
|
|
|
|||
|
|
@ -54,10 +54,6 @@ void pinos_client_node_destroy (PinosClientNode *node);
|
|||
|
||||
SpaResult pinos_client_node_get_data_socket (PinosClientNode *node, int *fd);
|
||||
|
||||
SpaResult pinos_client_node_dispatch_message (PinosClientNode *node,
|
||||
PinosMessageType type,
|
||||
void *message);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include "pinos/client/pinos.h"
|
||||
#include "pinos/client/interfaces.h"
|
||||
#include "pinos/client/serialize.h"
|
||||
|
||||
#include "pinos/server/node.h"
|
||||
#include "pinos/server/data-loop.h"
|
||||
|
|
@ -404,7 +403,6 @@ node_bind_func (PinosGlobal *global,
|
|||
info.input_formats = NULL;
|
||||
for (info.n_input_formats = 0; ; info.n_input_formats++) {
|
||||
SpaFormat *fmt;
|
||||
void *p;
|
||||
|
||||
if (spa_node_port_enum_formats (this->node,
|
||||
SPA_DIRECTION_INPUT,
|
||||
|
|
@ -415,16 +413,13 @@ node_bind_func (PinosGlobal *global,
|
|||
break;
|
||||
|
||||
info.input_formats = realloc (info.input_formats, sizeof (SpaFormat*) * (info.n_input_formats + 1));
|
||||
|
||||
p = malloc (pinos_serialize_format_get_size (fmt));
|
||||
info.input_formats[info.n_input_formats] = pinos_serialize_format_copy_into (p, fmt);
|
||||
info.input_formats[info.n_input_formats] = spa_format_copy (fmt);
|
||||
}
|
||||
info.max_outputs = this->transport->area->max_outputs;
|
||||
info.n_outputs = this->transport->area->n_outputs;
|
||||
info.output_formats = NULL;
|
||||
for (info.n_output_formats = 0; ; info.n_output_formats++) {
|
||||
SpaFormat *fmt;
|
||||
void *p;
|
||||
|
||||
if (spa_node_port_enum_formats (this->node,
|
||||
SPA_DIRECTION_OUTPUT,
|
||||
|
|
@ -435,9 +430,7 @@ node_bind_func (PinosGlobal *global,
|
|||
break;
|
||||
|
||||
info.output_formats = realloc (info.output_formats, sizeof (SpaFormat*) * (info.n_output_formats + 1));
|
||||
|
||||
p = malloc (pinos_serialize_format_get_size (fmt));
|
||||
info.output_formats[info.n_output_formats] = pinos_serialize_format_copy_into (p, fmt);
|
||||
info.output_formats[info.n_output_formats] = spa_format_copy (fmt);
|
||||
}
|
||||
info.state = this->state;
|
||||
info.error = this->error;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "pinos/client/pinos.h"
|
||||
|
||||
typedef void (*PinosMarshallFunc) (void *object, void *data, size_t size);
|
||||
typedef void (*PinosDemarshalFunc) (void *object, void *data, size_t size);
|
||||
|
||||
extern const PinosCoreEvent pinos_protocol_native_server_core_event;
|
||||
extern const PinosRegistryEvent pinos_protocol_native_server_registry_event;
|
||||
|
|
@ -29,6 +29,6 @@ extern const PinosClientEvent pinos_protocol_native_server_client_event;
|
|||
extern const PinosClientNodeEvent pinos_protocol_native_server_client_node_events;
|
||||
extern const PinosLinkEvent pinos_protocol_native_server_link_event;
|
||||
|
||||
extern const PinosMarshallFunc pinos_protocol_native_server_core_marshall[];
|
||||
extern const PinosMarshallFunc pinos_protocol_native_server_registry_marshall[];
|
||||
extern const PinosMarshallFunc pinos_protocol_native_server_client_node_marshall[];
|
||||
extern const PinosDemarshalFunc pinos_protocol_native_server_core_demarshal[];
|
||||
extern const PinosDemarshalFunc pinos_protocol_native_server_registry_demarshal[];
|
||||
extern const PinosDemarshalFunc pinos_protocol_native_server_client_node_demarshal[];
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ struct _PinosResource {
|
|||
|
||||
const void *interface;
|
||||
const void *event;
|
||||
const void *marshall;
|
||||
const void *demarshal;
|
||||
|
||||
PINOS_SIGNAL (destroy_signal, (PinosListener *listener,
|
||||
PinosResource *resource));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue