big s/polyp/pulse/g
[platform/upstream/pulseaudio.git] / src / pulsecore / sink-input.h
1 #ifndef foosinkinputhfoo
2 #define foosinkinputhfoo
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_input pa_sink_input;
28
29 #include <pulse/sample.h>
30 #include <pulsecore/sink.h>
31 #include <pulsecore/memblockq.h>
32 #include <pulsecore/resampler.h>
33 #include <pulsecore/module.h>
34 #include <pulsecore/client.h>
35
36 typedef enum pa_sink_input_state {
37     PA_SINK_INPUT_RUNNING,
38     PA_SINK_INPUT_CORKED,
39     PA_SINK_INPUT_DISCONNECTED
40 } pa_sink_input_state_t;
41
42 struct pa_sink_input {
43     int ref;
44     uint32_t index;
45     pa_sink_input_state_t state;
46     
47     char *name, *driver;
48     pa_module *owner;
49
50     pa_sink *sink;
51     pa_client *client;
52     
53     pa_sample_spec sample_spec;
54     pa_channel_map channel_map;
55
56     pa_cvolume volume;
57     
58     int (*peek) (pa_sink_input *i, pa_memchunk *chunk);
59     void (*drop) (pa_sink_input *i, const pa_memchunk *chunk, size_t length);
60     void (*kill) (pa_sink_input *i);
61     pa_usec_t (*get_latency) (pa_sink_input *i);
62     void (*underrun) (pa_sink_input *i);
63
64     void *userdata;
65
66     int playing;
67
68     pa_memchunk resampled_chunk;
69     pa_resampler *resampler;
70 };
71
72 pa_sink_input* pa_sink_input_new(
73     pa_sink *s,
74     const char *driver,
75     const char *name,
76     const pa_sample_spec *spec,
77     const pa_channel_map *map,
78     const pa_cvolume *volume,
79     int variable_rate,
80     int resample_method);
81
82 void pa_sink_input_unref(pa_sink_input* i);
83 pa_sink_input* pa_sink_input_ref(pa_sink_input* i);
84
85 /* To be called by the implementing module only */
86 void pa_sink_input_disconnect(pa_sink_input* i);
87
88 /* External code may request disconnection with this funcion */
89 void pa_sink_input_kill(pa_sink_input*i);
90
91 pa_usec_t pa_sink_input_get_latency(pa_sink_input *i);
92
93 int pa_sink_input_peek(pa_sink_input *i, pa_memchunk *chunk, pa_cvolume *volume);
94 void pa_sink_input_drop(pa_sink_input *i, const pa_memchunk *chunk, size_t length);
95
96 void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume);
97 const pa_cvolume * pa_sink_input_get_volume(pa_sink_input *i);
98
99 void pa_sink_input_cork(pa_sink_input *i, int b);
100
101 void pa_sink_input_set_rate(pa_sink_input *i, uint32_t rate);
102
103 void pa_sink_input_set_name(pa_sink_input *i, const char *name);
104
105 pa_resample_method_t pa_sink_input_get_resample_method(pa_sink_input *i);
106
107 #endif