PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2 of the License,
+ by the Free Software Foundation; either version 2.1 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
#include <pulse/cdecl.h>
#include <pulse/operation.h>
#include <pulse/proplist.h>
+#include <pulse/version.h>
/** \page async Asynchronous API
*
* \section overv_sec Overview
*
* The asynchronous API is the native interface to the PulseAudio library.
- * It allows full access to all available functions. This also means that
+ * It allows full access to all available functionality. This however means that
* it is rather complex and can take some time to fully master.
*
* \section mainloop_sec Main Loop Abstraction
* implementation where all of PulseAudio's
* internal handling runs in a separate
* thread.
- * \li \subpage glib-mainloop - A wrapper around GLIB's main loop. Available
- * for both GLIB 1.2 and GLIB 2.x.
+ * \li \subpage glib-mainloop - A wrapper around GLib's main loop.
*
* UNIX signals may be hooked to a main loop using the functions from
* \ref mainloop-signal.h. These rely only on the main loop abstraction
* server. A pa_context object wraps a connection to a PulseAudio
* server using its native protocol. */
-/** \example pacat.c
- * A playback and recording tool using the asynchronous API */
-
-/** \example paplay.c
- * A sound file playback tool using the asynchronous API, based on libsndfile */
-
PA_C_DECL_BEGIN
/** An opaque connection context to a daemon */
/** A generic callback for operation completion */
typedef void (*pa_context_success_cb_t) (pa_context *c, int success, void *userdata);
+/** A callback for asynchronous meta/policy event messages. The set
+ * of defined events can be extended at any time. Also, server modules
+ * may introduce additional message types so make sure that your
+ * callback function ignores messages it doesn't know. \since
+ * 0.9.15 */
+typedef void (*pa_context_event_cb_t)(pa_context *c, const char *name, pa_proplist *p, void *userdata);
+
/** Instantiate a new connection context with an abstract mainloop API
* and an application name. It is recommended to use pa_context_new_with_proplist()
* instead and specify some initial properties.*/
/** Set a callback function that is called whenever the context status changes */
void pa_context_set_state_callback(pa_context *c, pa_context_notify_cb_t cb, void *userdata);
+/** Set a callback function that is called whenver a meta/policy
+ * control event is received. \since 0.9.15 */
+void pa_context_set_event_callback(pa_context *p, pa_context_event_cb_t cb, void *userdata);
+
/** Return the error number of the last failed operation */
int pa_context_errno(pa_context *c);
connect to the default server. This routine may but will not always
return synchronously on error. Use pa_context_set_state_callback() to
be notified when the connection is established. If flags doesn't have
-PA_NOAUTOSPAWN set and no specific server is specified or accessible a
-new daemon is spawned. If api is non-NULL, the functions specified in
-the structure are used when forking a new child process. */
+PA_CONTEXT_NOAUTOSPAWN set and no specific server is specified or
+accessible a new daemon is spawned. If api is non-NULL, the functions
+specified in the structure are used when forking a new child
+process. */
int pa_context_connect(pa_context *c, const char *server, pa_context_flags_t flags, const pa_spawn_api *api);
/** Terminate the context connection immediately */
/** Return the protocol version of the connected server. */
uint32_t pa_context_get_server_protocol_version(pa_context *c);
-/* Update the property list of the client, adding new entries. Please
+/** Update the property list of the client, adding new entries. Please
* note that it is highly recommended to set as much properties
* initially via pa_context_new_with_proplist() as possible instead a
* posteriori with this function, since that information may then be
* used to route streams of the client to the right device. \since 0.9.11 */
pa_operation *pa_context_proplist_update(pa_context *c, pa_update_mode_t mode, pa_proplist *p, pa_context_success_cb_t cb, void *userdata);
-/* Update the property list of the client, remove entries. \since 0.9.11 */
+/** Update the property list of the client, remove entries. \since 0.9.11 */
pa_operation *pa_context_proplist_remove(pa_context *c, const char *const keys[], pa_context_success_cb_t cb, void *userdata);
/** Return the client index this context is
* introspection functions, such as pa_context_get_client_info(). \since 0.9.11 */
uint32_t pa_context_get_index(pa_context *s);
+/** Create a new timer event source for the specified time (wrapper
+ for mainloop->time_new). \since 0.9.16 */
+pa_time_event* pa_context_rttime_new(pa_context *c, pa_usec_t usec, pa_time_event_cb_t cb, void *userdata);
+/** Restart a running or expired timer event source (wrapper
+ for mainloop->time_restart). \since 0.9.16 */
+void pa_context_rttime_restart(pa_context *c, pa_time_event *e, pa_usec_t usec);
+
PA_C_DECL_END
#endif