mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
gst: use object_path to hide providers
Don't use the core info to manage the hiden providers, that info can't be put there anymore because the session manager manages the devices now. Look at the object path instead and hide those with well known prefixes.
This commit is contained in:
parent
8e9bbaf3dc
commit
c173b23ac4
1 changed files with 13 additions and 30 deletions
|
|
@ -296,33 +296,6 @@ static void remove_pending(struct pending *p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
on_core_info (void *data, const struct pw_core_info *info)
|
|
||||||
{
|
|
||||||
GstPipeWireDeviceProvider *self = data;
|
|
||||||
GstDeviceProvider *provider = (GstDeviceProvider*)self;
|
|
||||||
const gchar *value;
|
|
||||||
|
|
||||||
if (info == NULL || info->props == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
value = spa_dict_lookup (info->props, PW_KEY_CORE_MONITORS);
|
|
||||||
if (value) {
|
|
||||||
gchar **monitors = g_strsplit (value, ",", -1);
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (provider, "have hidden providers: %s", value);
|
|
||||||
|
|
||||||
for (i = 0; monitors[i]; i++) {
|
|
||||||
if (strcmp (monitors[i], "v4l2") == 0)
|
|
||||||
gst_device_provider_hide_provider (provider, "v4l2deviceprovider");
|
|
||||||
else if (strcmp (monitors[i], "alsa") == 0)
|
|
||||||
gst_device_provider_hide_provider (provider, "pulsedeviceprovider");
|
|
||||||
}
|
|
||||||
g_strfreev (monitors);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_core_done (void *data, uint32_t id, int seq)
|
on_core_done (void *data, uint32_t id, int seq)
|
||||||
{
|
{
|
||||||
|
|
@ -353,7 +326,7 @@ on_core_error(void *data, uint32_t id, int seq, int res, const char *message)
|
||||||
pw_log_error("error id:%u seq:%d res:%d (%s): %s",
|
pw_log_error("error id:%u seq:%d res:%d (%s): %s",
|
||||||
id, seq, res, spa_strerror(res), message);
|
id, seq, res, spa_strerror(res), message);
|
||||||
|
|
||||||
if (id == 0) {
|
if (id == PW_ID_CORE) {
|
||||||
self->error = res;
|
self->error = res;
|
||||||
}
|
}
|
||||||
pw_thread_loop_signal(self->loop, FALSE);
|
pw_thread_loop_signal(self->loop, FALSE);
|
||||||
|
|
@ -361,7 +334,6 @@ on_core_error(void *data, uint32_t id, int seq, int res, const char *message)
|
||||||
|
|
||||||
static const struct pw_core_events core_events = {
|
static const struct pw_core_events core_events = {
|
||||||
PW_VERSION_CORE_EVENTS,
|
PW_VERSION_CORE_EVENTS,
|
||||||
.info = on_core_info,
|
|
||||||
.done = on_core_done,
|
.done = on_core_done,
|
||||||
.error = on_core_error,
|
.error = on_core_error,
|
||||||
};
|
};
|
||||||
|
|
@ -467,7 +439,9 @@ static void registry_event_global(void *data, uint32_t id, uint32_t permissions,
|
||||||
{
|
{
|
||||||
struct core_data *rd = data;
|
struct core_data *rd = data;
|
||||||
GstPipeWireDeviceProvider *self = rd->self;
|
GstPipeWireDeviceProvider *self = rd->self;
|
||||||
|
GstDeviceProvider *provider = (GstDeviceProvider*)self;
|
||||||
struct node_data *nd;
|
struct node_data *nd;
|
||||||
|
const char *str;
|
||||||
|
|
||||||
if (strcmp(type, PW_TYPE_INTERFACE_Node) == 0) {
|
if (strcmp(type, PW_TYPE_INTERFACE_Node) == 0) {
|
||||||
struct pw_node *node;
|
struct pw_node *node;
|
||||||
|
|
@ -477,6 +451,16 @@ static void registry_event_global(void *data, uint32_t id, uint32_t permissions,
|
||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
goto no_mem;
|
goto no_mem;
|
||||||
|
|
||||||
|
if (props != NULL) {
|
||||||
|
str = spa_dict_lookup(props, PW_KEY_OBJECT_PATH);
|
||||||
|
if (str != NULL) {
|
||||||
|
if (g_str_has_prefix(str, "alsa:"))
|
||||||
|
gst_device_provider_hide_provider (provider, "pulsedeviceprovider");
|
||||||
|
else if (g_str_has_prefix(str, "v4l2:"))
|
||||||
|
gst_device_provider_hide_provider (provider, "v4l2deviceprovider");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nd = pw_proxy_get_user_data((struct pw_proxy*)node);
|
nd = pw_proxy_get_user_data((struct pw_proxy*)node);
|
||||||
nd->self = self;
|
nd->self = self;
|
||||||
nd->proxy = node;
|
nd->proxy = node;
|
||||||
|
|
@ -490,7 +474,6 @@ static void registry_event_global(void *data, uint32_t id, uint32_t permissions,
|
||||||
else if (strcmp(type, PW_TYPE_INTERFACE_Port) == 0) {
|
else if (strcmp(type, PW_TYPE_INTERFACE_Port) == 0) {
|
||||||
struct pw_port *port;
|
struct pw_port *port;
|
||||||
struct port_data *pd;
|
struct port_data *pd;
|
||||||
const char *str;
|
|
||||||
|
|
||||||
if ((str = spa_dict_lookup(props, PW_KEY_NODE_ID)) == NULL)
|
if ((str = spa_dict_lookup(props, PW_KEY_NODE_ID)) == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue