media-session: detect passthrough and passthrough only nodes

This commit is contained in:
Wim Taymans 2021-08-23 13:28:02 +02:00
parent 44d575ba70
commit 454a9bd55f

View file

@ -130,6 +130,7 @@ struct node {
unsigned int capture_sink:1; unsigned int capture_sink:1;
unsigned int virtual:1; unsigned int virtual:1;
unsigned int linking:1; unsigned int linking:1;
unsigned int have_passthrough:1;
unsigned int passthrough_only:1; unsigned int passthrough_only:1;
}; };
@ -137,7 +138,10 @@ static bool find_format(struct node *node)
{ {
struct impl *impl = node->impl; struct impl *impl = node->impl;
struct sm_param *p; struct sm_param *p;
bool have_format = false, have_passthrough = false; bool have_format = false;
node->have_passthrough = false;
node->passthrough_only = false;
spa_list_for_each(p, &node->obj->param_list, link) { spa_list_for_each(p, &node->obj->param_list, link) {
struct spa_audio_info info = { 0, }; struct spa_audio_info info = { 0, };
@ -153,11 +157,8 @@ static bool find_format(struct node *node)
if (info.media_type != SPA_MEDIA_TYPE_audio) if (info.media_type != SPA_MEDIA_TYPE_audio)
continue; continue;
if (info.media_subtype != SPA_MEDIA_SUBTYPE_raw) { switch (info.media_subtype) {
have_passthrough = true; case SPA_MEDIA_SUBTYPE_raw:
continue;
}
spa_pod_object_fixate((struct spa_pod_object*)p->param); spa_pod_object_fixate((struct spa_pod_object*)p->param);
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG)) if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
spa_debug_pod(2, NULL, p->param); spa_debug_pod(2, NULL, p->param);
@ -186,9 +187,16 @@ static bool find_format(struct node *node)
node->format = info; node->format = info;
have_format = true; have_format = true;
break;
case SPA_MEDIA_SUBTYPE_iec958:
pw_log_info("passthrough node %d found", node->id);
node->have_passthrough = true;
break;
} }
if (!have_format && have_passthrough) { }
pw_log_info("passthrough only stream found"); if (!have_format && node->have_passthrough) {
pw_log_info("passthrough only node %d found", node->id);
node->passthrough_only = true; node->passthrough_only = true;
have_format = true; have_format = true;
} }