context: move core implementation to impl-core.h

Move the core implementation to a separate file. Make a default
core object in the context.

Pass impl-core to server. We now tie the server to a core. Also
keep track of the core that a client connected to.

Fill the properties that we usually use to connect in the context
and copy them when a connection is made.

Use "internal" as the remote name to connect to the default
internal core.
This commit is contained in:
Wim Taymans 2019-12-12 16:34:01 +01:00
parent a1451fd820
commit f724319e8a
16 changed files with 839 additions and 613 deletions

View file

@ -95,10 +95,33 @@ struct protocol_compat_v2 {
struct pw_map types;
};
#define pw_impl_core_emit(s,m,v,...) spa_hook_list_call(&s->listener_list, struct pw_impl_core_events, m, v, ##__VA_ARGS__)
#define pw_impl_core_emit_destroy(s) pw_impl_core_emit(s, destroy, 0)
#define pw_impl_core_emit_free(s) pw_impl_core_emit(s, free, 0)
#define pw_impl_core_emit_initialized(s) pw_impl_core_emit(s, initialized, 0)
struct pw_impl_core {
struct pw_context *context;
struct spa_list link; /**< link in context object core_impl list */
struct pw_global *global; /**< global object created for this core */
struct spa_hook global_listener;
struct pw_properties *properties; /**< core properties */
struct pw_core_info info; /**< core info */
struct spa_hook_list listener_list;
void *user_data; /**< extra user data */
unsigned int registered:1;
};
struct pw_impl_client {
struct pw_impl_core *core; /**< core object */
struct pw_context *context; /**< context object */
struct spa_list link; /**< link in context object client list */
struct pw_global *global; /**< global object created for this client */
struct spa_list link; /**< link in context object client list */
struct pw_global *global; /**< global object created for this client */
struct spa_hook global_listener;
pw_permission_func_t permission_func; /**< get permissions of an object */
@ -201,10 +224,7 @@ pw_core_resource_errorf(struct pw_resource *resource, uint32_t id, int seq,
struct pw_context {
struct pw_global *global; /**< the global of the context */
struct spa_hook global_listener;
struct pw_core_info info; /**< info about the core */
struct pw_impl_core *core; /**< core object */
struct pw_properties *properties; /**< properties of the context */
@ -212,6 +232,7 @@ struct pw_context {
struct pw_map globals; /**< map of globals */
struct spa_list core_impl_list; /**< list of core_imp */
struct spa_list protocol_list; /**< list of protocols */
struct spa_list core_list; /**< list of core connections */
struct spa_list registry_resource_list; /**< list of registry resources */
@ -675,7 +696,7 @@ struct pw_impl_link {
struct pw_resource {
struct spa_interface impl; /**< object implementation */
struct pw_context *context; /**< the context object */
struct pw_context *context; /**< the context object */
struct spa_list link; /**< link in global resource_list */
struct pw_impl_client *client; /**< owner client */