]> code.delx.au - pulseaudio/blob - src/pulsecore/source.h
big s/polyp/pulse/g
[pulseaudio] / src / pulsecore / source.h
1 #ifndef foosourcehfoo
2 #define foosourcehfoo
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 typedef struct pa_source pa_source;
26
27 #include <inttypes.h>
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/memblock.h>
36 #include <pulsecore/memchunk.h>
37 #include <pulsecore/sink.h>
38 #include <pulsecore/module.h>
39
40 #define PA_MAX_OUTPUTS_PER_SOURCE 16
41
42 typedef enum pa_source_state {
43 PA_SOURCE_RUNNING,
44 PA_SOURCE_DISCONNECTED
45 } pa_source_state_t;
46
47 struct pa_source {
48 int ref;
49 uint32_t index;
50 pa_core *core;
51 pa_source_state_t state;
52
53 char *name, *description, *driver;
54 pa_module *owner;
55
56 pa_sample_spec sample_spec;
57 pa_channel_map channel_map;
58
59 pa_idxset *outputs;
60 pa_sink *monitor_of;
61
62 pa_cvolume hw_volume, sw_volume;
63 int hw_muted, sw_muted;
64
65 void (*notify)(pa_source*source);
66 pa_usec_t (*get_latency)(pa_source *s);
67 int (*set_hw_volume)(pa_source *s);
68 int (*get_hw_volume)(pa_source *s);
69 int (*set_hw_mute)(pa_source *s);
70 int (*get_hw_mute)(pa_source *s);
71
72 void *userdata;
73 };
74
75 pa_source* pa_source_new(
76 pa_core *core,
77 const char *driver,
78 const char *name,
79 int namereg_fail,
80 const pa_sample_spec *spec,
81 const pa_channel_map *map);
82
83 void pa_source_disconnect(pa_source *s);
84 void pa_source_unref(pa_source *s);
85 pa_source* pa_source_ref(pa_source *c);
86
87 /* Pass a new memory block to all output streams */
88 void pa_source_post(pa_source*s, const pa_memchunk *b);
89
90 void pa_source_notify(pa_source *s);
91
92 void pa_source_set_owner(pa_source *s, pa_module *m);
93
94 pa_usec_t pa_source_get_latency(pa_source *s);
95
96 void pa_source_set_volume(pa_source *source, pa_mixer_t m, const pa_cvolume *volume);
97 const pa_cvolume *pa_source_get_volume(pa_source *source, pa_mixer_t m);
98 void pa_source_set_mute(pa_source *source, pa_mixer_t m, int mute);
99 int pa_source_get_mute(pa_source *source, pa_mixer_t m);
100
101 #endif