mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pw_module_proxy -> pw_module
This commit is contained in:
		
							parent
							
								
									e633e205c2
								
							
						
					
					
						commit
						199fa47216
					
				
					 10 changed files with 58 additions and 58 deletions
				
			
		| 
						 | 
				
			
			@ -487,8 +487,8 @@ static void module_event_info(void *object, const struct pw_module_info *info)
 | 
			
		|||
	g->pending_seq = pw_proxy_sync(g->proxy, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct pw_module_proxy_events module_events = {
 | 
			
		||||
	PW_VERSION_MODULE_PROXY_EVENTS,
 | 
			
		||||
static const struct pw_module_events module_events = {
 | 
			
		||||
	PW_VERSION_MODULE_EVENTS,
 | 
			
		||||
	.info = module_event_info,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -679,7 +679,7 @@ static int set_mask(pa_context *c, struct global *g)
 | 
			
		|||
		g->mask = PA_SUBSCRIPTION_MASK_MODULE;
 | 
			
		||||
		g->event = PA_SUBSCRIPTION_EVENT_MODULE;
 | 
			
		||||
		events = &module_events;
 | 
			
		||||
                client_version = PW_VERSION_MODULE_PROXY;
 | 
			
		||||
                client_version = PW_VERSION_MODULE;
 | 
			
		||||
                destroy = module_destroy;
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -730,7 +730,7 @@ static int registry_demarshal_destroy(void *object, const struct pw_protocol_nat
 | 
			
		|||
 | 
			
		||||
static int module_method_marshal_add_listener(void *object,
 | 
			
		||||
			struct spa_hook *listener,
 | 
			
		||||
			const struct pw_module_proxy_events *events,
 | 
			
		||||
			const struct pw_module_events *events,
 | 
			
		||||
			void *data)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_proxy *proxy = object;
 | 
			
		||||
| 
						 | 
				
			
			@ -744,7 +744,7 @@ static void module_marshal_info(void *object, const struct pw_module_info *info)
 | 
			
		|||
	struct spa_pod_builder *b;
 | 
			
		||||
	struct spa_pod_frame f;
 | 
			
		||||
 | 
			
		||||
	b = pw_protocol_native_begin_resource(resource, PW_MODULE_PROXY_EVENT_INFO, NULL);
 | 
			
		||||
	b = pw_protocol_native_begin_resource(resource, PW_MODULE_EVENT_INFO, NULL);
 | 
			
		||||
 | 
			
		||||
	spa_pod_builder_push_struct(b, &f);
 | 
			
		||||
	spa_pod_builder_add(b,
 | 
			
		||||
| 
						 | 
				
			
			@ -788,7 +788,7 @@ static int module_demarshal_info(void *object, const struct pw_protocol_native_m
 | 
			
		|||
	if (parse_dict(&prs, &props) < 0)
 | 
			
		||||
		return -EINVAL;
 | 
			
		||||
 | 
			
		||||
	return pw_proxy_notify(proxy, struct pw_module_proxy_events, info, 0, &info);
 | 
			
		||||
	return pw_proxy_notify(proxy, struct pw_module_events, info, 0, &info);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int device_method_marshal_add_listener(void *object,
 | 
			
		||||
| 
						 | 
				
			
			@ -1993,35 +1993,35 @@ const struct pw_protocol_marshal pw_protocol_native_registry_marshal = {
 | 
			
		|||
	.client_demarshal = pw_protocol_native_registry_event_demarshal,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const struct pw_module_proxy_events pw_protocol_native_module_event_marshal = {
 | 
			
		||||
	PW_VERSION_MODULE_PROXY_EVENTS,
 | 
			
		||||
static const struct pw_module_events pw_protocol_native_module_event_marshal = {
 | 
			
		||||
	PW_VERSION_MODULE_EVENTS,
 | 
			
		||||
	.info = &module_marshal_info,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const struct pw_protocol_native_demarshal
 | 
			
		||||
pw_protocol_native_module_event_demarshal[PW_MODULE_PROXY_EVENT_NUM] =
 | 
			
		||||
pw_protocol_native_module_event_demarshal[PW_MODULE_EVENT_NUM] =
 | 
			
		||||
{
 | 
			
		||||
	[PW_MODULE_PROXY_EVENT_INFO] = { &module_demarshal_info, 0, },
 | 
			
		||||
	[PW_MODULE_EVENT_INFO] = { &module_demarshal_info, 0, },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static const struct pw_module_proxy_methods pw_protocol_native_module_method_marshal = {
 | 
			
		||||
	PW_VERSION_MODULE_PROXY_METHODS,
 | 
			
		||||
static const struct pw_module_methods pw_protocol_native_module_method_marshal = {
 | 
			
		||||
	PW_VERSION_MODULE_METHODS,
 | 
			
		||||
	.add_listener = &module_method_marshal_add_listener,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const struct pw_protocol_native_demarshal
 | 
			
		||||
pw_protocol_native_module_method_demarshal[PW_MODULE_PROXY_METHOD_NUM] =
 | 
			
		||||
pw_protocol_native_module_method_demarshal[PW_MODULE_METHOD_NUM] =
 | 
			
		||||
{
 | 
			
		||||
	[PW_MODULE_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
 | 
			
		||||
	[PW_MODULE_METHOD_ADD_LISTENER] = { NULL, 0, },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const struct pw_protocol_marshal pw_protocol_native_module_marshal = {
 | 
			
		||||
	PW_TYPE_INTERFACE_Module,
 | 
			
		||||
	PW_VERSION_MODULE_PROXY,
 | 
			
		||||
	PW_VERSION_MODULE,
 | 
			
		||||
	0,
 | 
			
		||||
	PW_MODULE_PROXY_METHOD_NUM,
 | 
			
		||||
	PW_MODULE_PROXY_EVENT_NUM,
 | 
			
		||||
	PW_MODULE_METHOD_NUM,
 | 
			
		||||
	PW_MODULE_EVENT_NUM,
 | 
			
		||||
	.client_marshal = &pw_protocol_native_module_method_marshal,
 | 
			
		||||
	.server_demarshal = pw_protocol_native_module_method_demarshal,
 | 
			
		||||
	.server_marshal = &pw_protocol_native_module_event_marshal,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -337,12 +337,12 @@ struct pw_registry_v0_events {
 | 
			
		|||
 | 
			
		||||
#define PW_VERSION_MODULE_V0			0
 | 
			
		||||
 | 
			
		||||
#define PW_MODULE_PROXY_V0_EVENT_INFO		0
 | 
			
		||||
#define PW_MODULE_PROXY_V0_EVENT_NUM		1
 | 
			
		||||
#define PW_MODULE_V0_EVENT_INFO		0
 | 
			
		||||
#define PW_MODULE_V0_EVENT_NUM		1
 | 
			
		||||
 | 
			
		||||
/** Module events */
 | 
			
		||||
struct pw_module_proxy_v0_events {
 | 
			
		||||
#define PW_VERSION_MODULE_PROXY_V0_EVENTS	0
 | 
			
		||||
struct pw_module_v0_events {
 | 
			
		||||
#define PW_VERSION_MODULE_V0_EVENTS	0
 | 
			
		||||
	uint32_t version;
 | 
			
		||||
	/**
 | 
			
		||||
	 * Notify module info
 | 
			
		||||
| 
						 | 
				
			
			@ -352,7 +352,7 @@ struct pw_module_proxy_v0_events {
 | 
			
		|||
	void (*info) (void *object, struct pw_module_info *info);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define pw_module_resource_v0_info(r,...)	pw_resource_notify(r,struct pw_module_proxy_v0_events,info,__VA_ARGS__)
 | 
			
		||||
#define pw_module_resource_v0_info(r,...)	pw_resource_notify(r,struct pw_module_v0_events,info,__VA_ARGS__)
 | 
			
		||||
 | 
			
		||||
#define PW_VERSION_NODE_V0		0
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -759,7 +759,7 @@ static void module_marshal_info(void *object, const struct pw_module_info *info)
 | 
			
		|||
	struct spa_pod_frame f;
 | 
			
		||||
	uint32_t i, n_items;
 | 
			
		||||
 | 
			
		||||
	b = pw_protocol_native_begin_resource(resource, PW_MODULE_PROXY_V0_EVENT_INFO, NULL);
 | 
			
		||||
	b = pw_protocol_native_begin_resource(resource, PW_MODULE_V0_EVENT_INFO, NULL);
 | 
			
		||||
 | 
			
		||||
	n_items = info->props ? info->props->n_items : 0;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1071,8 +1071,8 @@ static const struct pw_protocol_marshal pw_protocol_native_registry_marshal = {
 | 
			
		|||
	NULL
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const struct pw_module_proxy_events pw_protocol_native_module_event_marshal = {
 | 
			
		||||
	PW_VERSION_MODULE_PROXY_EVENTS,
 | 
			
		||||
static const struct pw_module_events pw_protocol_native_module_event_marshal = {
 | 
			
		||||
	PW_VERSION_MODULE_EVENTS,
 | 
			
		||||
	.info = &module_marshal_info,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1080,7 +1080,7 @@ static const struct pw_protocol_marshal pw_protocol_native_module_marshal = {
 | 
			
		|||
	PW_TYPE_INTERFACE_Module,
 | 
			
		||||
	PW_VERSION_MODULE_V0,
 | 
			
		||||
	0,
 | 
			
		||||
	PW_MODULE_PROXY_EVENT_NUM,
 | 
			
		||||
	PW_MODULE_EVENT_NUM,
 | 
			
		||||
	0,
 | 
			
		||||
	NULL, NULL,
 | 
			
		||||
	&pw_protocol_native_module_event_marshal,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,7 +44,7 @@ struct impl {
 | 
			
		|||
	void *hnd;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define pw_module_resource_info(r,...)	pw_resource_call(r,struct pw_module_proxy_events,info,0,__VA_ARGS__)
 | 
			
		||||
#define pw_module_resource_info(r,...)	pw_resource_call(r,struct pw_module_events,info,0,__VA_ARGS__)
 | 
			
		||||
 | 
			
		||||
struct resource_data {
 | 
			
		||||
	struct spa_hook resource_listener;
 | 
			
		||||
| 
						 | 
				
			
			@ -245,7 +245,7 @@ pw_impl_module_load(struct pw_context *context,
 | 
			
		|||
 | 
			
		||||
	this->global = pw_global_new(context,
 | 
			
		||||
				     PW_TYPE_INTERFACE_Module,
 | 
			
		||||
				     PW_VERSION_MODULE_PROXY,
 | 
			
		||||
				     PW_VERSION_MODULE,
 | 
			
		||||
				     pw_properties_new(
 | 
			
		||||
					     PW_KEY_MODULE_NAME, name,
 | 
			
		||||
					     NULL),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,8 +34,8 @@ extern "C" {
 | 
			
		|||
 | 
			
		||||
#include <pipewire/proxy.h>
 | 
			
		||||
 | 
			
		||||
#define PW_VERSION_MODULE_PROXY		3
 | 
			
		||||
struct pw_module_proxy;
 | 
			
		||||
#define PW_VERSION_MODULE		3
 | 
			
		||||
struct pw_module;
 | 
			
		||||
 | 
			
		||||
/** The module information. Extra information can be added in later versions \memberof pw_introspect */
 | 
			
		||||
struct pw_module_info {
 | 
			
		||||
| 
						 | 
				
			
			@ -57,12 +57,12 @@ pw_module_info_update(struct pw_module_info *info,
 | 
			
		|||
/** Free a \ref pw_module_info \memberof pw_introspect */
 | 
			
		||||
void pw_module_info_free(struct pw_module_info *info);
 | 
			
		||||
 | 
			
		||||
#define PW_MODULE_PROXY_EVENT_INFO		0
 | 
			
		||||
#define PW_MODULE_PROXY_EVENT_NUM		1
 | 
			
		||||
#define PW_MODULE_EVENT_INFO		0
 | 
			
		||||
#define PW_MODULE_EVENT_NUM		1
 | 
			
		||||
 | 
			
		||||
/** Module events */
 | 
			
		||||
struct pw_module_proxy_events {
 | 
			
		||||
#define PW_VERSION_MODULE_PROXY_EVENTS	0
 | 
			
		||||
struct pw_module_events {
 | 
			
		||||
#define PW_VERSION_MODULE_EVENTS	0
 | 
			
		||||
	uint32_t version;
 | 
			
		||||
	/**
 | 
			
		||||
	 * Notify module info
 | 
			
		||||
| 
						 | 
				
			
			@ -72,30 +72,30 @@ struct pw_module_proxy_events {
 | 
			
		|||
	void (*info) (void *object, const struct pw_module_info *info);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define PW_MODULE_PROXY_METHOD_ADD_LISTENER	0
 | 
			
		||||
#define PW_MODULE_PROXY_METHOD_NUM		1
 | 
			
		||||
#define PW_MODULE_METHOD_ADD_LISTENER	0
 | 
			
		||||
#define PW_MODULE_METHOD_NUM		1
 | 
			
		||||
 | 
			
		||||
/** Module methods */
 | 
			
		||||
struct pw_module_proxy_methods {
 | 
			
		||||
#define PW_VERSION_MODULE_PROXY_METHODS	0
 | 
			
		||||
struct pw_module_methods {
 | 
			
		||||
#define PW_VERSION_MODULE_METHODS	0
 | 
			
		||||
	uint32_t version;
 | 
			
		||||
 | 
			
		||||
	int (*add_listener) (void *object,
 | 
			
		||||
			struct spa_hook *listener,
 | 
			
		||||
			const struct pw_module_proxy_events *events,
 | 
			
		||||
			const struct pw_module_events *events,
 | 
			
		||||
			void *data);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define pw_module_proxy_method(o,method,version,...)			\
 | 
			
		||||
#define pw_module_method(o,method,version,...)				\
 | 
			
		||||
({									\
 | 
			
		||||
	int _res = -ENOTSUP;						\
 | 
			
		||||
	spa_interface_call_res((struct spa_interface*)o,		\
 | 
			
		||||
			struct pw_module_proxy_methods, _res,		\
 | 
			
		||||
			struct pw_module_methods, _res,			\
 | 
			
		||||
			method, version, ##__VA_ARGS__);		\
 | 
			
		||||
	_res;								\
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
#define pw_module_proxy_add_listener(c,...)	pw_module_proxy_method(c,add_listener,0,__VA_ARGS__)
 | 
			
		||||
#define pw_module_add_listener(c,...)	pw_module_method(c,add_listener,0,__VA_ARGS__)
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}  /* extern "C" */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -129,28 +129,28 @@ static void test_registry_abi(void)
 | 
			
		|||
 | 
			
		||||
static void test_module_abi(void)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_module_proxy_methods m;
 | 
			
		||||
	struct pw_module_proxy_events e;
 | 
			
		||||
	struct pw_module_methods m;
 | 
			
		||||
	struct pw_module_events e;
 | 
			
		||||
	struct {
 | 
			
		||||
		uint32_t version;
 | 
			
		||||
		int (*add_listener) (void *object,
 | 
			
		||||
			struct spa_hook *listener,
 | 
			
		||||
			const struct pw_module_proxy_events *events,
 | 
			
		||||
			const struct pw_module_events *events,
 | 
			
		||||
			void *data);
 | 
			
		||||
	} methods = { PW_VERSION_MODULE_PROXY_METHODS, };
 | 
			
		||||
	} methods = { PW_VERSION_MODULE_METHODS, };
 | 
			
		||||
	struct {
 | 
			
		||||
		uint32_t version;
 | 
			
		||||
		void (*info) (void *object, const struct pw_module_info *info);
 | 
			
		||||
	} events = { PW_VERSION_MODULE_PROXY_EVENTS, };
 | 
			
		||||
	} events = { PW_VERSION_MODULE_EVENTS, };
 | 
			
		||||
 | 
			
		||||
	TEST_FUNC(m, methods, version);
 | 
			
		||||
	TEST_FUNC(m, methods, add_listener);
 | 
			
		||||
	spa_assert(PW_VERSION_MODULE_PROXY_METHODS == 0);
 | 
			
		||||
	spa_assert(PW_VERSION_MODULE_METHODS == 0);
 | 
			
		||||
	spa_assert(sizeof(m) == sizeof(methods));
 | 
			
		||||
 | 
			
		||||
	TEST_FUNC(e, events, version);
 | 
			
		||||
	TEST_FUNC(e, events, info);
 | 
			
		||||
	spa_assert(PW_VERSION_MODULE_PROXY_EVENTS == 0);
 | 
			
		||||
	spa_assert(PW_VERSION_MODULE_EVENTS == 0);
 | 
			
		||||
	spa_assert(sizeof(e) == sizeof(events));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -733,8 +733,8 @@ static void module_event_info(void *object, const struct pw_module_info *info)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct pw_module_proxy_events module_events = {
 | 
			
		||||
	PW_VERSION_MODULE_PROXY_EVENTS,
 | 
			
		||||
static const struct pw_module_events module_events = {
 | 
			
		||||
	PW_VERSION_MODULE_EVENTS,
 | 
			
		||||
	.info = module_event_info
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1098,7 +1098,7 @@ static bool bind_global(struct remote_data *rd, struct global *global, char **er
 | 
			
		|||
		break;
 | 
			
		||||
	case PW_TYPE_INTERFACE_Module:
 | 
			
		||||
		events = &module_events;
 | 
			
		||||
		client_version = PW_VERSION_MODULE_PROXY;
 | 
			
		||||
		client_version = PW_VERSION_MODULE;
 | 
			
		||||
		destroy = (pw_destroy_t) pw_module_info_free;
 | 
			
		||||
		info_func = info_module;
 | 
			
		||||
		break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -571,8 +571,8 @@ static void module_event_info(void *data, const struct pw_module_info *info)
 | 
			
		|||
	global_event_info(data, info);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct pw_module_proxy_events module_events = {
 | 
			
		||||
	PW_VERSION_MODULE_PROXY_EVENTS,
 | 
			
		||||
static const struct pw_module_events module_events = {
 | 
			
		||||
	PW_VERSION_MODULE_EVENTS,
 | 
			
		||||
	.info = module_event_info
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -657,7 +657,7 @@ static void registry_event_global(void *data, uint32_t id, uint32_t permissions,
 | 
			
		|||
		info_destroy = (pw_destroy_t)pw_module_info_free;
 | 
			
		||||
		info_update = (info_update_t)pw_module_info_update;
 | 
			
		||||
		draw = draw_module;
 | 
			
		||||
		client_version = PW_VERSION_MODULE_PROXY;
 | 
			
		||||
		client_version = PW_VERSION_MODULE;
 | 
			
		||||
		break;
 | 
			
		||||
	case PW_TYPE_INTERFACE_Core:
 | 
			
		||||
		/* sync to notify we are done with globals */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -229,8 +229,8 @@ static void module_event_info(void *object, const struct pw_module_info *info)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct pw_module_proxy_events module_events = {
 | 
			
		||||
	PW_VERSION_MODULE_PROXY_EVENTS,
 | 
			
		||||
static const struct pw_module_events module_events = {
 | 
			
		||||
	PW_VERSION_MODULE_EVENTS,
 | 
			
		||||
        .info = module_event_info,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -590,7 +590,7 @@ static void registry_event_global(void *data, uint32_t id,
 | 
			
		|||
		break;
 | 
			
		||||
	case PW_TYPE_INTERFACE_Module:
 | 
			
		||||
		events = &module_events;
 | 
			
		||||
		client_version = PW_VERSION_MODULE_PROXY;
 | 
			
		||||
		client_version = PW_VERSION_MODULE;
 | 
			
		||||
		destroy = (pw_destroy_t) pw_module_info_free;
 | 
			
		||||
		break;
 | 
			
		||||
	case PW_TYPE_INTERFACE_Device:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue