mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
avoid including private.h
Expose some more methods to make it possible to build without including the private.h header, especially in modules.
This commit is contained in:
parent
8e6a5a1714
commit
df519ee3b3
43 changed files with 349 additions and 372 deletions
|
|
@ -31,9 +31,9 @@
|
|||
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/utils/hook.h>
|
||||
#include <spa/utils/result.h>
|
||||
|
||||
#include <pipewire/impl.h>
|
||||
#include "pipewire/private.h"
|
||||
|
||||
#include "modules/spa/spa-node.h"
|
||||
#include "module-adapter/adapter.h"
|
||||
|
|
@ -153,13 +153,14 @@ static void *create_object(void *_data,
|
|||
if (properties == NULL)
|
||||
goto error_properties;
|
||||
|
||||
pw_properties_setf(properties, PW_KEY_FACTORY_ID, "%d", d->this->global->id);
|
||||
pw_properties_setf(properties, PW_KEY_FACTORY_ID, "%d",
|
||||
pw_impl_factory_get_info(d->this)->id);
|
||||
|
||||
client = resource ? pw_resource_get_client(resource): NULL;
|
||||
|
||||
if (client) {
|
||||
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d",
|
||||
client->global->id);
|
||||
pw_impl_client_get_info(client)->id);
|
||||
}
|
||||
|
||||
slave = NULL;
|
||||
|
|
@ -265,7 +266,7 @@ static void module_registered(void *data)
|
|||
char id[16];
|
||||
int res;
|
||||
|
||||
snprintf(id, sizeof(id), "%d", module->global->id);
|
||||
snprintf(id, sizeof(id), "%d", pw_impl_module_get_info(module)->id);
|
||||
items[0] = SPA_DICT_ITEM_INIT(PW_KEY_MODULE_ID, id);
|
||||
pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1));
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@
|
|||
#include <spa/debug/types.h>
|
||||
|
||||
#include "pipewire/pipewire.h"
|
||||
#include "pipewire/private.h"
|
||||
|
||||
#include "modules/spa/spa-node.h"
|
||||
|
||||
|
|
@ -123,7 +122,7 @@ static void node_port_init(void *data, struct pw_impl_port *port)
|
|||
|
||||
if ((str = pw_properties_get(old, PW_KEY_AUDIO_CHANNEL)) == NULL ||
|
||||
strcmp(str, "UNK") == 0) {
|
||||
snprintf(position, 7, "%d", port->port_id);
|
||||
snprintf(position, 7, "%d", pw_impl_port_get_id(port));
|
||||
str = position;
|
||||
}
|
||||
if (direction == n->direction) {
|
||||
|
|
@ -139,7 +138,7 @@ static void node_port_init(void *data, struct pw_impl_port *port)
|
|||
node_name = "node";
|
||||
}
|
||||
pw_properties_setf(new, PW_KEY_OBJECT_PATH, "%s:%s_%d",
|
||||
path ? path : node_name, prefix, port->port_id);
|
||||
path ? path : node_name, prefix, pw_impl_port_get_id(port));
|
||||
|
||||
pw_properties_setf(new, PW_KEY_PORT_NAME, "%s_%s", prefix, str);
|
||||
pw_properties_setf(new, PW_KEY_PORT_ALIAS, "%s:%s_%s",
|
||||
|
|
@ -166,7 +165,7 @@ static int find_format(struct pw_impl_node *node, enum pw_direction direction,
|
|||
struct spa_pod *format;
|
||||
|
||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||
if ((res = spa_node_port_enum_params_sync(node->node,
|
||||
if ((res = spa_node_port_enum_params_sync(pw_impl_node_get_implementation(node),
|
||||
direction == PW_DIRECTION_INPUT ?
|
||||
SPA_DIRECTION_INPUT :
|
||||
SPA_DIRECTION_OUTPUT, 0,
|
||||
|
|
@ -236,7 +235,8 @@ struct pw_impl_node *pw_adapter_new(struct pw_context *context,
|
|||
goto error;
|
||||
|
||||
if (media_type == SPA_MEDIA_TYPE_audio) {
|
||||
pw_properties_setf(props, "audio.adapt.slave", "pointer:%p", slave->node);
|
||||
pw_properties_setf(props, "audio.adapt.slave", "pointer:%p",
|
||||
pw_impl_node_get_implementation(slave));
|
||||
pw_properties_set(props, SPA_KEY_LIBRARY_NAME, "audioconvert/libspa-audioconvert");
|
||||
if (pw_properties_get(props, PW_KEY_MEDIA_CLASS) == NULL)
|
||||
pw_properties_setf(props, PW_KEY_MEDIA_CLASS, "Audio/%s",
|
||||
|
|
@ -244,7 +244,8 @@ struct pw_impl_node *pw_adapter_new(struct pw_context *context,
|
|||
factory_name = SPA_NAME_AUDIO_ADAPT;
|
||||
}
|
||||
else if (media_type == SPA_MEDIA_TYPE_video) {
|
||||
pw_properties_setf(props, "video.adapt.slave", "pointer:%p", slave->node);
|
||||
pw_properties_setf(props, "video.adapt.slave", "pointer:%p",
|
||||
pw_impl_node_get_implementation(slave));
|
||||
pw_properties_set(props, SPA_KEY_LIBRARY_NAME, "videoconvert/libspa-videoconvert");
|
||||
if (pw_properties_get(props, PW_KEY_MEDIA_CLASS) == NULL)
|
||||
pw_properties_setf(props, PW_KEY_MEDIA_CLASS, "Video/%s",
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
#include <spa/monitor/device.h>
|
||||
|
||||
#include "pipewire/pipewire.h"
|
||||
#include "pipewire/private.h"
|
||||
|
||||
struct device_data {
|
||||
struct spa_device *device;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
#include <spa/debug/types.h>
|
||||
|
||||
#include <pipewire/impl.h>
|
||||
#include "pipewire/private.h"
|
||||
|
||||
struct impl {
|
||||
struct pw_context *context;
|
||||
|
|
@ -102,9 +101,10 @@ static void device_initialized(void *data)
|
|||
struct impl *impl = data;
|
||||
struct pw_impl_device *device = impl->device;
|
||||
struct pw_global *global = pw_impl_device_get_global(device);
|
||||
uint32_t id = pw_global_get_id(global);
|
||||
|
||||
pw_log_debug("client-device %p: initialized global:%d", impl, global->id);
|
||||
pw_resource_set_bound_id(impl->resource, global->id);
|
||||
pw_log_debug("client-device %p: initialized global:%d", impl, id);
|
||||
pw_resource_set_bound_id(impl->resource, id);
|
||||
}
|
||||
|
||||
static const struct pw_impl_device_events device_events = {
|
||||
|
|
@ -126,7 +126,8 @@ struct pw_impl_device *pw_client_device_new(struct pw_resource *resource,
|
|||
if (properties == NULL)
|
||||
return NULL;
|
||||
|
||||
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d", client->global->id);
|
||||
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d",
|
||||
pw_impl_client_get_info(client)->id);
|
||||
|
||||
device = pw_context_create_device(context, properties, sizeof(struct impl));
|
||||
if (device == NULL)
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include <spa/pod/parser.h>
|
||||
#include <spa/node/utils.h>
|
||||
#include <spa/utils/result.h>
|
||||
#include <spa/debug/types.h>
|
||||
|
||||
#include "pipewire/pipewire.h"
|
||||
|
|
|
|||
|
|
@ -20,9 +20,10 @@
|
|||
#include <errno.h>
|
||||
|
||||
#include <spa/pod/parser.h>
|
||||
#include <spa/pod/builder.h>
|
||||
#include <spa/utils/type-info.h>
|
||||
|
||||
#include "pipewire/impl.h"
|
||||
#include "pipewire/private.h"
|
||||
|
||||
#include "extensions/protocol-native.h"
|
||||
|
||||
|
|
@ -45,6 +46,7 @@ client_node_marshal_add_mem(void *object,
|
|||
int memfd, uint32_t flags)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct pw_impl_client *client = pw_resource_get_client(resource);
|
||||
struct spa_pod_builder *b;
|
||||
const char *typename;
|
||||
|
||||
|
|
@ -64,7 +66,7 @@ client_node_marshal_add_mem(void *object,
|
|||
|
||||
spa_pod_builder_add_struct(b,
|
||||
"i", mem_id,
|
||||
"I", pw_protocol_native0_find_type(resource->client, typename),
|
||||
"I", pw_protocol_native0_find_type(client, typename),
|
||||
"i", pw_protocol_native_add_resource_fd(resource, memfd),
|
||||
"i", flags);
|
||||
|
||||
|
|
@ -127,7 +129,7 @@ static void
|
|||
client_node_marshal_command(void *object, uint32_t seq, const struct spa_command *command)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct pw_impl_client *client = resource->client;
|
||||
struct pw_impl_client *client = pw_resource_get_client(resource);
|
||||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
|
|
@ -185,7 +187,7 @@ client_node_marshal_port_set_param(void *object,
|
|||
const struct spa_pod *param)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct pw_impl_client *client = resource->client;
|
||||
struct pw_impl_client *client = pw_resource_get_client(resource);
|
||||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
const char *typename;
|
||||
|
|
@ -224,7 +226,7 @@ client_node_marshal_port_use_buffers(void *object,
|
|||
uint32_t n_buffers, struct pw_client_node0_buffer *buffers)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct pw_impl_client *client = resource->client;
|
||||
struct pw_impl_client *client = pw_resource_get_client(resource);
|
||||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
uint32_t i, j;
|
||||
|
|
@ -277,7 +279,7 @@ client_node_marshal_port_command(void *object,
|
|||
const struct spa_command *command)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct pw_impl_client *client = resource->client;
|
||||
struct pw_impl_client *client = pw_resource_get_client(resource);
|
||||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
|
|
|
|||
|
|
@ -29,8 +29,9 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <spa/utils/result.h>
|
||||
|
||||
#include <pipewire/impl.h>
|
||||
#include "pipewire/private.h"
|
||||
|
||||
#define NAME "link-factory"
|
||||
|
||||
|
|
@ -145,6 +146,7 @@ static const struct pw_impl_link_events link_events = {
|
|||
static struct pw_impl_port *get_port(struct pw_impl_node *node, enum spa_direction direction)
|
||||
{
|
||||
struct pw_impl_port *p;
|
||||
struct pw_context *context = pw_impl_node_get_context(node);
|
||||
int res;
|
||||
|
||||
p = pw_impl_node_find_port(node, direction, SPA_ID_INVALID);
|
||||
|
|
@ -156,7 +158,7 @@ static struct pw_impl_port *get_port(struct pw_impl_node *node, enum spa_directi
|
|||
if (port_id == SPA_ID_INVALID)
|
||||
return NULL;
|
||||
|
||||
p = pw_context_create_port(node->context, direction, port_id, NULL, 0);
|
||||
p = pw_context_create_port(context, direction, port_id, NULL, 0);
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
|
||||
|
|
@ -253,9 +255,11 @@ static void *create_object(void *_data,
|
|||
str = pw_properties_get(properties, PW_KEY_OBJECT_LINGER);
|
||||
linger = str ? pw_properties_parse_bool(str) : false;
|
||||
|
||||
pw_properties_setf(properties, PW_KEY_FACTORY_ID, "%d", d->this->global->id);
|
||||
pw_properties_setf(properties, PW_KEY_FACTORY_ID, "%d",
|
||||
pw_impl_factory_get_info(d->this)->id);
|
||||
if (!linger)
|
||||
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d", client->global->id);
|
||||
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d",
|
||||
pw_impl_client_get_info(client)->id);
|
||||
|
||||
|
||||
link = pw_context_create_link(context, outport, inport, NULL, properties, sizeof(struct link_data));
|
||||
|
|
|
|||
|
|
@ -22,8 +22,7 @@
|
|||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <pipewire/pipewire.h>
|
||||
#include "pipewire/private.h"
|
||||
#include <pipewire/impl.h>
|
||||
|
||||
#include <extensions/metadata.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
#include <spa/pod/parser.h>
|
||||
|
||||
#include "pipewire/pipewire.h"
|
||||
#include "pipewire/private.h"
|
||||
#include "extensions/metadata.h"
|
||||
|
||||
struct object_data {
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include <sys/file.h>
|
||||
|
||||
#include <spa/pod/iter.h>
|
||||
#include <spa/utils/result.h>
|
||||
#include <spa/debug/pod.h>
|
||||
#include <spa/debug/types.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -31,9 +31,10 @@
|
|||
#include <sys/socket.h>
|
||||
|
||||
#include <spa/debug/pod.h>
|
||||
#include <spa/utils/result.h>
|
||||
#include <spa/pod/builder.h>
|
||||
|
||||
#include <pipewire/pipewire.h>
|
||||
#include "pipewire/private.h"
|
||||
|
||||
#include "connection.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include <errno.h>
|
||||
|
||||
#include "spa/pod/parser.h"
|
||||
#include "spa/pod/builder.h"
|
||||
#include "spa/debug/pod.h"
|
||||
|
||||
#include "pipewire/pipewire.h"
|
||||
|
|
@ -169,6 +170,7 @@ static void core_marshal_remove_id(void *object, uint32_t id)
|
|||
static int core_demarshal_client_update(void *object, const struct pw_protocol_native_message *msg)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct pw_impl_client *client = pw_resource_get_client(resource);
|
||||
struct spa_dict props;
|
||||
struct spa_pod_parser prs;
|
||||
struct spa_pod_frame f;
|
||||
|
|
@ -188,7 +190,7 @@ static int core_demarshal_client_update(void *object, const struct pw_protocol_n
|
|||
NULL) < 0)
|
||||
return -EINVAL;
|
||||
}
|
||||
pw_impl_client_update_properties(resource->client, &props);
|
||||
pw_impl_client_update_properties(client, &props);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -727,7 +729,7 @@ static void registry_marshal_global(void *object, uint32_t id, uint32_t permissi
|
|||
const char *type, uint32_t version, const struct spa_dict *props)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct pw_impl_client *client = resource->client;
|
||||
struct pw_impl_client *client = pw_resource_get_client(resource);
|
||||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
uint32_t i, n_items, parent_id;
|
||||
|
|
@ -775,6 +777,7 @@ static void registry_marshal_global_remove(void *object, uint32_t id)
|
|||
static int registry_demarshal_bind(void *object, const struct pw_protocol_native_message *msg)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct pw_impl_client *client = pw_resource_get_client(resource);
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t id, version, type, new_id;
|
||||
const char *type_name;
|
||||
|
|
@ -787,7 +790,7 @@ static int registry_demarshal_bind(void *object, const struct pw_protocol_native
|
|||
"i", &new_id) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
type_name = pw_protocol_native0_name_from_v2(resource->client, type);
|
||||
type_name = pw_protocol_native0_name_from_v2(client, type);
|
||||
if (type_name == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
|
|
@ -827,7 +830,7 @@ static void module_marshal_info(void *object, const struct pw_module_info *info)
|
|||
static void factory_marshal_info(void *object, const struct pw_factory_info *info)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct pw_impl_client *client = resource->client;
|
||||
struct pw_impl_client *client = pw_resource_get_client(resource);
|
||||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
uint32_t i, n_items, type, version;
|
||||
|
|
@ -908,7 +911,7 @@ static void node_marshal_param(void *object, int seq, uint32_t id, uint32_t inde
|
|||
static int node_demarshal_enum_params(void *object, const struct pw_protocol_native_message *msg)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct pw_impl_client *client = resource->client;
|
||||
struct pw_impl_client *client = pw_resource_get_client(resource);
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t id, index, num;
|
||||
struct spa_pod *filter;
|
||||
|
|
@ -960,7 +963,7 @@ static void port_marshal_param(void *object, int seq, uint32_t id, uint32_t inde
|
|||
const struct spa_pod *param)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct pw_impl_client *client = resource->client;
|
||||
struct pw_impl_client *client = pw_resource_get_client(resource);
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_PORT_V0_EVENT_PARAM, NULL);
|
||||
|
|
@ -975,7 +978,7 @@ static void port_marshal_param(void *object, int seq, uint32_t id, uint32_t inde
|
|||
static int port_demarshal_enum_params(void *object, const struct pw_protocol_native_message *msg)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct pw_impl_client *client = resource->client;
|
||||
struct pw_impl_client *client = pw_resource_get_client(resource);
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t id, index, num;
|
||||
struct spa_pod *filter;
|
||||
|
|
|
|||
|
|
@ -26,15 +26,15 @@
|
|||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <spa/utils/result.h>
|
||||
#include <pipewire/impl.h>
|
||||
|
||||
#include <extensions/session-manager.h>
|
||||
|
||||
#include "client-endpoint.h"
|
||||
#include "endpoint.h"
|
||||
#include "endpoint-stream.h"
|
||||
|
||||
#include <pipewire/private.h>
|
||||
|
||||
#define NAME "client-endpoint"
|
||||
|
||||
struct factory_data {
|
||||
|
|
@ -184,8 +184,10 @@ static void *create_object(void *data,
|
|||
if (!properties)
|
||||
goto no_mem;
|
||||
|
||||
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d", owner->global->id);
|
||||
pw_properties_setf(properties, PW_KEY_FACTORY_ID, "%d", factory->global->id);
|
||||
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d",
|
||||
pw_impl_client_get_info(owner)->id);
|
||||
pw_properties_setf(properties, PW_KEY_FACTORY_ID, "%d",
|
||||
pw_impl_factory_get_info(factory)->id);
|
||||
|
||||
this->resource = pw_resource_new(owner, new_id, PW_PERM_RWX, type, version, 0);
|
||||
if (this->resource == NULL)
|
||||
|
|
@ -235,7 +237,7 @@ static void module_registered(void *data)
|
|||
char id[16];
|
||||
int res;
|
||||
|
||||
snprintf(id, sizeof(id), "%d", module->global->id);
|
||||
snprintf(id, sizeof(id), "%d", pw_impl_module_get_info(module)->id);
|
||||
items[0] = SPA_DICT_ITEM_INIT(PW_KEY_MODULE_ID, id);
|
||||
pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1));
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <spa/utils/result.h>
|
||||
|
||||
#include <pipewire/impl.h>
|
||||
#include <extensions/session-manager.h>
|
||||
|
||||
|
|
@ -33,8 +35,6 @@
|
|||
#include "session.h"
|
||||
#include "endpoint-link.h"
|
||||
|
||||
#include <pipewire/private.h>
|
||||
|
||||
#define NAME "client-session"
|
||||
|
||||
struct factory_data {
|
||||
|
|
@ -183,8 +183,10 @@ static void *create_object(void *data,
|
|||
if (!properties)
|
||||
goto no_mem;
|
||||
|
||||
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d", owner->global->id);
|
||||
pw_properties_setf(properties, PW_KEY_FACTORY_ID, "%d", factory->global->id);
|
||||
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d",
|
||||
pw_impl_client_get_info(owner)->id);
|
||||
pw_properties_setf(properties, PW_KEY_FACTORY_ID, "%d",
|
||||
pw_impl_factory_get_info(factory)->id);
|
||||
|
||||
this->resource = pw_resource_new(owner, new_id, PW_PERM_RWX, type, version, 0);
|
||||
if (this->resource == NULL)
|
||||
|
|
@ -234,7 +236,7 @@ static void module_registered(void *data)
|
|||
char id[16];
|
||||
int res;
|
||||
|
||||
snprintf(id, sizeof(id), "%d", module->global->id);
|
||||
snprintf(id, sizeof(id), "%d", pw_impl_module_get_info(module)->id);
|
||||
items[0] = SPA_DICT_ITEM_INIT(PW_KEY_MODULE_ID, id);
|
||||
pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1));
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <pipewire/pipewire.h>
|
||||
#include <pipewire/impl.h>
|
||||
#include <extensions/session-manager.h>
|
||||
|
||||
#include <spa/pod/filter.h>
|
||||
|
|
@ -34,13 +34,10 @@
|
|||
#include "endpoint-link.h"
|
||||
#include "client-session.h"
|
||||
|
||||
#include <pipewire/private.h>
|
||||
|
||||
#define NAME "endpoint-link"
|
||||
|
||||
struct resource_data {
|
||||
struct endpoint_link *link;
|
||||
struct spa_hook resource_listener;
|
||||
struct spa_hook object_listener;
|
||||
uint32_t n_subscribe_ids;
|
||||
uint32_t subscribe_ids[32];
|
||||
|
|
@ -104,7 +101,7 @@ static int endpoint_link_subscribe_params (void *object, uint32_t *ids, uint32_t
|
|||
for (i = 0; i < n_ids; i++) {
|
||||
data->subscribe_ids[i] = ids[i];
|
||||
pw_log_debug(NAME" %p: resource %d subscribe param %u",
|
||||
data->link, resource->id, ids[i]);
|
||||
data->link, pw_resource_get_id(resource), ids[i]);
|
||||
endpoint_link_enum_params(resource, 1, ids[i], 0, UINT32_MAX, NULL);
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -143,30 +140,54 @@ static const struct pw_endpoint_link_methods methods = {
|
|||
.request_state = endpoint_link_request_state,
|
||||
};
|
||||
|
||||
struct emit_param_data {
|
||||
struct endpoint_link *this;
|
||||
struct spa_pod *param;
|
||||
uint32_t id;
|
||||
uint32_t index;
|
||||
uint32_t next;
|
||||
};
|
||||
|
||||
static int emit_param(void *_data, struct pw_resource *resource)
|
||||
{
|
||||
struct emit_param_data *d = _data;
|
||||
struct resource_data *data;
|
||||
uint32_t i;
|
||||
|
||||
data = pw_resource_get_user_data(resource);
|
||||
for (i = 0; i < data->n_subscribe_ids; i++) {
|
||||
if (data->subscribe_ids[i] == d->id) {
|
||||
pw_endpoint_link_resource_param(resource, 1,
|
||||
d->id, d->index, d->next, d->param);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void endpoint_link_notify_subscribed(struct endpoint_link *this,
|
||||
uint32_t index, uint32_t next)
|
||||
{
|
||||
struct pw_global *global = this->global;
|
||||
struct pw_resource *resource;
|
||||
struct resource_data *data;
|
||||
struct emit_param_data data;
|
||||
struct spa_pod *param = this->params[index];
|
||||
uint32_t id;
|
||||
uint32_t i;
|
||||
|
||||
if (!param || !spa_pod_is_object (param))
|
||||
return;
|
||||
|
||||
id = SPA_POD_OBJECT_ID (param);
|
||||
data.this = this;
|
||||
data.param = param;
|
||||
data.id = SPA_POD_OBJECT_ID (param);
|
||||
data.index = index;
|
||||
data.next = next;
|
||||
|
||||
spa_list_for_each(resource, &global->resource_list, link) {
|
||||
data = pw_resource_get_user_data(resource);
|
||||
for (i = 0; i < data->n_subscribe_ids; i++) {
|
||||
if (data->subscribe_ids[i] == id) {
|
||||
pw_endpoint_link_resource_param(resource, 1,
|
||||
id, index, next, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
pw_global_for_each_resource(global, emit_param, &data);
|
||||
}
|
||||
|
||||
static int emit_info(void *data, struct pw_resource *resource)
|
||||
{
|
||||
struct endpoint_link *this = data;
|
||||
pw_endpoint_link_resource_info(resource, &this->info);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int endpoint_link_update(struct endpoint_link *this,
|
||||
|
|
@ -197,8 +218,6 @@ int endpoint_link_update(struct endpoint_link *this,
|
|||
}
|
||||
|
||||
if (change_mask & PW_CLIENT_SESSION_UPDATE_INFO) {
|
||||
struct pw_resource *resource;
|
||||
|
||||
if (info->change_mask & PW_ENDPOINT_LINK_CHANGE_MASK_STATE) {
|
||||
this->info.state = info->state;
|
||||
free(this->info.error);
|
||||
|
|
@ -229,9 +248,7 @@ int endpoint_link_update(struct endpoint_link *this,
|
|||
}
|
||||
|
||||
this->info.change_mask = info->change_mask;
|
||||
spa_list_for_each(resource, &this->global->resource_list, link) {
|
||||
pw_endpoint_link_resource_info(resource, &this->info);
|
||||
}
|
||||
pw_global_for_each_resource(this->global, emit_info, this);
|
||||
this->info.change_mask = 0;
|
||||
}
|
||||
|
||||
|
|
@ -244,17 +261,6 @@ int endpoint_link_update(struct endpoint_link *this,
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
static void endpoint_link_unbind(void *data)
|
||||
{
|
||||
struct pw_resource *resource = data;
|
||||
spa_list_remove(&resource->link);
|
||||
}
|
||||
|
||||
static const struct pw_resource_events resource_events = {
|
||||
PW_VERSION_RESOURCE_EVENTS,
|
||||
.destroy = endpoint_link_unbind,
|
||||
};
|
||||
|
||||
static int endpoint_link_bind(void *_data, struct pw_impl_client *client,
|
||||
uint32_t permissions, uint32_t version, uint32_t id)
|
||||
{
|
||||
|
|
@ -263,20 +269,18 @@ static int endpoint_link_bind(void *_data, struct pw_impl_client *client,
|
|||
struct pw_resource *resource;
|
||||
struct resource_data *data;
|
||||
|
||||
resource = pw_resource_new(client, id, permissions, global->type, version, sizeof(*data));
|
||||
resource = pw_resource_new(client, id, permissions,
|
||||
pw_global_get_type(global), version, sizeof(*data));
|
||||
if (resource == NULL)
|
||||
goto no_mem;
|
||||
|
||||
data = pw_resource_get_user_data(resource);
|
||||
data->link = this;
|
||||
pw_resource_add_listener(resource, &data->resource_listener,
|
||||
&resource_events, resource);
|
||||
pw_resource_add_object_listener(resource, &data->object_listener,
|
||||
&methods, resource);
|
||||
|
||||
pw_log_debug(NAME" %p: bound to %d", this, resource->id);
|
||||
|
||||
spa_list_append(&global->resource_list, &resource->link);
|
||||
pw_log_debug(NAME" %p: bound to %d", this, pw_resource_get_id(resource));
|
||||
pw_global_add_resource(global, resource);
|
||||
|
||||
this->info.change_mask = PW_ENDPOINT_LINK_CHANGE_MASK_ALL;
|
||||
pw_endpoint_link_resource_info(resource, &this->info);
|
||||
|
|
@ -316,10 +320,11 @@ int endpoint_link_init(struct endpoint_link *this,
|
|||
if (!this->global)
|
||||
goto no_mem;
|
||||
|
||||
pw_properties_setf(this->props, PW_KEY_OBJECT_ID, "%u", this->global->id);
|
||||
pw_properties_setf(this->props, PW_KEY_OBJECT_ID, "%u",
|
||||
pw_global_get_id(this->global));
|
||||
|
||||
this->info.version = PW_VERSION_ENDPOINT_LINK_INFO;
|
||||
this->info.id = this->global->id;
|
||||
this->info.id = pw_global_get_id(this->global);
|
||||
this->info.session_id = session_id;
|
||||
this->info.props = &this->props->dict;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,13 +34,10 @@
|
|||
#include "endpoint-stream.h"
|
||||
#include "client-endpoint.h"
|
||||
|
||||
#include <pipewire/private.h>
|
||||
|
||||
#define NAME "endpoint-stream"
|
||||
|
||||
struct resource_data {
|
||||
struct endpoint_stream *stream;
|
||||
struct spa_hook resource_listener;
|
||||
struct spa_hook object_listener;
|
||||
uint32_t n_subscribe_ids;
|
||||
uint32_t subscribe_ids[32];
|
||||
|
|
@ -104,7 +101,7 @@ static int endpoint_stream_subscribe_params (void *object, uint32_t *ids, uint32
|
|||
for (i = 0; i < n_ids; i++) {
|
||||
data->subscribe_ids[i] = ids[i];
|
||||
pw_log_debug(NAME" %p: resource %d subscribe param %u",
|
||||
data->stream, resource->id, ids[i]);
|
||||
data->stream, pw_resource_get_id(resource), ids[i]);
|
||||
endpoint_stream_enum_params(resource, 1, ids[i], 0, UINT32_MAX, NULL);
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -130,30 +127,54 @@ static const struct pw_endpoint_stream_methods methods = {
|
|||
.set_param = endpoint_stream_set_param,
|
||||
};
|
||||
|
||||
struct emit_param_data {
|
||||
struct endpoint_stream *this;
|
||||
struct spa_pod *param;
|
||||
uint32_t id;
|
||||
uint32_t index;
|
||||
uint32_t next;
|
||||
};
|
||||
|
||||
static int emit_param(void *_data, struct pw_resource *resource)
|
||||
{
|
||||
struct emit_param_data *d = _data;
|
||||
struct resource_data *data;
|
||||
uint32_t i;
|
||||
|
||||
data = pw_resource_get_user_data(resource);
|
||||
for (i = 0; i < data->n_subscribe_ids; i++) {
|
||||
if (data->subscribe_ids[i] == d->id) {
|
||||
pw_endpoint_stream_resource_param(resource, 1,
|
||||
d->id, d->index, d->next, d->param);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void endpoint_stream_notify_subscribed(struct endpoint_stream *this,
|
||||
uint32_t index, uint32_t next)
|
||||
{
|
||||
struct pw_global *global = this->global;
|
||||
struct pw_resource *resource;
|
||||
struct resource_data *data;
|
||||
struct emit_param_data data;
|
||||
struct spa_pod *param = this->params[index];
|
||||
uint32_t id;
|
||||
uint32_t i;
|
||||
|
||||
if (!param || !spa_pod_is_object (param))
|
||||
return;
|
||||
|
||||
id = SPA_POD_OBJECT_ID (param);
|
||||
data.this = this;
|
||||
data.param = param;
|
||||
data.id = SPA_POD_OBJECT_ID (param);
|
||||
data.index = index;
|
||||
data.next = next;
|
||||
|
||||
spa_list_for_each(resource, &global->resource_list, link) {
|
||||
data = pw_resource_get_user_data(resource);
|
||||
for (i = 0; i < data->n_subscribe_ids; i++) {
|
||||
if (data->subscribe_ids[i] == id) {
|
||||
pw_endpoint_stream_resource_param(resource, 1,
|
||||
id, index, next, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
pw_global_for_each_resource(global, emit_param, &data);
|
||||
}
|
||||
|
||||
static int emit_info(void *data, struct pw_resource *resource)
|
||||
{
|
||||
struct endpoint_stream *this = data;
|
||||
pw_endpoint_stream_resource_info(resource, &this->info);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int endpoint_stream_update(struct endpoint_stream *this,
|
||||
|
|
@ -184,8 +205,6 @@ int endpoint_stream_update(struct endpoint_stream *this,
|
|||
}
|
||||
|
||||
if (change_mask & PW_CLIENT_ENDPOINT_UPDATE_INFO) {
|
||||
struct pw_resource *resource;
|
||||
|
||||
if (info->change_mask & PW_ENDPOINT_STREAM_CHANGE_MASK_LINK_PARAMS) {
|
||||
free(this->info.link_params);
|
||||
this->info.link_params = spa_pod_copy(info->link_params);
|
||||
|
|
@ -211,9 +230,7 @@ int endpoint_stream_update(struct endpoint_stream *this,
|
|||
this->info.name = info->name ? strdup(info->name) : NULL;
|
||||
|
||||
this->info.change_mask = info->change_mask;
|
||||
spa_list_for_each(resource, &this->global->resource_list, link) {
|
||||
pw_endpoint_stream_resource_info(resource, &this->info);
|
||||
}
|
||||
pw_global_for_each_resource(this->global, emit_info, this);
|
||||
this->info.change_mask = 0;
|
||||
}
|
||||
|
||||
|
|
@ -226,17 +243,6 @@ int endpoint_stream_update(struct endpoint_stream *this,
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
static void endpoint_stream_unbind(void *data)
|
||||
{
|
||||
struct pw_resource *resource = data;
|
||||
spa_list_remove(&resource->link);
|
||||
}
|
||||
|
||||
static const struct pw_resource_events resource_events = {
|
||||
PW_VERSION_RESOURCE_EVENTS,
|
||||
.destroy = endpoint_stream_unbind,
|
||||
};
|
||||
|
||||
static int endpoint_stream_bind(void *_data, struct pw_impl_client *client,
|
||||
uint32_t permissions, uint32_t version, uint32_t id)
|
||||
{
|
||||
|
|
@ -245,20 +251,18 @@ static int endpoint_stream_bind(void *_data, struct pw_impl_client *client,
|
|||
struct pw_resource *resource;
|
||||
struct resource_data *data;
|
||||
|
||||
resource = pw_resource_new(client, id, permissions, global->type, version, sizeof(*data));
|
||||
resource = pw_resource_new(client, id, permissions,
|
||||
pw_global_get_type(global), version, sizeof(*data));
|
||||
if (resource == NULL)
|
||||
goto no_mem;
|
||||
|
||||
data = pw_resource_get_user_data(resource);
|
||||
data->stream = this;
|
||||
pw_resource_add_listener(resource, &data->resource_listener,
|
||||
&resource_events, resource);
|
||||
pw_resource_add_object_listener(resource, &data->object_listener,
|
||||
&methods, resource);
|
||||
|
||||
pw_log_debug(NAME" %p: bound to %d", this, resource->id);
|
||||
|
||||
spa_list_append(&global->resource_list, &resource->link);
|
||||
pw_log_debug(NAME" %p: bound to %d", this, pw_resource_get_id(resource));
|
||||
pw_global_add_resource(global, resource);
|
||||
|
||||
this->info.change_mask = PW_ENDPOINT_STREAM_CHANGE_MASK_ALL;
|
||||
pw_endpoint_stream_resource_info(resource, &this->info);
|
||||
|
|
@ -298,10 +302,11 @@ int endpoint_stream_init(struct endpoint_stream *this,
|
|||
if (!this->global)
|
||||
goto no_mem;
|
||||
|
||||
pw_properties_setf(this->props, PW_KEY_OBJECT_ID, "%u", this->global->id);
|
||||
pw_properties_setf(this->props, PW_KEY_OBJECT_ID, "%u",
|
||||
pw_global_get_id(this->global));
|
||||
|
||||
this->info.version = PW_VERSION_ENDPOINT_STREAM_INFO;
|
||||
this->info.id = this->global->id;
|
||||
this->info.id = pw_global_get_id(this->global);
|
||||
this->info.endpoint_id = endpoint_id;
|
||||
this->info.props = &this->props->dict;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,13 +34,10 @@
|
|||
#include "endpoint.h"
|
||||
#include "client-endpoint.h"
|
||||
|
||||
#include <pipewire/private.h>
|
||||
|
||||
#define NAME "endpoint"
|
||||
|
||||
struct resource_data {
|
||||
struct endpoint *endpoint;
|
||||
struct spa_hook resource_listener;
|
||||
struct spa_hook object_listener;
|
||||
uint32_t n_subscribe_ids;
|
||||
uint32_t subscribe_ids[32];
|
||||
|
|
@ -106,7 +103,7 @@ static int endpoint_subscribe_params (void *object, uint32_t *ids, uint32_t n_id
|
|||
for (i = 0; i < n_ids; i++) {
|
||||
data->subscribe_ids[i] = ids[i];
|
||||
pw_log_debug(NAME" %p: resource %d subscribe param %u",
|
||||
data->endpoint, resource->id, ids[i]);
|
||||
data->endpoint, pw_resource_get_id(resource), ids[i]);
|
||||
endpoint_enum_params(resource, 1, ids[i], 0, UINT32_MAX, NULL);
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -147,30 +144,54 @@ static const struct pw_endpoint_methods methods = {
|
|||
.create_link = endpoint_create_link,
|
||||
};
|
||||
|
||||
struct emit_param_data {
|
||||
struct endpoint *this;
|
||||
struct spa_pod *param;
|
||||
uint32_t id;
|
||||
uint32_t index;
|
||||
uint32_t next;
|
||||
};
|
||||
|
||||
static int emit_param(void *_data, struct pw_resource *resource)
|
||||
{
|
||||
struct emit_param_data *d = _data;
|
||||
struct resource_data *data;
|
||||
uint32_t i;
|
||||
|
||||
data = pw_resource_get_user_data(resource);
|
||||
for (i = 0; i < data->n_subscribe_ids; i++) {
|
||||
if (data->subscribe_ids[i] == d->id) {
|
||||
pw_endpoint_resource_param(resource, 1,
|
||||
d->id, d->index, d->next, d->param);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void endpoint_notify_subscribed(struct endpoint *this,
|
||||
uint32_t index, uint32_t next)
|
||||
{
|
||||
struct pw_global *global = this->global;
|
||||
struct pw_resource *resource;
|
||||
struct resource_data *data;
|
||||
struct emit_param_data data;
|
||||
struct spa_pod *param = this->params[index];
|
||||
uint32_t id;
|
||||
uint32_t i;
|
||||
|
||||
if (!param || !spa_pod_is_object (param))
|
||||
return;
|
||||
|
||||
id = SPA_POD_OBJECT_ID (param);
|
||||
data.this = this;
|
||||
data.param = param;
|
||||
data.id = SPA_POD_OBJECT_ID (param);
|
||||
data.index = index;
|
||||
data.next = next;
|
||||
|
||||
spa_list_for_each(resource, &global->resource_list, link) {
|
||||
data = pw_resource_get_user_data(resource);
|
||||
for (i = 0; i < data->n_subscribe_ids; i++) {
|
||||
if (data->subscribe_ids[i] == id) {
|
||||
pw_endpoint_resource_param(resource, 1, id,
|
||||
index, next, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
pw_global_for_each_resource(global, emit_param, &data);
|
||||
}
|
||||
|
||||
static int emit_info(void *data, struct pw_resource *resource)
|
||||
{
|
||||
struct endpoint *this = data;
|
||||
pw_endpoint_resource_info(resource, &this->info);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int endpoint_update(struct endpoint *this,
|
||||
|
|
@ -201,8 +222,6 @@ int endpoint_update(struct endpoint *this,
|
|||
}
|
||||
|
||||
if (change_mask & PW_CLIENT_ENDPOINT_UPDATE_INFO) {
|
||||
struct pw_resource *resource;
|
||||
|
||||
if (info->change_mask & PW_ENDPOINT_CHANGE_MASK_STREAMS)
|
||||
this->info.n_streams = info->n_streams;
|
||||
|
||||
|
|
@ -233,9 +252,7 @@ int endpoint_update(struct endpoint *this,
|
|||
}
|
||||
|
||||
this->info.change_mask = info->change_mask;
|
||||
spa_list_for_each(resource, &this->global->resource_list, link) {
|
||||
pw_endpoint_resource_info(resource, &this->info);
|
||||
}
|
||||
pw_global_for_each_resource(this->global, emit_info, this);
|
||||
this->info.change_mask = 0;
|
||||
}
|
||||
|
||||
|
|
@ -248,17 +265,6 @@ int endpoint_update(struct endpoint *this,
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
static void endpoint_unbind(void *data)
|
||||
{
|
||||
struct pw_resource *resource = data;
|
||||
spa_list_remove(&resource->link);
|
||||
}
|
||||
|
||||
static const struct pw_resource_events resource_events = {
|
||||
PW_VERSION_RESOURCE_EVENTS,
|
||||
.destroy = endpoint_unbind,
|
||||
};
|
||||
|
||||
static int endpoint_bind(void *_data, struct pw_impl_client *client,
|
||||
uint32_t permissions, uint32_t version, uint32_t id)
|
||||
{
|
||||
|
|
@ -267,20 +273,18 @@ static int endpoint_bind(void *_data, struct pw_impl_client *client,
|
|||
struct pw_resource *resource;
|
||||
struct resource_data *data;
|
||||
|
||||
resource = pw_resource_new(client, id, permissions, global->type, version, sizeof(*data));
|
||||
resource = pw_resource_new(client, id, permissions,
|
||||
pw_global_get_type(global), version, sizeof(*data));
|
||||
if (resource == NULL)
|
||||
goto no_mem;
|
||||
|
||||
data = pw_resource_get_user_data(resource);
|
||||
data->endpoint = this;
|
||||
pw_resource_add_listener(resource, &data->resource_listener,
|
||||
&resource_events, resource);
|
||||
pw_resource_add_object_listener(resource, &data->object_listener,
|
||||
&methods, resource);
|
||||
|
||||
pw_log_debug(NAME" %p: bound to %d", this, resource->id);
|
||||
|
||||
spa_list_append(&global->resource_list, &resource->link);
|
||||
pw_log_debug(NAME" %p: bound to %d", this, pw_resource_get_id(resource));
|
||||
pw_global_add_resource(global, resource);
|
||||
|
||||
this->info.change_mask = PW_ENDPOINT_CHANGE_MASK_ALL;
|
||||
pw_endpoint_resource_info(resource, &this->info);
|
||||
|
|
@ -333,13 +337,14 @@ int endpoint_init(struct endpoint *this,
|
|||
if (!this->global)
|
||||
goto no_mem;
|
||||
|
||||
pw_properties_setf(this->props, PW_KEY_OBJECT_ID, "%u", this->global->id);
|
||||
pw_properties_setf(this->props, PW_KEY_OBJECT_ID, "%u",
|
||||
pw_global_get_id(this->global));
|
||||
|
||||
this->info.version = PW_VERSION_ENDPOINT_INFO;
|
||||
this->info.id = this->global->id;
|
||||
this->info.id = pw_global_get_id(this->global);
|
||||
this->info.props = &this->props->dict;
|
||||
|
||||
pw_resource_set_bound_id(client_ep->resource, this->global->id);
|
||||
pw_resource_set_bound_id(client_ep->resource, this->info.id);
|
||||
|
||||
return pw_global_register(this->global);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <pipewire/pipewire.h>
|
||||
#include <pipewire/impl.h>
|
||||
#include <extensions/session-manager.h>
|
||||
|
||||
#include <spa/pod/filter.h>
|
||||
|
|
@ -34,13 +34,10 @@
|
|||
#include "session.h"
|
||||
#include "client-session.h"
|
||||
|
||||
#include <pipewire/private.h>
|
||||
|
||||
#define NAME "session"
|
||||
|
||||
struct resource_data {
|
||||
struct session *session;
|
||||
struct spa_hook resource_listener;
|
||||
struct spa_hook object_listener;
|
||||
uint32_t n_subscribe_ids;
|
||||
uint32_t subscribe_ids[32];
|
||||
|
|
@ -104,7 +101,7 @@ static int session_subscribe_params (void *object, uint32_t *ids, uint32_t n_ids
|
|||
for (i = 0; i < n_ids; i++) {
|
||||
data->subscribe_ids[i] = ids[i];
|
||||
pw_log_debug(NAME" %p: resource %d subscribe param %u",
|
||||
data->session, resource->id, ids[i]);
|
||||
data->session, pw_resource_get_id(resource), ids[i]);
|
||||
session_enum_params(resource, 1, ids[i], 0, UINT32_MAX, NULL);
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -130,30 +127,54 @@ static const struct pw_session_methods methods = {
|
|||
.set_param = session_set_param,
|
||||
};
|
||||
|
||||
struct emit_param_data {
|
||||
struct session *this;
|
||||
struct spa_pod *param;
|
||||
uint32_t id;
|
||||
uint32_t index;
|
||||
uint32_t next;
|
||||
};
|
||||
|
||||
static int emit_param(void *_data, struct pw_resource *resource)
|
||||
{
|
||||
struct emit_param_data *d = _data;
|
||||
struct resource_data *data;
|
||||
uint32_t i;
|
||||
|
||||
data = pw_resource_get_user_data(resource);
|
||||
for (i = 0; i < data->n_subscribe_ids; i++) {
|
||||
if (data->subscribe_ids[i] == d->id) {
|
||||
pw_session_resource_param(resource, 1,
|
||||
d->id, d->index, d->next, d->param);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void session_notify_subscribed(struct session *this,
|
||||
uint32_t index, uint32_t next)
|
||||
{
|
||||
struct pw_global *global = this->global;
|
||||
struct pw_resource *resource;
|
||||
struct resource_data *data;
|
||||
struct emit_param_data data;
|
||||
struct spa_pod *param = this->params[index];
|
||||
uint32_t id;
|
||||
uint32_t i;
|
||||
|
||||
if (!param || !spa_pod_is_object (param))
|
||||
return;
|
||||
|
||||
id = SPA_POD_OBJECT_ID (param);
|
||||
data.this = this;
|
||||
data.param = param;
|
||||
data.id = SPA_POD_OBJECT_ID (param);
|
||||
data.index = index;
|
||||
data.next = next;
|
||||
|
||||
spa_list_for_each(resource, &global->resource_list, link) {
|
||||
data = pw_resource_get_user_data(resource);
|
||||
for (i = 0; i < data->n_subscribe_ids; i++) {
|
||||
if (data->subscribe_ids[i] == id) {
|
||||
pw_session_resource_param(resource, 1, id,
|
||||
index, next, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
pw_global_for_each_resource(global, emit_param, &data);
|
||||
}
|
||||
|
||||
static int emit_info(void *data, struct pw_resource *resource)
|
||||
{
|
||||
struct session *this = data;
|
||||
pw_session_resource_info(resource, &this->info);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int session_update(struct session *this,
|
||||
|
|
@ -184,8 +205,6 @@ int session_update(struct session *this,
|
|||
}
|
||||
|
||||
if (change_mask & PW_CLIENT_SESSION_UPDATE_INFO) {
|
||||
struct pw_resource *resource;
|
||||
|
||||
if (info->change_mask & PW_SESSION_CHANGE_MASK_PROPS)
|
||||
pw_properties_update(this->props, info->props);
|
||||
|
||||
|
|
@ -203,9 +222,7 @@ int session_update(struct session *this,
|
|||
}
|
||||
|
||||
this->info.change_mask = info->change_mask;
|
||||
spa_list_for_each(resource, &this->global->resource_list, link) {
|
||||
pw_session_resource_info(resource, &this->info);
|
||||
}
|
||||
pw_global_for_each_resource(this->global, emit_info, this);
|
||||
this->info.change_mask = 0;
|
||||
}
|
||||
|
||||
|
|
@ -218,17 +235,6 @@ int session_update(struct session *this,
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
static void session_unbind(void *data)
|
||||
{
|
||||
struct pw_resource *resource = data;
|
||||
spa_list_remove(&resource->link);
|
||||
}
|
||||
|
||||
static const struct pw_resource_events resource_events = {
|
||||
PW_VERSION_RESOURCE_EVENTS,
|
||||
.destroy = session_unbind,
|
||||
};
|
||||
|
||||
static int session_bind(void *_data, struct pw_impl_client *client,
|
||||
uint32_t permissions, uint32_t version, uint32_t id)
|
||||
{
|
||||
|
|
@ -237,20 +243,19 @@ static int session_bind(void *_data, struct pw_impl_client *client,
|
|||
struct pw_resource *resource;
|
||||
struct resource_data *data;
|
||||
|
||||
resource = pw_resource_new(client, id, permissions, global->type, version, sizeof(*data));
|
||||
resource = pw_resource_new(client, id, permissions,
|
||||
pw_global_get_type(global), version, sizeof(*data));
|
||||
if (resource == NULL)
|
||||
goto no_mem;
|
||||
|
||||
data = pw_resource_get_user_data(resource);
|
||||
data->session = this;
|
||||
pw_resource_add_listener(resource, &data->resource_listener,
|
||||
&resource_events, resource);
|
||||
|
||||
pw_resource_add_object_listener(resource, &data->object_listener,
|
||||
&methods, resource);
|
||||
|
||||
pw_log_debug(NAME" %p: bound to %d", this, resource->id);
|
||||
|
||||
spa_list_append(&global->resource_list, &resource->link);
|
||||
pw_log_debug(NAME" %p: bound to %d", this, pw_resource_get_id(resource));
|
||||
pw_global_add_resource(global, resource);
|
||||
|
||||
this->info.change_mask = PW_SESSION_CHANGE_MASK_ALL;
|
||||
pw_session_resource_info(resource, &this->info);
|
||||
|
|
@ -294,13 +299,14 @@ int session_init(struct session *this,
|
|||
if (!this->global)
|
||||
goto no_mem;
|
||||
|
||||
pw_properties_setf(this->props, PW_KEY_OBJECT_ID, "%u", this->global->id);
|
||||
pw_properties_setf(this->props, PW_KEY_OBJECT_ID, "%u",
|
||||
pw_global_get_id(this->global));
|
||||
|
||||
this->info.version = PW_VERSION_SESSION_INFO;
|
||||
this->info.id = this->global->id;
|
||||
this->info.id = pw_global_get_id(this->global);
|
||||
this->info.props = &this->props->dict;
|
||||
|
||||
pw_resource_set_bound_id(client_sess->resource, this->global->id);
|
||||
pw_resource_set_bound_id(client_sess->resource, this->info.id);
|
||||
|
||||
return pw_global_register(this->global);
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@
|
|||
#include <spa/debug/types.h>
|
||||
|
||||
#include "spa-device.h"
|
||||
#include "pipewire/private.h"
|
||||
|
||||
struct impl {
|
||||
struct pw_impl_device *this;
|
||||
|
|
@ -84,7 +83,7 @@ pw_spa_device_new(struct pw_context *context,
|
|||
if (this == NULL)
|
||||
return NULL;
|
||||
|
||||
impl = this->user_data;
|
||||
impl = pw_impl_device_get_user_data(this);
|
||||
impl->this = this;
|
||||
impl->device = device;
|
||||
impl->handle = handle;
|
||||
|
|
@ -110,7 +109,7 @@ error_register:
|
|||
|
||||
void *pw_spa_device_get_user_data(struct pw_impl_device *device)
|
||||
{
|
||||
struct impl *impl = device->user_data;
|
||||
struct impl *impl = pw_impl_device_get_user_data(device);
|
||||
return impl->user_data;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,12 +32,12 @@
|
|||
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/node/utils.h>
|
||||
#include <spa/utils/result.h>
|
||||
#include <spa/param/props.h>
|
||||
#include <spa/pod/iter.h>
|
||||
#include <spa/debug/types.h>
|
||||
|
||||
#include "spa-node.h"
|
||||
#include "pipewire/private.h"
|
||||
|
||||
struct impl {
|
||||
struct pw_impl_node *this;
|
||||
|
|
@ -119,7 +119,7 @@ pw_spa_node_new(struct pw_context *context,
|
|||
goto error_exit;
|
||||
}
|
||||
|
||||
impl = this->user_data;
|
||||
impl = pw_impl_node_get_user_data(this);
|
||||
impl->this = this;
|
||||
impl->node = node;
|
||||
impl->handle = handle;
|
||||
|
|
@ -152,7 +152,7 @@ error_exit:
|
|||
|
||||
void *pw_spa_node_get_user_data(struct pw_impl_node *node)
|
||||
{
|
||||
struct impl *impl = node->user_data;
|
||||
struct impl *impl = pw_impl_node_get_user_data(node);
|
||||
return impl->user_data;
|
||||
}
|
||||
|
||||
|
|
@ -273,7 +273,7 @@ struct pw_impl_node *pw_spa_node_load(struct pw_context *context,
|
|||
goto error_exit;
|
||||
}
|
||||
|
||||
impl = this->user_data;
|
||||
impl = pw_impl_node_get_user_data(this);
|
||||
impl->factory_name = strdup(factory_name);
|
||||
|
||||
return this;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue