core: move export function to core.h

This commit is contained in:
Wim Taymans 2019-12-05 10:54:47 +01:00
parent 2474f9ae7d
commit dd2fa2caee
4 changed files with 37 additions and 32 deletions

View file

@ -1288,3 +1288,23 @@ struct spa_handle *pw_core_load_spa_handle(struct pw_core *core,
return handle; return handle;
} }
SPA_EXPORT
int pw_core_register_export_type(struct pw_core *core, struct pw_export_type *type)
{
pw_log_debug("core %p: Add export type %d/%s to core", core, type->type,
spa_debug_type_find_name(pw_type_info(), type->type));
spa_list_append(&core->export_list, &type->link);
return 0;
}
SPA_EXPORT
const struct pw_export_type *pw_core_find_export_type(struct pw_core *core, uint32_t type)
{
const struct pw_export_type *t;
spa_list_for_each(t, &core->export_list, link) {
if (t->type == type)
return t;
}
return NULL;
}

View file

@ -44,6 +44,7 @@ struct pw_core;
#include <pipewire/client.h> #include <pipewire/client.h>
#include <pipewire/introspect.h> #include <pipewire/introspect.h>
#include <pipewire/remote.h>
#include <pipewire/global.h> #include <pipewire/global.h>
#include <pipewire/loop.h> #include <pipewire/loop.h>
#include <pipewire/factory.h> #include <pipewire/factory.h>
@ -157,6 +158,22 @@ struct spa_handle *pw_core_load_spa_handle(struct pw_core *core,
const char *factory_name, const char *factory_name,
const struct spa_dict *info); const struct spa_dict *info);
/** data for registering export functions */
struct pw_export_type {
struct spa_list link;
uint32_t type;
struct pw_proxy * (*func) (struct pw_remote *remote,
uint32_t type, struct pw_properties *properties, void *object,
size_t user_data_size);
};
/** register a type that can be exported on a core_proxy. This is usually used by
* extension modules */
int pw_core_register_export_type(struct pw_core *core, struct pw_export_type *type);
/** find information about registered export type */
const struct pw_export_type *pw_core_find_export_type(struct pw_core *core, uint32_t type);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -581,22 +581,3 @@ exit:
errno = -res; errno = -res;
return NULL; return NULL;
} }
SPA_EXPORT
int pw_core_register_export_type(struct pw_core *core, struct pw_export_type *type)
{
pw_log_debug("core %p: Add export type %d/%s to core", core, type->type,
spa_debug_type_find_name(pw_type_info(), type->type));
spa_list_append(&core->export_list, &type->link);
return 0;
}
const struct pw_export_type *pw_core_find_export_type(struct pw_core *core, uint32_t type)
{
const struct pw_export_type *t;
spa_list_for_each(t, &core->export_list, link) {
if (t->type == type)
return t;
}
return NULL;
}

View file

@ -203,19 +203,6 @@ struct pw_proxy *pw_remote_export(struct pw_remote *remote, /**< the remote */
void *object, /**< object to export */ void *object, /**< object to export */
size_t user_data_size /**< extra user data */); size_t user_data_size /**< extra user data */);
/** data for registering export functions */
struct pw_export_type {
struct spa_list link;
uint32_t type;
struct pw_proxy * (*func) (struct pw_remote *remote,
uint32_t type, struct pw_properties *properties, void *object,
size_t user_data_size);
};
/** register a type that can be exported on a remote. This is usually used by
* extension modules */
int pw_core_register_export_type(struct pw_core *core, struct pw_export_type *type);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif