mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
pulse-server: Factor out module code to compile independently
This starts breaking up the giant monolith that is the pulse-server.c code into more manageable chunks by trying to split the module code into individual compilation units.
This commit is contained in:
parent
abf193452c
commit
74140abada
19 changed files with 763 additions and 558 deletions
|
|
@ -22,87 +22,6 @@
|
|||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
static bool object_is_client(struct pw_manager_object *o)
|
||||
{
|
||||
return strcmp(o->type, PW_TYPE_INTERFACE_Client) == 0;
|
||||
}
|
||||
|
||||
static bool object_is_module(struct pw_manager_object *o)
|
||||
{
|
||||
return strcmp(o->type, PW_TYPE_INTERFACE_Module) == 0;
|
||||
}
|
||||
|
||||
static bool object_is_card(struct pw_manager_object *o)
|
||||
{
|
||||
const char *str;
|
||||
return strcmp(o->type, PW_TYPE_INTERFACE_Device) == 0 &&
|
||||
o->props != NULL &&
|
||||
(str = pw_properties_get(o->props, PW_KEY_MEDIA_CLASS)) != NULL &&
|
||||
strcmp(str, "Audio/Device") == 0;
|
||||
}
|
||||
|
||||
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/Duplex") == 0);
|
||||
}
|
||||
|
||||
static bool object_is_source(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/Source") == 0 ||
|
||||
strcmp(str, "Audio/Duplex") == 0 ||
|
||||
strcmp(str, "Audio/Source/Virtual") == 0);
|
||||
}
|
||||
|
||||
static bool object_is_monitor(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);
|
||||
}
|
||||
|
||||
static bool object_is_source_or_monitor(struct pw_manager_object *o)
|
||||
{
|
||||
return object_is_source(o) || object_is_monitor(o);
|
||||
}
|
||||
|
||||
static bool object_is_sink_input(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, "Stream/Output/Audio") == 0;
|
||||
}
|
||||
|
||||
static bool object_is_source_output(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, "Stream/Input/Audio") == 0;
|
||||
}
|
||||
|
||||
static bool object_is_recordable(struct pw_manager_object *o)
|
||||
{
|
||||
return object_is_source(o) || object_is_sink(o) || object_is_sink_input(o);
|
||||
}
|
||||
|
||||
static bool object_is_link(struct pw_manager_object *o)
|
||||
{
|
||||
return strcmp(o->type, PW_TYPE_INTERFACE_Link) == 0;
|
||||
}
|
||||
|
||||
struct selector {
|
||||
bool (*type) (struct pw_manager_object *o);
|
||||
uint32_t id;
|
||||
|
|
@ -160,7 +79,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 || !object_is_link(o))
|
||||
if (o->props == NULL || !pw_manager_object_is_link(o))
|
||||
continue;
|
||||
|
||||
if ((str = pw_properties_get(o->props, PW_KEY_LINK_OUTPUT_NODE)) == NULL)
|
||||
|
|
@ -171,12 +90,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 = object_is_sink, };
|
||||
struct selector sel = { .id = in_node, .type = pw_manager_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 = object_is_recordable, };
|
||||
struct selector sel = { .id = out_node, .type = pw_manager_object_is_recordable, };
|
||||
if ((p = select_object(m, &sel)) != NULL)
|
||||
return p;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue