diff options
Diffstat (limited to 'src')
36 files changed, 297 insertions, 2 deletions
diff --git a/src/modules/module-access.c b/src/modules/module-access.c index c7a64535..60d2b50a 100644 --- a/src/modules/module-access.c +++ b/src/modules/module-access.c @@ -204,6 +204,7 @@ static const struct pw_module_events module_events = { .destroy = module_destroy, }; +SPA_EXPORT int pipewire__module_init(struct pw_module *module, const char *args) { struct pw_core *core = pw_module_get_core(module); diff --git a/src/modules/module-audio-dsp.c b/src/modules/module-audio-dsp.c index 1a36407b..a103b31b 100644 --- a/src/modules/module-audio-dsp.c +++ b/src/modules/module-audio-dsp.c @@ -235,6 +235,7 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie return 0; } +SPA_EXPORT int pipewire__module_init(struct pw_module *module, const char *args) { return module_init(module, NULL); diff --git a/src/modules/module-client-node.c b/src/modules/module-client-node.c index dadd62b6..55842be9 100644 --- a/src/modules/module-client-node.c +++ b/src/modules/module-client-node.c @@ -167,6 +167,7 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie return 0; } +SPA_EXPORT int pipewire__module_init(struct pw_module *module, const char *args) { return module_init(module, NULL); diff --git a/src/modules/module-link-factory.c b/src/modules/module-link-factory.c index fe42a412..797f7f66 100644 --- a/src/modules/module-link-factory.c +++ b/src/modules/module-link-factory.c @@ -338,6 +338,7 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie return 0; } +SPA_EXPORT int pipewire__module_init(struct pw_module *module, const char *args) { return module_init(module, NULL); diff --git a/src/modules/module-protocol-dbus.c b/src/modules/module-protocol-dbus.c index 24beab24..fb9f22e5 100644 --- a/src/modules/module-protocol-dbus.c +++ b/src/modules/module-protocol-dbus.c @@ -631,6 +631,7 @@ static void pw_protocol_dbus_destroy(struct impl *impl) } #endif +SPA_EXPORT int pipewire__module_init(struct pw_module *module, const char *args) { pw_protocol_dbus_new(module->core, NULL); diff --git a/src/modules/module-protocol-native.c b/src/modules/module-protocol-native.c index 8ea1b537..e019b6b6 100644 --- a/src/modules/module-protocol-native.c +++ b/src/modules/module-protocol-native.c @@ -879,6 +879,7 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie return 0; } +SPA_EXPORT int pipewire__module_init(struct pw_module *module, const char *args) { return module_init(module, NULL); diff --git a/src/modules/module-rtkit.c b/src/modules/module-rtkit.c index 87ae6adc..28033a0d 100644 --- a/src/modules/module-rtkit.c +++ b/src/modules/module-rtkit.c @@ -525,6 +525,7 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie } +SPA_EXPORT int pipewire__module_init(struct pw_module *module, const char *args) { return module_init(module, NULL); diff --git a/src/modules/spa/module-device.c b/src/modules/spa/module-device.c index 55140f17..15d76412 100644 --- a/src/modules/spa/module-device.c +++ b/src/modules/spa/module-device.c @@ -62,6 +62,7 @@ static const struct pw_module_events module_events = { .destroy = module_destroy, }; +SPA_EXPORT int pipewire__module_init(struct pw_module *module, const char *args) { struct pw_properties *props = NULL; diff --git a/src/modules/spa/module-monitor.c b/src/modules/spa/module-monitor.c index b570773a..d1e5cd6b 100644 --- a/src/modules/spa/module-monitor.c +++ b/src/modules/spa/module-monitor.c @@ -63,6 +63,7 @@ const struct pw_module_events module_events = { .destroy = module_destroy, }; +SPA_EXPORT int pipewire__module_init(struct pw_module *module, const char *args) { const char *dir; diff --git a/src/modules/spa/module-node-factory.c b/src/modules/spa/module-node-factory.c index 3f07e6fc..f1e61f39 100644 --- a/src/modules/spa/module-node-factory.c +++ b/src/modules/spa/module-node-factory.c @@ -205,6 +205,7 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie return 0; } +SPA_EXPORT int pipewire__module_init(struct pw_module *module, const char *args) { return module_init(module, NULL); diff --git a/src/modules/spa/module-node.c b/src/modules/spa/module-node.c index 84ba07c5..c3b6957b 100644 --- a/src/modules/spa/module-node.c +++ b/src/modules/spa/module-node.c @@ -64,6 +64,7 @@ static const struct pw_module_events module_events = { .destroy = module_destroy, }; +SPA_EXPORT int pipewire__module_init(struct pw_module *module, const char *args) { struct pw_properties *props = NULL; diff --git a/src/pipewire/client.c b/src/pipewire/client.c index aea69bd1..120b5e56 100644 --- a/src/pipewire/client.c +++ b/src/pipewire/client.c @@ -225,6 +225,7 @@ static const struct pw_core_events core_events = { * * \memberof pw_client */ +SPA_EXPORT struct pw_client *pw_client_new(struct pw_core *core, struct ucred *ucred, struct pw_properties *properties, @@ -295,6 +296,7 @@ static const struct pw_global_events global_events = { .bind = global_bind, }; +SPA_EXPORT int pw_client_register(struct pw_client *client, struct pw_client *owner, struct pw_global *parent, @@ -321,31 +323,37 @@ int pw_client_register(struct pw_client *client, return 0; } +SPA_EXPORT struct pw_core *pw_client_get_core(struct pw_client *client) { return client->core; } +SPA_EXPORT struct pw_resource *pw_client_get_core_resource(struct pw_client *client) { return client->core_resource; } +SPA_EXPORT struct pw_resource *pw_client_find_resource(struct pw_client *client, uint32_t id) { return pw_map_lookup(&client->objects, id); } +SPA_EXPORT struct pw_global *pw_client_get_global(struct pw_client *client) { return client->global; } +SPA_EXPORT const struct pw_properties *pw_client_get_properties(struct pw_client *client) { return client->properties; } +SPA_EXPORT const struct ucred *pw_client_get_ucred(struct pw_client *client) { if (!client->ucred_valid) @@ -354,6 +362,7 @@ const struct ucred *pw_client_get_ucred(struct pw_client *client) return &client->ucred; } +SPA_EXPORT void *pw_client_get_user_data(struct pw_client *client) { return client->user_data; @@ -373,6 +382,7 @@ static int destroy_resource(void *object, void *data) * * \memberof pw_client */ +SPA_EXPORT void pw_client_destroy(struct pw_client *client) { struct impl *impl = SPA_CONTAINER_OF(client, struct impl, this); @@ -403,6 +413,7 @@ void pw_client_destroy(struct pw_client *client) free(impl); } +SPA_EXPORT void pw_client_add_listener(struct pw_client *client, struct spa_hook *listener, const struct pw_client_events *events, @@ -411,6 +422,7 @@ void pw_client_add_listener(struct pw_client *client, spa_hook_list_append(&client->listener_list, listener, events, data); } +SPA_EXPORT const struct pw_client_info *pw_client_get_info(struct pw_client *client) { return &client->info; @@ -427,6 +439,7 @@ const struct pw_client_info *pw_client_get_info(struct pw_client *client) * * \memberof pw_client */ +SPA_EXPORT int pw_client_update_properties(struct pw_client *client, const struct spa_dict *dict) { struct pw_resource *resource; @@ -453,6 +466,7 @@ int pw_client_update_properties(struct pw_client *client, const struct spa_dict return changed; } +SPA_EXPORT int pw_client_update_permissions(struct pw_client *client, uint32_t n_permissions, const struct pw_permission *permissions) { @@ -511,6 +525,7 @@ int pw_client_update_permissions(struct pw_client *client, return 0; } +SPA_EXPORT void pw_client_set_busy(struct pw_client *client, bool busy) { if (client->busy != busy) { diff --git a/src/pipewire/command.c b/src/pipewire/command.c index da51c689..c47d6e32 100644 --- a/src/pipewire/command.c +++ b/src/pipewire/command.c @@ -187,6 +187,7 @@ static struct pw_command *parse_command_exec(const char *line, char **err) * * \memberof pw_command */ +SPA_EXPORT void pw_command_free(struct pw_command *command) { struct impl *impl = SPA_CONTAINER_OF(command, struct impl, this); @@ -206,6 +207,7 @@ void pw_command_free(struct pw_command *command) * * \memberof pw_command */ +SPA_EXPORT struct pw_command *pw_command_parse(const char *line, char **err) { struct pw_command *command = NULL; @@ -239,6 +241,7 @@ struct pw_command *pw_command_parse(const char *line, char **err) * * \memberof pw_command */ +SPA_EXPORT int pw_command_run(struct pw_command *command, struct pw_core *core, char **err) { return command->func(command, core, err); diff --git a/src/pipewire/control.c b/src/pipewire/control.c index ff129036..2c08d0b6 100644 --- a/src/pipewire/control.c +++ b/src/pipewire/control.c @@ -124,11 +124,13 @@ void pw_control_destroy(struct pw_control *control) free(control); } +SPA_EXPORT struct pw_port *pw_control_get_port(struct pw_control *control) { return control->port; } +SPA_EXPORT void pw_control_add_listener(struct pw_control *control, struct spa_hook *listener, const struct pw_control_events *events, @@ -137,6 +139,7 @@ void pw_control_add_listener(struct pw_control *control, spa_hook_list_append(&control->listener_list, listener, events, data); } +SPA_EXPORT int pw_control_link(struct pw_control *control, struct pw_control *other) { int res = 0; @@ -215,6 +218,7 @@ int pw_control_link(struct pw_control *control, struct pw_control *other) return res; } +SPA_EXPORT int pw_control_unlink(struct pw_control *control, struct pw_control *other) { int res = 0; diff --git a/src/pipewire/core.c b/src/pipewire/core.c index c89e8598..1c97270b 100644 --- a/src/pipewire/core.c +++ b/src/pipewire/core.c @@ -385,6 +385,7 @@ static const struct pw_global_events global_events = { * * \memberof pw_core */ +SPA_EXPORT struct pw_core *pw_core_new(struct pw_loop *main_loop, struct pw_properties *properties, size_t user_data_size) @@ -497,6 +498,7 @@ struct pw_core *pw_core_new(struct pw_loop *main_loop, * * \memberof pw_core */ +SPA_EXPORT void pw_core_destroy(struct pw_core *core) { struct impl *impl = SPA_CONTAINER_OF(core, struct impl, this); @@ -540,21 +542,25 @@ void pw_core_destroy(struct pw_core *core) free(core); } +SPA_EXPORT void *pw_core_get_user_data(struct pw_core *core) { return core->user_data; } +SPA_EXPORT const struct pw_core_info *pw_core_get_info(struct pw_core *core) { return &core->info; } +SPA_EXPORT struct pw_global *pw_core_get_global(struct pw_core *core) { return core->global; } +SPA_EXPORT void pw_core_add_listener(struct pw_core *core, struct spa_hook *listener, const struct pw_core_events *events, @@ -563,17 +569,20 @@ void pw_core_add_listener(struct pw_core *core, spa_hook_list_append(&core->listener_list, listener, events, data); } +SPA_EXPORT const struct spa_support *pw_core_get_support(struct pw_core *core, uint32_t *n_support) { *n_support = core->n_support; return core->support; } +SPA_EXPORT struct pw_loop *pw_core_get_main_loop(struct pw_core *core) { return core->main_loop; } +SPA_EXPORT const struct pw_properties *pw_core_get_properties(struct pw_core *core) { return core->properties; @@ -588,6 +597,7 @@ const struct pw_properties *pw_core_get_properties(struct pw_core *core) * * \memberof pw_core */ +SPA_EXPORT int pw_core_update_properties(struct pw_core *core, const struct spa_dict *dict) { struct pw_resource *resource; @@ -614,6 +624,7 @@ int pw_core_update_properties(struct pw_core *core, const struct spa_dict *dict) return changed; } +SPA_EXPORT int pw_core_for_each_global(struct pw_core *core, int (*callback) (void *data, struct pw_global *global), void *data) @@ -631,6 +642,7 @@ int pw_core_for_each_global(struct pw_core *core, return 0; } +SPA_EXPORT struct pw_global *pw_core_find_global(struct pw_core *core, uint32_t id) { struct pw_global *global; @@ -876,6 +888,7 @@ int pw_core_find_format(struct pw_core *core, * * \memberof pw_core */ +SPA_EXPORT struct pw_factory *pw_core_find_factory(struct pw_core *core, const char *name) { diff --git a/src/pipewire/device.c b/src/pipewire/device.c index d2c65bb6..1f1c17b1 100644 --- a/src/pipewire/device.c +++ b/src/pipewire/device.c @@ -44,6 +44,7 @@ struct node_data { struct spa_hook node_listener; }; +SPA_EXPORT struct pw_device *pw_device_new(struct pw_core *core, const char *name, struct pw_properties *properties, @@ -81,6 +82,7 @@ struct pw_device *pw_device_new(struct pw_core *core, return NULL; } +SPA_EXPORT void pw_device_destroy(struct pw_device *device) { struct node_data *nd; @@ -115,6 +117,7 @@ static const struct pw_resource_events resource_events = { .destroy = device_unbind_func, }; +SPA_EXPORT int pw_device_for_each_param(struct pw_device *device, uint32_t param_id, uint32_t index, uint32_t max, @@ -237,6 +240,7 @@ static const struct pw_global_events global_events = { .bind = global_bind, }; +SPA_EXPORT int pw_device_register(struct pw_device *device, struct pw_client *owner, struct pw_global *parent, @@ -382,22 +386,26 @@ static const struct spa_device_callbacks device_callbacks = { .remove = device_remove, }; +SPA_EXPORT void pw_device_set_implementation(struct pw_device *device, struct spa_device *spa_device) { device->implementation = spa_device; spa_device_set_callbacks(device->implementation, &device_callbacks, device); } +SPA_EXPORT struct spa_device *pw_device_get_implementation(struct pw_device *device) { return device->implementation; } +SPA_EXPORT const struct pw_properties *pw_device_get_properties(struct pw_device *device) { return device->properties; } +SPA_EXPORT int pw_device_update_properties(struct pw_device *device, const struct spa_dict *dict) { struct pw_resource *resource; @@ -423,16 +431,19 @@ int pw_device_update_properties(struct pw_device *device, const struct spa_dict return changed; } +SPA_EXPORT void *pw_device_get_user_data(struct pw_device *device) { return device->user_data; } +SPA_EXPORT struct pw_global *pw_device_get_global(struct pw_device *device) { return device->global; } +SPA_EXPORT void pw_device_add_listener(struct pw_device *device, struct spa_hook *listener, const struct pw_device_events *events, diff --git a/src/pipewire/factory.c b/src/pipewire/factory.c index a4588730..b8187ef7 100644 --- a/src/pipewire/factory.c +++ b/src/pipewire/factory.c @@ -35,6 +35,7 @@ struct resource_data { struct spa_hook resource_listener; }; +SPA_EXPORT struct pw_factory *pw_factory_new(struct pw_core *core, const char *name, uint32_t type, @@ -62,6 +63,7 @@ struct pw_factory *pw_factory_new(struct pw_core *core, return this; } +SPA_EXPORT void pw_factory_destroy(struct pw_factory *factory) { pw_log_debug("factory %p: destroy", factory); @@ -138,6 +140,7 @@ static const struct pw_global_events global_events = { .bind = global_bind, }; +SPA_EXPORT int pw_factory_register(struct pw_factory *factory, struct pw_client *owner, struct pw_global *parent, @@ -173,16 +176,19 @@ int pw_factory_register(struct pw_factory *factory, return 0; } +SPA_EXPORT void *pw_factory_get_user_data(struct pw_factory *factory) { return factory->user_data; } +SPA_EXPORT struct pw_global *pw_factory_get_global(struct pw_factory *factory) { return factory->global; } +SPA_EXPORT void pw_factory_add_listener(struct pw_factory *factory, struct spa_hook *listener, const struct pw_factory_events *events, @@ -191,6 +197,7 @@ void pw_factory_add_listener(struct pw_factory *factory, spa_hook_list_append(&factory->listener_list, listener, events, data); } +SPA_EXPORT void pw_factory_set_implementation(struct pw_factory *factory, const struct pw_factory_implementation *implementation, void *data) @@ -199,6 +206,7 @@ void pw_factory_set_implementation(struct pw_factory *factory, factory->implementation_data = data; } +SPA_EXPORT void *pw_factory_create_object(struct pw_factory *factory, struct pw_resource *resource, uint32_t type, diff --git a/src/pipewire/global.c b/src/pipewire/global.c index e10a8eb1..d728d59e 100644 --- a/src/pipewire/global.c +++ b/src/pipewire/global.c @@ -42,6 +42,7 @@ struct impl { /** \endcond */ +SPA_EXPORT uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_client *client) { uint32_t perms = PW_PERM_RWX; @@ -64,6 +65,7 @@ uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_client *c * * \memberof pw_global */ +SPA_EXPORT struct pw_global * pw_global_new(struct pw_core *core, uint32_t type, @@ -106,6 +108,7 @@ pw_global_new(struct pw_core *core, * * \memberof pw_global */ +SPA_EXPORT int pw_global_register(struct pw_global *global, struct pw_client *owner, @@ -176,46 +179,55 @@ static int global_unregister(struct pw_global *global) return 0; } +SPA_EXPORT struct pw_core *pw_global_get_core(struct pw_global *global) { return global->core; } +SPA_EXPORT struct pw_client *pw_global_get_owner(struct pw_global *global) { return global->owner; } +SPA_EXPORT struct pw_global *pw_global_get_parent(struct pw_global *global) { return global->parent; } +SPA_EXPORT uint32_t pw_global_get_type(struct pw_global *global) { return global->type; } +SPA_EXPORT uint32_t pw_global_get_version(struct pw_global *global) { return global->version; } +SPA_EXPORT const struct pw_properties *pw_global_get_properties(struct pw_global *global) { return global->properties; } +SPA_EXPORT void * pw_global_get_object(struct pw_global *global) { return global->object; } +SPA_EXPORT uint32_t pw_global_get_id(struct pw_global *global) { return global->id; } +SPA_EXPORT void pw_global_add_listener(struct pw_global *global, struct spa_hook *listener, const struct pw_global_events *events, @@ -237,6 +249,7 @@ void pw_global_add_listener(struct pw_global *global, * * \memberof pw_global */ +SPA_EXPORT int pw_global_bind(struct pw_global *global, struct pw_client *client, uint32_t permissions, uint32_t version, uint32_t id) @@ -258,6 +271,7 @@ pw_global_bind(struct pw_global *global, struct pw_client *client, uint32_t perm return res; } +SPA_EXPORT int pw_global_update_permissions(struct pw_global *global, struct pw_client *client, uint32_t old_permissions, uint32_t new_permissions) { @@ -301,6 +315,7 @@ int pw_global_update_permissions(struct pw_global *global, struct pw_client *cli * * \memberof pw_global */ +SPA_EXPORT void pw_global_destroy(struct pw_global *global) { struct pw_resource *resource; diff --git a/src/pipewire/introspect.c b/src/pipewire/introspect.c index a688d45f..cfb1b63a 100644 --- a/src/pipewire/introspect.c +++ b/src/pipewire/introspect.c @@ -28,6 +28,7 @@ #include "pipewire/remote.h" +SPA_EXPORT const char *pw_node_state_as_string(enum pw_node_state state) { switch (state) { @@ -45,6 +46,7 @@ const char *pw_node_state_as_string(enum pw_node_state state) return "invalid-state"; } +SPA_EXPORT const char *pw_direction_as_string(enum pw_direction direction) { switch (direction) { @@ -58,6 +60,7 @@ const char *pw_direction_as_string(enum pw_direction direction) return "invalid-direction"; } +SPA_EXPORT const char *pw_link_state_as_string(enum pw_link_state state) { switch (state) { @@ -120,6 +123,7 @@ static struct spa_dict *pw_spa_dict_copy(struct spa_dict *dict) return NULL; } +SPA_EXPORT struct pw_core_info *pw_core_info_update(struct pw_core_info *info, const struct pw_core_info *update) { @@ -160,6 +164,7 @@ struct pw_core_info *pw_core_info_update(struct pw_core_info *info, return info; } +SPA_EXPORT void pw_core_info_free(struct pw_core_info *info) { free((void *) info->user_name); @@ -171,6 +176,7 @@ void pw_core_info_free(struct pw_core_info *info) free(info); } +SPA_EXPORT struct pw_node_info *pw_node_info_update(struct pw_node_info *info, const struct pw_node_info *update) { @@ -212,6 +218,7 @@ struct pw_node_info *pw_node_info_update(struct pw_node_info *info, return info; } +SPA_EXPORT void pw_node_info_free(struct pw_node_info *info) { @@ -222,6 +229,7 @@ void pw_node_info_free(struct pw_node_info *info) free(info); } +SPA_EXPORT struct pw_port_info *pw_port_info_update(struct pw_port_info *info, const struct pw_port_info *update) { @@ -246,6 +254,7 @@ struct pw_port_info *pw_port_info_update(struct pw_port_info *info, return info; } +SPA_EXPORT void pw_port_info_free(struct pw_port_info *info) { @@ -254,6 +263,7 @@ void pw_port_info_free(struct pw_port_info *info) free(info); } +SPA_EXPORT struct pw_factory_info *pw_factory_info_update(struct pw_factory_info *info, const struct pw_factory_info *update) { @@ -280,6 +290,7 @@ struct pw_factory_info *pw_factory_info_update(struct pw_factory_info *info, return info; } +SPA_EXPORT void pw_factory_info_free(struct pw_factory_info *info) { free((void *) info->name); @@ -288,6 +299,7 @@ void pw_factory_info_free(struct pw_factory_info *info) free(info); } +SPA_EXPORT struct pw_module_info *pw_module_info_update(struct pw_module_info *info, const struct pw_module_info *update) { @@ -322,6 +334,7 @@ struct pw_module_info *pw_module_info_update(struct pw_module_info *info, return info; } +SPA_EXPORT void pw_module_info_free(struct pw_module_info *info) { free((void *) info->name); @@ -333,6 +346,7 @@ void pw_module_info_free(struct pw_module_info *info) } +SPA_EXPORT struct pw_device_info *pw_device_info_update(struct pw_device_info *info, const struct pw_device_info *update) { @@ -357,6 +371,7 @@ struct pw_device_info *pw_device_info_update(struct pw_device_info *info, return info; } +SPA_EXPORT void pw_device_info_free(struct pw_device_info *info) { free((void *) info->name); @@ -365,6 +380,7 @@ void pw_device_info_free(struct pw_device_info *info) free(info); } +SPA_EXPORT struct pw_client_info *pw_client_info_update(struct pw_client_info *info, const struct pw_client_info *update) { @@ -387,6 +403,7 @@ struct pw_client_info *pw_client_info_update(struct pw_client_info *info, return info; } +SPA_EXPORT void pw_client_info_free(struct pw_client_info *info) { if (info->props) @@ -394,6 +411,7 @@ void pw_client_info_free(struct pw_client_info *info) free(info); } +SPA_EXPORT struct pw_link_info *pw_link_info_update(struct pw_link_info *info, const struct pw_link_info *update) { @@ -433,6 +451,7 @@ struct pw_link_info *pw_link_info_update(struct pw_link_info *info, return info; } +SPA_EXPORT void pw_link_info_free(struct pw_link_info *info) { free((void *) info->error); diff --git a/src/pipewire/link.c b/src/pipewire/link.c index c30556fb..ddb44ab3 100644 --- a/src/pipewire/link.c +++ b/src/pipewire/link.c @@ -1228,6 +1228,7 @@ static void try_unlink_controls(struct impl *impl, struct pw_port *port, struct } } +SPA_EXPORT struct pw_link *pw_link_new(struct pw_core *core, struct pw_port *output, struct pw_port *input, @@ -1347,6 +1348,7 @@ static const struct pw_global_events global_events = { .bind = global_bind, }; +SPA_EXPORT int pw_link_register(struct pw_link *link, struct pw_client *owner, struct pw_global *parent, @@ -1396,6 +1398,7 @@ int pw_link_register(struct pw_link *link, return 0; } +SPA_EXPORT void pw_link_destroy(struct pw_link *link) { struct impl *impl = SPA_CONTAINER_OF(link, struct impl, this); @@ -1430,6 +1433,7 @@ void pw_link_destroy(struct pw_link *link) free(impl); } +SPA_EXPORT void pw_link_add_listener(struct pw_link *link, struct spa_hook *listener, const struct pw_link_events *events, @@ -1450,31 +1454,37 @@ struct pw_link *pw_link_find(struct pw_port *output_port, struct pw_port *input_ return NULL; } +SPA_EXPORT struct pw_core *pw_link_get_core(struct pw_link *link) { return link->core; } +SPA_EXPORT void *pw_link_get_user_data(struct pw_link *link) { return link->user_data; } +SPA_EXPORT const struct pw_link_info *pw_link_get_info(struct pw_link *link) { return &link->info; } +SPA_EXPORT struct pw_global *pw_link_get_global(struct pw_link *link) { return link->global; } +SPA_EXPORT struct pw_port *pw_link_get_output(struct pw_link *link) { return link->output; } +SPA_EXPORT struct pw_port *pw_link_get_input(struct pw_link *link) { return link->input; diff --git a/src/pipewire/log.c b/src/pipewire/log.c index f95edc24..43ec6fed 100644 --- a/src/pipewire/log.c +++ b/src/pipewire/log.c @@ -26,6 +26,7 @@ #define DEFAULT_LOG_LEVEL SPA_LOG_LEVEL_ERROR +SPA_EXPORT enum spa_log_level pw_log_level = DEFAULT_LOG_LEVEL; static struct spa_log *global_log = NULL; @@ -34,6 +35,7 @@ static struct spa_log *global_log = NULL; * \param log the global log to set * \memberof pw_log */ +SPA_EXPORT void pw_log_set(struct spa_log *log) { global_log = log; @@ -45,6 +47,7 @@ void pw_log_set(struct spa_log *log) * \return the global log * \memberof pw_log */ +SPA_EXPORT struct spa_log *pw_log_get(void) { return global_log; @@ -54,6 +57,7 @@ struct spa_log *pw_log_get(void) * \param level the new log level * \memberof pw_log */ +SPA_EXPORT void pw_log_set_level(enum spa_log_level level) { pw_log_level = level; @@ -71,6 +75,7 @@ void pw_log_set_level(enum spa_log_level level) * * \memberof pw_log */ +SPA_EXPORT void pw_log_log(enum spa_log_level level, const char *file, @@ -96,6 +101,7 @@ pw_log_log(enum spa_log_level level, * * \memberof pw_log */ +SPA_EXPORT void pw_log_logv(enum spa_log_level level, const char *file, diff --git a/src/pipewire/loop.c b/src/pipewire/loop.c index 40da66a4..d2a9b1e5 100644 --- a/src/pipewire/loop.c +++ b/src/pipewire/loop.c @@ -46,6 +46,7 @@ struct impl { * \returns a newly allocated loop * \memberof pw_loop */ +SPA_EXPORT struct pw_loop *pw_loop_new(struct pw_properties *properties) { int res; @@ -116,6 +117,7 @@ struct pw_loop *pw_loop_new(struct pw_properties *properties) * \param loop a loop to destroy * \memberof pw_loop */ +SPA_EXPORT void pw_loop_destroy(struct pw_loop *loop) { struct impl *impl = SPA_CONTAINER_OF(loop, struct impl, this); diff --git a/src/pipewire/main-loop.c b/src/pipewire/main-loop.c index 58025519..94160ba0 100644 --- a/src/pipewire/main-loop.c +++ b/src/pipewire/main-loop.c @@ -38,6 +38,7 @@ static void do_stop(void *data, uint64_t count) * * \memberof pw_main_loop */ +SPA_EXPORT struct pw_main_loop *pw_main_loop_new(struct pw_properties *properties) { struct pw_main_loop *this; @@ -68,6 +69,7 @@ struct pw_main_loop *pw_main_loop_new(struct pw_properties *properties) * * \memberof pw_main_loop */ +SPA_EXPORT void pw_main_loop_destroy(struct pw_main_loop *loop) { pw_log_debug("main-loop %p: destroy", loop); @@ -78,6 +80,7 @@ void pw_main_loop_destroy(struct pw_main_loop *loop) free(loop); } +SPA_EXPORT void pw_main_loop_add_listener(struct pw_main_loop *loop, struct spa_hook *listener, const struct pw_main_loop_events *events, @@ -86,6 +89,7 @@ void pw_main_loop_add_listener(struct pw_main_loop *loop, spa_hook_list_append(&loop->listener_list, listener, events, data); } +SPA_EXPORT struct pw_loop * pw_main_loop_get_loop(struct pw_main_loop *loop) { return loop->loop; @@ -98,6 +102,7 @@ struct pw_loop * pw_main_loop_get_loop(struct pw_main_loop *loop) * * \memberof pw_main_loop */ +SPA_EXPORT void pw_main_loop_quit(struct pw_main_loop *loop) { pw_log_debug("main-loop %p: quit", loop); @@ -112,6 +117,7 @@ void pw_main_loop_quit(struct pw_main_loop *loop) * * \memberof pw_main_loop */ +SPA_EXPORT void pw_main_loop_run(struct pw_main_loop *loop) { pw_log_debug("main-loop %p: run", loop); diff --git a/src/pipewire/mem.c b/src/pipewire/mem.c index a142f48c..2a5b64ce 100644 --- a/src/pipewire/mem.c +++ b/src/pipewire/mem.c @@ -94,6 +94,7 @@ static struct spa_list _memblocks = SPA_LIST_INIT(&_memblocks); * \return 0 on success, < 0 on error * \memberof pw_memblock */ +SPA_EXPORT int pw_memblock_map(struct pw_memblock *mem) { if (mem->ptr != NULL) @@ -154,6 +155,7 @@ int pw_memblock_map(struct pw_memblock *mem) * \return 0 on success, < 0 on error * \memberof pw_memblock */ +SPA_EXPORT int pw_memblock_alloc(enum pw_memblock_flags flags, size_t size, struct pw_memblock **mem) { struct memblock tmp, *p; @@ -229,6 +231,7 @@ int pw_memblock_alloc(enum pw_memblock_flags flags, size_t size, struct pw_membl return -ENOMEM; } +SPA_EXPORT int pw_memblock_import(enum pw_memblock_flags flags, int fd, off_t offset, size_t size, @@ -253,6 +256,7 @@ pw_memblock_import(enum pw_memblock_flags flags, * \param mem a memblock * \memberof pw_memblock */ +SPA_EXPORT void pw_memblock_free(struct pw_memblock *mem) { struct memblock *m = (struct memblock *)mem; @@ -273,6 +277,7 @@ void pw_memblock_free(struct pw_memblock *mem) free(mem); } +SPA_EXPORT struct pw_memblock * pw_memblock_find(const void *ptr) { struct memblock *m; diff --git a/src/pipewire/module.c b/src/pipewire/module.c index de77ead5..19c79ccc 100644 --- a/src/pipewire/module.c +++ b/src/pipewire/module.c @@ -166,6 +166,7 @@ static const struct pw_global_events global_events = { * * \memberof pw_module */ +SPA_EXPORT struct pw_module * pw_module_load(struct pw_core *core, const char *name, const char *args, @@ -289,6 +290,7 @@ pw_module_load(struct pw_core *core, * \param module the module to destroy * \memberof pw_module */ +SPA_EXPORT void pw_module_destroy(struct pw_module *module) { struct impl *impl = SPA_CONTAINER_OF(module, struct impl, this); @@ -313,22 +315,26 @@ void pw_module_destroy(struct pw_module *module) free(impl); } +SPA_EXPORT struct pw_core * pw_module_get_core(struct pw_module *module) { return module->core; } +SPA_EXPORT struct pw_global * pw_module_get_global(struct pw_module *module) { return module->global; } +SPA_EXPORT const struct pw_properties *pw_module_get_properties(struct pw_module *module) { return module->properties; } +SPA_EXPORT int pw_module_update_properties(struct pw_module *module, const struct spa_dict *dict) { struct pw_resource *resource; @@ -352,12 +358,14 @@ int pw_module_update_properties(struct pw_module *module, const struct spa_dict return changed; } +SPA_EXPORT const struct pw_module_info * pw_module_get_info(struct pw_module *module) { return &module->info; } +SPA_EXPORT void pw_module_add_listener(struct pw_module *module, struct spa_hook *listener, const struct pw_module_events *events, diff --git a/src/pipewire/node.c b/src/pipewire/node.c index 36b4f10b..1ba16ae5 100644 --- a/src/pipewire/node.c +++ b/src/pipewire/node.c @@ -276,6 +276,7 @@ static void update_port_map(struct pw_node *node, enum pw_direction direction, } } +SPA_EXPORT int pw_node_update_ports(struct pw_node *node) { uint32_t *input_port_ids, *output_port_ids; @@ -456,6 +457,7 @@ static const struct pw_global_events global_events = { .bind = global_bind, }; +SPA_EXPORT int pw_node_register(struct pw_node *this, struct pw_client *owner, struct pw_global *parent, @@ -505,6 +507,7 @@ int pw_node_register(struct pw_node *this, return 0; } +SPA_EXPORT int pw_node_initialized(struct pw_node *this) { pw_log_debug("node %p initialized", this); @@ -568,6 +571,7 @@ static int recalc_quantum(struct pw_node *driver) return 0; } +SPA_EXPORT int pw_node_set_driver(struct pw_node *node, struct pw_node *driver) { struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this); @@ -648,6 +652,7 @@ static void check_properties(struct pw_node *node) } +SPA_EXPORT struct pw_node *pw_node_new(struct pw_core *core, const char *name, struct pw_properties *properties, @@ -727,31 +732,37 @@ struct pw_node *pw_node_new(struct pw_core *core, return NULL; } +SPA_EXPORT const struct pw_node_info *pw_node_get_info(struct pw_node *node) { return &node->info; } +SPA_EXPORT void * pw_node_get_user_data(struct pw_node *node) { return node->user_data; } +SPA_EXPORT struct pw_core * pw_node_get_core(struct pw_node *node) { return node->core; } +SPA_EXPORT struct pw_global *pw_node_get_global(struct pw_node *node) { return node->global; } +SPA_EXPORT const struct pw_properties *pw_node_get_properties(struct pw_node *node) { return node->properties; } +SPA_EXPORT int pw_node_update_properties(struct pw_node *node, const struct spa_dict *dict) { struct pw_resource *resource; @@ -882,6 +893,7 @@ static const struct spa_node_callbacks node_callbacks = { .reuse_buffer = node_reuse_buffer, }; +SPA_EXPORT void pw_node_set_implementation(struct pw_node *node, struct spa_node *spa_node) { @@ -905,11 +917,13 @@ void pw_node_set_implementation(struct pw_node *node, } } +SPA_EXPORT struct spa_node *pw_node_get_implementation(struct pw_node *node) { return node->node; } +SPA_EXPORT void pw_node_add_listener(struct pw_node *node, struct spa_hook *listener, const struct pw_node_events *events, @@ -926,6 +940,7 @@ void pw_node_add_listener(struct pw_node *node, * * \memberof pw_node */ +SPA_EXPORT void pw_node_destroy(struct pw_node *node) { struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this); @@ -986,6 +1001,7 @@ void pw_node_destroy(struct pw_node *node) free(impl); } +SPA_EXPORT int pw_node_for_each_port(struct pw_node *node, enum pw_direction direction, int (*callback) (void *data, struct pw_port *port), @@ -1006,6 +1022,7 @@ int pw_node_for_each_port(struct pw_node *node, return 0; } +SPA_EXPORT int pw_node_for_each_param(struct pw_node *node, uint32_t param_id, uint32_t index, uint32_t max, @@ -1039,6 +1056,7 @@ int pw_node_for_each_param(struct pw_node *node, return res; } +SPA_EXPORT struct pw_port * pw_node_find_port(struct pw_node *node, enum pw_direction direction, uint32_t port_id) { @@ -1073,6 +1091,7 @@ pw_node_find_port(struct pw_node *node, enum pw_direction direction, uint32_t po return port; } +SPA_EXPORT uint32_t pw_node_get_free_port_id(struct pw_node *node, enum pw_direction direction) { uint32_t n_ports, max_ports; @@ -1147,6 +1166,7 @@ static void node_activate(struct pw_node *this) * * \memberof pw_node */ +SPA_EXPORT int pw_node_set_state(struct pw_node *node, enum pw_node_state state) { int res = 0; @@ -1195,6 +1215,7 @@ int pw_node_set_state(struct pw_node *node, enum pw_node_state state) return res; } +SPA_EXPORT int pw_node_set_active(struct pw_node *node, bool active) { bool old = node->active; @@ -1217,11 +1238,13 @@ int pw_node_set_active(struct pw_node *node, bool active) return 0; } +SPA_EXPORT bool pw_node_is_active(struct pw_node *node) { return node->active; } +SPA_EXPORT int pw_node_set_enabled(struct pw_node *node, bool enabled) { bool old = node->enabled; @@ -1242,6 +1265,7 @@ int pw_node_set_enabled(struct pw_node *node, bool enabled) return 0; } +SPA_EXPORT bool pw_node_is_enabled(struct pw_node *node) { return node->enabled; diff --git a/src/pipewire/pipewire.c b/src/pipewire/pipewire.c index 5445dadd..92b7e985 100644 --- a/src/pipewire/pipewire.c +++ b/src/pipewire/pipewire.c @@ -302,11 +302,13 @@ static void configure_debug(struct support *support, const char *str) * \param type the interface type * \return the interface or NULL when not configured */ +SPA_EXPORT void *pw_get_support_interface(uint32_t type) { return spa_support_find(global_support.support, global_support.n_support, type); } +SPA_EXPORT const struct spa_handle_factory *pw_get_support_factory(const char *factory_name) { struct plugin *plugin = global_support.support_plugin; @@ -315,12 +317,14 @@ const struct spa_handle_factory *pw_get_support_factory(const char *factory_name return find_factory(plugin, factory_name); } +SPA_EXPORT const struct spa_support *pw_get_support(uint32_t *n_support) { *n_support = global_support.n_support; return global_support.support; } +SPA_EXPORT void *pw_load_spa_interface(const char *lib, const char *factory_name, uint32_t type, const struct spa_dict *info, uint32_t n_support, @@ -372,6 +376,7 @@ static struct interface *find_interface(void *iface) return NULL; } +SPA_EXPORT int pw_unload_spa_interface(void *iface) { struct interface *i; @@ -384,6 +389,7 @@ int pw_unload_spa_interface(void *iface) return 0; } +SPA_EXPORT void *pw_load_spa_dbus_interface(struct pw_loop *loop) { struct spa_support support = SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_LoopUtils, loop->utils); @@ -404,6 +410,7 @@ void *pw_load_spa_dbus_interface(struct pw_loop *loop) * * \memberof pw_pipewire */ +SPA_EXPORT void pw_init(int *argc, char **argv[]) { const char *str; @@ -467,6 +474,7 @@ void pw_init(int *argc, char **argv[]) * * \memberof pw_pipewire */ +SPA_EXPORT bool pw_debug_is_category_enabled(const char *name) { int i; @@ -482,12 +490,14 @@ bool pw_debug_is_category_enabled(const char *name) } /** Get the application name \memberof pw_pipewire */ +SPA_EXPORT const char *pw_get_application_name(void) { return NULL; } /** Get the program name \memberof pw_pipewire */ +SPA_EXPORT const char *pw_get_prgname(void) { static char tcomm[16 + 1]; @@ -500,6 +510,7 @@ const char *pw_get_prgname(void) } /** Get the user name \memberof pw_pipewire */ +SPA_EXPORT const char *pw_get_user_name(void) { struct passwd *pw; @@ -511,6 +522,7 @@ const char *pw_get_user_name(void) } /** Get the host name \memberof pw_pipewire */ +SPA_EXPORT const char *pw_get_host_name(void) { static char hname[256]; @@ -528,6 +540,7 @@ const char *pw_get_host_name(void) * * \memberof pw_pipewire */ +SPA_EXPORT const char *pw_get_client_name(void) { const char *cc; @@ -552,6 +565,7 @@ const char *pw_get_client_name(void) * * \memberof pw_pipewire */ +SPA_EXPORT void pw_fill_remote_properties(struct pw_core *core, struct pw_properties *properties) { const char *val; @@ -596,11 +610,13 @@ void pw_fill_remote_properties(struct pw_core *core, struct pw_properties *prope * * \memberof pw_pipewire */ +SPA_EXPORT void pw_fill_stream_properties(struct pw_core *core, struct pw_properties *properties) { } /** Reverse the direction \memberof pw_pipewire */ +SPA_EXPORT enum pw_direction pw_direction_reverse(enum pw_direction direction) { if (direction == PW_DIRECTION_INPUT) @@ -611,6 +627,7 @@ enum pw_direction pw_direction_reverse(enum pw_direction direction) } /** Get the currently running version */ +SPA_EXPORT const char* pw_get_library_version(void) { return pw_get_headers_version(); @@ -631,6 +648,7 @@ static const struct spa_type_info type_info[] = { { 0, NULL, 0, NULL }, }; +SPA_EXPORT const struct spa_type_info * pw_type_info(void) { return type_info; diff --git a/src/pipewire/port.c b/src/pipewire/port.c index 4422a810..c0987734 100644 --- a/src/pipewire/port.c +++ b/src/pipewire/port.c @@ -187,6 +187,7 @@ static const struct spa_node schedule_mix_node = { .port_reuse_buffer = schedule_mix_reuse_buffer, }; +SPA_EXPORT int pw_port_init_mix(struct pw_port *port, struct pw_port_mix *mix) { uint32_t port_id; @@ -215,6 +216,8 @@ int pw_port_init_mix(struct pw_port *port, struct pw_port_mix *mix) return res; } + +SPA_EXPORT int pw_port_release_mix(struct pw_port *port, struct pw_port_mix *mix) { int res = 0; @@ -238,6 +241,7 @@ int pw_port_release_mix(struct pw_port *port, struct pw_port_mix *mix) return res; } +SPA_EXPORT struct pw_port *pw_port_new(enum pw_direction direction, uint32_t port_id, struct pw_properties *properties, @@ -304,6 +308,7 @@ struct pw_port *pw_port_new(enum pw_direction direction, return NULL; } +SPA_EXPORT int pw_port_set_mix(struct pw_port *port, struct spa_node *node, uint32_t flags) { struct impl *impl = SPA_CONTAINER_OF(port, struct impl, this); @@ -320,21 +325,25 @@ int pw_port_set_mix(struct pw_port *port, struct spa_node *node, uint32_t flags) return 0; } +SPA_EXPORT enum pw_direction pw_port_get_direction(struct pw_port *port) { return port->direction; } +SPA_EXPORT uint32_t pw_port_get_id(struct pw_port *port) { return port->port_id; } +SPA_EXPORT const struct pw_properties *pw_port_get_properties(struct pw_port *port) { return port->properties; } +SPA_EXPORT int pw_port_update_properties(struct pw_port *port, const struct spa_dict *dict) { struct pw_resource *resource; @@ -360,11 +369,13 @@ int pw_port_update_properties(struct pw_port *port, const struct spa_dict *dict) return changed; } +SPA_EXPORT struct pw_node *pw_port_get_node(struct pw_port *port) { return port->node; } +SPA_EXPORT void pw_port_add_listener(struct pw_port *port, struct spa_hook *listener, const struct pw_port_events *events, @@ -373,6 +384,7 @@ void pw_port_add_listener(struct pw_port *port, spa_hook_list_append(&port->listener_list, listener, events, data); } +SPA_EXPORT void * pw_port_get_user_data(struct pw_port *port) { return port->user_data; @@ -535,6 +547,7 @@ int pw_port_register(struct pw_port *port, return pw_global_register(port->global, owner, parent); } +SPA_EXPORT int pw_port_add(struct pw_port *port, struct pw_node *node) { uint32_t port_id = port->port_id; @@ -758,6 +771,7 @@ do_port_command(struct spa_loop *loop, return spa_node_port_send_command(node->node, port->direction, port->port_id, data); } +SPA_EXPORT int pw_port_send_command(struct pw_port *port, bool block, const struct spa_command *command) { return pw_loop_invoke(port->node->data_loop, do_port_command, 0, @@ -856,11 +870,13 @@ int pw_port_for_each_link(struct pw_port *port, return res; } +SPA_EXPORT int pw_port_is_linked(struct pw_port *port) { return spa_list_is_empty(&port->links) ? 0 : 1; } +SPA_EXPORT int pw_port_set_param(struct pw_port *port, uint32_t mix_id, uint32_t id, uint32_t flags, const struct spa_pod *param) { @@ -915,6 +931,7 @@ int pw_port_set_param(struct pw_port *port, uint32_t mix_id, uint32_t id, uint32 return res; } +SPA_EXPORT int pw_port_use_buffers(struct pw_port *port, uint32_t mix_id, struct spa_buffer **buffers, uint32_t n_buffers) { @@ -970,6 +987,7 @@ int pw_port_use_buffers(struct pw_port *port, uint32_t mix_id, return res; } +SPA_EXPORT int pw_port_alloc_buffers(struct pw_port *port, uint32_t mix_id, struct spa_pod **params, uint32_t n_params, struct spa_buffer **buffers, uint32_t *n_buffers) diff --git a/src/pipewire/properties.c b/src/pipewire/properties.c index 619565e2..3da92e3c 100644 --- a/src/pipewire/properties.c +++ b/src/pipewire/properties.c @@ -89,6 +89,7 @@ static struct properties *properties_new(int prealloc) * * \memberof pw_properties */ +SPA_EXPORT struct pw_properties *pw_properties_new(const char *key, ...) { struct properties *impl; @@ -118,6 +119,7 @@ struct pw_properties *pw_properties_new(const char *key, ...) * * \memberof pw_properties */ +SPA_EXPORT struct pw_properties *pw_properties_new_dict(const struct spa_dict *dict) { uint32_t i; @@ -147,6 +149,7 @@ struct pw_properties *pw_properties_new_dict(const struct spa_dict *dict) * * \memberof pw_properties */ +SPA_EXPORT struct pw_properties * pw_properties_new_string(const char *str) { @@ -186,6 +189,7 @@ pw_properties_new_string(const char *str) * * \memberof pw_properties */ +SPA_EXPORT struct pw_properties *pw_properties_copy(const struct pw_properties *properties) { return pw_properties_new_dict(&properties->dict); @@ -197,6 +201,7 @@ struct pw_properties *pw_properties_copy(const struct pw_properties *properties) * * \memberof pw_properties */ +SPA_EXPORT void pw_properties_clear(struct pw_properties *properties) { struct properties *impl = SPA_CONTAINER_OF(properties, struct properties, this); @@ -219,6 +224,7 @@ void pw_properties_clear(struct pw_properties *properties) * * \memberof pw_properties */ +SPA_EXPORT int pw_properties_update(struct pw_properties *props, const struct spa_dict *dict) { @@ -237,6 +243,7 @@ int pw_properties_update(struct pw_properties *props, * * \memberof pw_properties */ +SPA_EXPORT void pw_properties_free(struct pw_properties *properties) { struct properties *impl = SPA_CONTAINER_OF(properties, struct properties, this); @@ -301,13 +308,14 @@ static int do_replace(struct pw_properties *properties, const char *key, char *v * * \memberof pw_properties */ +SPA_EXPORT int pw_properties_set(struct pw_properties *properties, const char *key, const char *value) { return do_replace(properties, key, (char*)value, true); } -int -pw_properties_setva(struct pw_properties *properties, +SPA_EXPORT +int pw_properties_setva(struct pw_properties *properties, const char *key, const char *format, va_list args) { char *value; @@ -327,6 +335,7 @@ pw_properties_setva(struct pw_properties *properties, * * \memberof pw_properties */ +SPA_EXPORT int pw_properties_setf(struct pw_properties *properties, const char *key, const char *format, ...) { int res; @@ -349,6 +358,7 @@ int pw_properties_setf(struct pw_properties *properties, const char *key, const * * \memberof pw_properties */ +SPA_EXPORT const char *pw_properties_get(const struct pw_properties *properties, const char *key) { struct properties *impl = SPA_CONTAINER_OF(properties, struct properties, this); @@ -373,6 +383,7 @@ const char *pw_properties_get(const struct pw_properties *properties, const char * * \memberof pw_properties */ +SPA_EXPORT const char *pw_properties_iterate(const struct pw_properties *properties, void **state) { struct properties *impl = SPA_CONTAINER_OF(properties, struct properties, this); diff --git a/src/pipewire/protocol.c b/src/pipewire/protocol.c index b9b7e8d5..dd816778 100644 --- a/src/pipewire/protocol.c +++ b/src/pipewire/protocol.c @@ -41,6 +41,7 @@ struct marshal { }; /** \endcond */ +SPA_EXPORT struct pw_protocol *pw_protocol_new(struct pw_core *core, const char *name, size_t user_data_size) @@ -69,23 +70,27 @@ struct pw_protocol *pw_protocol_new(struct pw_core *core, return protocol; } +SPA_EXPORT void *pw_protocol_get_user_data(struct pw_protocol *protocol) { return protocol->user_data; } +SPA_EXPORT const struct pw_protocol_implementaton * pw_protocol_get_implementation(struct pw_protocol *protocol) { return protocol->implementation; } +SPA_EXPORT const void * pw_protocol_get_extension(struct pw_protocol *protocol) { return protocol->extension; } +SPA_EXPORT void pw_protocol_destroy(struct pw_protocol *protocol) { struct impl *impl = SPA_CONTAINER_OF(protocol, struct impl, this); @@ -112,6 +117,7 @@ void pw_protocol_destroy(struct pw_protocol *protocol) free(impl); } +SPA_EXPORT void pw_protocol_add_listener(struct pw_protocol *protocol, struct spa_hook *listener, const struct pw_protocol_events *events, @@ -120,6 +126,7 @@ void pw_protocol_add_listener(struct pw_protocol *protocol, spa_hook_list_append(&protocol->listener_list, listener, events, data); } +SPA_EXPORT int pw_protocol_add_marshal(struct pw_protocol *protocol, const struct pw_protocol_marshal *marshal) @@ -141,6 +148,7 @@ pw_protocol_add_marshal(struct pw_protocol *protocol, return 0; } +SPA_EXPORT const struct pw_protocol_marshal * pw_protocol_get_marshal(struct pw_protocol *protocol, uint32_t type) { @@ -156,6 +164,7 @@ pw_protocol_get_marshal(struct pw_protocol *protocol, uint32_t type) return NULL; } +SPA_EXPORT struct pw_protocol *pw_core_find_protocol(struct pw_core *core, const char *name) { struct pw_protocol *protocol; diff --git a/src/pipewire/proxy.c b/src/pipewire/proxy.c index 378417f2..71961ccc 100644 --- a/src/pipewire/proxy.c +++ b/src/pipewire/proxy.c @@ -51,6 +51,7 @@ struct proxy { * * \memberof pw_proxy */ +SPA_EXPORT struct pw_proxy *pw_proxy_new(struct pw_proxy *factory, uint32_t type, size_t user_data_size) @@ -86,21 +87,25 @@ struct pw_proxy *pw_proxy_new(struct pw_proxy *factory, return this; } +SPA_EXPORT void *pw_proxy_get_user_data(struct pw_proxy *proxy) { return proxy->user_data; } +SPA_EXPORT uint32_t pw_proxy_get_id(struct pw_proxy *proxy) { return proxy->id; } +SPA_EXPORT struct pw_protocol *pw_proxy_get_protocol(struct pw_proxy *proxy) { return proxy->remote->conn->protocol; } +SPA_EXPORT void pw_proxy_add_listener(struct pw_proxy *proxy, struct spa_hook *listener, const struct pw_proxy_events *events, @@ -109,6 +114,7 @@ void pw_proxy_add_listener(struct pw_proxy *proxy, spa_hook_list_append(&proxy->listener_list, listener, events, data); } +SPA_EXPORT void pw_proxy_add_proxy_listener(struct pw_proxy *proxy, struct spa_hook *listener, const void *events, @@ -125,6 +131,7 @@ void pw_proxy_add_proxy_listener(struct pw_proxy *proxy, * decides to destroy the server side object * \memberof pw_proxy */ +SPA_EXPORT void pw_proxy_destroy(struct pw_proxy *proxy) { struct proxy *impl = SPA_CONTAINER_OF(proxy, struct proxy, this); @@ -138,11 +145,13 @@ void pw_proxy_destroy(struct pw_proxy *proxy) free(impl); } +SPA_EXPORT struct spa_hook_list *pw_proxy_get_proxy_listeners(struct pw_proxy *proxy) { return &proxy->proxy_listener_list; } +SPA_EXPORT const struct pw_protocol_marshal *pw_proxy_get_marshal(struct pw_proxy *proxy) { return proxy->marshal; diff --git a/src/pipewire/remote.c b/src/pipewire/remote.c index 3207c065..67e78c11 100644 --- a/src/pipewire/remote.c +++ b/src/pipewire/remote.c @@ -46,6 +46,7 @@ struct remote { /** \endcond */ +SPA_EXPORT const char *pw_remote_state_as_string(enum pw_remote_state state) { switch (state) { @@ -116,6 +117,7 @@ static const struct pw_core_proxy_events core_proxy_events = { .remove_id = core_event_remove_id, }; +SPA_EXPORT struct pw_remote *pw_remote_new(struct pw_core *core, struct pw_properties *properties, size_t user_data_size) @@ -193,6 +195,7 @@ struct pw_remote *pw_remote_new(struct pw_core *core, return NULL; } +SPA_EXPORT void pw_remote_destroy(struct pw_remote *remote) { struct remote *impl = SPA_CONTAINER_OF(remote, struct remote, this); @@ -219,16 +222,19 @@ void pw_remote_destroy(struct pw_remote *remote) free(impl); } +SPA_EXPORT struct pw_core *pw_remote_get_core(struct pw_remote *remote) { return remote->core; } +SPA_EXPORT const struct pw_properties *pw_remote_get_properties(struct pw_remote *remote) { return remote->properties; } +SPA_EXPORT int pw_remote_update_properties(struct pw_remote *remote, const struct spa_dict *dict) { int changed; @@ -246,11 +252,13 @@ int pw_remote_update_properties(struct pw_remote *remote, const struct spa_dict return changed; } +SPA_EXPORT void *pw_remote_get_user_data(struct pw_remote *remote) { return remote->user_data; } +SPA_EXPORT enum pw_remote_state pw_remote_get_state(struct pw_remote *remote, const char **error) { if (error) @@ -258,6 +266,7 @@ enum pw_remote_state pw_remote_get_state(struct pw_remote *remote, const char ** return remote->state; } +SPA_EXPORT void pw_remote_add_listener(struct pw_remote *remote, struct spa_hook *listener, const struct pw_remote_events *events, @@ -299,16 +308,19 @@ static int do_connect(struct pw_remote *remote) return -ENOMEM; } +SPA_EXPORT struct pw_core_proxy * pw_remote_get_core_proxy(struct pw_remote *remote) { return remote->core_proxy; } +SPA_EXPORT struct pw_client_proxy * pw_remote_get_client_proxy(struct pw_remote *remote) { return remote->client_proxy; } +SPA_EXPORT struct pw_proxy *pw_remote_find_proxy(struct pw_remote *remote, uint32_t id) { return pw_map_lookup(&remote->objects, id); @@ -326,6 +338,7 @@ static void done_connect(void *data, int result) do_connect(remote); } +SPA_EXPORT int pw_remote_connect(struct pw_remote *remote) { int res; @@ -340,6 +353,7 @@ int pw_remote_connect(struct pw_remote *remote) return remote->state == PW_REMOTE_STATE_ERROR ? -EIO : 0; } +SPA_EXPORT int pw_remote_connect_fd(struct pw_remote *remote, int fd) { int res; @@ -355,6 +369,7 @@ int pw_remote_connect_fd(struct pw_remote *remote, int fd) return do_connect(remote); } +SPA_EXPORT int pw_remote_steal_fd(struct pw_remote *remote) { int fd; @@ -365,6 +380,7 @@ int pw_remote_steal_fd(struct pw_remote *remote) return fd; } +SPA_EXPORT int pw_remote_disconnect(struct pw_remote *remote) { struct pw_proxy *proxy; @@ -389,6 +405,7 @@ int pw_remote_disconnect(struct pw_remote *remote) return 0; } +SPA_EXPORT struct pw_proxy *pw_remote_export(struct pw_remote *remote, uint32_t type, struct pw_properties *props, void *object) { @@ -420,6 +437,7 @@ struct pw_proxy *pw_remote_export(struct pw_remote *remote, return NULL; } +SPA_EXPORT int pw_core_register_export_type(struct pw_core *core, struct pw_export_type *type) { pw_log_debug("Add export type %d/%s to core", type->type, diff --git a/src/pipewire/resource.c b/src/pipewire/resource.c index 6294d1aa..c1aba349 100644 --- a/src/pipewire/resource.c +++ b/src/pipewire/resource.c @@ -38,6 +38,7 @@ struct impl { }; /** \endcond */ +SPA_EXPORT struct pw_resource *pw_resource_new(struct pw_client *client, uint32_t id, uint32_t permissions, @@ -89,36 +90,43 @@ struct pw_resource *pw_resource_new(struct pw_client *client, return NULL; } +SPA_EXPORT struct pw_client *pw_resource_get_client(struct pw_resource *resource) { return resource->client; } +SPA_EXPORT uint32_t pw_resource_get_id(struct pw_resource *resource) { return resource->id; } +SPA_EXPORT uint32_t pw_resource_get_permissions(struct pw_resource *resource) { return resource->permissions; } +SPA_EXPORT uint32_t pw_resource_get_type(struct pw_resource *resource) { return resource->type; } +SPA_EXPORT struct pw_protocol *pw_resource_get_protocol(struct pw_resource *resource) { return resource->client->protocol; } +SPA_EXPORT void *pw_resource_get_user_data(struct pw_resource *resource) { return resource->user_data; } +SPA_EXPORT void pw_resource_add_listener(struct pw_resource *resource, struct spa_hook *listener, const struct pw_resource_events *events, @@ -127,6 +135,7 @@ void pw_resource_add_listener(struct pw_resource *resource, spa_hook_list_append(&resource->listener_list, listener, events, data); } +SPA_EXPORT void pw_resource_set_implementation(struct pw_resource *resource, const void *implementation, void *data) @@ -139,6 +148,7 @@ void pw_resource_set_implementation(struct pw_resource *resource, pw_client_events_resource_impl(client, resource); } +SPA_EXPORT void pw_resource_add_override(struct pw_resource *resource, struct spa_hook *listener, const void *implementation, @@ -147,22 +157,26 @@ void pw_resource_add_override(struct pw_resource *resource, spa_hook_list_prepend(&resource->implementation_list, listener, implementation, data); } +SPA_EXPORT struct spa_hook_list *pw_resource_get_implementation(struct pw_resource *resource) { return &resource->implementation_list; } +SPA_EXPORT const struct pw_protocol_marshal *pw_resource_get_marshal(struct pw_resource *resource) { return resource->marshal; } +SPA_EXPORT void pw_resource_error(struct pw_resource *resource, uint32_t id, int result, const char *error) { if (resource->client->core_resource) pw_core_resource_error(resource->client->core_resource, id, result, error); } +SPA_EXPORT void pw_resource_destroy(struct pw_resource *resource) { struct pw_client *client = resource->client; diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index e4cd4732..10d5260f 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -900,6 +900,7 @@ static const struct pw_remote_events remote_events = { .exported = on_remote_exported, }; +SPA_EXPORT struct pw_stream * pw_stream_new(struct pw_remote *remote, const char *name, struct pw_properties *props) { @@ -963,6 +964,7 @@ struct pw_stream * pw_stream_new(struct pw_remote *remote, const char *name, return NULL; } +SPA_EXPORT struct pw_stream * pw_stream_new_simple(struct pw_loop *loop, const char *name, @@ -997,6 +999,7 @@ pw_stream_new_simple(struct pw_loop *loop, return NULL; } +SPA_EXPORT const char *pw_stream_state_as_string(enum pw_stream_state state) { switch (state) { @@ -1018,6 +1021,7 @@ const char *pw_stream_state_as_string(enum pw_stream_state state) return "invalid-state"; } +SPA_EXPORT void pw_stream_destroy(struct pw_stream *stream) { struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this); @@ -1046,6 +1050,7 @@ void pw_stream_destroy(struct pw_stream *stream) free(impl); } +SPA_EXPORT void pw_stream_add_listener(struct pw_stream *stream, struct spa_hook *listener, const struct pw_stream_events *events, @@ -1054,6 +1059,7 @@ void pw_stream_add_listener(struct pw_stream *stream, spa_hook_list_append(&stream->listener_list, listener, events, data); } +SPA_EXPORT enum pw_stream_state pw_stream_get_state(struct pw_stream *stream, const char **error) { if (error) @@ -1061,16 +1067,19 @@ enum pw_stream_state pw_stream_get_state(struct pw_stream *stream, const char ** return stream->state; } +SPA_EXPORT const char *pw_stream_get_name(struct pw_stream *stream) { return stream->name; } +SPA_EXPORT const struct pw_properties *pw_stream_get_properties(struct pw_stream *stream) { return stream->properties; } +SPA_EXPORT int pw_stream_update_properties(struct pw_stream *stream, const struct spa_dict *dict) { struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this); @@ -1087,6 +1096,7 @@ int pw_stream_update_properties(struct pw_stream *stream, const struct spa_dict return res; } +SPA_EXPORT struct pw_remote *pw_stream_get_remote(struct pw_stream *stream) { return stream->remote; @@ -1116,6 +1126,7 @@ static void add_controls(struct pw_stream *stream) SPA_PARAM_IO_size, SPA_POD_Int(sizeof(struct spa_io_sequence)))); } +SPA_EXPORT int pw_stream_connect(struct pw_stream *stream, enum pw_direction direction, @@ -1166,11 +1177,13 @@ pw_stream_connect(struct pw_stream *stream, return res; } +SPA_EXPORT uint32_t pw_stream_get_node_id(struct pw_stream *stream) { return stream->node_id; } +SPA_EXPORT int pw_stream_disconnect(struct pw_stream *stream) { struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this); @@ -1191,6 +1204,7 @@ int pw_stream_disconnect(struct pw_stream *stream) return 0; } +SPA_EXPORT void pw_stream_finish_format(struct pw_stream *stream, int res, const struct spa_pod **params, @@ -1208,6 +1222,7 @@ void pw_stream_finish_format(struct pw_stream *stream, impl->pending_seq = SPA_ID_INVALID; } +SPA_EXPORT int pw_stream_set_control(struct pw_stream *stream, const char *name, float value) { @@ -1224,6 +1239,7 @@ int pw_stream_set_control(struct pw_stream *stream, return 0; } +SPA_EXPORT int pw_stream_get_control(struct pw_stream *stream, const char *name, float *value) { @@ -1238,6 +1254,7 @@ int pw_stream_get_control(struct pw_stream *stream, return 0; } +SPA_EXPORT int pw_stream_set_active(struct pw_stream *stream, bool active) { struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this); @@ -1246,6 +1263,7 @@ int pw_stream_set_active(struct pw_stream *stream, bool active) return 0; } +SPA_EXPORT int pw_stream_get_time(struct pw_stream *stream, struct pw_time *time) { struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this); @@ -1290,6 +1308,7 @@ static inline int call_trigger(struct stream *impl) return res; } +SPA_EXPORT struct pw_buffer *pw_stream_dequeue_buffer(struct pw_stream *stream) { struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this); @@ -1306,6 +1325,7 @@ struct pw_buffer *pw_stream_dequeue_buffer(struct pw_stream *stream) return &b->this; } +SPA_EXPORT int pw_stream_queue_buffer(struct pw_stream *stream, struct pw_buffer *buffer) { struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this); @@ -1340,6 +1360,7 @@ do_flush(struct spa_loop *loop, return 0; } +SPA_EXPORT int pw_stream_flush(struct pw_stream *stream, bool drain) { struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this); diff --git a/src/pipewire/thread-loop.c b/src/pipewire/thread-loop.c index d3f5234b..91beb004 100644 --- a/src/pipewire/thread-loop.c +++ b/src/pipewire/thread-loop.c @@ -101,6 +101,7 @@ do { \ * * \memberof pw_thread_loop */ +SPA_EXPORT struct pw_thread_loop *pw_thread_loop_new(struct pw_loop *loop, const char *name) { @@ -150,6 +151,7 @@ struct pw_thread_loop *pw_thread_loop_new(struct pw_loop *loop, } /** Destroy a threaded loop \memberof pw_thread_loop */ +SPA_EXPORT void pw_thread_loop_destroy(struct pw_thread_loop *loop) { pw_thread_loop_events_destroy(loop); @@ -168,6 +170,7 @@ void pw_thread_loop_destroy(struct pw_thread_loop *loop) free(loop); } +SPA_EXPORT void pw_thread_loop_add_listener(struct pw_thread_loop *loop, struct spa_hook *listener, const struct pw_thread_loop_events *events, @@ -176,6 +179,7 @@ void pw_thread_loop_add_listener(struct pw_thread_loop *loop, spa_hook_list_append(&loop->listener_list, listener, events, data); } +SPA_EXPORT struct pw_loop * pw_thread_loop_get_loop(struct pw_thread_loop *loop) { @@ -210,6 +214,7 @@ static void *do_loop(void *user_data) * * \memberof pw_thread_loop */ +SPA_EXPORT int pw_thread_loop_start(struct pw_thread_loop *loop) { if (!loop->running) { @@ -232,6 +237,7 @@ int pw_thread_loop_start(struct pw_thread_loop *loop) * * \memberof pw_thread_loop */ +SPA_EXPORT void pw_thread_loop_stop(struct pw_thread_loop *loop) { pw_log_debug("thread-loop: %p stopping", loop); @@ -252,6 +258,7 @@ void pw_thread_loop_stop(struct pw_thread_loop *loop) * * \memberof pw_thread_loop */ +SPA_EXPORT void pw_thread_loop_lock(struct pw_thread_loop *loop) { pthread_mutex_lock(&loop->lock); @@ -264,6 +271,7 @@ void pw_thread_loop_lock(struct pw_thread_loop *loop) * * \memberof pw_thread_loop */ +SPA_EXPORT void pw_thread_loop_unlock(struct pw_thread_loop *loop) { pw_log_trace("thread-loop: %p", loop); @@ -280,6 +288,7 @@ void pw_thread_loop_unlock(struct pw_thread_loop *loop) * * \memberof pw_thread_loop */ +SPA_EXPORT void pw_thread_loop_signal(struct pw_thread_loop *loop, bool wait_for_accept) { pw_log_trace("thread-loop: %p, waiting %d", loop, loop->n_waiting); @@ -300,6 +309,7 @@ void pw_thread_loop_signal(struct pw_thread_loop *loop, bool wait_for_accept) * * \memberof pw_thread_loop */ +SPA_EXPORT void pw_thread_loop_wait(struct pw_thread_loop *loop) { pw_log_trace("thread-loop: %p, waiting %d", loop, loop->n_waiting); @@ -318,6 +328,7 @@ void pw_thread_loop_wait(struct pw_thread_loop *loop) * * \memberof pw_thread_loop */ +SPA_EXPORT int pw_thread_loop_timed_wait(struct pw_thread_loop *loop, int wait_max_sec) { struct timespec timeout; @@ -339,6 +350,7 @@ int pw_thread_loop_timed_wait(struct pw_thread_loop *loop, int wait_max_sec) * * \memberof pw_thread_loop */ +SPA_EXPORT void pw_thread_loop_accept(struct pw_thread_loop *loop) { loop->n_waiting_for_accept--; @@ -352,6 +364,7 @@ void pw_thread_loop_accept(struct pw_thread_loop *loop) * * \memberof pw_thread_loop */ +SPA_EXPORT bool pw_thread_loop_in_thread(struct pw_thread_loop *loop) { return pthread_self() == loop->thread; diff --git a/src/pipewire/utils.c b/src/pipewire/utils.c index c6b18538..f15b88c6 100644 --- a/src/pipewire/utils.c +++ b/src/pipewire/utils.c @@ -41,6 +41,7 @@ * * \memberof pw_utils */ +SPA_EXPORT const char *pw_split_walk(const char *str, const char *delimiter, size_t * len, const char **state) { const char *s = *state ? *state : str; @@ -66,6 +67,7 @@ const char *pw_split_walk(const char *str, const char *delimiter, size_t * len, * * \memberof pw_utils */ +SPA_EXPORT char **pw_split_strv(const char *str, const char *delimiter, int max_tokens, int *n_tokens) { const char *state = NULL, *s = NULL; @@ -99,6 +101,7 @@ char **pw_split_strv(const char *str, const char *delimiter, int max_tokens, int * * \memberof pw_utils */ +SPA_EXPORT void pw_free_strv(char **str) { int i; @@ -117,6 +120,7 @@ void pw_free_strv(char **str) * * \memberof pw_utils */ +SPA_EXPORT char *pw_strip(char *str, const char *whitespace) { char *e, *l = NULL; |