]>
code.delx.au - pulseaudio/blob - src/pulse/browser.h
5 This file is part of PulseAudio.
7 Copyright 2004-2006 Lennart Poettering
9 PulseAudio is free software; you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version.
14 PulseAudio is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public
20 License along with PulseAudio; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25 #include <pulse/mainloop-api.h>
26 #include <pulse/sample.h>
27 #include <pulse/channelmap.h>
28 #include <pulse/cdecl.h>
31 * An abstract interface for Zeroconf browsing of PulseAudio servers */
35 /** An opaque Zeroconf service browser object */
36 typedef struct pa_browser pa_browser
;
38 /** Opcodes for pa_browser_cb_t callbacks */
39 typedef enum pa_browse_opcode
{
40 PA_BROWSE_NEW_SERVER
= 0, /**< New server found */
41 PA_BROWSE_NEW_SINK
, /**< New sink found */
42 PA_BROWSE_NEW_SOURCE
, /**< New source found */
43 PA_BROWSE_REMOVE_SERVER
, /**< Server disappeared */
44 PA_BROWSE_REMOVE_SINK
, /**< Sink disappeared */
45 PA_BROWSE_REMOVE_SOURCE
/**< Source disappeared */
48 typedef enum pa_browse_flags
{
49 PA_BROWSE_FOR_SERVERS
= 1, /**< Browse for servers */
50 PA_BROWSE_FOR_SINKS
= 2, /**< Browse for sinks */
51 PA_BROWSE_FOR_SOURCES
= 4 /** Browse for sources */
54 /** Create a new browser object on the specified main loop */
55 pa_browser
*pa_browser_new(pa_mainloop_api
*mainloop
);
57 /** Same pa_browser_new, but pass additional flags parameter. */
58 pa_browser
*pa_browser_new_full(pa_mainloop_api
*mainloop
, pa_browse_flags_t flags
, const char **error_string
);
60 /** Increase reference counter of the specified browser object */
61 pa_browser
*pa_browser_ref(pa_browser
*z
);
63 /** Decrease reference counter of the specified browser object */
64 void pa_browser_unref(pa_browser
*z
);
66 /** Information about a sink/source/server found with Zeroconf */
67 typedef struct pa_browse_info
{
68 const char *name
; /**< Unique service name; always available */
70 const char *server
; /**< Server name; always available */
71 const char *server_version
; /**< Server version string; optional */
72 const char *user_name
; /**< User name of the server process; optional */
73 const char *fqdn
; /* Server version; optional */
74 const uint32_t *cookie
; /* Server cookie; optional */
76 const char *device
; /* Device name; always available when this information is of a sink/source */
77 const char *description
; /* Device description; optional */
78 const pa_sample_spec
*sample_spec
; /* Sample specification of the device; optional */
81 /** Callback prototype */
82 typedef void (*pa_browse_cb_t
)(pa_browser
*z
, pa_browse_opcode_t c
, const pa_browse_info
*i
, void *userdata
);
84 /** Set the callback pointer for the browser object */
85 void pa_browser_set_callback(pa_browser
*z
, pa_browse_cb_t cb
, void *userdata
);
87 /** Callback prototype for errors */
88 typedef void (*pa_browser_error_cb_t
)(pa_browser
*z
, const char *error_string
, void *userdata
);
90 /** Set a callback function that is called whenever the browser object
91 * becomes invalid due to an error. After this function has been
92 * called the browser object has become invalid and should be
94 void pa_browser_set_error_callback(pa_browser
*z
, pa_browser_error_cb_t
, void *userdata
);