mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alsa: add period-size, period-num and headroom in props
Add the currently configured alsa hw_params in the properties for easier access.
This commit is contained in:
parent
32421965c7
commit
5b2b93f915
2 changed files with 16 additions and 4 deletions
|
|
@ -56,9 +56,9 @@ static void emit_node_info(struct state *this, bool full)
|
|||
if (full)
|
||||
this->info.change_mask = this->info_all;
|
||||
if (this->info.change_mask) {
|
||||
struct spa_dict_item items[4];
|
||||
struct spa_dict_item items[7];
|
||||
uint32_t i, n_items = 0;
|
||||
char latency[64];
|
||||
char latency[64], period[64], nperiods[64], headroom[64];
|
||||
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_API, "alsa");
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_MEDIA_CLASS, "Audio/Sink");
|
||||
|
|
@ -66,6 +66,12 @@ static void emit_node_info(struct state *this, bool full)
|
|||
if (this->have_format) {
|
||||
snprintf(latency, sizeof(latency), "%lu/%d", this->buffer_frames / 2, this->rate);
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_NODE_MAX_LATENCY, latency);
|
||||
snprintf(period, sizeof(period), "%lu", this->period_frames);
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT("api.alsa.period-size", period);
|
||||
snprintf(nperiods, sizeof(nperiods), "%lu", this->buffer_frames / this->period_frames);
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT("api.alsa.period-num", nperiods);
|
||||
snprintf(headroom, sizeof(headroom), "%u", this->headroom);
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT("api.alsa.headroom", headroom);
|
||||
}
|
||||
this->info.props = &SPA_DICT_INIT(items, n_items);
|
||||
|
||||
|
|
|
|||
|
|
@ -57,9 +57,9 @@ static void emit_node_info(struct state *this, bool full)
|
|||
if (full)
|
||||
this->info.change_mask = this->info_all;
|
||||
if (this->info.change_mask) {
|
||||
struct spa_dict_item items[4];
|
||||
struct spa_dict_item items[7];
|
||||
uint32_t i, n_items = 0;
|
||||
char latency[64];
|
||||
char latency[64], period[64], nperiods[64], headroom[64];
|
||||
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_API, "alsa");
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_MEDIA_CLASS, "Audio/Source");
|
||||
|
|
@ -67,6 +67,12 @@ static void emit_node_info(struct state *this, bool full)
|
|||
if (this->have_format) {
|
||||
snprintf(latency, sizeof(latency), "%lu/%d", this->buffer_frames / 2, this->rate);
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_NODE_MAX_LATENCY, latency);
|
||||
snprintf(period, sizeof(period), "%lu", this->period_frames);
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT("api.alsa.period-size", period);
|
||||
snprintf(nperiods, sizeof(nperiods), "%lu", this->buffer_frames / this->period_frames);
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT("api.alsa.period-num", nperiods);
|
||||
snprintf(headroom, sizeof(headroom), "%u", this->headroom);
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT("api.alsa.headroom", headroom);
|
||||
}
|
||||
this->info.props = &SPA_DICT_INIT(items, n_items);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue