Skip to content

Commit e640aa4

Browse files
committed
PCM delay and client delay properties monitoring
1 parent f40fe1c commit e640aa4

File tree

2 files changed

+30
-10
lines changed

2 files changed

+30
-10
lines changed

doc/bluealsactl.1.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ monitor [-p[PROPS] | --properties[=PROPS]]
245245

246246
``PropertyChanged PCM_PATH PROPERTY_NAME VALUE``
247247

248-
Property names that can be monitored are **Codec**, **Running**,
249-
**SoftVolume** and **Volume**.
248+
Property names that can be monitored are **Codec**, **Delay**,
249+
**ClientDelay**, **Running**, **SoftVolume** and **Volume**.
250250

251251
Volume is an array of values, each showing the loudness and mute components
252252
of a channel. The order of the values corresponds to the ChannelMap

src/bluealsactl/cmd-monitor.c

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@
2626

2727
enum {
2828
PROPERTY_CODEC,
29+
PROPERTY_DELAY,
30+
PROPERTY_CLIENT_DELAY,
2931
PROPERTY_RUNNING,
30-
PROPERTY_SOFTVOL,
32+
PROPERTY_SOFT_VOLUME,
3133
PROPERTY_VOLUME,
3234
};
3335

@@ -39,8 +41,10 @@ struct property {
3941
static bool monitor_properties = false;
4042
static struct property monitor_properties_set[] = {
4143
[PROPERTY_CODEC] = { "Codec", false },
44+
[PROPERTY_DELAY] = { "Delay", false },
45+
[PROPERTY_CLIENT_DELAY] = { "ClientDelay", false },
4246
[PROPERTY_RUNNING] = { "Running", false },
43-
[PROPERTY_SOFTVOL] = { "SoftVolume", false },
47+
[PROPERTY_SOFT_VOLUME] = { "SoftVolume", false },
4448
[PROPERTY_VOLUME] = { "Volume", false },
4549
};
4650

@@ -76,23 +80,39 @@ static dbus_bool_t monitor_dbus_message_iter_get_pcm_props_cb(const char *key,
7680
goto fail;
7781
const char *codec;
7882
dbus_message_iter_get_basic(&variant, &codec);
79-
printf("PropertyChanged %s Codec %s\n", path, codec);
83+
printf("PropertyChanged %s %s %s\n", path, key, codec);
84+
}
85+
else if (monitor_properties_set[PROPERTY_DELAY].enabled &&
86+
strcmp(key, monitor_properties_set[PROPERTY_DELAY].name) == 0) {
87+
if (type != (type_expected = DBUS_TYPE_UINT16))
88+
goto fail;
89+
dbus_uint16_t delay;
90+
dbus_message_iter_get_basic(&variant, &delay);
91+
printf("PropertyChanged %s %s %#.1f\n", path, key, delay / 10.0);
92+
}
93+
else if (monitor_properties_set[PROPERTY_CLIENT_DELAY].enabled &&
94+
strcmp(key, monitor_properties_set[PROPERTY_CLIENT_DELAY].name) == 0) {
95+
if (type != (type_expected = DBUS_TYPE_INT16))
96+
goto fail;
97+
dbus_int16_t delay;
98+
dbus_message_iter_get_basic(&variant, &delay);
99+
printf("PropertyChanged %s %s %#.1f\n", path, key, delay / 10.0);
80100
}
81101
else if (monitor_properties_set[PROPERTY_RUNNING].enabled &&
82102
strcmp(key, monitor_properties_set[PROPERTY_RUNNING].name) == 0) {
83103
if (type != (type_expected = DBUS_TYPE_BOOLEAN))
84104
goto fail;
85105
dbus_bool_t running;
86106
dbus_message_iter_get_basic(&variant, &running);
87-
printf("PropertyChanged %s Running %s\n", path, running ? "true" : "false");
107+
printf("PropertyChanged %s %s %s\n", path, key, running ? "true" : "false");
88108
}
89-
else if (monitor_properties_set[PROPERTY_SOFTVOL].enabled &&
90-
strcmp(key, monitor_properties_set[PROPERTY_SOFTVOL].name) == 0) {
109+
else if (monitor_properties_set[PROPERTY_SOFT_VOLUME].enabled &&
110+
strcmp(key, monitor_properties_set[PROPERTY_SOFT_VOLUME].name) == 0) {
91111
if (type != (type_expected = DBUS_TYPE_BOOLEAN))
92112
goto fail;
93113
dbus_bool_t softvol;
94114
dbus_message_iter_get_basic(&variant, &softvol);
95-
printf("PropertyChanged %s SoftVolume %s\n", path, softvol ? "true" : "false");
115+
printf("PropertyChanged %s %s %s\n", path, key, softvol ? "true" : "false");
96116
}
97117
else if (monitor_properties_set[PROPERTY_VOLUME].enabled &&
98118
strcmp(key, monitor_properties_set[PROPERTY_VOLUME].name) == 0) {
@@ -106,7 +126,7 @@ static dbus_bool_t monitor_dbus_message_iter_get_pcm_props_cb(const char *key,
106126
dbus_message_iter_recurse(&variant, &iter);
107127
dbus_message_iter_get_fixed_array(&iter, &data, &len);
108128

109-
printf("PropertyChanged %s Volume", path);
129+
printf("PropertyChanged %s %s", path, key);
110130
for (size_t i = 0; i < (size_t)len; i++)
111131
printf(" %u%s", data[i] & 0x7f, data[i] & 0x80 ? "[M]" : "");
112132
printf("\n");

0 commit comments

Comments
 (0)