]> code.delx.au - pulseaudio/blob - src/pulse/browser.h
Update todo
[pulseaudio] / src / pulse / browser.h
1 #ifndef foobrowserhfoo
2 #define foobrowserhfoo
3
4 /***
5 This file is part of PulseAudio.
6
7 Copyright 2004-2006 Lennart Poettering
8
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.1 of the
12 License, or (at your option) any later version.
13
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.
18
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
22 USA.
23 ***/
24
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>
30
31 /** \file
32 * An abstract interface for Zeroconf browsing of PulseAudio servers */
33
34 PA_C_DECL_BEGIN
35
36 /** An opaque Zeroconf service browser object */
37 typedef struct pa_browser pa_browser;
38
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 */
47 } pa_browse_opcode_t;
48
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 */
53 } pa_browse_flags_t;
54
55 /** Create a new browser object on the specified main loop */
56 pa_browser *pa_browser_new(pa_mainloop_api *mainloop);
57
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);
60
61 /** Increase reference counter of the specified browser object */
62 pa_browser *pa_browser_ref(pa_browser *z);
63
64 /** Decrease reference counter of the specified browser object */
65 void pa_browser_unref(pa_browser *z);
66
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 */
70
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 */
76
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 */
80 } pa_browse_info;
81
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);
84
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);
87
88 /** Callback prototype for errors */
89 typedef void (*pa_browser_error_cb_t)(pa_browser *z, const char *error_string, void *userdata);
90
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
94 * freed. */
95 void pa_browser_set_error_callback(pa_browser *z, pa_browser_error_cb_t, void *userdata);
96
97 PA_C_DECL_END
98
99 #endif