mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pw_device_proxy -> pw_device
This commit is contained in:
		
							parent
							
								
									a8f1d756c3
								
							
						
					
					
						commit
						f1eb5f6046
					
				
					 13 changed files with 79 additions and 79 deletions
				
			
		| 
						 | 
					@ -231,11 +231,11 @@ static void device_event_info(void *object, const struct pw_device_info *update)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			switch (info->params[n].id) {
 | 
								switch (info->params[n].id) {
 | 
				
			||||||
			case SPA_PARAM_EnumProfile:
 | 
								case SPA_PARAM_EnumProfile:
 | 
				
			||||||
				pw_device_proxy_enum_params((struct pw_device_proxy*)g->proxy,
 | 
									pw_device_enum_params((struct pw_device*)g->proxy,
 | 
				
			||||||
					0, SPA_PARAM_EnumProfile, 0, -1, NULL);
 | 
										0, SPA_PARAM_EnumProfile, 0, -1, NULL);
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			case SPA_PARAM_Profile:
 | 
								case SPA_PARAM_Profile:
 | 
				
			||||||
				pw_device_proxy_enum_params((struct pw_device_proxy*)g->proxy,
 | 
									pw_device_enum_params((struct pw_device*)g->proxy,
 | 
				
			||||||
					0, SPA_PARAM_Profile, 0, -1, NULL);
 | 
										0, SPA_PARAM_Profile, 0, -1, NULL);
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			default:
 | 
								default:
 | 
				
			||||||
| 
						 | 
					@ -296,8 +296,8 @@ static void device_event_param(void *object, int seq,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct pw_device_proxy_events device_events = {
 | 
					static const struct pw_device_events device_events = {
 | 
				
			||||||
	PW_VERSION_ENDPOINT_PROXY_EVENTS,
 | 
						PW_VERSION_DEVICE_EVENTS,
 | 
				
			||||||
	.info = device_event_info,
 | 
						.info = device_event_info,
 | 
				
			||||||
	.param = device_event_param,
 | 
						.param = device_event_param,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -592,7 +592,7 @@ static int set_mask(pa_context *c, struct global *g)
 | 
				
			||||||
		g->event = PA_SUBSCRIPTION_EVENT_CARD;
 | 
							g->event = PA_SUBSCRIPTION_EVENT_CARD;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		events = &device_events;
 | 
							events = &device_events;
 | 
				
			||||||
                client_version = PW_VERSION_DEVICE_PROXY;
 | 
					                client_version = PW_VERSION_DEVICE;
 | 
				
			||||||
                destroy = device_destroy;
 | 
					                destroy = device_destroy;
 | 
				
			||||||
                spa_list_init(&g->card_info.profiles);
 | 
					                spa_list_init(&g->card_info.profiles);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1372,7 +1372,7 @@ static void card_profile(pa_operation *o, void *userdata)
 | 
				
			||||||
	if (id == SPA_ID_INVALID)
 | 
						if (id == SPA_ID_INVALID)
 | 
				
			||||||
		goto done;;
 | 
							goto done;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_device_proxy_set_param((struct pw_device_proxy*)g->proxy,
 | 
						pw_device_set_param((struct pw_device*)g->proxy,
 | 
				
			||||||
			SPA_PARAM_Profile, 0,
 | 
								SPA_PARAM_Profile, 0,
 | 
				
			||||||
			spa_pod_builder_add_object(&b,
 | 
								spa_pod_builder_add_object(&b,
 | 
				
			||||||
				SPA_TYPE_OBJECT_ParamProfile, SPA_PARAM_Profile,
 | 
									SPA_TYPE_OBJECT_ParamProfile, SPA_PARAM_Profile,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -61,7 +61,7 @@ static int make_device(struct data *data)
 | 
				
			||||||
	data->device = pw_impl_factory_create_object(factory,
 | 
						data->device = pw_impl_factory_create_object(factory,
 | 
				
			||||||
					      NULL,
 | 
										      NULL,
 | 
				
			||||||
					      PW_TYPE_INTERFACE_Device,
 | 
										      PW_TYPE_INTERFACE_Device,
 | 
				
			||||||
					      PW_VERSION_DEVICE_PROXY,
 | 
										      PW_VERSION_DEVICE,
 | 
				
			||||||
					      props, SPA_ID_INVALID);
 | 
										      props, SPA_ID_INVALID);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_core_export(data->core, SPA_TYPE_INTERFACE_Device, NULL,
 | 
						pw_core_export(data->core, SPA_TYPE_INTERFACE_Device, NULL,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -401,7 +401,7 @@ static void set_jack_profile(struct impl *impl, int index)
 | 
				
			||||||
	if (impl->jack_device == NULL)
 | 
						if (impl->jack_device == NULL)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_device_proxy_set_param((struct pw_device_proxy*)impl->jack_device,
 | 
						pw_device_set_param((struct pw_device*)impl->jack_device,
 | 
				
			||||||
			SPA_PARAM_Profile, 0,
 | 
								SPA_PARAM_Profile, 0,
 | 
				
			||||||
			spa_pod_builder_add_object(&b,
 | 
								spa_pod_builder_add_object(&b,
 | 
				
			||||||
				SPA_TYPE_OBJECT_ParamProfile, SPA_PARAM_Profile,
 | 
									SPA_TYPE_OBJECT_ParamProfile, SPA_PARAM_Profile,
 | 
				
			||||||
| 
						 | 
					@ -687,7 +687,7 @@ static int alsa_start_jack_device(struct impl *impl)
 | 
				
			||||||
	impl->jack_device = sm_media_session_create_object(impl->session,
 | 
						impl->jack_device = sm_media_session_create_object(impl->session,
 | 
				
			||||||
				"spa-device-factory",
 | 
									"spa-device-factory",
 | 
				
			||||||
				PW_TYPE_INTERFACE_Device,
 | 
									PW_TYPE_INTERFACE_Device,
 | 
				
			||||||
				PW_VERSION_DEVICE_PROXY,
 | 
									PW_VERSION_DEVICE,
 | 
				
			||||||
				&props->dict,
 | 
									&props->dict,
 | 
				
			||||||
                                0);
 | 
					                                0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -323,7 +323,7 @@ static void device_event_info(void *object, const struct pw_device_info *info)
 | 
				
			||||||
	device->obj.changed |= SM_DEVICE_CHANGE_MASK_INFO;
 | 
						device->obj.changed |= SM_DEVICE_CHANGE_MASK_INFO;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (info->change_mask & PW_DEVICE_CHANGE_MASK_PARAMS) {
 | 
						if (info->change_mask & PW_DEVICE_CHANGE_MASK_PARAMS) {
 | 
				
			||||||
		pw_device_proxy_enum_params((struct pw_device_proxy*)device->obj.proxy,
 | 
							pw_device_enum_params((struct pw_device*)device->obj.proxy,
 | 
				
			||||||
				1, SPA_PARAM_Profile, 0, UINT32_MAX, NULL);
 | 
									1, SPA_PARAM_Profile, 0, UINT32_MAX, NULL);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pw_proxy_sync(device->obj.proxy, 1);
 | 
						pw_proxy_sync(device->obj.proxy, 1);
 | 
				
			||||||
| 
						 | 
					@ -346,8 +346,8 @@ static void device_event_param(void *object, int seq,
 | 
				
			||||||
	device->obj.changed |= SM_DEVICE_CHANGE_MASK_PARAMS;
 | 
						device->obj.changed |= SM_DEVICE_CHANGE_MASK_PARAMS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct pw_device_proxy_events device_events = {
 | 
					static const struct pw_device_events device_events = {
 | 
				
			||||||
	PW_VERSION_DEVICE_PROXY_EVENTS,
 | 
						PW_VERSION_DEVICE_EVENTS,
 | 
				
			||||||
	.info = device_event_info,
 | 
						.info = device_event_info,
 | 
				
			||||||
	.param = device_event_param,
 | 
						.param = device_event_param,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -378,7 +378,7 @@ static void device_destroy(void *object)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct object_info device_info = {
 | 
					static const struct object_info device_info = {
 | 
				
			||||||
	.type = PW_TYPE_INTERFACE_Device,
 | 
						.type = PW_TYPE_INTERFACE_Device,
 | 
				
			||||||
	.version = PW_VERSION_DEVICE_PROXY,
 | 
						.version = PW_VERSION_DEVICE,
 | 
				
			||||||
	.events = &device_events,
 | 
						.events = &device_events,
 | 
				
			||||||
	.size = sizeof(struct sm_device),
 | 
						.size = sizeof(struct sm_device),
 | 
				
			||||||
	.init = device_init,
 | 
						.init = device_init,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -793,7 +793,7 @@ static int module_demarshal_info(void *object, const struct pw_protocol_native_m
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int device_method_marshal_add_listener(void *object,
 | 
					static int device_method_marshal_add_listener(void *object,
 | 
				
			||||||
			struct spa_hook *listener,
 | 
								struct spa_hook *listener,
 | 
				
			||||||
			const struct pw_device_proxy_events *events,
 | 
								const struct pw_device_events *events,
 | 
				
			||||||
			void *data)
 | 
								void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_proxy *proxy = object;
 | 
						struct pw_proxy *proxy = object;
 | 
				
			||||||
| 
						 | 
					@ -807,7 +807,7 @@ static void device_marshal_info(void *object, const struct pw_device_info *info)
 | 
				
			||||||
	struct spa_pod_builder *b;
 | 
						struct spa_pod_builder *b;
 | 
				
			||||||
	struct spa_pod_frame f;
 | 
						struct spa_pod_frame f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	b = pw_protocol_native_begin_resource(resource, PW_DEVICE_PROXY_EVENT_INFO, NULL);
 | 
						b = pw_protocol_native_begin_resource(resource, PW_DEVICE_EVENT_INFO, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_pod_builder_push_struct(b, &f);
 | 
						spa_pod_builder_push_struct(b, &f);
 | 
				
			||||||
	spa_pod_builder_add(b,
 | 
						spa_pod_builder_add(b,
 | 
				
			||||||
| 
						 | 
					@ -862,7 +862,7 @@ static int device_demarshal_info(void *object, const struct pw_protocol_native_m
 | 
				
			||||||
			return -EINVAL;
 | 
								return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return pw_proxy_notify(proxy, struct pw_device_proxy_events, info, 0, &info);
 | 
						return pw_proxy_notify(proxy, struct pw_device_events, info, 0, &info);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void device_marshal_param(void *object, int seq, uint32_t id, uint32_t index, uint32_t next,
 | 
					static void device_marshal_param(void *object, int seq, uint32_t id, uint32_t index, uint32_t next,
 | 
				
			||||||
| 
						 | 
					@ -871,7 +871,7 @@ static void device_marshal_param(void *object, int seq, uint32_t id, uint32_t in
 | 
				
			||||||
	struct pw_resource *resource = object;
 | 
						struct pw_resource *resource = object;
 | 
				
			||||||
	struct spa_pod_builder *b;
 | 
						struct spa_pod_builder *b;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	b = pw_protocol_native_begin_resource(resource, PW_DEVICE_PROXY_EVENT_PARAM, NULL);
 | 
						b = pw_protocol_native_begin_resource(resource, PW_DEVICE_EVENT_PARAM, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_pod_builder_add_struct(b,
 | 
						spa_pod_builder_add_struct(b,
 | 
				
			||||||
			SPA_POD_Int(seq),
 | 
								SPA_POD_Int(seq),
 | 
				
			||||||
| 
						 | 
					@ -900,7 +900,7 @@ static int device_demarshal_param(void *object, const struct pw_protocol_native_
 | 
				
			||||||
				SPA_POD_Pod(¶m)) < 0)
 | 
									SPA_POD_Pod(¶m)) < 0)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return pw_proxy_notify(proxy, struct pw_device_proxy_events, param, 0,
 | 
						return pw_proxy_notify(proxy, struct pw_device_events, param, 0,
 | 
				
			||||||
			seq, id, index, next, param);
 | 
								seq, id, index, next, param);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -911,7 +911,7 @@ static int device_marshal_enum_params(void *object, int seq,
 | 
				
			||||||
	struct pw_proxy *proxy = object;
 | 
						struct pw_proxy *proxy = object;
 | 
				
			||||||
	struct spa_pod_builder *b;
 | 
						struct spa_pod_builder *b;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	b = pw_protocol_native_begin_proxy(proxy, PW_DEVICE_PROXY_METHOD_ENUM_PARAMS, &msg);
 | 
						b = pw_protocol_native_begin_proxy(proxy, PW_DEVICE_METHOD_ENUM_PARAMS, &msg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_pod_builder_add_struct(b,
 | 
						spa_pod_builder_add_struct(b,
 | 
				
			||||||
			SPA_POD_Int(SPA_RESULT_RETURN_ASYNC(msg->seq)),
 | 
								SPA_POD_Int(SPA_RESULT_RETURN_ASYNC(msg->seq)),
 | 
				
			||||||
| 
						 | 
					@ -940,7 +940,7 @@ static int device_demarshal_enum_params(void *object, const struct pw_protocol_n
 | 
				
			||||||
				SPA_POD_Pod(&filter)) < 0)
 | 
									SPA_POD_Pod(&filter)) < 0)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return pw_resource_notify(resource, struct pw_device_proxy_methods, enum_params, 0,
 | 
						return pw_resource_notify(resource, struct pw_device_methods, enum_params, 0,
 | 
				
			||||||
			seq, id, index, num, filter);
 | 
								seq, id, index, num, filter);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -950,7 +950,7 @@ static int device_marshal_set_param(void *object, uint32_t id, uint32_t flags,
 | 
				
			||||||
	struct pw_proxy *proxy = object;
 | 
						struct pw_proxy *proxy = object;
 | 
				
			||||||
	struct spa_pod_builder *b;
 | 
						struct spa_pod_builder *b;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	b = pw_protocol_native_begin_proxy(proxy, PW_DEVICE_PROXY_METHOD_SET_PARAM, NULL);
 | 
						b = pw_protocol_native_begin_proxy(proxy, PW_DEVICE_METHOD_SET_PARAM, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_pod_builder_add_struct(b,
 | 
						spa_pod_builder_add_struct(b,
 | 
				
			||||||
			SPA_POD_Id(id),
 | 
								SPA_POD_Id(id),
 | 
				
			||||||
| 
						 | 
					@ -973,7 +973,7 @@ static int device_demarshal_set_param(void *object, const struct pw_protocol_nat
 | 
				
			||||||
				SPA_POD_Pod(¶m)) < 0)
 | 
									SPA_POD_Pod(¶m)) < 0)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return pw_resource_notify(resource, struct pw_device_proxy_methods, set_param, 0, id, flags, param);
 | 
						return pw_resource_notify(resource, struct pw_device_methods, set_param, 0, id, flags, param);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int factory_method_marshal_add_listener(void *object,
 | 
					static int factory_method_marshal_add_listener(void *object,
 | 
				
			||||||
| 
						 | 
					@ -2062,38 +2062,38 @@ const struct pw_protocol_marshal pw_protocol_native_factory_marshal = {
 | 
				
			||||||
	.client_demarshal = pw_protocol_native_factory_event_demarshal,
 | 
						.client_demarshal = pw_protocol_native_factory_event_demarshal,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct pw_device_proxy_methods pw_protocol_native_device_method_marshal = {
 | 
					static const struct pw_device_methods pw_protocol_native_device_method_marshal = {
 | 
				
			||||||
	PW_VERSION_DEVICE_PROXY_METHODS,
 | 
						PW_VERSION_DEVICE_METHODS,
 | 
				
			||||||
	.add_listener = &device_method_marshal_add_listener,
 | 
						.add_listener = &device_method_marshal_add_listener,
 | 
				
			||||||
	.enum_params = &device_marshal_enum_params,
 | 
						.enum_params = &device_marshal_enum_params,
 | 
				
			||||||
	.set_param = &device_marshal_set_param,
 | 
						.set_param = &device_marshal_set_param,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct pw_protocol_native_demarshal
 | 
					static const struct pw_protocol_native_demarshal
 | 
				
			||||||
pw_protocol_native_device_method_demarshal[PW_DEVICE_PROXY_METHOD_NUM] = {
 | 
					pw_protocol_native_device_method_demarshal[PW_DEVICE_METHOD_NUM] = {
 | 
				
			||||||
	[PW_DEVICE_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
 | 
						[PW_DEVICE_METHOD_ADD_LISTENER] = { NULL, 0, },
 | 
				
			||||||
	[PW_DEVICE_PROXY_METHOD_ENUM_PARAMS] = { &device_demarshal_enum_params, 0, },
 | 
						[PW_DEVICE_METHOD_ENUM_PARAMS] = { &device_demarshal_enum_params, 0, },
 | 
				
			||||||
	[PW_DEVICE_PROXY_METHOD_SET_PARAM] = { &device_demarshal_set_param, PW_PERM_W, },
 | 
						[PW_DEVICE_METHOD_SET_PARAM] = { &device_demarshal_set_param, PW_PERM_W, },
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct pw_device_proxy_events pw_protocol_native_device_event_marshal = {
 | 
					static const struct pw_device_events pw_protocol_native_device_event_marshal = {
 | 
				
			||||||
	PW_VERSION_DEVICE_PROXY_EVENTS,
 | 
						PW_VERSION_DEVICE_EVENTS,
 | 
				
			||||||
	.info = &device_marshal_info,
 | 
						.info = &device_marshal_info,
 | 
				
			||||||
	.param = &device_marshal_param,
 | 
						.param = &device_marshal_param,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct pw_protocol_native_demarshal
 | 
					static const struct pw_protocol_native_demarshal
 | 
				
			||||||
pw_protocol_native_device_event_demarshal[PW_DEVICE_PROXY_EVENT_NUM] = {
 | 
					pw_protocol_native_device_event_demarshal[PW_DEVICE_EVENT_NUM] = {
 | 
				
			||||||
	[PW_DEVICE_PROXY_EVENT_INFO] = { &device_demarshal_info, 0, },
 | 
						[PW_DEVICE_EVENT_INFO] = { &device_demarshal_info, 0, },
 | 
				
			||||||
	[PW_DEVICE_PROXY_EVENT_PARAM] = { &device_demarshal_param, 0, }
 | 
						[PW_DEVICE_EVENT_PARAM] = { &device_demarshal_param, 0, }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct pw_protocol_marshal pw_protocol_native_device_marshal = {
 | 
					static const struct pw_protocol_marshal pw_protocol_native_device_marshal = {
 | 
				
			||||||
	PW_TYPE_INTERFACE_Device,
 | 
						PW_TYPE_INTERFACE_Device,
 | 
				
			||||||
	PW_VERSION_DEVICE_PROXY,
 | 
						PW_VERSION_DEVICE,
 | 
				
			||||||
	0,
 | 
						0,
 | 
				
			||||||
	PW_DEVICE_PROXY_METHOD_NUM,
 | 
						PW_DEVICE_METHOD_NUM,
 | 
				
			||||||
	PW_DEVICE_PROXY_EVENT_NUM,
 | 
						PW_DEVICE_EVENT_NUM,
 | 
				
			||||||
	.client_marshal = &pw_protocol_native_device_method_marshal,
 | 
						.client_marshal = &pw_protocol_native_device_method_marshal,
 | 
				
			||||||
	.server_demarshal = pw_protocol_native_device_method_demarshal,
 | 
						.server_demarshal = pw_protocol_native_device_method_demarshal,
 | 
				
			||||||
	.server_marshal = &pw_protocol_native_device_event_marshal,
 | 
						.server_marshal = &pw_protocol_native_device_event_marshal,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -208,7 +208,7 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	factory = pw_impl_factory_new(context,
 | 
						factory = pw_impl_factory_new(context,
 | 
				
			||||||
				 "spa-device-factory",
 | 
									 "spa-device-factory",
 | 
				
			||||||
				 PW_TYPE_INTERFACE_Device,
 | 
									 PW_TYPE_INTERFACE_Device,
 | 
				
			||||||
				 PW_VERSION_DEVICE_PROXY,
 | 
									 PW_VERSION_DEVICE,
 | 
				
			||||||
				 NULL,
 | 
									 NULL,
 | 
				
			||||||
				 sizeof(*data));
 | 
									 sizeof(*data));
 | 
				
			||||||
	if (factory == NULL)
 | 
						if (factory == NULL)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,8 +34,8 @@ extern "C" {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <pipewire/proxy.h>
 | 
					#include <pipewire/proxy.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define PW_VERSION_DEVICE_PROXY		3
 | 
					#define PW_VERSION_DEVICE		3
 | 
				
			||||||
struct pw_device_proxy;
 | 
					struct pw_device;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** The device information. Extra information can be added in later versions \memberof pw_introspect */
 | 
					/** The device information. Extra information can be added in later versions \memberof pw_introspect */
 | 
				
			||||||
struct pw_device_info {
 | 
					struct pw_device_info {
 | 
				
			||||||
| 
						 | 
					@ -57,13 +57,13 @@ pw_device_info_update(struct pw_device_info *info,
 | 
				
			||||||
/** Free a \ref pw_device_info \memberof pw_introspect */
 | 
					/** Free a \ref pw_device_info \memberof pw_introspect */
 | 
				
			||||||
void pw_device_info_free(struct pw_device_info *info);
 | 
					void pw_device_info_free(struct pw_device_info *info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define PW_DEVICE_PROXY_EVENT_INFO	0
 | 
					#define PW_DEVICE_EVENT_INFO	0
 | 
				
			||||||
#define PW_DEVICE_PROXY_EVENT_PARAM	1
 | 
					#define PW_DEVICE_EVENT_PARAM	1
 | 
				
			||||||
#define PW_DEVICE_PROXY_EVENT_NUM	2
 | 
					#define PW_DEVICE_EVENT_NUM	2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Device events */
 | 
					/** Device events */
 | 
				
			||||||
struct pw_device_proxy_events {
 | 
					struct pw_device_events {
 | 
				
			||||||
#define PW_VERSION_DEVICE_PROXY_EVENTS	0
 | 
					#define PW_VERSION_DEVICE_EVENTS	0
 | 
				
			||||||
	uint32_t version;
 | 
						uint32_t version;
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Notify device info
 | 
						 * Notify device info
 | 
				
			||||||
| 
						 | 
					@ -88,19 +88,19 @@ struct pw_device_proxy_events {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define PW_DEVICE_PROXY_METHOD_ADD_LISTENER	0
 | 
					#define PW_DEVICE_METHOD_ADD_LISTENER	0
 | 
				
			||||||
#define PW_DEVICE_PROXY_METHOD_ENUM_PARAMS	1
 | 
					#define PW_DEVICE_METHOD_ENUM_PARAMS	1
 | 
				
			||||||
#define PW_DEVICE_PROXY_METHOD_SET_PARAM	2
 | 
					#define PW_DEVICE_METHOD_SET_PARAM	2
 | 
				
			||||||
#define PW_DEVICE_PROXY_METHOD_NUM		3
 | 
					#define PW_DEVICE_METHOD_NUM		3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Device methods */
 | 
					/** Device methods */
 | 
				
			||||||
struct pw_device_proxy_methods {
 | 
					struct pw_device_methods {
 | 
				
			||||||
#define PW_VERSION_DEVICE_PROXY_METHODS	0
 | 
					#define PW_VERSION_DEVICE_METHODS	0
 | 
				
			||||||
	uint32_t version;
 | 
						uint32_t version;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int (*add_listener) (void *object,
 | 
						int (*add_listener) (void *object,
 | 
				
			||||||
			struct spa_hook *listener,
 | 
								struct spa_hook *listener,
 | 
				
			||||||
			const struct pw_device_proxy_events *events,
 | 
								const struct pw_device_events *events,
 | 
				
			||||||
			void *data);
 | 
								void *data);
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Enumerate device parameters
 | 
						 * Enumerate device parameters
 | 
				
			||||||
| 
						 | 
					@ -127,18 +127,18 @@ struct pw_device_proxy_methods {
 | 
				
			||||||
			  const struct spa_pod *param);
 | 
								  const struct spa_pod *param);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_device_proxy_method(o,method,version,...)			\
 | 
					#define pw_device_method(o,method,version,...)				\
 | 
				
			||||||
({									\
 | 
					({									\
 | 
				
			||||||
	int _res = -ENOTSUP;						\
 | 
						int _res = -ENOTSUP;						\
 | 
				
			||||||
	spa_interface_call_res((struct spa_interface*)o,		\
 | 
						spa_interface_call_res((struct spa_interface*)o,		\
 | 
				
			||||||
			struct pw_device_proxy_methods, _res,		\
 | 
								struct pw_device_methods, _res,			\
 | 
				
			||||||
			method, version, ##__VA_ARGS__);		\
 | 
								method, version, ##__VA_ARGS__);		\
 | 
				
			||||||
	_res;								\
 | 
						_res;								\
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_device_proxy_add_listener(c,...)	pw_device_proxy_method(c,add_listener,0,__VA_ARGS__)
 | 
					#define pw_device_add_listener(c,...)	pw_device_method(c,add_listener,0,__VA_ARGS__)
 | 
				
			||||||
#define pw_device_proxy_enum_params(c,...)	pw_device_proxy_method(c,enum_params,0,__VA_ARGS__)
 | 
					#define pw_device_enum_params(c,...)	pw_device_method(c,enum_params,0,__VA_ARGS__)
 | 
				
			||||||
#define pw_device_proxy_set_param(c,...)	pw_device_proxy_method(c,set_param,0,__VA_ARGS__)
 | 
					#define pw_device_set_param(c,...)	pw_device_method(c,set_param,0,__VA_ARGS__)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}  /* extern "C" */
 | 
					}  /* extern "C" */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,7 +36,7 @@ struct impl {
 | 
				
			||||||
	struct pw_impl_device this;
 | 
						struct pw_impl_device this;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_device_resource(r,m,v,...)	pw_resource_call(r,struct pw_device_proxy_events,m,v,__VA_ARGS__)
 | 
					#define pw_device_resource(r,m,v,...)	pw_resource_call(r,struct pw_device_events,m,v,__VA_ARGS__)
 | 
				
			||||||
#define pw_device_resource_info(r,...)	pw_device_resource(r,info,0,__VA_ARGS__)
 | 
					#define pw_device_resource_info(r,...)	pw_device_resource(r,info,0,__VA_ARGS__)
 | 
				
			||||||
#define pw_device_resource_param(r,...) pw_device_resource(r,param,0,__VA_ARGS__)
 | 
					#define pw_device_resource_param(r,...) pw_device_resource(r,param,0,__VA_ARGS__)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -337,8 +337,8 @@ static int device_set_param(void *object, uint32_t id, uint32_t flags,
 | 
				
			||||||
	return res;
 | 
						return res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct pw_device_proxy_methods device_methods = {
 | 
					static const struct pw_device_methods device_methods = {
 | 
				
			||||||
	PW_VERSION_DEVICE_PROXY_METHODS,
 | 
						PW_VERSION_DEVICE_METHODS,
 | 
				
			||||||
	.enum_params = device_enum_params,
 | 
						.enum_params = device_enum_params,
 | 
				
			||||||
	.set_param = device_set_param
 | 
						.set_param = device_set_param
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -428,7 +428,7 @@ int pw_impl_device_register(struct pw_impl_device *device,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        device->global = pw_global_new(context,
 | 
					        device->global = pw_global_new(context,
 | 
				
			||||||
				       PW_TYPE_INTERFACE_Device,
 | 
									       PW_TYPE_INTERFACE_Device,
 | 
				
			||||||
				       PW_VERSION_DEVICE_PROXY,
 | 
									       PW_VERSION_DEVICE,
 | 
				
			||||||
				       properties,
 | 
									       properties,
 | 
				
			||||||
				       global_bind,
 | 
									       global_bind,
 | 
				
			||||||
				       device);
 | 
									       device);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -156,39 +156,39 @@ static void test_module_abi(void)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void test_device_abi(void)
 | 
					static void test_device_abi(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_device_proxy_methods m;
 | 
						struct pw_device_methods m;
 | 
				
			||||||
	struct pw_device_proxy_events e;
 | 
						struct pw_device_events e;
 | 
				
			||||||
	struct {
 | 
						struct {
 | 
				
			||||||
		uint32_t version;
 | 
							uint32_t version;
 | 
				
			||||||
		int (*add_listener) (void *object,
 | 
							int (*add_listener) (void *object,
 | 
				
			||||||
			struct spa_hook *listener,
 | 
								struct spa_hook *listener,
 | 
				
			||||||
			const struct pw_device_proxy_events *events,
 | 
								const struct pw_device_events *events,
 | 
				
			||||||
			void *data);
 | 
								void *data);
 | 
				
			||||||
		int (*enum_params) (void *object, int seq, uint32_t id,
 | 
							int (*enum_params) (void *object, int seq, uint32_t id,
 | 
				
			||||||
			uint32_t start, uint32_t num,
 | 
								uint32_t start, uint32_t num,
 | 
				
			||||||
			const struct spa_pod *filter);
 | 
								const struct spa_pod *filter);
 | 
				
			||||||
		int (*set_param) (void *object, uint32_t id, uint32_t flags,
 | 
							int (*set_param) (void *object, uint32_t id, uint32_t flags,
 | 
				
			||||||
			const struct spa_pod *param);
 | 
								const struct spa_pod *param);
 | 
				
			||||||
	} methods = { PW_VERSION_DEVICE_PROXY_METHODS, };
 | 
						} methods = { PW_VERSION_DEVICE_METHODS, };
 | 
				
			||||||
	struct {
 | 
						struct {
 | 
				
			||||||
		uint32_t version;
 | 
							uint32_t version;
 | 
				
			||||||
		void (*info) (void *object, const struct pw_device_info *info);
 | 
							void (*info) (void *object, const struct pw_device_info *info);
 | 
				
			||||||
		void (*param) (void *object, int seq,
 | 
							void (*param) (void *object, int seq,
 | 
				
			||||||
			uint32_t id, uint32_t index, uint32_t next,
 | 
								uint32_t id, uint32_t index, uint32_t next,
 | 
				
			||||||
			const struct spa_pod *param);
 | 
								const struct spa_pod *param);
 | 
				
			||||||
	} events = { PW_VERSION_DEVICE_PROXY_EVENTS, };
 | 
						} events = { PW_VERSION_DEVICE_EVENTS, };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	TEST_FUNC(m, methods, version);
 | 
						TEST_FUNC(m, methods, version);
 | 
				
			||||||
	TEST_FUNC(m, methods, add_listener);
 | 
						TEST_FUNC(m, methods, add_listener);
 | 
				
			||||||
	TEST_FUNC(m, methods, enum_params);
 | 
						TEST_FUNC(m, methods, enum_params);
 | 
				
			||||||
	TEST_FUNC(m, methods, set_param);
 | 
						TEST_FUNC(m, methods, set_param);
 | 
				
			||||||
	spa_assert(PW_VERSION_DEVICE_PROXY_METHODS == 0);
 | 
						spa_assert(PW_VERSION_DEVICE_METHODS == 0);
 | 
				
			||||||
	spa_assert(sizeof(m) == sizeof(methods));
 | 
						spa_assert(sizeof(m) == sizeof(methods));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	TEST_FUNC(e, events, version);
 | 
						TEST_FUNC(e, events, version);
 | 
				
			||||||
	TEST_FUNC(e, events, info);
 | 
						TEST_FUNC(e, events, info);
 | 
				
			||||||
	TEST_FUNC(e, events, param);
 | 
						TEST_FUNC(e, events, param);
 | 
				
			||||||
	spa_assert(PW_VERSION_DEVICE_PROXY_EVENTS == 0);
 | 
						spa_assert(PW_VERSION_DEVICE_EVENTS == 0);
 | 
				
			||||||
	spa_assert(sizeof(e) == sizeof(events));
 | 
						spa_assert(sizeof(e) == sizeof(events));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -892,8 +892,8 @@ static void device_event_info(void *object, const struct pw_device_info *info)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct pw_device_proxy_events device_events = {
 | 
					static const struct pw_device_events device_events = {
 | 
				
			||||||
	PW_VERSION_DEVICE_PROXY_EVENTS,
 | 
						PW_VERSION_DEVICE_EVENTS,
 | 
				
			||||||
	.info = device_event_info,
 | 
						.info = device_event_info,
 | 
				
			||||||
	.param = event_param
 | 
						.param = event_param
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -1104,7 +1104,7 @@ static bool bind_global(struct remote_data *rd, struct global *global, char **er
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case PW_TYPE_INTERFACE_Device:
 | 
						case PW_TYPE_INTERFACE_Device:
 | 
				
			||||||
		events = &device_events;
 | 
							events = &device_events;
 | 
				
			||||||
		client_version = PW_VERSION_DEVICE_PROXY;
 | 
							client_version = PW_VERSION_DEVICE;
 | 
				
			||||||
		destroy = (pw_destroy_t) pw_device_info_free;
 | 
							destroy = (pw_destroy_t) pw_device_info_free;
 | 
				
			||||||
		info_func = info_device;
 | 
							info_func = info_device;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
| 
						 | 
					@ -1260,7 +1260,7 @@ static bool do_create_device(struct data *data, const char *cmd, char *args, cha
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	proxy = pw_core_create_object(rd->core, a[0],
 | 
						proxy = pw_core_create_object(rd->core, a[0],
 | 
				
			||||||
					    PW_TYPE_INTERFACE_Device,
 | 
										    PW_TYPE_INTERFACE_Device,
 | 
				
			||||||
					    PW_VERSION_DEVICE_PROXY,
 | 
										    PW_VERSION_DEVICE,
 | 
				
			||||||
					    props ? &props->dict : NULL,
 | 
										    props ? &props->dict : NULL,
 | 
				
			||||||
					    sizeof(struct proxy_data));
 | 
										    sizeof(struct proxy_data));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1464,7 +1464,7 @@ static bool do_enum_params(struct data *data, const char *cmd, char *args, char
 | 
				
			||||||
			param_id, 0, 0, NULL);
 | 
								param_id, 0, 0, NULL);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case PW_TYPE_INTERFACE_Device:
 | 
						case PW_TYPE_INTERFACE_Device:
 | 
				
			||||||
		pw_device_proxy_enum_params((struct pw_device_proxy*)global->proxy, 0,
 | 
							pw_device_enum_params((struct pw_device*)global->proxy, 0,
 | 
				
			||||||
			param_id, 0, 0, NULL);
 | 
								param_id, 0, 0, NULL);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case PW_TYPE_INTERFACE_Endpoint:
 | 
						case PW_TYPE_INTERFACE_Endpoint:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -551,8 +551,8 @@ static void device_event_info(void *data, const struct pw_device_info *info)
 | 
				
			||||||
	global_event_info(data, info);
 | 
						global_event_info(data, info);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct pw_device_proxy_events device_events = {
 | 
					static const struct pw_device_events device_events = {
 | 
				
			||||||
	PW_VERSION_DEVICE_PROXY_EVENTS,
 | 
						PW_VERSION_DEVICE_EVENTS,
 | 
				
			||||||
	.info = device_event_info
 | 
						.info = device_event_info
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -643,7 +643,7 @@ static void registry_event_global(void *data, uint32_t id, uint32_t permissions,
 | 
				
			||||||
		info_destroy = (pw_destroy_t)pw_device_info_free;
 | 
							info_destroy = (pw_destroy_t)pw_device_info_free;
 | 
				
			||||||
		info_update = (info_update_t)pw_device_info_update;
 | 
							info_update = (info_update_t)pw_device_info_update;
 | 
				
			||||||
		draw = draw_device;
 | 
							draw = draw_device;
 | 
				
			||||||
		client_version = PW_VERSION_DEVICE_PROXY;
 | 
							client_version = PW_VERSION_DEVICE;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case PW_TYPE_INTERFACE_Factory:
 | 
						case PW_TYPE_INTERFACE_Factory:
 | 
				
			||||||
		events = &factory_events;
 | 
							events = &factory_events;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -524,7 +524,7 @@ static void device_event_info(void *object, const struct pw_device_info *info)
 | 
				
			||||||
			remove_params(data, info->params[i].id, 0);
 | 
								remove_params(data, info->params[i].id, 0);
 | 
				
			||||||
			if (!SPA_FLAG_IS_SET(info->params[i].flags, SPA_PARAM_INFO_READ))
 | 
								if (!SPA_FLAG_IS_SET(info->params[i].flags, SPA_PARAM_INFO_READ))
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			pw_device_proxy_enum_params((struct pw_device_proxy*)data->proxy,
 | 
								pw_device_enum_params((struct pw_device*)data->proxy,
 | 
				
			||||||
					0, info->params[i].id, 0, 0, NULL);
 | 
										0, info->params[i].id, 0, 0, NULL);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		add_pending(data);
 | 
							add_pending(data);
 | 
				
			||||||
| 
						 | 
					@ -536,8 +536,8 @@ static void device_event_info(void *object, const struct pw_device_info *info)
 | 
				
			||||||
		data->print_func(data);
 | 
							data->print_func(data);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct pw_device_proxy_events device_events = {
 | 
					static const struct pw_device_events device_events = {
 | 
				
			||||||
	PW_VERSION_DEVICE_PROXY_EVENTS,
 | 
						PW_VERSION_DEVICE_EVENTS,
 | 
				
			||||||
	.info = device_event_info,
 | 
						.info = device_event_info,
 | 
				
			||||||
        .param = event_param
 | 
					        .param = event_param
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -595,7 +595,7 @@ static void registry_event_global(void *data, uint32_t id,
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case PW_TYPE_INTERFACE_Device:
 | 
						case PW_TYPE_INTERFACE_Device:
 | 
				
			||||||
		events = &device_events;
 | 
							events = &device_events;
 | 
				
			||||||
		client_version = PW_VERSION_DEVICE_PROXY;
 | 
							client_version = PW_VERSION_DEVICE;
 | 
				
			||||||
		destroy = (pw_destroy_t) pw_device_info_free;
 | 
							destroy = (pw_destroy_t) pw_device_info_free;
 | 
				
			||||||
		print_func = print_device;
 | 
							print_func = print_device;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue