alsa: always list PCM as iec958 codec

Always put PCM as the supported format for iec958.
Only accept iec958codecs for iec958 capable nodes.
This commit is contained in:
Wim Taymans 2021-09-01 11:16:38 +02:00
parent 592163fb0a
commit 01f640709e
2 changed files with 5 additions and 4 deletions

View file

@ -205,8 +205,8 @@ static int impl_node_enum_params(void *object, int seq,
SPA_PROP_latencyOffsetNsec, SPA_POD_Long(this->process_latency.ns), SPA_PROP_latencyOffsetNsec, SPA_POD_Long(this->process_latency.ns),
0); 0);
n_codecs = spa_alsa_get_iec958_codecs(this, codecs, SPA_N_ELEMENTS(codecs)); if (this->is_iec958 || this->is_hdmi) {
if (n_codecs > 0) { n_codecs = spa_alsa_get_iec958_codecs(this, codecs, SPA_N_ELEMENTS(codecs));
spa_pod_builder_prop(&b, SPA_PROP_iec958Codecs, 0); spa_pod_builder_prop(&b, SPA_PROP_iec958Codecs, 0);
spa_pod_builder_array(&b, sizeof(uint32_t), SPA_TYPE_Id, spa_pod_builder_array(&b, sizeof(uint32_t), SPA_TYPE_Id,
n_codecs, codecs); n_codecs, codecs);
@ -337,11 +337,11 @@ static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
SPA_PROP_START_CUSTOM, SPA_POD_OPT_Bool(&p->use_chmap), SPA_PROP_START_CUSTOM, SPA_POD_OPT_Bool(&p->use_chmap),
SPA_PROP_iec958Codecs, SPA_POD_OPT_Pod(&iec958_codecs)); SPA_PROP_iec958Codecs, SPA_POD_OPT_Pod(&iec958_codecs));
if (iec958_codecs != NULL) { if ((this->is_iec958 || this->is_hdmi) && iec958_codecs != NULL) {
uint32_t i, codecs[16], n_codecs; uint32_t i, codecs[16], n_codecs;
n_codecs = spa_pod_copy_array(iec958_codecs, SPA_TYPE_Id, n_codecs = spa_pod_copy_array(iec958_codecs, SPA_TYPE_Id,
codecs, SPA_N_ELEMENTS(codecs)); codecs, SPA_N_ELEMENTS(codecs));
this->iec958_codecs = 0; this->iec958_codecs = 1ULL << SPA_AUDIO_IEC958_CODEC_PCM;
for (i = 0; i < n_codecs; i++) for (i = 0; i < n_codecs; i++)
this->iec958_codecs |= 1ULL << codecs[i]; this->iec958_codecs |= 1ULL << codecs[i];
} }

View file

@ -94,6 +94,7 @@ int spa_alsa_init(struct state *state)
if (state->stream == SND_PCM_STREAM_PLAYBACK) { if (state->stream == SND_PCM_STREAM_PLAYBACK) {
state->is_iec958 = spa_strstartswith(state->props.device, "iec958"); state->is_iec958 = spa_strstartswith(state->props.device, "iec958");
state->is_hdmi = spa_strstartswith(state->props.device, "hdmi"); state->is_hdmi = spa_strstartswith(state->props.device, "hdmi");
state->iec958_codecs |= 1ULL << SPA_AUDIO_IEC958_CODEC_PCM;
} }
if (state->open_ucm) { if (state->open_ucm) {