[pulseaudio-discuss] [PATCH 5/6] protocol-native: Add signal receiving capability

Tanu Kaskinen tanuk at iki.fi
Tue Oct 3 13:03:00 UTC 2017


On Mon, 2017-10-02 at 14:36 +0200, Georg Chini wrote:
> On 02.10.2017 12:20, Tanu Kaskinen wrote:
> > On Sat, 2017-08-19 at 17:48 +0200, Georg Chini wrote:
> > > This patch extends the client subscription API, so that signals sent from
> > > PulseAudio can be processed. Within PulseAudio, a signal can be emitted
> > > using pa_signal_post(). The interface can be used to notify the client of
> > > events that are not covered by the subscription API (for example a button
> > > press event on a bluetooth headset).
> > > 
> > > Setting up signal notification is very similar to using subscriptions.
> > > First the client needs to subscribe with pa_context_subscribe_signals()
> > > and then sets up a signal handler using pa_context_set_signal_callback().
> > > 
> > > The signal handler will receive three arguments in addition to the usual
> > > context and userdata:
> > > sender - string that specifies the origin of the signal
> > > signal - string that specifies the type of the signal
> > > signal_parameters - optional string for additional information
> > > ---
> > >   PROTOCOL                        |  3 ++
> > >   src/map-file                    |  2 ++
> > >   src/pulse/def.h                 |  4 +++
> > >   src/pulse/internal.h            |  2 ++
> > >   src/pulse/subscribe.c           | 66 +++++++++++++++++++++++++++++++++++++----
> > >   src/pulse/subscribe.h           |  9 ++++++
> > >   src/pulsecore/core-messages.c   | 23 ++++++++++++++
> > >   src/pulsecore/core-messages.h   | 11 +++++++
> > >   src/pulsecore/core.h            |  1 +
> > >   src/pulsecore/native-common.h   |  1 +
> > >   src/pulsecore/pdispatch.c       |  1 +
> > >   src/pulsecore/protocol-native.c | 57 +++++++++++++++++++++++++++++++++++
> > >   12 files changed, 174 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/PROTOCOL b/PROTOCOL
> > > index ccd3cd2c..e9337e27 100644
> > > --- a/PROTOCOL
> > > +++ b/PROTOCOL
> > > @@ -427,6 +427,9 @@ Added new command for communication with objects.
> > >   PA_COMMAND_SEND_OBJECT_MESSAGE:
> > >   sends a message to an object that registered a named message handler
> > >   
> > > +Added signal subscription functions. Clients can now subscribe to signals
> > > +that PulseAudio sends.
> > 
> > The PROTOCOL file is supposed to document the protocol changes in
> > detail (or at least that's my impression), but this description is a
> > very high-level note. Also, talking about "functions" is off-topic
> > since the protocol doesn't define any functions.
> > 
> 
> Where does your impression come from? My impression was, that the
> PROTOCOL file has only very brief and high level descriptions, so I kept
> it that way. I can surely add more details, if you want.

My impression comes from this kind of stuff:

    ## v26, implemented by >= 2.0

    In reply from PA_COMMAND_GET_CARD_INFO (and thus
    PA_COMMAND_GET_CARD_INFO_LIST), the following is added:

        uint32_t n_ports

    ...followed by n_ports extended port entries, which look like this:

        string name
        string description
        uint32_t priority
        uint32_t available
        uint8_t direction
        proplist
        uint32_t n_profiles
        string profile_name_1
        ...
        string profile_name_n

    Profile names must match earlier sent profile names for the same
    card.

Admittedly, not all of the notes are of the same quality, but I would
certainly like them to be.

-- 
Tanu

https://www.patreon.com/tanuk


More information about the pulseaudio-discuss mailing list