mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2026-02-05 04:06:31 -05:00
pactl: Add signal receiver
This commit is contained in:
parent
6f07cd10ec
commit
c44209d3b8
2 changed files with 21 additions and 1 deletions
|
|
@ -303,7 +303,7 @@ License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
<option>
|
||||
<p><opt>subscribe</opt></p>
|
||||
<optdesc><p>Subscribe to events, pactl does not exit by itself, but keeps waiting for new events.</p></optdesc>
|
||||
<optdesc><p>Subscribe to events and signals, pactl does not exit by itself, but keeps waiting for new events.</p></optdesc>
|
||||
</option>
|
||||
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -2225,6 +2225,17 @@ static void context_subscribe_callback(pa_context *c, pa_subscription_event_type
|
|||
fflush(stdout);
|
||||
}
|
||||
|
||||
static void context_signal_callback(pa_context *c, const char *signal_object_path, const char *signal, char *signal_parameters, void *userdata) {
|
||||
pa_assert(c);
|
||||
|
||||
printf(_("Signal '%s' from %s\n"),
|
||||
signal,
|
||||
signal_object_path);
|
||||
if (signal_parameters)
|
||||
printf(_("Signal parameters: '%s'\n"), signal_parameters);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
static void context_state_callback(pa_context *c, void *userdata) {
|
||||
pa_operation *o = NULL;
|
||||
|
||||
|
|
@ -2495,6 +2506,15 @@ static void context_state_callback(pa_context *c, void *userdata) {
|
|||
PA_SUBSCRIPTION_MASK_CARD,
|
||||
NULL,
|
||||
NULL);
|
||||
if (o) {
|
||||
pa_operation_unref(o);
|
||||
actions++;
|
||||
}
|
||||
|
||||
pa_context_set_signal_callback(c, context_signal_callback, NULL);
|
||||
|
||||
o = pa_context_subscribe_signals(c, (uint64_t) -1, NULL, NULL);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue