m-default-nodes: lift restrictions on media.class for audio nodes

Previously a default source had to be Audio/Source and a default sink
had to be Audio/Sink. This did not account for:
 - monitor sources (Audio/Sink)
 - duplex nodes (Audio/Duplex)
 - virtual sources (Audio/Source/Virtual)

With this change the restriction is now on the number of input/output
ports, so any Audio/* node with output ports is a valid target to select
as a default source, while any Audio/* node with input ports is a valid
target for a default sink.

Fixes #60
This commit is contained in:
George Kiagiadakis
2021-10-05 17:21:06 +03:00
parent 4f97def376
commit 5e14c69108
3 changed files with 68 additions and 19 deletions

View File

@@ -23,20 +23,34 @@ static const gchar * DEFAULT_KEY[N_DEFAULT_NODES] = {
[VIDEO_SOURCE] = "default.video.source",
};
#if DEFAULT_CONFIG_KEYS
static const gchar * NODE_TYPE_STR[N_DEFAULT_NODES] = {
[AUDIO_SINK] = "Audio/Sink",
[AUDIO_SOURCE] = "Audio/Source",
[VIDEO_SOURCE] = "Video/Source",
};
#if COMPILING_MODULE_DEFAULT_NODES
static const gchar * DEFAULT_CONFIG_KEY[N_DEFAULT_NODES] = {
[AUDIO_SINK] = "default.configured.audio.sink",
[AUDIO_SOURCE] = "default.configured.audio.source",
[VIDEO_SOURCE] = "default.configured.video.source",
};
#endif
static const gchar * MEDIA_CLASS[N_DEFAULT_NODES] = {
[AUDIO_SINK] = "Audio/Sink",
[AUDIO_SOURCE] = "Audio/Source",
[VIDEO_SOURCE] = "Video/Source",
static const gchar * MEDIA_CLASS_MATCH[N_DEFAULT_NODES] = {
[AUDIO_SINK] = "Audio/*",
[AUDIO_SOURCE] = "Audio/*",
[VIDEO_SOURCE] = "Video/*",
};
static const gchar * N_PORTS_KEY[N_DEFAULT_NODES] = {
[AUDIO_SINK] = "n-input-ports",
[AUDIO_SOURCE] = "n-output-ports",
[VIDEO_SOURCE] = "n-output-ports",
};
#endif
static int
json_object_find (const char *obj, const char *key, char *value, size_t len)
{