]>
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>
29 #include <pulse/version.h>
32 * An abstract interface for Zeroconf browsing of PulseAudio servers */
36 /** An opaque Zeroconf service browser object */
37 typedef struct pa_browser pa_browser
;
39 /** Opcodes for pa_browser_cb_t callbacks */
40 typedef enum pa_browse_opcode
{
41 PA_BROWSE_NEW_SERVER
= 0, /**< New server found */
42 PA_BROWSE_NEW_SINK
, /**< New sink found */
43 PA_BROWSE_NEW_SOURCE
, /**< New source found */
44 PA_BROWSE_REMOVE_SERVER
, /**< Server disappeared */
45 PA_BROWSE_REMOVE_SINK
, /**< Sink disappeared */
46 PA_BROWSE_REMOVE_SOURCE
/**< Source disappeared */
49 typedef enum pa_browse_flags
{
50 PA_BROWSE_FOR_SERVERS
= 1, /**< Browse for servers */
51 PA_BROWSE_FOR_SINKS
= 2, /**< Browse for sinks */
52 PA_BROWSE_FOR_SOURCES
= 4 /** Browse for sources */
55 /** Create a new browser object on the specified main loop */
56 pa_browser
*pa_browser_new(pa_mainloop_api
*mainloop
);
58 /** Same pa_browser_new, but pass additional flags parameter. */
59 pa_browser
*pa_browser_new_full(pa_mainloop_api
*mainloop
, pa_browse_flags_t flags
, const char **error_string
);
61 /** Increase reference counter of the specified browser object */
62 pa_browser
*pa_browser_ref(pa_browser
*z
);
64 /** Decrease reference counter of the specified browser object */
65 void pa_browser_unref(pa_browser
*z
);
67 /** Information about a sink/source/server found with Zeroconf */
68 typedef struct pa_browse_info
{
69 const char *name
; /**< Unique service name; always available */
71 const char *server
; /**< Server name; always available */
72 const char *server_version
; /**< Server version string; optional */
73 const char *user_name
; /**< User name of the server process; optional */
74 const char *fqdn
; /* Server version; optional */
75 const uint32_t *cookie
; /* Server cookie; optional */
77 const char *device
; /* Device name; always available when this information is of a sink/source */
78 const char *description
; /* Device description; optional */
79 const pa_sample_spec
*sample_spec
; /* Sample specification of the device; optional */
82 /** Callback prototype */
83 typedef void (*pa_browse_cb_t
)(pa_browser
*z
, pa_browse_opcode_t c
, const pa_browse_info
*i
, void *userdata
);
85 /** Set the callback pointer for the browser object */
86 void pa_browser_set_callback(pa_browser
*z
, pa_browse_cb_t cb
, void *userdata
);
88 /** Callback prototype for errors */
89 typedef void (*pa_browser_error_cb_t
)(pa_browser
*z
, const char *error_string
, void *userdata
);
91 /** Set a callback function that is called whenever the browser object
92 * becomes invalid due to an error. After this function has been
93 * called the browser object has become invalid and should be
95 void pa_browser_set_error_callback(pa_browser
*z
, pa_browser_error_cb_t
, void *userdata
);