]> code.delx.au - pulseaudio/blob - src/pulsecore/sink.h
comment which values in pa_{sink,source,sink_input,source_output} structures may...
[pulseaudio] / src / pulsecore / sink.h
1 #ifndef foosinkhfoo
2 #define foosinkhfoo
3
4 /* $Id$ */
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 published
11 by the Free Software Foundation; either version 2 of the License,
12 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 License
20 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 <inttypes.h>
26
27 typedef struct pa_sink pa_sink;
28
29 #include <pulse/sample.h>
30 #include <pulse/channelmap.h>
31 #include <pulse/volume.h>
32 #include <pulsecore/core-def.h>
33 #include <pulsecore/core.h>
34 #include <pulsecore/idxset.h>
35 #include <pulsecore/source.h>
36 #include <pulsecore/module.h>
37
38 #define PA_MAX_INPUTS_PER_SINK 32
39
40 typedef enum pa_sink_state {
41 PA_SINK_RUNNING,
42 PA_SINK_DISCONNECTED
43 } pa_sink_state_t;
44
45 struct pa_sink {
46 int ref;
47 uint32_t index;
48 pa_core *core;
49 pa_sink_state_t state;
50
51 char *name;
52 char *description, *driver; /* may be NULL */
53 int is_hardware;
54
55 pa_module *owner; /* may be NULL */
56
57 pa_sample_spec sample_spec;
58 pa_channel_map channel_map;
59
60 pa_idxset *inputs;
61 pa_source *monitor_source; /* may be NULL */
62
63 pa_cvolume hw_volume, sw_volume;
64 int hw_muted, sw_muted;
65
66 void (*notify)(pa_sink*sink); /* may be NULL */
67 pa_usec_t (*get_latency)(pa_sink *s); /* dito */
68 int (*set_hw_volume)(pa_sink *s); /* dito */
69 int (*get_hw_volume)(pa_sink *s); /* dito */
70 int (*set_hw_mute)(pa_sink *s); /* dito */
71 int (*get_hw_mute)(pa_sink *s); /* dito */
72
73 void *userdata;
74 };
75
76 pa_sink* pa_sink_new(
77 pa_core *core,
78 const char *driver,
79 const char *name,
80 int namereg_fail,
81 const pa_sample_spec *spec,
82 const pa_channel_map *map);
83
84 void pa_sink_disconnect(pa_sink* s);
85 void pa_sink_unref(pa_sink*s);
86 pa_sink* pa_sink_ref(pa_sink *s);
87
88 int pa_sink_render(pa_sink*s, size_t length, pa_memchunk *result);
89 void pa_sink_render_full(pa_sink *s, size_t length, pa_memchunk *result);
90 int pa_sink_render_into(pa_sink*s, pa_memchunk *target);
91 void pa_sink_render_into_full(pa_sink *s, pa_memchunk *target);
92
93 pa_usec_t pa_sink_get_latency(pa_sink *s);
94
95 void pa_sink_notify(pa_sink*s);
96
97 void pa_sink_set_owner(pa_sink *sink, pa_module *m);
98
99 void pa_sink_set_volume(pa_sink *sink, pa_mixer_t m, const pa_cvolume *volume);
100 const pa_cvolume *pa_sink_get_volume(pa_sink *sink, pa_mixer_t m);
101 void pa_sink_set_mute(pa_sink *sink, pa_mixer_t m, int mute);
102 int pa_sink_get_mute(pa_sink *sink, pa_mixer_t m);
103
104 void pa_sink_set_description(pa_sink *s, const char *description);
105
106 #endif