diff --git a/spa/plugins/alsa/acp/acp.h b/spa/plugins/alsa/acp/acp.h index 91703a6c6..c41dc9e90 100644 --- a/spa/plugins/alsa/acp/acp.h +++ b/spa/plugins/alsa/acp/acp.h @@ -185,6 +185,7 @@ struct acp_card_profile { char *name; char *description; + char *description_key; uint32_t priority; enum acp_available available; struct acp_dict props; diff --git a/spa/plugins/alsa/acp/alsa-mixer.c b/spa/plugins/alsa/acp/alsa-mixer.c index 2d5da3855..0dc07a4ad 100644 --- a/spa/plugins/alsa/acp/alsa-mixer.c +++ b/spa/plugins/alsa/acp/alsa-mixer.c @@ -2405,11 +2405,10 @@ static int path_verify(pa_alsa_path *p) { { "hdmi-output", N_("HDMI / DisplayPort"), PA_DEVICE_PORT_TYPE_HDMI }, { "iec958-stereo-output", N_("Digital Output (S/PDIF)"), PA_DEVICE_PORT_TYPE_SPDIF }, { "iec958-stereo-input", N_("Digital Input (S/PDIF)"), PA_DEVICE_PORT_TYPE_SPDIF }, - { "iec958-passthrough-output", N_("Digital Passthrough (S/PDIF)"), PA_DEVICE_PORT_TYPE_SPDIF }, { "multichannel-input", N_("Multichannel Input"), PA_DEVICE_PORT_TYPE_LINE }, { "multichannel-output", N_("Multichannel Output"), PA_DEVICE_PORT_TYPE_LINE }, - { "steelseries-arctis-5-output-game", N_("Game Output"), PA_DEVICE_PORT_TYPE_HEADSET }, - { "steelseries-arctis-5-output-chat", N_("Chat Output"), PA_DEVICE_PORT_TYPE_HEADSET }, + { "steelseries-arctis-output-game-common", N_("Game Output"), PA_DEVICE_PORT_TYPE_HEADSET }, + { "steelseries-arctis-output-chat-common", N_("Chat Output"), PA_DEVICE_PORT_TYPE_HEADSET }, }; pa_alsa_element *e; @@ -3395,6 +3394,7 @@ static void mapping_free(pa_alsa_mapping *m) { pa_xfree(m->name); pa_xfree(m->description); + pa_xfree(m->description_key); pa_proplist_free(m->proplist); @@ -3421,6 +3421,7 @@ static void profile_free(pa_alsa_profile *p) { pa_xfree(p->profile.name); pa_xfree(p->profile.description); + pa_xfree(p->profile.description_key); pa_xfree(p->input_name); pa_xfree(p->output_name); @@ -3697,6 +3698,30 @@ static int mapping_parse_description(pa_config_parser_state *state) { return 0; } +static int mapping_parse_description_key(pa_config_parser_state *state) { + pa_alsa_profile_set *ps; + pa_alsa_profile *p; + pa_alsa_mapping *m; + + pa_assert(state); + + ps = state->userdata; + + if ((m = pa_alsa_mapping_get(ps, state->section))) { + pa_xfree(m->description_key); + m->description_key = pa_xstrdup(state->rvalue); + } else if ((p = profile_get(ps, state->section))) { + pa_xfree(p->profile.description_key); + p->profile.description_key = pa_xstrdup(state->rvalue); + } else { + pa_log("[%s:%u] Section name %s invalid.", state->filename, state->lineno, state->section); + return -1; + } + + return 0; +} + + static int mapping_parse_priority(pa_config_parser_state *state) { pa_alsa_profile_set *ps; pa_alsa_profile *p; @@ -4059,13 +4084,15 @@ static int mapping_verify(pa_alsa_mapping *m, const pa_channel_map *bonus) { { "analog-surround-70", N_("Analog Surround 7.0") }, { "analog-surround-71", N_("Analog Surround 7.1") }, { "iec958-stereo", N_("Digital Stereo (IEC958)") }, - { "iec958-passthrough", N_("Digital Passthrough (IEC958)") }, { "iec958-ac3-surround-40", N_("Digital Surround 4.0 (IEC958/AC3)") }, { "iec958-ac3-surround-51", N_("Digital Surround 5.1 (IEC958/AC3)") }, { "iec958-dts-surround-51", N_("Digital Surround 5.1 (IEC958/DTS)") }, { "hdmi-stereo", N_("Digital Stereo (HDMI)") }, { "hdmi-surround-51", N_("Digital Surround 5.1 (HDMI)") }, + { "gaming-headset-chat", N_("Chat") }, + { "gaming-headset-game", N_("Game") }, }; + const char *description_key = m->description_key ? m->description_key : m->name; pa_assert(m); @@ -4086,7 +4113,7 @@ static int mapping_verify(pa_alsa_mapping *m, const pa_channel_map *bonus) { } if (!m->description) - m->description = pa_xstrdup(lookup_description(m->name, + m->description = pa_xstrdup(lookup_description(description_key, well_known_descriptions, PA_ELEMENTSOF(well_known_descriptions))); @@ -4204,6 +4231,7 @@ static int profile_verify(pa_alsa_profile *p) { { "output:unknown-stereo+input:unknown-stereo", N_("Stereo Duplex") }, { "off", N_("Off") } }; + const char *description_key = p->profile.description_key ? p->profile.description_key : p->profile.name; pa_assert(p); @@ -4285,7 +4313,7 @@ static int profile_verify(pa_alsa_profile *p) { } if (!p->profile.description) - p->profile.description = pa_xstrdup(lookup_description(p->profile.name, + p->profile.description = pa_xstrdup(lookup_description(description_key, well_known_descriptions, PA_ELEMENTSOF(well_known_descriptions))); @@ -4415,6 +4443,7 @@ pa_alsa_profile_set* pa_alsa_profile_set_new(const char *fname, const pa_channel /* Shared by [Mapping ...] and [Profile ...] */ { "description", mapping_parse_description, NULL, NULL }, + { "description-key", mapping_parse_description_key,NULL, NULL }, { "priority", mapping_parse_priority, NULL, NULL }, { "fallback", mapping_parse_fallback, NULL, NULL }, diff --git a/spa/plugins/alsa/acp/alsa-mixer.h b/spa/plugins/alsa/acp/alsa-mixer.h index c11d0d4fd..58f90280d 100644 --- a/spa/plugins/alsa/acp/alsa-mixer.h +++ b/spa/plugins/alsa/acp/alsa-mixer.h @@ -312,6 +312,7 @@ struct pa_alsa_mapping { char *name; char *description; + char *description_key; unsigned priority; pa_alsa_direction_t direction; /* These are copied over to the resultant sink/source */