pulse-server: use right prefix for object check

This commit is contained in:
Wim Taymans 2020-12-02 10:59:25 +01:00
parent f8059be328
commit b0a717c95e
2 changed files with 63 additions and 63 deletions

View file

@ -22,17 +22,17 @@
* DEALINGS IN THE SOFTWARE.
*/
static bool is_client(struct pw_manager_object *o)
static bool object_is_client(struct pw_manager_object *o)
{
return strcmp(o->type, PW_TYPE_INTERFACE_Client) == 0;
}
static bool is_module(struct pw_manager_object *o)
static bool object_is_module(struct pw_manager_object *o)
{
return strcmp(o->type, PW_TYPE_INTERFACE_Module) == 0;
}
static bool is_card(struct pw_manager_object *o)
static bool object_is_card(struct pw_manager_object *o)
{
const char *str;
return
@ -42,17 +42,17 @@ static bool is_card(struct pw_manager_object *o)
strcmp(str, "Audio/Device") == 0;
}
static bool is_sink(struct pw_manager_object *o)
static bool object_is_sink(struct pw_manager_object *o)
{
const char *str;
return
strcmp(o->type, PW_TYPE_INTERFACE_Node) == 0 &&
o->props != NULL &&
(str = pw_properties_get(o->props, PW_KEY_MEDIA_CLASS)) != NULL &&
strcmp(str, "Audio/Sink") == 0;
(strcmp(str, "Audio/Sink") == 0 || strcmp(str, "Audio/Sink/Virtual") == 0);
}
static bool is_source(struct pw_manager_object *o)
static bool object_is_source(struct pw_manager_object *o)
{
const char *str;
return
@ -62,12 +62,12 @@ static bool is_source(struct pw_manager_object *o)
strcmp(str, "Audio/Source") == 0;
}
static bool is_source_or_monitor(struct pw_manager_object *o)
static bool object_is_source_or_monitor(struct pw_manager_object *o)
{
return is_source(o) || is_sink(o);
return object_is_source(o) || object_is_sink(o);
}
static bool is_sink_input(struct pw_manager_object *o)
static bool object_is_sink_input(struct pw_manager_object *o)
{
const char *str;
return
@ -77,7 +77,7 @@ static bool is_sink_input(struct pw_manager_object *o)
strcmp(str, "Stream/Output/Audio") == 0;
}
static bool is_source_output(struct pw_manager_object *o)
static bool object_is_source_output(struct pw_manager_object *o)
{
const char *str;
return
@ -87,12 +87,12 @@ static bool is_source_output(struct pw_manager_object *o)
strcmp(str, "Stream/Input/Audio") == 0;
}
static bool is_recordable(struct pw_manager_object *o)
static bool object_is_recordable(struct pw_manager_object *o)
{
return is_source(o) || is_sink(o) || is_sink_input(o);
return object_is_source(o) || object_is_sink(o) || object_is_sink_input(o);
}
static bool is_link(struct pw_manager_object *o)
static bool object_is_link(struct pw_manager_object *o)
{
return strcmp(o->type, PW_TYPE_INTERFACE_Link) == 0;
}
@ -154,7 +154,7 @@ static struct pw_manager_object *find_linked(struct pw_manager *m, uint32_t obj_
uint32_t in_node, out_node;
spa_list_for_each(o, &m->object_list, link) {
if (o->props == NULL || !is_link(o))
if (o->props == NULL || !object_is_link(o))
continue;
if ((str = pw_properties_get(o->props, PW_KEY_LINK_OUTPUT_NODE)) == NULL)
@ -165,12 +165,12 @@ static struct pw_manager_object *find_linked(struct pw_manager *m, uint32_t obj_
in_node = pw_properties_parse_int(str);
if (direction == PW_DIRECTION_OUTPUT && obj_id == out_node) {
struct selector sel = { .id = in_node, .type = is_sink, };
struct selector sel = { .id = in_node, .type = object_is_sink, };
if ((p = select_object(m, &sel)) != NULL)
return p;
}
if (direction == PW_DIRECTION_INPUT && obj_id == in_node) {
struct selector sel = { .id = out_node, .type = is_recordable, };
struct selector sel = { .id = out_node, .type = object_is_recordable, };
if ((p = select_object(m, &sel)) != NULL)
return p;
}