fold the seperate variable pa_sink_input::playing into pa_sink_input::state as state...
[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,      /*< The stream is alive and kicking */
38     PA_SINK_INPUT_DRAINED,      /*< The stream stopped playing because there was no data to play */
39     PA_SINK_INPUT_CORKED,       /*< The stream was corked on user request */
40     PA_SINK_INPUT_DISCONNECTED  /*< The stream is dead */
41 } pa_sink_input_state_t;
42
43 struct pa_sink_input {
44     int ref;
45     uint32_t index;
46     pa_sink_input_state_t state;
47     
48     char *name, *driver;
49     pa_module *owner;
50
51     pa_sink *sink;
52     pa_client *client;
53     
54     pa_sample_spec sample_spec;
55     pa_channel_map channel_map;
56
57     pa_cvolume volume;
58     
59     int (*peek) (pa_sink_input *i, pa_memchunk *chunk);
60     void (*drop) (pa_sink_input *i, const pa_memchunk *chunk, size_t length);
61     void (*kill) (pa_sink_input *i);
62     pa_usec_t (*get_latency) (pa_sink_input *i);
63     void (*underrun) (pa_sink_input *i);
64
65     void *userdata;
66
67     pa_memchunk resampled_chunk;
68     pa_resampler *resampler;
69 };
70
71 pa_sink_input* pa_sink_input_new(
72     pa_sink *s,
73     const char *driver,
74     const char *name,
75     const pa_sample_spec *spec,
76     const pa_channel_map *map,
77     const pa_cvolume *volume,
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