reorganize some struct members to remove holes

This commit is contained in:
Wim Taymans 2019-02-08 12:01:50 +01:00
parent 658c1da52f
commit f45e0b8966
27 changed files with 533 additions and 539 deletions

View file

@ -919,12 +919,12 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_client_node_
static const struct pw_protocol_marshal pw_protocol_native_client_node_marshal = {
PW_TYPE_INTERFACE_ClientNode,
PW_VERSION_CLIENT_NODE,
PW_CLIENT_NODE_PROXY_METHOD_NUM,
PW_CLIENT_NODE_PROXY_EVENT_NUM,
&pw_protocol_native_client_node_method_marshal,
&pw_protocol_native_client_node_method_demarshal,
PW_CLIENT_NODE_PROXY_METHOD_NUM,
&pw_protocol_native_client_node_event_marshal,
pw_protocol_native_client_node_event_demarshal,
PW_CLIENT_NODE_PROXY_EVENT_NUM,
};
struct pw_protocol *pw_protocol_native_ext_client_node_init(struct pw_core *core)

View file

@ -1500,12 +1500,12 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_core_event_d
static const struct pw_protocol_marshal pw_protocol_native_core_marshal = {
PW_TYPE_INTERFACE_Core,
PW_VERSION_CORE,
PW_CORE_PROXY_METHOD_NUM,
PW_CORE_PROXY_EVENT_NUM,
&pw_protocol_native_core_method_marshal,
pw_protocol_native_core_method_demarshal,
PW_CORE_PROXY_METHOD_NUM,
&pw_protocol_native_core_event_marshal,
pw_protocol_native_core_event_demarshal,
PW_CORE_PROXY_EVENT_NUM
};
static const struct pw_registry_proxy_methods pw_protocol_native_registry_method_marshal = {
@ -1533,12 +1533,12 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_registry_eve
const struct pw_protocol_marshal pw_protocol_native_registry_marshal = {
PW_TYPE_INTERFACE_Registry,
PW_VERSION_REGISTRY,
PW_REGISTRY_PROXY_METHOD_NUM,
PW_REGISTRY_PROXY_EVENT_NUM,
&pw_protocol_native_registry_method_marshal,
pw_protocol_native_registry_method_demarshal,
PW_REGISTRY_PROXY_METHOD_NUM,
&pw_protocol_native_registry_event_marshal,
pw_protocol_native_registry_event_demarshal,
PW_REGISTRY_PROXY_EVENT_NUM,
};
static const struct pw_module_proxy_events pw_protocol_native_module_event_marshal = {
@ -1553,10 +1553,11 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_module_event
const struct pw_protocol_marshal pw_protocol_native_module_marshal = {
PW_TYPE_INTERFACE_Module,
PW_VERSION_MODULE,
NULL, NULL, 0,
0,
PW_MODULE_PROXY_EVENT_NUM,
NULL, NULL,
&pw_protocol_native_module_event_marshal,
pw_protocol_native_module_event_demarshal,
PW_MODULE_PROXY_EVENT_NUM,
};
static const struct pw_factory_proxy_events pw_protocol_native_factory_event_marshal = {
@ -1571,10 +1572,11 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_factory_even
const struct pw_protocol_marshal pw_protocol_native_factory_marshal = {
PW_TYPE_INTERFACE_Factory,
PW_VERSION_FACTORY,
NULL, NULL, 0,
0,
PW_FACTORY_PROXY_EVENT_NUM,
NULL, NULL,
&pw_protocol_native_factory_event_marshal,
pw_protocol_native_factory_event_demarshal,
PW_FACTORY_PROXY_EVENT_NUM,
};
static const struct pw_device_proxy_methods pw_protocol_native_device_method_marshal = {
@ -1602,12 +1604,12 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_device_event
static const struct pw_protocol_marshal pw_protocol_native_device_marshal = {
PW_TYPE_INTERFACE_Device,
PW_VERSION_DEVICE,
PW_DEVICE_PROXY_METHOD_NUM,
PW_DEVICE_PROXY_EVENT_NUM,
&pw_protocol_native_device_method_marshal,
pw_protocol_native_device_method_demarshal,
PW_DEVICE_PROXY_METHOD_NUM,
&pw_protocol_native_device_event_marshal,
pw_protocol_native_device_event_demarshal,
PW_DEVICE_PROXY_EVENT_NUM,
};
static const struct pw_node_proxy_methods pw_protocol_native_node_method_marshal = {
@ -1637,12 +1639,12 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_node_event_d
static const struct pw_protocol_marshal pw_protocol_native_node_marshal = {
PW_TYPE_INTERFACE_Node,
PW_VERSION_NODE,
PW_NODE_PROXY_METHOD_NUM,
PW_NODE_PROXY_EVENT_NUM,
&pw_protocol_native_node_method_marshal,
pw_protocol_native_node_method_demarshal,
PW_NODE_PROXY_METHOD_NUM,
&pw_protocol_native_node_event_marshal,
pw_protocol_native_node_event_demarshal,
PW_NODE_PROXY_EVENT_NUM,
};
@ -1669,12 +1671,12 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_port_event_d
static const struct pw_protocol_marshal pw_protocol_native_port_marshal = {
PW_TYPE_INTERFACE_Port,
PW_VERSION_PORT,
PW_PORT_PROXY_METHOD_NUM,
PW_PORT_PROXY_EVENT_NUM,
&pw_protocol_native_port_method_marshal,
pw_protocol_native_port_method_demarshal,
PW_PORT_PROXY_METHOD_NUM,
&pw_protocol_native_port_event_marshal,
pw_protocol_native_port_event_demarshal,
PW_PORT_PROXY_EVENT_NUM,
};
static const struct pw_client_proxy_methods pw_protocol_native_client_method_marshal = {
@ -1706,12 +1708,12 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_client_event
static const struct pw_protocol_marshal pw_protocol_native_client_marshal = {
PW_TYPE_INTERFACE_Client,
PW_VERSION_CLIENT,
PW_CLIENT_PROXY_METHOD_NUM,
PW_CLIENT_PROXY_EVENT_NUM,
&pw_protocol_native_client_method_marshal,
pw_protocol_native_client_method_demarshal,
PW_CLIENT_PROXY_METHOD_NUM,
&pw_protocol_native_client_event_marshal,
pw_protocol_native_client_event_demarshal,
PW_CLIENT_PROXY_EVENT_NUM,
};
static const struct pw_link_proxy_events pw_protocol_native_link_event_marshal = {
@ -1726,10 +1728,11 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_link_event_d
static const struct pw_protocol_marshal pw_protocol_native_link_marshal = {
PW_TYPE_INTERFACE_Link,
PW_VERSION_LINK,
NULL, NULL, 0,
0,
PW_LINK_PROXY_EVENT_NUM,
NULL, NULL,
&pw_protocol_native_link_event_marshal,
pw_protocol_native_link_event_demarshal,
PW_LINK_PROXY_EVENT_NUM,
};
void pw_protocol_native_init(struct pw_protocol *protocol)

View file

@ -136,6 +136,7 @@ struct pw_core_info *pw_core_info_update(struct pw_core_info *info,
return NULL;
}
info->id = update->id;
info->cookie = update->cookie;
info->change_mask = update->change_mask;
if (update->change_mask & PW_CORE_CHANGE_MASK_USER_NAME) {
@ -154,8 +155,6 @@ struct pw_core_info *pw_core_info_update(struct pw_core_info *info,
free((void *) info->name);
info->name = update->name ? strdup(update->name) : NULL;
}
if (update->change_mask & PW_CORE_CHANGE_MASK_COOKIE)
info->cookie = update->cookie;
if (update->change_mask & PW_CORE_CHANGE_MASK_PROPS) {
if (info->props)
pw_spa_dict_destroy(info->props);

View file

@ -80,19 +80,18 @@ const char * pw_link_state_as_string(enum pw_link_state state);
/** The core information. Extra information can be added in later versions \memberof pw_introspect */
struct pw_core_info {
uint32_t id; /**< id of the global */
uint32_t cookie; /**< a random cookie for identifying this instance of PipeWire */
#define PW_CORE_CHANGE_MASK_USER_NAME (1 << 0)
#define PW_CORE_CHANGE_MASK_HOST_NAME (1 << 1)
#define PW_CORE_CHANGE_MASK_VERSION (1 << 2)
#define PW_CORE_CHANGE_MASK_NAME (1 << 3)
#define PW_CORE_CHANGE_MASK_COOKIE (1 << 4)
#define PW_CORE_CHANGE_MASK_PROPS (1 << 5)
#define PW_CORE_CHANGE_MASK_PROPS (1 << 4)
#define PW_CORE_CHANGE_MASK_ALL (~0)
uint64_t change_mask; /**< bitfield of changed fields since last call */
const char *user_name; /**< name of the user that started the core */
const char *host_name; /**< name of the machine the core is running on */
const char *version; /**< version of the core */
const char *name; /**< name of the core */
uint32_t cookie; /**< a random cookie for identifying this instance of PipeWire */
struct spa_dict *props; /**< extra properties */
};

View file

@ -43,29 +43,29 @@
#define MAX_SUPPORT 32
struct plugin {
int ref;
struct spa_list link;
char *filename;
void *hnd;
spa_handle_factory_enum_func_t enum_func;
struct spa_list handles;
int ref;
};
struct handle {
int ref;
struct spa_list link;
struct plugin *plugin;
const char *factory_name;
struct spa_handle *handle;
struct spa_list interfaces;
int ref;
};
struct interface {
int ref;
struct spa_list link;
struct handle *handle;
uint32_t type;
void *iface;
uint32_t type;
int ref;
};
struct registry {
@ -77,8 +77,8 @@ struct support {
const char *plugin_dir;
struct plugin *support_plugin;
struct spa_support support[MAX_SUPPORT];
uint32_t n_support;
struct registry *registry;
uint32_t n_support;
};
static struct registry global_registry;
@ -634,18 +634,18 @@ const char* pw_get_library_version(void)
}
static const struct spa_type_info type_info[] = {
{ PW_TYPE_INTERFACE_Core, PW_TYPE_INFO_INTERFACE_BASE "Core", SPA_TYPE_Pointer, NULL },
{ PW_TYPE_INTERFACE_Registry, PW_TYPE_INFO_INTERFACE_BASE "Registry", SPA_TYPE_Pointer, NULL },
{ PW_TYPE_INTERFACE_Node, PW_TYPE_INFO_INTERFACE_BASE "Node", SPA_TYPE_Pointer, NULL },
{ PW_TYPE_INTERFACE_Port, PW_TYPE_INFO_INTERFACE_BASE "Port", SPA_TYPE_Pointer, NULL },
{ PW_TYPE_INTERFACE_Factory, PW_TYPE_INFO_INTERFACE_BASE "Factory", SPA_TYPE_Pointer, NULL },
{ PW_TYPE_INTERFACE_Link, PW_TYPE_INFO_INTERFACE_BASE "Link", SPA_TYPE_Pointer, NULL },
{ PW_TYPE_INTERFACE_Client, PW_TYPE_INFO_INTERFACE_BASE "Client", SPA_TYPE_Pointer, NULL },
{ PW_TYPE_INTERFACE_Module, PW_TYPE_INFO_INTERFACE_BASE "Module", SPA_TYPE_Pointer, NULL },
{ PW_TYPE_INTERFACE_ClientNode, PW_TYPE_INFO_INTERFACE_BASE "ClientNode", SPA_TYPE_Pointer, NULL },
{ PW_TYPE_INTERFACE_Device, PW_TYPE_INFO_INTERFACE_BASE "Device", SPA_TYPE_Pointer, NULL },
{ SPA_ID_INVALID, "spa_types", SPA_ID_INVALID, spa_types },
{ 0, NULL, 0, NULL },
{ PW_TYPE_INTERFACE_Core, SPA_TYPE_Pointer, PW_TYPE_INFO_INTERFACE_BASE "Core", NULL },
{ PW_TYPE_INTERFACE_Registry, SPA_TYPE_Pointer, PW_TYPE_INFO_INTERFACE_BASE "Registry", NULL },
{ PW_TYPE_INTERFACE_Node, SPA_TYPE_Pointer, PW_TYPE_INFO_INTERFACE_BASE "Node", NULL },
{ PW_TYPE_INTERFACE_Port, SPA_TYPE_Pointer, PW_TYPE_INFO_INTERFACE_BASE "Port", NULL },
{ PW_TYPE_INTERFACE_Factory, SPA_TYPE_Pointer, PW_TYPE_INFO_INTERFACE_BASE "Factory", NULL },
{ PW_TYPE_INTERFACE_Link, SPA_TYPE_Pointer, PW_TYPE_INFO_INTERFACE_BASE "Link", NULL },
{ PW_TYPE_INTERFACE_Client, SPA_TYPE_Pointer, PW_TYPE_INFO_INTERFACE_BASE "Client", NULL },
{ PW_TYPE_INTERFACE_Module, SPA_TYPE_Pointer, PW_TYPE_INFO_INTERFACE_BASE "Module", NULL },
{ PW_TYPE_INTERFACE_ClientNode, SPA_TYPE_Pointer, PW_TYPE_INFO_INTERFACE_BASE "ClientNode", NULL },
{ PW_TYPE_INTERFACE_Device, SPA_TYPE_Pointer, PW_TYPE_INFO_INTERFACE_BASE "Device", NULL },
{ SPA_ID_INVALID, SPA_ID_INVALID, "spa_types", spa_types },
{ 0, 0, NULL, NULL },
};
SPA_EXPORT

View file

@ -53,10 +53,10 @@ typedef int (*pw_command_func_t) (struct pw_command *command, struct pw_core *co
/** \cond */
struct pw_command {
uint32_t id; /**< id of command */
struct spa_list link; /**< link in list of commands */
pw_command_func_t func;
char **args;
uint32_t id; /**< id of command */
int n_args;
};
@ -100,7 +100,6 @@ struct pw_client {
struct spa_list link; /**< link in core object client list */
struct pw_global *global; /**< global object created for this client */
struct spa_hook global_listener;
bool registered;
pw_permission_func_t permission_func; /**< get permissions of an object */
void *permission_data; /**< data passed to permission function */
@ -108,21 +107,22 @@ struct pw_client {
struct pw_properties *properties; /**< Client properties */
struct pw_client_info info; /**< client info */
bool ucred_valid; /**< if the ucred member is valid */
struct ucred ucred; /**< ucred information */
struct pw_resource *core_resource; /**< core resource object */
struct pw_map objects; /**< list of resource objects */
bool busy;
struct spa_hook_list listener_list;
struct pw_protocol *protocol; /**< protocol in use */
struct spa_list protocol_link; /**< link in the protocol client_list */
void *user_data; /**< extra user data */
struct ucred ucred; /**< ucred information */
int registered:1;
int ucred_valid:1; /**< if the ucred member is valid */
int busy:1;
};
#define pw_global_events_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_global_events, m, v, ##__VA_ARGS__)
@ -210,8 +210,8 @@ struct pw_data_loop {
struct spa_source *event;
bool running;
pthread_t thread;
int running:1;
};
#define pw_main_loop_events_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_main_loop_events, m, v, ##__VA_ARGS__)
@ -223,7 +223,7 @@ struct pw_main_loop {
struct spa_hook_list listener_list;
struct spa_source *event;
bool running;
int running:1;
};
struct allocation {
@ -258,7 +258,6 @@ struct pw_device {
struct spa_list link; /**< link in the core device_list */
struct pw_global *global; /**< global object for this device */
struct spa_hook global_listener;
bool registered;
struct pw_properties *properties; /**< properties of the device */
struct pw_device_info info; /**< introspectable device info */
@ -269,6 +268,8 @@ struct pw_device {
struct spa_list node_list;
void *user_data; /**< device user_data */
int registered:1;
};
#define pw_module_events_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_module_events, m, v, ##__VA_ARGS__)
@ -327,21 +328,23 @@ struct pw_node {
struct spa_list link; /**< link in core node_list */
struct pw_global *global; /**< global for this node */
struct spa_hook global_listener;
bool registered;
struct pw_properties *properties; /**< properties of the node */
struct pw_node_info info; /**< introspectable node info */
bool enabled; /**< if the node is enabled */
bool active; /**< if the node is active */
bool live; /**< if the node is live */
bool driver; /**< if the node can drive the graph */
bool exported; /**< if the node is exported */
bool remote; /**< if the node is implemented remotely */
bool master; /**< a master node is one of the driver nodes that
int registered:1;
int enabled:1; /**< if the node is enabled */
int active:1; /**< if the node is active */
int live:1; /**< if the node is live */
int driver:1; /**< if the node can drive the graph */
int exported:1; /**< if the node is exported */
int remote:1; /**< if the node is implemented remotely */
int master:1; /**< a master node is one of the driver nodes that
* is selected to drive the graph */
uint32_t port_user_data_size; /**< extra size for port user data */
struct pw_node *driver_node;
struct pw_node *driver_root;
struct spa_list driver_list;
@ -349,16 +352,15 @@ struct pw_node {
struct spa_node *node; /**< SPA node implementation */
uint32_t port_user_data_size; /**< extra size for port user data */
struct spa_list input_ports; /**< list of input ports */
struct pw_map input_port_map; /**< map from port_id to port */
struct spa_list output_ports; /**< list of output ports */
struct pw_map output_port_map; /**< map from port_id to port */
uint32_t n_used_input_links; /**< number of active input links */
uint32_t idle_used_input_links; /**< number of active input to be idle */
uint32_t n_ready_input_links; /**< number of ready input links */
struct spa_list output_ports; /**< list of output ports */
struct pw_map output_port_map; /**< map from port_id to port */
uint32_t n_used_output_links; /**< number of active output links */
uint32_t idle_used_output_links; /**< number of active output to be idle */
uint32_t n_ready_output_links; /**< number of ready output links */
@ -430,12 +432,11 @@ struct pw_port {
enum pw_direction direction; /**< port direction */
uint32_t port_id; /**< port id */
enum pw_port_state state; /**< state of the port */
struct pw_properties *properties; /**< properties of the port */
struct pw_port_info info;
enum pw_port_state state; /**< state of the port */
bool allocated; /**< if buffers are allocated */
struct allocation allocation;
struct spa_list links; /**< list of \ref pw_link */
@ -451,6 +452,9 @@ struct pw_port {
#define PW_PORT_MIX_FLAG_MULTI (1<<0) /**< multi input or output */
#define PW_PORT_MIX_FLAG_MIX_ONLY (1<<1) /**< only negotiate mix ports */
uint32_t mix_flags; /**< flags for the mixing */
int allocated:1; /**< if buffers are allocated */
struct pw_map mix_port_map; /**< map from port_id from mixer */
uint32_t n_mix;
uint32_t n_mix_configure;
@ -483,11 +487,9 @@ struct pw_link {
struct spa_list link; /**< link in core link_list */
struct pw_global *global; /**< global for this link */
struct spa_hook global_listener;
bool registered;
struct pw_link_info info; /**< introspectable link info */
struct pw_properties *properties; /**< extra link properties */
bool feedback;
struct spa_io_buffers *io; /**< link io area */
@ -505,6 +507,9 @@ struct pw_link {
} rt;
void *user_data;
int registered:1;
int feedback:1;
};
#define pw_resource_events_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_resource_events, m, v, ##__VA_ARGS__)
@ -593,10 +598,10 @@ struct pw_stream {
struct spa_list link; /**< link in the remote */
char *name; /**< the name of the stream */
uint32_t node_id; /**< node id for remote node, available from
* CONFIGURE state and higher */
struct pw_properties *properties; /**< properties of the stream */
uint32_t node_id; /**< node id for remote node, available from
* CONFIGURE state and higher */
enum pw_stream_state state; /**< stream state */
char *error; /**< error reason when state is in error */
@ -615,7 +620,6 @@ struct pw_factory {
struct spa_list link; /**< link in core node_factory_list */
struct pw_global *global; /**< global for this factory */
struct spa_hook global_listener;
bool registered;
struct pw_factory_info info; /**< introspectable factory info */
struct pw_properties *properties; /**< properties of the factory */
@ -626,6 +630,8 @@ struct pw_factory {
void *implementation_data;
void *user_data;
int registered:1;
};
#define pw_control_events_emit(c,m,v,...) spa_hook_list_call(&c->listener_list, struct pw_control_events, m, v, ##__VA_ARGS__)

View file

@ -75,12 +75,12 @@ struct pw_protocol_server {
struct pw_protocol_marshal {
uint32_t type; /**< interface type */
uint32_t version; /**< version */
uint32_t n_methods; /**< number of methods in the interface */
uint32_t n_events; /**< number of events in the interface */
const void *method_marshal;
const void *method_demarshal;
uint32_t n_methods; /**< number of methods in the interface */
const void *event_marshal;
const void *event_demarshal;
uint32_t n_events; /**< number of events in the interface */
};
struct pw_protocol_implementaton {

View file

@ -80,8 +80,8 @@ struct param {
#define DEFAULT_VOLUME 1.0
struct props {
bool changed;
float volume;
int changed:1;
};
static void reset_props(struct props *props)
@ -101,7 +101,6 @@ struct stream {
enum spa_direction direction;
enum pw_stream_flags flags;
bool async_connect;
struct spa_hook remote_listener;
struct pw_node *node;
@ -112,27 +111,28 @@ struct stream {
void *callbacks_data;
struct spa_io_buffers *io;
struct spa_io_sequence *io_control;
uint32_t io_control_size;
struct spa_io_sequence *io_notify;
uint32_t io_notify_size;
struct spa_io_position *position;
uint32_t io_control_size;
uint32_t io_notify_size;
struct pw_array params;
struct buffer buffers[MAX_BUFFERS];
uint32_t n_buffers;
uint32_t pending_seq;
struct queue dequeued;
struct queue queued;
uint32_t pending_seq;
bool disconnecting;
bool free_data;
struct data data;
uintptr_t seq;
struct pw_time time;
int async_connect:1;
int disconnecting:1;
int free_data:1;
};
static struct param *add_param(struct pw_stream *stream,

View file

@ -43,7 +43,6 @@ struct pw_thread_loop {
pthread_cond_t cond;
pthread_cond_t accept_cond;
bool running;
pthread_t thread;
struct spa_hook hook;
@ -52,6 +51,7 @@ struct pw_thread_loop {
int n_waiting;
int n_waiting_for_accept;
int running:1;
};
/** \endcond */

View file

@ -33,24 +33,24 @@
/** \cond */
struct work_item {
uint32_t id;
void *obj;
uint32_t id;
uint32_t seq;
int res;
pw_work_func_t func;
void *data;
struct spa_list link;
int res;
};
struct pw_work_queue {
struct pw_loop *loop;
struct spa_source *wakeup;
uint32_t counter;
struct spa_list work_list;
struct spa_list free_list;
int n_queued;
uint32_t counter;
uint32_t n_queued;
};
/** \endcond */

View file

@ -151,13 +151,13 @@ static void on_core_info(void *data, const struct pw_core_info *info)
bool print_all = true, print_mark = false;
printf("\ttype: %s\n", spa_debug_type_find_name(pw_type_info(), PW_TYPE_INTERFACE_Core));
printf("\tcookie: %u\n", info->cookie);
if (print_all) {
printf("%c\tuser-name: \"%s\"\n", MARK_CHANGE(0), info->user_name);
printf("%c\thost-name: \"%s\"\n", MARK_CHANGE(1), info->host_name);
printf("%c\tversion: \"%s\"\n", MARK_CHANGE(2), info->version);
printf("%c\tname: \"%s\"\n", MARK_CHANGE(3), info->name);
printf("%c\tcookie: %u\n", MARK_CHANGE(4), info->cookie);
print_properties(info->props, MARK_CHANGE(5));
print_properties(info->props, MARK_CHANGE(4));
}
}