context.h File Reference

Connection contexts for asynchrononous communication with a server. More...

Go to the source code of this file.

Typedefs

typedef pa_context pa_context
 An opaque connection context to a daemon.
typedef void(*) pa_context_notify_cb_t (pa_context *c, void *userdata)
 Generic notification callback prototype.
typedef void(*) pa_context_success_cb_t (pa_context *c, int success, void *userdata)
 A generic callback for operation completion.

Functions

pa_contextpa_context_new (pa_mainloop_api *mainloop, const char *name)
 Instantiate a new connection context with an abstract mainloop API and an application name.
void pa_context_unref (pa_context *c)
 Decrease the reference counter of the context by one.
pa_contextpa_context_ref (pa_context *c)
 Increase the reference counter of the context by one.
void pa_context_set_state_callback (pa_context *c, pa_context_notify_cb_t cb, void *userdata)
 Set a callback function that is called whenever the context status changes.
int pa_context_errno (pa_context *c)
 Return the error number of the last failed operation.
int pa_context_is_pending (pa_context *c)
 Return non-zero if some data is pending to be written to the connection.
pa_context_state_t pa_context_get_state (pa_context *c)
 Return the current context status.
int pa_context_connect (pa_context *c, const char *server, pa_context_flags_t flags, const pa_spawn_api *api)
 Connect the context to the specified server.
void pa_context_disconnect (pa_context *c)
 Terminate the context connection immediately.
pa_operationpa_context_drain (pa_context *c, pa_context_notify_cb_t cb, void *userdata)
 Drain the context.
pa_operationpa_context_exit_daemon (pa_context *c, pa_context_success_cb_t cb, void *userdata)
 Tell the daemon to exit.
pa_operationpa_context_set_default_sink (pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata)
 Set the name of the default sink.
pa_operationpa_context_set_default_source (pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata)
 Set the name of the default source.
int pa_context_is_local (pa_context *c)
 Returns 1 when the connection is to a local daemon.
pa_operationpa_context_set_name (pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata)
 Set a different application name for context on the server.
const char * pa_context_get_server (pa_context *c)
 Return the server name this context is connected to.
uint32_t pa_context_get_protocol_version (pa_context *c)
 Return the protocol version of the library.
uint32_t pa_context_get_server_protocol_version (pa_context *c)
 Return the protocol version of the connected server.


Detailed Description

Connection contexts for asynchrononous communication with a server.

A pa_context object wraps a connection to a PulseAudio server using its native protocol.


Typedef Documentation

typedef struct pa_context pa_context

An opaque connection context to a daemon.

Examples:
pacat.c, and paplay.c.

typedef void(*) pa_context_notify_cb_t(pa_context *c, void *userdata)

Generic notification callback prototype.

typedef void(*) pa_context_success_cb_t(pa_context *c, int success, void *userdata)

A generic callback for operation completion.


Function Documentation

int pa_context_connect ( pa_context c,
const char *  server,
pa_context_flags_t  flags,
const pa_spawn_api api 
)

Connect the context to the specified server.

If server is NULL, 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.

Examples:
pacat.c, and paplay.c.

void pa_context_disconnect ( pa_context c  ) 

Terminate the context connection immediately.

Examples:
pacat.c, and paplay.c.

pa_operation* pa_context_drain ( pa_context c,
pa_context_notify_cb_t  cb,
void *  userdata 
)

Drain the context.

If there is nothing to drain, the function returns NULL

Examples:
pacat.c, and paplay.c.

int pa_context_errno ( pa_context c  ) 

Return the error number of the last failed operation.

Examples:
pacat.c, and paplay.c.

pa_operation* pa_context_exit_daemon ( pa_context c,
pa_context_success_cb_t  cb,
void *  userdata 
)

Tell the daemon to exit.

The returned operation is unlikely to complete succesfully, since the daemon probably died before returning a success notification

uint32_t pa_context_get_protocol_version ( pa_context c  ) 

Return the protocol version of the library.

Since:
0.8

const char* pa_context_get_server ( pa_context c  ) 

Return the server name this context is connected to.

Since:
0.7

uint32_t pa_context_get_server_protocol_version ( pa_context c  ) 

Return the protocol version of the connected server.

Since:
0.8

pa_context_state_t pa_context_get_state ( pa_context c  ) 

Return the current context status.

Examples:
pacat.c, and paplay.c.

int pa_context_is_local ( pa_context c  ) 

Returns 1 when the connection is to a local daemon.

Returns negative when no connection has been made yet.

Since:
0.5

int pa_context_is_pending ( pa_context c  ) 

Return non-zero if some data is pending to be written to the connection.

pa_context* pa_context_new ( pa_mainloop_api mainloop,
const char *  name 
)

Instantiate a new connection context with an abstract mainloop API and an application name.

Examples:
pacat.c, and paplay.c.

pa_context* pa_context_ref ( pa_context c  ) 

Increase the reference counter of the context by one.

pa_operation* pa_context_set_default_sink ( pa_context c,
const char *  name,
pa_context_success_cb_t  cb,
void *  userdata 
)

Set the name of the default sink.

Since:
0.4

pa_operation* pa_context_set_default_source ( pa_context c,
const char *  name,
pa_context_success_cb_t  cb,
void *  userdata 
)

Set the name of the default source.

Since:
0.4

pa_operation* pa_context_set_name ( pa_context c,
const char *  name,
pa_context_success_cb_t  cb,
void *  userdata 
)

Set a different application name for context on the server.

Since:
0.5

void pa_context_set_state_callback ( pa_context c,
pa_context_notify_cb_t  cb,
void *  userdata 
)

Set a callback function that is called whenever the context status changes.

Examples:
pacat.c, and paplay.c.

void pa_context_unref ( pa_context c  ) 

Decrease the reference counter of the context by one.

Examples:
pacat.c, and paplay.c.


Generated on Tue Apr 24 02:06:15 2012 for PulseAudio by  doxygen 1.4.7