summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/sink-input.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-08-30 22:57:53 +0000
committerLennart Poettering <lennart@poettering.net>2007-08-30 22:57:53 +0000
commit4d623f0d4442148f20f2ffdc85cf95e54ef83721 (patch)
treef758269ece89edac69365e19317ee221af7a6889 /src/pulsecore/sink-input.h
parentb552541dd1f65646a5963e7a8c8ec43e4ea416c8 (diff)
Lots of assorted minor cleanups and fixes:
* s/disconnect/unlink/ at many places where it makes sense * make "start_corked" a normal pa_sink_input/pa_source_output flag instead of a seperate boolean variable * add generic process() function to pa_sink_input/pa_source_output vtable that can be used by streams to do some arbitrary processing in each rt loop iteration even the sink/source is suspended * add detach()/attach() functions to pa_sink_input/pa_source_output vtable that are called when ever the rtpoll object of the event thread changes * add suspend() functions to pa_sink_input/pa_source_output vtable which are called whenever the sink/source they are attached to suspends/resumes * add PA_SINK_INIT/PA_SOURCE_INIT/PA_SINK_INPUT_INIT/PA_SINK_OUTPUT_INIT states to state machines which is active between _new() and _put() * seperate _put() from _new() for pa_sink/pa_source * add PA_SOURCE_OUTPUT_DONT_MOVE/PA_SINK_INPUT_DONT_MOVE flags * make the pa_rtpoll object a property of pa_sink/pa_source to allow streams attached to them make use of it * fix skipping over move_silence * update module-pipe-source to make use of pa_rtpoll * add pa_sink_skip() as optimization in cases where the actualy data returned by pa_sink_render() doesn't matter git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1733 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/pulsecore/sink-input.h')
-rw-r--r--src/pulsecore/sink-input.h45
1 files changed, 41 insertions, 4 deletions
diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h
index d728d462..e1d89ffb 100644
--- a/src/pulsecore/sink-input.h
+++ b/src/pulsecore/sink-input.h
@@ -39,14 +39,21 @@ typedef struct pa_sink_input pa_sink_input;
#include <pulsecore/core.h>
typedef enum pa_sink_input_state {
+ PA_SINK_INPUT_INIT, /*< The stream is not active yet, because pa_sink_put() has not been called yet */
PA_SINK_INPUT_DRAINED, /*< The stream stopped playing because there was no data to play */
PA_SINK_INPUT_RUNNING, /*< The stream is alive and kicking */
PA_SINK_INPUT_CORKED, /*< The stream was corked on user request */
- PA_SINK_INPUT_DISCONNECTED /*< The stream is dead */
+ PA_SINK_INPUT_UNLINKED /*< The stream is dead */
} pa_sink_input_state_t;
+static inline int PA_SINK_INPUT_LINKED(pa_sink_input_state_t x) {
+ return x == PA_SINK_INPUT_DRAINED || x == PA_SINK_INPUT_RUNNING || x == PA_SINK_INPUT_CORKED;
+}
+
typedef enum pa_sink_input_flags {
PA_SINK_INPUT_VARIABLE_RATE = 1,
+ PA_SINK_INPUT_DONT_MOVE = 2,
+ PA_SINK_INPUT_START_CORKED = 4
} pa_sink_input_flags_t;
struct pa_sink_input {
@@ -75,11 +82,42 @@ struct pa_sink_input {
pa_cvolume volume;
int muted;
+ /* Returns the chunk of audio data (but doesn't drop it
+ * yet!). Returns -1 on failure. Called from IO thread context. */
int (*peek) (pa_sink_input *i, pa_memchunk *chunk);
+
+ /* Drops the specified number of bytes, usually called right after
+ * peek(), but not necessarily. Called from IO thread context. */
void (*drop) (pa_sink_input *i, size_t length);
+
+ /* If non-NULL this function is called in each IO event loop and
+ * can be used to do additional processing even when the device is
+ * suspended and peek() is never called. Should return 1 when
+ * "some work" has been done and the IO event loop should be
+ * reiterated immediately. Called from IO thread context. */
+ int (*process) (pa_sink_input *i); /* may be NULL */
+
+ /* If non-NULL this function is called when the input is first
+ * connected to a sink. Called from IO thread context */
+ void (*attach) (pa_sink_input *i); /* may be NULL */
+
+ /* If non-NULL this function is called when the output is
+ * disconnected from its sink. Called from IO thread context */
+ void (*detach) (pa_sink_input *i); /* may be NULL */
+
+ /* If non-NULL called whenever the the sink this input is attached
+ * to suspends or resumes. Called from main context */
+ void (*suspend) (pa_sink_input *i, int b); /* may be NULL */
+
+ /* Supposed to unlink and destroy this stream. Called from main
+ * context. */
void (*kill) (pa_sink_input *i); /* may be NULL */
+
+ /* Return the current latency (i.e. length of bufferd audio) of
+ this stream. Called from main context. If NULL a
+ PA_SINK_INPUT_MESSAGE_GET_LATENCY message is sent to the IO thread
+ instead. */
pa_usec_t (*get_latency) (pa_sink_input *i); /* may be NULL */
- void (*underrun) (pa_sink_input *i); /* may be NULL */
pa_resample_method_t resample_method;
@@ -138,7 +176,6 @@ typedef struct pa_sink_input_new_data {
pa_resample_method_t resample_method;
- int start_corked;
pa_sink_input *sync_base;
} pa_sink_input_new_data;
@@ -156,7 +193,7 @@ pa_sink_input* pa_sink_input_new(
pa_sink_input_flags_t flags);
void pa_sink_input_put(pa_sink_input *i);
-void pa_sink_input_disconnect(pa_sink_input* i);
+void pa_sink_input_unlink(pa_sink_input* i);
void pa_sink_input_set_name(pa_sink_input *i, const char *name);