]> code.delx.au - pulseaudio/blob - src/pulsecore/source.h
comment which values in pa_{sink,source,sink_input,source_output} structures may...
[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;
54 char *description, *driver; /* may be NULL */
55
56 pa_module *owner; /* may be NULL */
57
58 pa_sample_spec sample_spec;
59 pa_channel_map channel_map;
60
61 pa_idxset *outputs;
62 pa_sink *monitor_of; /* may be NULL */
63
64 pa_cvolume hw_volume, sw_volume;
65 int hw_muted, sw_muted;
66
67 int is_hardware;
68
69 void (*notify)(pa_source*source); /* may be NULL */
70 pa_usec_t (*get_latency)(pa_source *s); /* dito */
71 int (*set_hw_volume)(pa_source *s); /* dito */
72 int (*get_hw_volume)(pa_source *s); /* dito */
73 int (*set_hw_mute)(pa_source *s); /* dito */
74 int (*get_hw_mute)(pa_source *s); /* dito */
75
76 void *userdata;
77 };
78
79 pa_source* pa_source_new(
80 pa_core *core,
81 const char *driver,
82 const char *name,
83 int namereg_fail,
84 const pa_sample_spec *spec,
85 const pa_channel_map *map);
86
87 void pa_source_disconnect(pa_source *s);
88 void pa_source_unref(pa_source *s);
89 pa_source* pa_source_ref(pa_source *c);
90
91 /* Pass a new memory block to all output streams */
92 void pa_source_post(pa_source*s, const pa_memchunk *b);
93
94 void pa_source_notify(pa_source *s);
95
96 void pa_source_set_owner(pa_source *s, pa_module *m);
97
98 pa_usec_t pa_source_get_latency(pa_source *s);
99
100 void pa_source_set_volume(pa_source *source, pa_mixer_t m, const pa_cvolume *volume);
101 const pa_cvolume *pa_source_get_volume(pa_source *source, pa_mixer_t m);
102 void pa_source_set_mute(pa_source *source, pa_mixer_t m, int mute);
103 int pa_source_get_mute(pa_source *source, pa_mixer_t m);
104
105 void pa_source_set_description(pa_source *s, const char *description);
106
107
108 #endif