pw_device -> pw_impl_device

This commit is contained in:
Wim Taymans 2019-12-11 11:34:02 +01:00
parent 95688939bf
commit 73900eea1b
12 changed files with 112 additions and 258 deletions

View file

@ -59,7 +59,7 @@ struct factory_data {
struct device_data {
struct spa_list link;
struct pw_device *device;
struct pw_impl_device *device;
struct spa_hook device_listener;
};
@ -70,8 +70,8 @@ static void device_destroy(void *data)
spa_hook_remove(&nd->device_listener);
}
static const struct pw_device_events device_events = {
PW_VERSION_DEVICE_EVENTS,
static const struct pw_impl_device_events device_events = {
PW_VERSION_IMPL_DEVICE_EVENTS,
.destroy = device_destroy,
};
@ -84,7 +84,7 @@ static void *create_object(void *_data,
{
struct factory_data *data = _data;
struct pw_context *context = data->context;
struct pw_device *device;
struct pw_impl_device *device;
const char *factory_name;
struct device_data *nd;
struct pw_impl_client *client;
@ -121,10 +121,10 @@ static void *create_object(void *_data,
nd->device = device;
spa_list_append(&data->device_list, &nd->link);
pw_device_add_listener(device, &nd->device_listener, &device_events, nd);
pw_impl_device_add_listener(device, &nd->device_listener, &device_events, nd);
if (client) {
pw_global_bind(pw_device_get_global(device),
pw_global_bind(pw_impl_device_get_global(device),
client,
PW_PERM_RWX, version,
new_id);
@ -160,7 +160,7 @@ static void factory_destroy(void *_data)
spa_hook_remove(&data->module_listener);
spa_list_consume(nd, &data->device_list, link)
pw_device_destroy(nd->device);
pw_impl_device_destroy(nd->device);
}
static const struct pw_factory_events factory_events = {

View file

@ -43,7 +43,7 @@ static const struct spa_dict_item module_props[] = {
};
struct device_data {
struct pw_device *this;
struct pw_impl_device *this;
struct pw_context *context;
struct spa_hook module_listener;
@ -55,7 +55,7 @@ static void module_destroy(void *_data)
spa_hook_remove(&data->module_listener);
pw_device_destroy(data->this);
pw_impl_device_destroy(data->this);
}
static const struct pw_module_events module_events = {
@ -70,7 +70,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
char **argv = NULL;
int n_tokens;
struct pw_context *context = pw_module_get_context(module);
struct pw_device *device;
struct pw_impl_device *device;
struct device_data *data;
int res;

View file

@ -38,7 +38,7 @@
#include "pipewire/private.h"
struct impl {
struct pw_device *this;
struct pw_impl_device *this;
enum pw_spa_device_flags flags;
@ -54,7 +54,7 @@ struct impl {
static void device_destroy(void *data)
{
struct impl *impl = data;
struct pw_device *device = impl->this;
struct pw_impl_device *device = impl->this;
pw_log_debug("spa-device %p: free", device);
@ -63,12 +63,12 @@ static void device_destroy(void *data)
pw_unload_spa_handle(impl->handle);
}
static const struct pw_device_events device_events = {
PW_VERSION_DEVICE_EVENTS,
static const struct pw_impl_device_events device_events = {
PW_VERSION_IMPL_DEVICE_EVENTS,
.destroy = device_destroy,
};
struct pw_device *
struct pw_impl_device *
pw_spa_device_new(struct pw_context *context,
enum pw_spa_device_flags flags,
struct spa_device *device,
@ -76,11 +76,11 @@ pw_spa_device_new(struct pw_context *context,
struct pw_properties *properties,
size_t user_data_size)
{
struct pw_device *this;
struct pw_impl_device *this;
struct impl *impl;
int res;
this = pw_device_new(context, properties, sizeof(struct impl) + user_data_size);
this = pw_impl_device_new(context, properties, sizeof(struct impl) + user_data_size);
if (this == NULL)
return NULL;
@ -93,34 +93,34 @@ pw_spa_device_new(struct pw_context *context,
if (user_data_size > 0)
impl->user_data = SPA_MEMBER(impl, sizeof(struct impl), void);
pw_device_add_listener(this, &impl->device_listener, &device_events, impl);
pw_device_set_implementation(this, impl->device);
pw_impl_device_add_listener(this, &impl->device_listener, &device_events, impl);
pw_impl_device_set_implementation(this, impl->device);
if (!SPA_FLAG_IS_SET(impl->flags, PW_SPA_DEVICE_FLAG_NO_REGISTER)) {
if ((res = pw_device_register(this, NULL)) < 0)
if ((res = pw_impl_device_register(this, NULL)) < 0)
goto error_register;
}
return this;
error_register:
pw_device_destroy(this);
pw_impl_device_destroy(this);
errno = -res;
return NULL;
}
void *pw_spa_device_get_user_data(struct pw_device *device)
void *pw_spa_device_get_user_data(struct pw_impl_device *device)
{
struct impl *impl = device->user_data;
return impl->user_data;
}
struct pw_device *pw_spa_device_load(struct pw_context *context,
struct pw_impl_device *pw_spa_device_load(struct pw_context *context,
const char *factory_name,
enum pw_spa_device_flags flags,
struct pw_properties *properties,
size_t user_data_size)
{
struct pw_device *this;
struct pw_impl_device *this;
struct spa_handle *handle;
void *iface;
int res;

View file

@ -38,7 +38,7 @@ enum pw_spa_device_flags {
PW_SPA_DEVICE_FLAG_NO_REGISTER = (1 << 1),
};
struct pw_device *
struct pw_impl_device *
pw_spa_device_new(struct pw_context *context,
enum pw_spa_device_flags flags,
struct spa_device *device,
@ -46,14 +46,14 @@ pw_spa_device_new(struct pw_context *context,
struct pw_properties *properties,
size_t user_data_size);
struct pw_device *
struct pw_impl_device *
pw_spa_device_load(struct pw_context *context,
const char *factory_name,
enum pw_spa_device_flags flags,
struct pw_properties *properties,
size_t user_data_size);
void *pw_spa_device_get_user_data(struct pw_device *device);
void *pw_spa_device_get_user_data(struct pw_impl_device *device);
#ifdef __cplusplus
}