diff --git a/pipewire-pulseaudio/src/context.c b/pipewire-pulseaudio/src/context.c index 2bcef4656..eab3f3a03 100644 --- a/pipewire-pulseaudio/src/context.c +++ b/pipewire-pulseaudio/src/context.c @@ -231,11 +231,11 @@ static void device_event_info(void *object, const struct pw_device_info *update) switch (info->params[n].id) { 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); break; 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); break; default: @@ -296,8 +296,8 @@ static void device_event_param(void *object, int seq, } } -static const struct pw_device_proxy_events device_events = { - PW_VERSION_ENDPOINT_PROXY_EVENTS, +static const struct pw_device_events device_events = { + PW_VERSION_DEVICE_EVENTS, .info = device_event_info, .param = device_event_param, }; @@ -592,7 +592,7 @@ static int set_mask(pa_context *c, struct global *g) g->event = PA_SUBSCRIPTION_EVENT_CARD; events = &device_events; - client_version = PW_VERSION_DEVICE_PROXY; + client_version = PW_VERSION_DEVICE; destroy = device_destroy; spa_list_init(&g->card_info.profiles); break; diff --git a/pipewire-pulseaudio/src/introspect.c b/pipewire-pulseaudio/src/introspect.c index ec94ed74b..883a0e81c 100644 --- a/pipewire-pulseaudio/src/introspect.c +++ b/pipewire-pulseaudio/src/introspect.c @@ -1372,7 +1372,7 @@ static void card_profile(pa_operation *o, void *userdata) if (id == SPA_ID_INVALID) 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_pod_builder_add_object(&b, SPA_TYPE_OBJECT_ParamProfile, SPA_PARAM_Profile, diff --git a/src/examples/export-spa-device.c b/src/examples/export-spa-device.c index 0b7d61bfb..2050ca1aa 100644 --- a/src/examples/export-spa-device.c +++ b/src/examples/export-spa-device.c @@ -61,7 +61,7 @@ static int make_device(struct data *data) data->device = pw_impl_factory_create_object(factory, NULL, PW_TYPE_INTERFACE_Device, - PW_VERSION_DEVICE_PROXY, + PW_VERSION_DEVICE, props, SPA_ID_INVALID); pw_core_export(data->core, SPA_TYPE_INTERFACE_Device, NULL, diff --git a/src/examples/media-session/alsa-monitor.c b/src/examples/media-session/alsa-monitor.c index 8087cb307..5b19acbfd 100644 --- a/src/examples/media-session/alsa-monitor.c +++ b/src/examples/media-session/alsa-monitor.c @@ -401,7 +401,7 @@ static void set_jack_profile(struct impl *impl, int index) if (impl->jack_device == NULL) 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_pod_builder_add_object(&b, 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, "spa-device-factory", PW_TYPE_INTERFACE_Device, - PW_VERSION_DEVICE_PROXY, + PW_VERSION_DEVICE, &props->dict, 0); diff --git a/src/examples/media-session/media-session.c b/src/examples/media-session/media-session.c index 3be52ad86..a2f9f03eb 100644 --- a/src/examples/media-session/media-session.c +++ b/src/examples/media-session/media-session.c @@ -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; 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); } 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; } -static const struct pw_device_proxy_events device_events = { - PW_VERSION_DEVICE_PROXY_EVENTS, +static const struct pw_device_events device_events = { + PW_VERSION_DEVICE_EVENTS, .info = device_event_info, .param = device_event_param, }; @@ -378,7 +378,7 @@ static void device_destroy(void *object) static const struct object_info device_info = { .type = PW_TYPE_INTERFACE_Device, - .version = PW_VERSION_DEVICE_PROXY, + .version = PW_VERSION_DEVICE, .events = &device_events, .size = sizeof(struct sm_device), .init = device_init, diff --git a/src/modules/module-protocol-native/protocol-native.c b/src/modules/module-protocol-native/protocol-native.c index cbcf3a3e7..42774b4e3 100644 --- a/src/modules/module-protocol-native/protocol-native.c +++ b/src/modules/module-protocol-native/protocol-native.c @@ -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, struct spa_hook *listener, - const struct pw_device_proxy_events *events, + const struct pw_device_events *events, void *data) { 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_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_add(b, @@ -862,7 +862,7 @@ static int device_demarshal_info(void *object, const struct pw_protocol_native_m 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, @@ -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 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_Int(seq), @@ -900,7 +900,7 @@ static int device_demarshal_param(void *object, const struct pw_protocol_native_ SPA_POD_Pod(¶m)) < 0) 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); } @@ -911,7 +911,7 @@ static int device_marshal_enum_params(void *object, int seq, struct pw_proxy *proxy = object; 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_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) 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); } @@ -950,7 +950,7 @@ static int device_marshal_set_param(void *object, uint32_t id, uint32_t flags, struct pw_proxy *proxy = object; 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_Id(id), @@ -973,7 +973,7 @@ static int device_demarshal_set_param(void *object, const struct pw_protocol_nat SPA_POD_Pod(¶m)) < 0) 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, @@ -2062,38 +2062,38 @@ const struct pw_protocol_marshal pw_protocol_native_factory_marshal = { .client_demarshal = pw_protocol_native_factory_event_demarshal, }; -static const struct pw_device_proxy_methods pw_protocol_native_device_method_marshal = { - PW_VERSION_DEVICE_PROXY_METHODS, +static const struct pw_device_methods pw_protocol_native_device_method_marshal = { + PW_VERSION_DEVICE_METHODS, .add_listener = &device_method_marshal_add_listener, .enum_params = &device_marshal_enum_params, .set_param = &device_marshal_set_param, }; static const struct pw_protocol_native_demarshal -pw_protocol_native_device_method_demarshal[PW_DEVICE_PROXY_METHOD_NUM] = { - [PW_DEVICE_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, }, - [PW_DEVICE_PROXY_METHOD_ENUM_PARAMS] = { &device_demarshal_enum_params, 0, }, - [PW_DEVICE_PROXY_METHOD_SET_PARAM] = { &device_demarshal_set_param, PW_PERM_W, }, +pw_protocol_native_device_method_demarshal[PW_DEVICE_METHOD_NUM] = { + [PW_DEVICE_METHOD_ADD_LISTENER] = { NULL, 0, }, + [PW_DEVICE_METHOD_ENUM_PARAMS] = { &device_demarshal_enum_params, 0, }, + [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 = { - PW_VERSION_DEVICE_PROXY_EVENTS, +static const struct pw_device_events pw_protocol_native_device_event_marshal = { + PW_VERSION_DEVICE_EVENTS, .info = &device_marshal_info, .param = &device_marshal_param, }; static const struct pw_protocol_native_demarshal -pw_protocol_native_device_event_demarshal[PW_DEVICE_PROXY_EVENT_NUM] = { - [PW_DEVICE_PROXY_EVENT_INFO] = { &device_demarshal_info, 0, }, - [PW_DEVICE_PROXY_EVENT_PARAM] = { &device_demarshal_param, 0, } +pw_protocol_native_device_event_demarshal[PW_DEVICE_EVENT_NUM] = { + [PW_DEVICE_EVENT_INFO] = { &device_demarshal_info, 0, }, + [PW_DEVICE_EVENT_PARAM] = { &device_demarshal_param, 0, } }; static const struct pw_protocol_marshal pw_protocol_native_device_marshal = { PW_TYPE_INTERFACE_Device, - PW_VERSION_DEVICE_PROXY, + PW_VERSION_DEVICE, 0, - PW_DEVICE_PROXY_METHOD_NUM, - PW_DEVICE_PROXY_EVENT_NUM, + PW_DEVICE_METHOD_NUM, + PW_DEVICE_EVENT_NUM, .client_marshal = &pw_protocol_native_device_method_marshal, .server_demarshal = pw_protocol_native_device_method_demarshal, .server_marshal = &pw_protocol_native_device_event_marshal, diff --git a/src/modules/spa/module-device-factory.c b/src/modules/spa/module-device-factory.c index 68ab13423..c26f34b73 100644 --- a/src/modules/spa/module-device-factory.c +++ b/src/modules/spa/module-device-factory.c @@ -208,7 +208,7 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args) factory = pw_impl_factory_new(context, "spa-device-factory", PW_TYPE_INTERFACE_Device, - PW_VERSION_DEVICE_PROXY, + PW_VERSION_DEVICE, NULL, sizeof(*data)); if (factory == NULL) diff --git a/src/pipewire/device.h b/src/pipewire/device.h index 84287477c..3c8f5b351 100644 --- a/src/pipewire/device.h +++ b/src/pipewire/device.h @@ -34,8 +34,8 @@ extern "C" { #include -#define PW_VERSION_DEVICE_PROXY 3 -struct pw_device_proxy; +#define PW_VERSION_DEVICE 3 +struct pw_device; /** The device information. Extra information can be added in later versions \memberof pw_introspect */ 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 */ void pw_device_info_free(struct pw_device_info *info); -#define PW_DEVICE_PROXY_EVENT_INFO 0 -#define PW_DEVICE_PROXY_EVENT_PARAM 1 -#define PW_DEVICE_PROXY_EVENT_NUM 2 +#define PW_DEVICE_EVENT_INFO 0 +#define PW_DEVICE_EVENT_PARAM 1 +#define PW_DEVICE_EVENT_NUM 2 /** Device events */ -struct pw_device_proxy_events { -#define PW_VERSION_DEVICE_PROXY_EVENTS 0 +struct pw_device_events { +#define PW_VERSION_DEVICE_EVENTS 0 uint32_t version; /** * Notify device info @@ -88,19 +88,19 @@ struct pw_device_proxy_events { }; -#define PW_DEVICE_PROXY_METHOD_ADD_LISTENER 0 -#define PW_DEVICE_PROXY_METHOD_ENUM_PARAMS 1 -#define PW_DEVICE_PROXY_METHOD_SET_PARAM 2 -#define PW_DEVICE_PROXY_METHOD_NUM 3 +#define PW_DEVICE_METHOD_ADD_LISTENER 0 +#define PW_DEVICE_METHOD_ENUM_PARAMS 1 +#define PW_DEVICE_METHOD_SET_PARAM 2 +#define PW_DEVICE_METHOD_NUM 3 /** Device methods */ -struct pw_device_proxy_methods { -#define PW_VERSION_DEVICE_PROXY_METHODS 0 +struct pw_device_methods { +#define PW_VERSION_DEVICE_METHODS 0 uint32_t version; int (*add_listener) (void *object, struct spa_hook *listener, - const struct pw_device_proxy_events *events, + const struct pw_device_events *events, void *data); /** * Enumerate device parameters @@ -127,18 +127,18 @@ struct pw_device_proxy_methods { const struct spa_pod *param); }; -#define pw_device_proxy_method(o,method,version,...) \ +#define pw_device_method(o,method,version,...) \ ({ \ int _res = -ENOTSUP; \ spa_interface_call_res((struct spa_interface*)o, \ - struct pw_device_proxy_methods, _res, \ + struct pw_device_methods, _res, \ method, version, ##__VA_ARGS__); \ _res; \ }) -#define pw_device_proxy_add_listener(c,...) pw_device_proxy_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_proxy_set_param(c,...) pw_device_proxy_method(c,set_param,0,__VA_ARGS__) +#define pw_device_add_listener(c,...) pw_device_method(c,add_listener,0,__VA_ARGS__) +#define pw_device_enum_params(c,...) pw_device_method(c,enum_params,0,__VA_ARGS__) +#define pw_device_set_param(c,...) pw_device_method(c,set_param,0,__VA_ARGS__) #ifdef __cplusplus } /* extern "C" */ diff --git a/src/pipewire/impl-device.c b/src/pipewire/impl-device.c index cf8f7046d..1032926ad 100644 --- a/src/pipewire/impl-device.c +++ b/src/pipewire/impl-device.c @@ -36,7 +36,7 @@ struct impl { 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_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; } -static const struct pw_device_proxy_methods device_methods = { - PW_VERSION_DEVICE_PROXY_METHODS, +static const struct pw_device_methods device_methods = { + PW_VERSION_DEVICE_METHODS, .enum_params = device_enum_params, .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, PW_TYPE_INTERFACE_Device, - PW_VERSION_DEVICE_PROXY, + PW_VERSION_DEVICE, properties, global_bind, device); diff --git a/src/tests/test-interfaces.c b/src/tests/test-interfaces.c index ef80ee37e..d732eae71 100644 --- a/src/tests/test-interfaces.c +++ b/src/tests/test-interfaces.c @@ -156,39 +156,39 @@ static void test_module_abi(void) static void test_device_abi(void) { - struct pw_device_proxy_methods m; - struct pw_device_proxy_events e; + struct pw_device_methods m; + struct pw_device_events e; struct { uint32_t version; int (*add_listener) (void *object, struct spa_hook *listener, - const struct pw_device_proxy_events *events, + const struct pw_device_events *events, void *data); int (*enum_params) (void *object, int seq, uint32_t id, uint32_t start, uint32_t num, const struct spa_pod *filter); int (*set_param) (void *object, uint32_t id, uint32_t flags, const struct spa_pod *param); - } methods = { PW_VERSION_DEVICE_PROXY_METHODS, }; + } methods = { PW_VERSION_DEVICE_METHODS, }; struct { uint32_t version; void (*info) (void *object, const struct pw_device_info *info); void (*param) (void *object, int seq, uint32_t id, uint32_t index, uint32_t next, 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, add_listener); TEST_FUNC(m, methods, enum_params); 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)); TEST_FUNC(e, events, version); TEST_FUNC(e, events, info); 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)); } diff --git a/src/tools/pipewire-cli.c b/src/tools/pipewire-cli.c index 67ab11630..236f6aac1 100644 --- a/src/tools/pipewire-cli.c +++ b/src/tools/pipewire-cli.c @@ -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 = { - PW_VERSION_DEVICE_PROXY_EVENTS, +static const struct pw_device_events device_events = { + PW_VERSION_DEVICE_EVENTS, .info = device_event_info, .param = event_param }; @@ -1104,7 +1104,7 @@ static bool bind_global(struct remote_data *rd, struct global *global, char **er break; case PW_TYPE_INTERFACE_Device: events = &device_events; - client_version = PW_VERSION_DEVICE_PROXY; + client_version = PW_VERSION_DEVICE; destroy = (pw_destroy_t) pw_device_info_free; info_func = info_device; 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], PW_TYPE_INTERFACE_Device, - PW_VERSION_DEVICE_PROXY, + PW_VERSION_DEVICE, props ? &props->dict : NULL, 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); break; 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); break; case PW_TYPE_INTERFACE_Endpoint: diff --git a/src/tools/pipewire-dot.c b/src/tools/pipewire-dot.c index b8e4cc3bc..4251a016f 100644 --- a/src/tools/pipewire-dot.c +++ b/src/tools/pipewire-dot.c @@ -551,8 +551,8 @@ static void device_event_info(void *data, const struct pw_device_info *info) global_event_info(data, info); } -static const struct pw_device_proxy_events device_events = { - PW_VERSION_DEVICE_PROXY_EVENTS, +static const struct pw_device_events device_events = { + PW_VERSION_DEVICE_EVENTS, .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_update = (info_update_t)pw_device_info_update; draw = draw_device; - client_version = PW_VERSION_DEVICE_PROXY; + client_version = PW_VERSION_DEVICE; break; case PW_TYPE_INTERFACE_Factory: events = &factory_events; diff --git a/src/tools/pipewire-monitor.c b/src/tools/pipewire-monitor.c index 36d3d704a..67602a7fd 100644 --- a/src/tools/pipewire-monitor.c +++ b/src/tools/pipewire-monitor.c @@ -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); if (!SPA_FLAG_IS_SET(info->params[i].flags, SPA_PARAM_INFO_READ)) 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); } add_pending(data); @@ -536,8 +536,8 @@ static void device_event_info(void *object, const struct pw_device_info *info) data->print_func(data); } -static const struct pw_device_proxy_events device_events = { - PW_VERSION_DEVICE_PROXY_EVENTS, +static const struct pw_device_events device_events = { + PW_VERSION_DEVICE_EVENTS, .info = device_event_info, .param = event_param }; @@ -595,7 +595,7 @@ static void registry_event_global(void *data, uint32_t id, break; case PW_TYPE_INTERFACE_Device: events = &device_events; - client_version = PW_VERSION_DEVICE_PROXY; + client_version = PW_VERSION_DEVICE; destroy = (pw_destroy_t) pw_device_info_free; print_func = print_device; break;