pw_core -> pw_context

The proxy API is the one that we would like to expose for applications
and the other API is used internally when implementing modules or
factories.

The current pw_core object is really a context for all objects so
name it that way. It also makes it possible to rename pw_core_proxy
to pw_proxy later.
This commit is contained in:
Wim Taymans 2019-12-10 18:19:56 +01:00
parent 42103a8218
commit 8ea78c2e3f
113 changed files with 905 additions and 906 deletions

View file

@ -539,7 +539,7 @@ static const struct sm_object_events device_events = {
static struct device *alsa_create_device(struct impl *impl, uint32_t id,
const struct spa_device_object_info *info)
{
struct pw_core *core = impl->session->core;
struct pw_context *context = impl->session->context;
struct device *device;
struct spa_handle *handle;
int res;
@ -553,7 +553,7 @@ static struct device *alsa_create_device(struct impl *impl, uint32_t id,
return NULL;
}
handle = pw_core_load_spa_handle(core,
handle = pw_context_load_spa_handle(context,
info->factory_name,
info->props);
if (handle == NULL) {
@ -700,7 +700,7 @@ static int alsa_start_jack_device(struct impl *impl)
void *sm_alsa_monitor_start(struct sm_media_session *session)
{
struct pw_core *core = session->core;
struct pw_context *context = session->context;
struct impl *impl;
void *iface;
int res;
@ -718,7 +718,7 @@ void *sm_alsa_monitor_start(struct sm_media_session *session)
else
pw_log_debug("got dbus connection %p", impl->conn);
impl->handle = pw_core_load_spa_handle(core, SPA_NAME_API_ALSA_ENUM_UDEV, NULL);
impl->handle = pw_context_load_spa_handle(context, SPA_NAME_API_ALSA_ENUM_UDEV, NULL);
if (impl->handle == NULL) {
res = -errno;
goto out_free;

View file

@ -105,7 +105,7 @@ static struct bluez5_node *bluez5_create_node(struct bluez5_object *obj, uint32_
{
struct bluez5_node *node;
struct impl *impl = obj->impl;
struct pw_core *core = impl->session->core;
struct pw_context *context = impl->session->context;
struct pw_factory *factory;
int res;
const char *str;
@ -142,7 +142,7 @@ static struct bluez5_node *bluez5_create_node(struct bluez5_object *obj, uint32_
node->object = obj;
node->id = id;
factory = pw_core_find_factory(core, "adapter");
factory = pw_context_find_factory(context, "adapter");
if (factory == NULL) {
pw_log_error("no adapter factory found");
res = -EIO;
@ -236,7 +236,7 @@ static void bluez5_update_object(struct impl *impl, struct bluez5_object *obj,
static struct bluez5_object *bluez5_create_object(struct impl *impl, uint32_t id,
const struct spa_device_object_info *info)
{
struct pw_core *core = impl->session->core;
struct pw_context *context = impl->session->context;
struct bluez5_object *obj;
struct spa_handle *handle;
int res;
@ -249,7 +249,7 @@ static struct bluez5_object *bluez5_create_object(struct impl *impl, uint32_t id
return NULL;
}
handle = pw_core_load_spa_handle(core,
handle = pw_context_load_spa_handle(context,
info->factory_name,
info->props);
if (handle == NULL) {
@ -346,12 +346,12 @@ static const struct spa_device_events bluez5_enum_callbacks =
void *sm_bluez5_monitor_start(struct sm_media_session *session)
{
struct spa_handle *handle;
struct pw_core *core = session->core;
struct pw_context *context = session->context;
int res;
void *iface;
struct impl *impl;
handle = pw_core_load_spa_handle(core, SPA_NAME_API_BLUEZ5_ENUM_DBUS, NULL);
handle = pw_context_load_spa_handle(context, SPA_NAME_API_BLUEZ5_ENUM_DBUS, NULL);
if (handle == NULL) {
res = -errno;
goto out;

View file

@ -1523,7 +1523,7 @@ static const struct pw_proxy_events client_session_proxy_events = {
static int start_session(struct impl *impl)
{
impl->monitor_core = pw_core_connect(impl->this.core, NULL, 0);
impl->monitor_core = pw_context_connect(impl->this.context, NULL, 0);
if (impl->monitor_core == NULL) {
pw_log_error("can't start monitor: %m");
return -errno;
@ -1579,14 +1579,14 @@ static void core_error(void *data, uint32_t id, int seq, int res, const char *me
static const struct pw_core_proxy_events core_events = {
PW_VERSION_CORE_EVENTS,
PW_VERSION_CORE_PROXY_EVENTS,
.done = core_done,
.error = core_error
};
static int start_policy(struct impl *impl)
{
impl->policy_core = pw_core_connect(impl->this.core, NULL, 0);
impl->policy_core = pw_context_connect(impl->this.context, NULL, 0);
if (impl->policy_core == NULL) {
pw_log_error("can't start policy: %m");
return -errno;
@ -1614,11 +1614,11 @@ int main(int argc, char *argv[])
impl.loop = pw_main_loop_new(NULL);
impl.this.loop = pw_main_loop_get_loop(impl.loop);
impl.this.core = pw_core_new(impl.this.loop, NULL, 0);
impl.this.context = pw_context_new(impl.this.loop, NULL, 0);
pw_core_add_spa_lib(impl.this.core, "api.bluez5.*", "bluez5/libspa-bluez5");
pw_core_add_spa_lib(impl.this.core, "api.alsa.*", "alsa/libspa-alsa");
pw_core_add_spa_lib(impl.this.core, "api.v4l2.*", "v4l2/libspa-v4l2");
pw_context_add_spa_lib(impl.this.context, "api.bluez5.*", "bluez5/libspa-bluez5");
pw_context_add_spa_lib(impl.this.context, "api.alsa.*", "alsa/libspa-alsa");
pw_context_add_spa_lib(impl.this.context, "api.v4l2.*", "v4l2/libspa-v4l2");
pw_map_init(&impl.globals, 64, 64);
spa_list_init(&impl.global_list);
@ -1627,7 +1627,7 @@ int main(int argc, char *argv[])
spa_list_init(&impl.sync_list);
spa_hook_list_init(&impl.hooks);
support = pw_core_get_support(impl.this.core, &n_support);
support = pw_context_get_support(impl.this.context, &n_support);
impl.dbus = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DBus);
if (impl.dbus)
@ -1644,7 +1644,7 @@ int main(int argc, char *argv[])
pw_main_loop_run(impl.loop);
pw_core_destroy(impl.this.core);
pw_context_destroy(impl.this.context);
pw_main_loop_destroy(impl.loop);
return 0;

View file

@ -198,7 +198,7 @@ struct sm_media_session {
struct sm_session *session; /** session object managed by this session */
struct pw_loop *loop; /** the main loop */
struct pw_core *core;
struct pw_context *context;
struct spa_dbus_connection *dbus_connection;
};

View file

@ -56,7 +56,7 @@ struct impl {
struct sm_media_session *session;
struct spa_hook listener;
struct pw_core *core;
struct pw_context *context;
struct spa_list endpoint_list;
int seq;
@ -474,6 +474,9 @@ static int rescan_endpoint(struct impl *impl, struct endpoint *ep)
peer = sm_object_get_data(obj, SESSION_KEY);
goto do_link;
}
if (obj->type == PW_TYPE_INTERFACE_Node) {
pw_log_debug(NAME " %p: target is node", impl);
}
}
else {
str = spa_dict_lookup(props, PW_KEY_NODE_DONT_RECONNECT);
@ -542,7 +545,7 @@ void *sm_policy_ep_start(struct sm_media_session *session)
return NULL;
impl->session = session;
impl->core = session->core;
impl->context = session->context;
spa_list_init(&impl->endpoint_list);

View file

@ -261,7 +261,7 @@ static int v4l2_update_device_props(struct v4l2_object *obj)
static struct v4l2_object *v4l2_create_object(struct impl *impl, uint32_t id,
const struct spa_device_object_info *info)
{
struct pw_core *core = impl->session->core;
struct pw_context *context = impl->session->context;
struct v4l2_object *obj;
struct spa_handle *handle;
int res;
@ -274,7 +274,7 @@ static struct v4l2_object *v4l2_create_object(struct impl *impl, uint32_t id,
return NULL;
}
handle = pw_core_load_spa_handle(core,
handle = pw_context_load_spa_handle(context,
info->factory_name,
info->props);
if (handle == NULL) {
@ -364,7 +364,7 @@ static const struct spa_device_events v4l2_udev_callbacks =
void * sm_v4l2_monitor_start(struct sm_media_session *sess)
{
struct pw_core *core = sess->core;
struct pw_context *context = sess->context;
struct impl *impl;
int res;
void *iface;
@ -375,7 +375,7 @@ void * sm_v4l2_monitor_start(struct sm_media_session *sess)
impl->session = sess;
impl->handle = pw_core_load_spa_handle(core, SPA_NAME_API_V4L2_ENUM_UDEV, NULL);
impl->handle = pw_context_load_spa_handle(context, SPA_NAME_API_V4L2_ENUM_UDEV, NULL);
if (impl->handle == NULL) {
res = -errno;
goto out_free;