Path: blob/master/thirdparty/linuxbsd_headers/pulse/subscribe.h
9905 views
#ifndef foosubscribehfoo1#define foosubscribehfoo23/***4This file is part of PulseAudio.56Copyright 2004-2006 Lennart Poettering7Copyright 2006 Pierre Ossman <[email protected]> for Cendio AB89PulseAudio is free software; you can redistribute it and/or modify10it under the terms of the GNU Lesser General Public License as published11by the Free Software Foundation; either version 2.1 of the License,12or (at your option) any later version.1314PulseAudio is distributed in the hope that it will be useful, but15WITHOUT ANY WARRANTY; without even the implied warranty of16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU17General Public License for more details.1819You should have received a copy of the GNU Lesser General Public License20along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.21***/2223#include <inttypes.h>2425#include <pulse/def.h>26#include <pulse/context.h>27#include <pulse/cdecl.h>28#include <pulse/version.h>2930/** \page subscribe Event Subscription31*32* \section overv_sec Overview33*34* The application can be notified, asynchronously, whenever the internal35* layout of the server changes. Possible notifications are described in the36* \ref pa_subscription_event_type and \ref pa_subscription_mask37* enumerations.38*39* The application sets the notification mask using pa_context_subscribe()40* and the function that will be called whenever a notification occurs using41* pa_context_set_subscribe_callback().42*43* The callback will be called with a \ref pa_subscription_event_type_t44* representing the event that caused the callback. Clients can examine what45* object changed using \ref PA_SUBSCRIPTION_EVENT_FACILITY_MASK. The actual46* event type can then be extracted with \ref PA_SUBSCRIPTION_EVENT_TYPE_MASK.47* Please note that the masked values are integers, not flags (so you will48* check the object/event type using a comparison not a binary AND). For49* example, the callback might look something like:50*51@verbatim52void my_subscription_callback(pa_context *c, pa_subscription_event_type_t t,53uint32_t idx, void *userdata) {54if ((t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SOURCE) {55if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_NEW) {56... a source was added, let's do stuff! ...57}58}59}60@endverbatim61*/6263/** \file64* Daemon introspection event subscription subsystem.65*66* See also \subpage subscribe67*/6869PA_C_DECL_BEGIN7071/** Subscription event callback prototype */72typedef void (*pa_context_subscribe_cb_t)(pa_context *c, pa_subscription_event_type_t t, uint32_t idx, void *userdata);7374/** Enable event notification */75pa_operation* pa_context_subscribe(pa_context *c, pa_subscription_mask_t m, pa_context_success_cb_t cb, void *userdata);7677/** Set the context specific call back function that is called whenever the state of the daemon changes */78void pa_context_set_subscribe_callback(pa_context *c, pa_context_subscribe_cb_t cb, void *userdata);7980PA_C_DECL_END8182#endif838485