]> code.delx.au - pulseaudio/blob - src/polypcore/sink-input.h
Reorganised the source tree. We now have src/ with a couple of subdirs:
[pulseaudio] / src / polypcore / 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 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 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 Lesser 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 typedef struct pa_sink_input pa_sink_input;
28
29 #include "sink.h"
30 #include <polyp/sample.h>
31 #include "memblockq.h"
32 #include "resampler.h"
33 #include "module.h"
34 #include "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 int variable_rate,
79 int resample_method);
80
81 void pa_sink_input_unref(pa_sink_input* i);
82 pa_sink_input* pa_sink_input_ref(pa_sink_input* i);
83
84 /* To be called by the implementing module only */
85 void pa_sink_input_disconnect(pa_sink_input* i);
86
87 /* External code may request disconnection with this funcion */
88 void pa_sink_input_kill(pa_sink_input*i);
89
90 pa_usec_t pa_sink_input_get_latency(pa_sink_input *i);
91
92 int pa_sink_input_peek(pa_sink_input *i, pa_memchunk *chunk, pa_cvolume *volume);
93 void pa_sink_input_drop(pa_sink_input *i, const pa_memchunk *chunk, size_t length);
94
95 void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume);
96 const pa_cvolume * pa_sink_input_get_volume(pa_sink_input *i);
97
98 void pa_sink_input_cork(pa_sink_input *i, int b);
99
100 void pa_sink_input_set_rate(pa_sink_input *i, uint32_t rate);
101
102 void pa_sink_input_set_name(pa_sink_input *i, const char *name);
103
104 pa_resample_method_t pa_sink_input_get_resample_method(pa_sink_input *i);
105
106 #endif