~ubuntu-branches/ubuntu/jaunty/pulseaudio/jaunty-updates

« back to all changes in this revision

Viewing changes to src/pulse/browser.h

  • Committer: Bazaar Package Importer
  • Author(s): Oliver Grawert
  • Date: 2006-11-12 20:00:18 UTC
  • Revision ID: james.westby@ubuntu.com-20061112200018-oji9njq7rr3te53k
Tags: upstream-0.9.5
ImportĀ upstreamĀ versionĀ 0.9.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef foobrowserhfoo
 
2
#define foobrowserhfoo
 
3
 
 
4
/* $Id: browser.h 1069 2006-07-13 17:33:44Z lennart $ */
 
5
 
 
6
/***
 
7
  This file is part of PulseAudio.
 
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 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
 
 
30
/** \file
 
31
 * An abstract interface for Zeroconf browsing of PulseAudio servers */
 
32
 
 
33
PA_C_DECL_BEGIN
 
34
 
 
35
/** An opaque Zeroconf service browser object */
 
36
typedef struct pa_browser pa_browser;
 
37
 
 
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 */
 
46
} pa_browse_opcode_t;
 
47
 
 
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 */
 
52
} pa_browse_flags_t;
 
53
 
 
54
/** Create a new browser object on the specified main loop */
 
55
pa_browser *pa_browser_new(pa_mainloop_api *mainloop);
 
56
 
 
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);
 
59
 
 
60
/** Increase reference counter of the specified browser object */
 
61
pa_browser *pa_browser_ref(pa_browser *z);
 
62
 
 
63
/** Decrease reference counter of the specified browser object */
 
64
void pa_browser_unref(pa_browser *z);
 
65
 
 
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 */
 
69
 
 
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 */
 
75
 
 
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 */
 
79
} pa_browse_info;
 
80
 
 
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);
 
83
 
 
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);
 
86
 
 
87
/** Callback prototype for errors */
 
88
typedef void (*pa_browser_error_cb_t)(pa_browser *z, const char *error_string, void *userdata);
 
89
 
 
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
 
93
 * freed. */
 
94
void pa_browser_set_error_callback(pa_browser *z, pa_browser_error_cb_t, void *userdata);
 
95
 
 
96
PA_C_DECL_END
 
97
 
 
98
#endif