mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
media-session: move all flags to the object
This commit is contained in:
parent
5b96e3a528
commit
87946ed2cf
3 changed files with 45 additions and 63 deletions
|
|
@ -226,10 +226,10 @@ static void client_event_info(void *object, const struct pw_client_info *info)
|
|||
pw_log_debug(NAME" %p: client %d info", impl, client->obj.id);
|
||||
client->info = pw_client_info_update(client->info, info);
|
||||
|
||||
client->avail |= SM_CLIENT_CHANGE_MASK_INFO;
|
||||
client->changed |= SM_CLIENT_CHANGE_MASK_INFO;
|
||||
client->obj.avail |= SM_CLIENT_CHANGE_MASK_INFO;
|
||||
client->obj.changed |= SM_CLIENT_CHANGE_MASK_INFO;
|
||||
sm_object_emit_update(&client->obj);
|
||||
client->changed = 0;
|
||||
client->obj.changed = 0;
|
||||
}
|
||||
|
||||
static const struct pw_client_proxy_events client_events = {
|
||||
|
|
@ -300,13 +300,13 @@ static void node_event_info(void *object, const struct pw_node_info *info)
|
|||
add_object(impl, &node->obj);
|
||||
}
|
||||
|
||||
node->avail |= SM_NODE_CHANGE_MASK_INFO;
|
||||
node->changed |= SM_NODE_CHANGE_MASK_INFO;
|
||||
node->obj.avail |= SM_NODE_CHANGE_MASK_INFO;
|
||||
node->obj.changed |= SM_NODE_CHANGE_MASK_INFO;
|
||||
sm_object_emit_update(&node->obj);
|
||||
node->changed = 0;
|
||||
node->obj.changed = 0;
|
||||
|
||||
if (info->change_mask & PW_NODE_CHANGE_MASK_PARAMS &&
|
||||
(node->mask & SM_NODE_CHANGE_MASK_PARAMS) &&
|
||||
(node->obj.mask & SM_NODE_CHANGE_MASK_PARAMS) &&
|
||||
!node->subscribe) {
|
||||
uint32_t subscribe[info->n_params], n_subscribe = 0;
|
||||
|
||||
|
|
@ -343,10 +343,10 @@ static void node_event_param(void *object, int seq,
|
|||
|
||||
add_param(&node->param_list, id, param);
|
||||
|
||||
node->avail |= SM_NODE_CHANGE_MASK_PARAMS;
|
||||
node->changed |= SM_NODE_CHANGE_MASK_PARAMS;
|
||||
node->obj.avail |= SM_NODE_CHANGE_MASK_PARAMS;
|
||||
node->obj.changed |= SM_NODE_CHANGE_MASK_PARAMS;
|
||||
sm_object_emit_update(&node->obj);
|
||||
node->changed = 0;
|
||||
node->obj.changed = 0;
|
||||
}
|
||||
|
||||
static const struct pw_node_proxy_events node_events = {
|
||||
|
|
@ -381,10 +381,10 @@ static void port_event_info(void *object, const struct pw_port_info *info)
|
|||
pw_log_debug(NAME" %p: port %d info", impl, port->obj.id);
|
||||
port->info = pw_port_info_update(port->info, info);
|
||||
|
||||
port->avail |= SM_PORT_CHANGE_MASK_INFO;
|
||||
port->changed |= SM_PORT_CHANGE_MASK_INFO;
|
||||
port->obj.avail |= SM_PORT_CHANGE_MASK_INFO;
|
||||
port->obj.changed |= SM_PORT_CHANGE_MASK_INFO;
|
||||
sm_object_emit_update(&port->obj);
|
||||
port->changed = 0;
|
||||
port->obj.changed = 0;
|
||||
}
|
||||
|
||||
static const struct pw_port_proxy_events port_events = {
|
||||
|
|
@ -399,7 +399,7 @@ static void port_destroy(void *object)
|
|||
pw_port_info_free(port->info);
|
||||
if (port->node) {
|
||||
spa_list_remove(&port->link);
|
||||
port->node->changed |= SM_NODE_CHANGE_MASK_PORTS;
|
||||
port->node->obj.changed |= SM_NODE_CHANGE_MASK_PORTS;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -425,10 +425,10 @@ static void session_event_info(void *object, const struct pw_session_info *info)
|
|||
i->props = (struct spa_dict *) pw_properties_new_dict (info->props);
|
||||
}
|
||||
|
||||
sess->avail |= SM_SESSION_CHANGE_MASK_INFO;
|
||||
sess->changed |= SM_SESSION_CHANGE_MASK_INFO;
|
||||
sess->obj.avail |= SM_SESSION_CHANGE_MASK_INFO;
|
||||
sess->obj.changed |= SM_SESSION_CHANGE_MASK_INFO;
|
||||
sm_object_emit_update(&sess->obj);
|
||||
sess->changed = 0;
|
||||
sess->obj.changed = 0;
|
||||
}
|
||||
|
||||
static const struct pw_session_proxy_events session_events = {
|
||||
|
|
@ -482,10 +482,10 @@ static void endpoint_event_info(void *object, const struct pw_endpoint_info *inf
|
|||
endpoint->priority = pw_properties_parse_int(str);
|
||||
}
|
||||
|
||||
endpoint->avail |= SM_ENDPOINT_CHANGE_MASK_INFO;
|
||||
endpoint->changed |= SM_ENDPOINT_CHANGE_MASK_INFO;
|
||||
endpoint->obj.avail |= SM_ENDPOINT_CHANGE_MASK_INFO;
|
||||
endpoint->obj.changed |= SM_ENDPOINT_CHANGE_MASK_INFO;
|
||||
sm_object_emit_update(&endpoint->obj);
|
||||
endpoint->changed = 0;
|
||||
endpoint->obj.changed = 0;
|
||||
}
|
||||
|
||||
static const struct pw_endpoint_proxy_events endpoint_events = {
|
||||
|
|
@ -532,10 +532,10 @@ static void endpoint_stream_event_info(void *object, const struct pw_endpoint_st
|
|||
}
|
||||
stream->info->change_mask = info->change_mask;
|
||||
|
||||
stream->avail |= SM_ENDPOINT_CHANGE_MASK_INFO;
|
||||
stream->changed |= SM_ENDPOINT_CHANGE_MASK_INFO;
|
||||
stream->obj.avail |= SM_ENDPOINT_CHANGE_MASK_INFO;
|
||||
stream->obj.changed |= SM_ENDPOINT_CHANGE_MASK_INFO;
|
||||
sm_object_emit_update(&stream->obj);
|
||||
stream->changed = 0;
|
||||
stream->obj.changed = 0;
|
||||
}
|
||||
|
||||
static const struct pw_endpoint_stream_proxy_events endpoint_stream_events = {
|
||||
|
|
@ -577,10 +577,10 @@ static void endpoint_link_event_info(void *object, const struct pw_endpoint_link
|
|||
}
|
||||
link->info->change_mask = info->change_mask;
|
||||
|
||||
link->avail |= SM_ENDPOINT_LINK_CHANGE_MASK_INFO;
|
||||
link->changed |= SM_ENDPOINT_LINK_CHANGE_MASK_INFO;
|
||||
link->obj.avail |= SM_ENDPOINT_LINK_CHANGE_MASK_INFO;
|
||||
link->obj.changed |= SM_ENDPOINT_LINK_CHANGE_MASK_INFO;
|
||||
sm_object_emit_update(&link->obj);
|
||||
link->changed = 0;
|
||||
link->obj.changed = 0;
|
||||
}
|
||||
|
||||
static const struct pw_endpoint_link_proxy_events endpoint_link_events = {
|
||||
|
|
@ -745,7 +745,7 @@ init_object(struct impl *impl, struct sm_object *obj, uint32_t id,
|
|||
port->direction);
|
||||
if (port->node) {
|
||||
spa_list_append(&port->node->port_list, &port->link);
|
||||
port->node->changed |= SM_NODE_CHANGE_MASK_PORTS;
|
||||
port->node->obj.changed |= SM_NODE_CHANGE_MASK_PORTS;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -781,7 +781,7 @@ init_object(struct impl *impl, struct sm_object *obj, uint32_t id,
|
|||
pw_log_debug(NAME" %p: stream %d parent endpoint %s", impl, id, str);
|
||||
if (stream->endpoint) {
|
||||
spa_list_append(&stream->endpoint->stream_list, &stream->link);
|
||||
stream->endpoint->changed |= SM_ENDPOINT_CHANGE_MASK_STREAMS;
|
||||
stream->endpoint->obj.changed |= SM_ENDPOINT_CHANGE_MASK_STREAMS;
|
||||
}
|
||||
}
|
||||
spa_list_init(&stream->link_list);
|
||||
|
|
|
|||
|
|
@ -49,8 +49,10 @@ struct sm_object {
|
|||
|
||||
#define SM_OBJECT_CHANGE_MASK_PROPERTIES (1<<0)
|
||||
#define SM_OBJECT_CHANGE_MASK_BIND (1<<1)
|
||||
#define SM_OBJECT_CHANGE_MASK_LAST (1<<8)
|
||||
uint32_t mask; /**< monitored info */
|
||||
uint32_t avail; /**< available info */
|
||||
uint32_t changed; /**< changed since last update */
|
||||
struct pw_properties *props; /**< global properties */
|
||||
|
||||
struct pw_proxy *proxy;
|
||||
|
|
@ -80,11 +82,8 @@ int sm_object_remove_data(struct sm_object *obj, const char *id);
|
|||
struct sm_client {
|
||||
struct sm_object obj;
|
||||
|
||||
#define SM_CLIENT_CHANGE_MASK_INFO (1<<0)
|
||||
#define SM_CLIENT_CHANGE_MASK_PERMISSIONS (1<<1)
|
||||
uint32_t mask; /**< monitored info */
|
||||
uint32_t avail; /**< available info */
|
||||
uint32_t changed; /**< changed since last update */
|
||||
#define SM_CLIENT_CHANGE_MASK_INFO (SM_OBJECT_CHANGE_MASK_LAST<<0)
|
||||
#define SM_CLIENT_CHANGE_MASK_PERMISSIONS (SM_OBJECT_CHANGE_MASK_LAST<<1)
|
||||
struct pw_client_info *info;
|
||||
};
|
||||
|
||||
|
|
@ -93,15 +92,13 @@ struct sm_node {
|
|||
|
||||
unsigned int subscribe:1; /**< if we subscribed to param changes */
|
||||
|
||||
#define SM_NODE_CHANGE_MASK_INFO (1<<0)
|
||||
#define SM_NODE_CHANGE_MASK_PORTS (1<<1)
|
||||
#define SM_NODE_CHANGE_MASK_PARAMS (1<<2)
|
||||
uint32_t mask; /**< monitored info */
|
||||
uint32_t avail; /**< available info */
|
||||
uint32_t changed; /**< changed since last update */
|
||||
#define SM_NODE_CHANGE_MASK_INFO (SM_OBJECT_CHANGE_MASK_LAST<<0)
|
||||
#define SM_NODE_CHANGE_MASK_PORTS (SM_OBJECT_CHANGE_MASK_LAST<<1)
|
||||
#define SM_NODE_CHANGE_MASK_PARAMS (SM_OBJECT_CHANGE_MASK_LAST<<2)
|
||||
uint32_t n_params;
|
||||
struct spa_list param_list; /**< list of sm_param */
|
||||
struct pw_node_info *info;
|
||||
struct spa_list port_list;
|
||||
struct spa_list param_list; /**< list of sm_param */
|
||||
};
|
||||
|
||||
struct sm_port {
|
||||
|
|
@ -111,20 +108,14 @@ struct sm_port {
|
|||
struct sm_node *node;
|
||||
struct spa_list link; /**< link in node port_list */
|
||||
|
||||
#define SM_PORT_CHANGE_MASK_INFO (1<<0)
|
||||
uint32_t mask; /**< monitored info */
|
||||
uint32_t avail; /**< available info */
|
||||
uint32_t changed; /**< changed since last update */
|
||||
#define SM_PORT_CHANGE_MASK_INFO (SM_OBJECT_CHANGE_MASK_LAST<<0)
|
||||
struct pw_port_info *info;
|
||||
};
|
||||
|
||||
struct sm_session {
|
||||
struct sm_object obj;
|
||||
|
||||
#define SM_SESSION_CHANGE_MASK_INFO (1<<0)
|
||||
uint32_t mask; /**< monitored info */
|
||||
uint32_t avail; /**< available info */
|
||||
uint32_t changed; /**< changed since last update */
|
||||
#define SM_SESSION_CHANGE_MASK_INFO (SM_OBJECT_CHANGE_MASK_LAST<<0)
|
||||
struct pw_session_info *info;
|
||||
struct spa_list endpoint_list;
|
||||
};
|
||||
|
|
@ -137,11 +128,8 @@ struct sm_endpoint {
|
|||
struct sm_session *session;
|
||||
struct spa_list link; /**< link in session endpoint_list */
|
||||
|
||||
#define SM_ENDPOINT_CHANGE_MASK_INFO (1<<0)
|
||||
#define SM_ENDPOINT_CHANGE_MASK_STREAMS (1<<1)
|
||||
uint32_t mask; /**< monitored info */
|
||||
uint32_t avail; /**< available info */
|
||||
uint32_t changed; /**< changed since last update */
|
||||
#define SM_ENDPOINT_CHANGE_MASK_INFO (SM_OBJECT_CHANGE_MASK_LAST<<0)
|
||||
#define SM_ENDPOINT_CHANGE_MASK_STREAMS (SM_OBJECT_CHANGE_MASK_LAST<<1)
|
||||
struct pw_endpoint_info *info;
|
||||
struct spa_list stream_list;
|
||||
};
|
||||
|
|
@ -156,10 +144,7 @@ struct sm_endpoint_stream {
|
|||
|
||||
struct spa_list link_list; /**< list of links */
|
||||
|
||||
#define SM_ENDPOINT_STREAM_CHANGE_MASK_INFO (1<<0)
|
||||
uint32_t mask; /**< monitored info */
|
||||
uint32_t avail; /**< available info */
|
||||
uint32_t changed; /**< changed since last update */
|
||||
#define SM_ENDPOINT_STREAM_CHANGE_MASK_INFO (SM_OBJECT_CHANGE_MASK_LAST<<0)
|
||||
struct pw_endpoint_stream_info *info;
|
||||
};
|
||||
|
||||
|
|
@ -173,10 +158,7 @@ struct sm_endpoint_link {
|
|||
struct spa_list input_link;
|
||||
struct sm_endpoint_stream *input;
|
||||
|
||||
#define SM_ENDPOINT_LINK_CHANGE_MASK_INFO (1<<0)
|
||||
uint32_t mask; /**< monitored info */
|
||||
uint32_t avail; /**< available info */
|
||||
uint32_t changed; /**< changed since last update */
|
||||
#define SM_ENDPOINT_LINK_CHANGE_MASK_INFO (SM_OBJECT_CHANGE_MASK_LAST<<0)
|
||||
struct pw_endpoint_link_info *info;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -430,13 +430,13 @@ static void object_update(void *data)
|
|||
struct node *node = data;
|
||||
struct impl *impl = node->impl;
|
||||
|
||||
pw_log_debug(NAME" %p: node %p endpoint %p %08x", impl, node, node->endpoint, node->obj->changed);
|
||||
pw_log_debug(NAME" %p: node %p endpoint %p %08x", impl, node, node->endpoint, node->obj->obj.changed);
|
||||
|
||||
if (node->endpoint == NULL &&
|
||||
node->obj->obj.avail & SM_OBJECT_CHANGE_MASK_PROPERTIES)
|
||||
node->endpoint = make_endpoint(node);
|
||||
|
||||
if (node->obj->changed & SM_NODE_CHANGE_MASK_PARAMS)
|
||||
if (node->obj->obj.changed & SM_NODE_CHANGE_MASK_PARAMS)
|
||||
update_params(node->endpoint);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue