]> code.delx.au - pulseaudio/blob - src/pulsecore/source.h
5a28cf4b7f4edd2d330cc7f463c46ebbd0c00661
[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 Copyright 2004-2006 Lennart Poettering
10 Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
11
12 PulseAudio is free software; you can redistribute it and/or modify
13 it under the terms of the GNU Lesser General Public License as published
14 by the Free Software Foundation; either version 2 of the License,
15 or (at your option) any later version.
16
17 PulseAudio is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 General Public License for more details.
21
22 You should have received a copy of the GNU Lesser General Public License
23 along with PulseAudio; if not, write to the Free Software
24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25 USA.
26 ***/
27
28 typedef struct pa_source pa_source;
29
30 #include <inttypes.h>
31
32 #include <pulse/sample.h>
33 #include <pulse/channelmap.h>
34 #include <pulse/volume.h>
35 #include <pulsecore/core-def.h>
36 #include <pulsecore/core.h>
37 #include <pulsecore/idxset.h>
38 #include <pulsecore/memblock.h>
39 #include <pulsecore/memchunk.h>
40 #include <pulsecore/sink.h>
41 #include <pulsecore/module.h>
42
43 #define PA_MAX_OUTPUTS_PER_SOURCE 16
44
45 typedef enum pa_source_state {
46 PA_SOURCE_RUNNING,
47 PA_SOURCE_DISCONNECTED
48 } pa_source_state_t;
49
50 struct pa_source {
51 int ref;
52 uint32_t index;
53 pa_core *core;
54 pa_source_state_t state;
55
56 char *name;
57 char *description, *driver; /* may be NULL */
58
59 pa_module *owner; /* may be NULL */
60
61 pa_sample_spec sample_spec;
62 pa_channel_map channel_map;
63
64 pa_idxset *outputs;
65 pa_sink *monitor_of; /* may be NULL */
66
67 pa_cvolume hw_volume, sw_volume;
68 int hw_muted, sw_muted;
69
70 int is_hardware;
71
72 void (*notify)(pa_source*source); /* may be NULL */
73 pa_usec_t (*get_latency)(pa_source *s); /* dito */
74 int (*set_hw_volume)(pa_source *s); /* dito */
75 int (*get_hw_volume)(pa_source *s); /* dito */
76 int (*set_hw_mute)(pa_source *s); /* dito */
77 int (*get_hw_mute)(pa_source *s); /* dito */
78
79 void *userdata;
80 };
81
82 pa_source* pa_source_new(
83 pa_core *core,
84 const char *driver,
85 const char *name,
86 int namereg_fail,
87 const pa_sample_spec *spec,
88 const pa_channel_map *map);
89
90 void pa_source_disconnect(pa_source *s);
91 void pa_source_unref(pa_source *s);
92 pa_source* pa_source_ref(pa_source *c);
93
94 /* Pass a new memory block to all output streams */
95 void pa_source_post(pa_source*s, const pa_memchunk *b);
96
97 void pa_source_notify(pa_source *s);
98
99 void pa_source_set_owner(pa_source *s, pa_module *m);
100
101 pa_usec_t pa_source_get_latency(pa_source *s);
102
103 void pa_source_set_volume(pa_source *source, pa_mixer_t m, const pa_cvolume *volume);
104 const pa_cvolume *pa_source_get_volume(pa_source *source, pa_mixer_t m);
105 void pa_source_set_mute(pa_source *source, pa_mixer_t m, int mute);
106 int pa_source_get_mute(pa_source *source, pa_mixer_t m);
107
108 void pa_source_set_description(pa_source *s, const char *description);
109
110 unsigned pa_source_used_by(pa_source *s);
111 #endif