]> code.delx.au - pulseaudio/blob - polyp/sink-input.h
add resample_method option module-combine
[pulseaudio] / polyp / sink-input.h
1 #ifndef foosinkinputhfoo
2 #define foosinkinputhfoo
3
4 /* $Id$ */
5
6 /***
7 This file is part of polypaudio.
8
9 polypaudio is free software; you can redistribute it and/or modify
10 it under the terms of the GNU 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 polypaudio 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 General Public License
20 along with polypaudio; 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 #include "sink.h"
28 #include "sample.h"
29 #include "memblockq.h"
30 #include "resampler.h"
31 #include "module.h"
32 #include "client.h"
33
34 enum pa_sink_input_state {
35 PA_SINK_INPUT_RUNNING,
36 PA_SINK_INPUT_DISCONNECTED
37 };
38
39 struct pa_sink_input {
40 int ref;
41 enum pa_sink_input_state state;
42
43 uint32_t index;
44
45 int corked;
46
47 char *name;
48 struct pa_module *owner;
49 struct pa_client *client;
50 struct pa_sink *sink;
51 struct pa_sample_spec sample_spec;
52 uint32_t volume;
53
54 int (*peek) (struct pa_sink_input *i, struct pa_memchunk *chunk);
55 void (*drop) (struct pa_sink_input *i, const struct pa_memchunk *chunk, size_t length);
56 void (*kill) (struct pa_sink_input *i);
57 pa_usec_t (*get_latency) (struct pa_sink_input *i);
58
59 void *userdata;
60
61 struct pa_memchunk resampled_chunk;
62 struct pa_resampler *resampler;
63 };
64
65 struct pa_sink_input* pa_sink_input_new(struct pa_sink *s, const char *name, const struct pa_sample_spec *spec, int variable_rate, int resample_method);
66 void pa_sink_input_unref(struct pa_sink_input* i);
67 struct pa_sink_input* pa_sink_input_ref(struct pa_sink_input* i);
68
69 /* To be called by the implementing module only */
70 void pa_sink_input_disconnect(struct pa_sink_input* i);
71
72 /* External code may request disconnection with this funcion */
73 void pa_sink_input_kill(struct pa_sink_input*i);
74
75 pa_usec_t pa_sink_input_get_latency(struct pa_sink_input *i);
76
77 int pa_sink_input_peek(struct pa_sink_input *i, struct pa_memchunk *chunk);
78 void pa_sink_input_drop(struct pa_sink_input *i, const struct pa_memchunk *chunk, size_t length);
79
80 void pa_sink_input_set_volume(struct pa_sink_input *i, pa_volume_t volume);
81
82 void pa_sink_input_cork(struct pa_sink_input *i, int b);
83
84 void pa_sink_input_set_rate(struct pa_sink_input *i, uint32_t rate);
85
86 void pa_sink_input_set_name(struct pa_sink_input *i, const char *name);
87
88 #endif