mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
spa: alsa: autodetect supported iec958 codecs via ELD info
The alsa/acp code already supports getting a user-friendly monitor name
using the EDID-Like Data (ELD) information available from cards that follow
the Intel HDA specification.
This patch adds support for also parsing the SAD fields of the ELD, and
exposing the results as a "iec958.codecs.detected" property on the
corresponding node, which should make it possible to provide more
user-friendly configuration UIs and defaults.
The default value will take effect if the session manager does not set a
different value.
Brief example:
test@test:~/checkouts/pipewire$ pw-dump | grep -E "(iec958.codecs.detected|iec958.codecs)\":"
"iec958.codecs": "[\"PCM\",\"AC3\",\"EAC3\",\"TrueHD\"]",
"iec958.codecs.detected": "[\"PCM\",\"AC3\",\"EAC3\",\"TrueHD\"]",
<after powering on my receiver>
test@test:~/checkouts/pipewire$ pw-dump | grep -E "(iec958.codecs.detected|iec958.codecs)\":"
"iec958.codecs": "[\"PCM\",\"DTS\",\"AC3\",\"EAC3\",\"TrueHD\",\"DTS-HD\"]",
"iec958.codecs.detected": "[\"PCM\",\"DTS\",\"AC3\",\"EAC3\",\"TrueHD\",\"DTS-HD\"]",
Big thanks to Pauli Virtanen <pav@iki.fi>, who also wrote large paths of the
code for this patch.
This commit is contained in:
parent
0570d1dd00
commit
f33e1bc8c3
5 changed files with 144 additions and 6 deletions
|
|
@ -157,6 +157,7 @@ static int emit_node(struct impl *this, struct acp_device *dev)
|
|||
char device_name[128], path[210], channels[16], ch[12], routes[16];
|
||||
char card_index[16], card_name[64], *p;
|
||||
char positions[SPA_AUDIO_MAX_CHANNELS * 12];
|
||||
char codecs[512];
|
||||
struct spa_device_object_info info;
|
||||
struct acp_card *card = this->card;
|
||||
const char *stream, *card_id;
|
||||
|
|
@ -174,7 +175,7 @@ static int emit_node(struct impl *this, struct acp_device *dev)
|
|||
|
||||
info.change_mask = SPA_DEVICE_OBJECT_CHANGE_MASK_PROPS;
|
||||
|
||||
items = alloca((dev->props.n_items + 9) * sizeof(*items));
|
||||
items = alloca((dev->props.n_items + 10) * sizeof(*items));
|
||||
n_items = 0;
|
||||
|
||||
snprintf(card_index, sizeof(card_index), "%d", card->index);
|
||||
|
|
@ -202,6 +203,11 @@ static int emit_node(struct impl *this, struct acp_device *dev)
|
|||
}
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_AUDIO_POSITION, positions);
|
||||
|
||||
if (dev->n_codecs > 0) {
|
||||
acp_iec958_codecs_to_json(dev->codecs, dev->n_codecs, codecs, sizeof(codecs));
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT("iec958.codecs", codecs);
|
||||
}
|
||||
|
||||
snprintf(routes, sizeof(routes), "%d", dev->n_ports);
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT("device.routes", routes);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue