diff options
author | Lennart Poettering <lennart@poettering.net> | 2007-08-30 22:57:53 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2007-08-30 22:57:53 +0000 |
commit | 4d623f0d4442148f20f2ffdc85cf95e54ef83721 (patch) | |
tree | f758269ece89edac69365e19317ee221af7a6889 /src/pulsecore/source-output.h | |
parent | b552541dd1f65646a5963e7a8c8ec43e4ea416c8 (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/source-output.h')
-rw-r--r-- | src/pulsecore/source-output.h | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/src/pulsecore/source-output.h b/src/pulsecore/source-output.h index b17adcb5..2027e37a 100644 --- a/src/pulsecore/source-output.h +++ b/src/pulsecore/source-output.h @@ -36,13 +36,20 @@ typedef struct pa_source_output pa_source_output; #include <pulsecore/client.h> typedef enum pa_source_output_state { + PA_SOURCE_OUTPUT_INIT, PA_SOURCE_OUTPUT_RUNNING, PA_SOURCE_OUTPUT_CORKED, - PA_SOURCE_OUTPUT_DISCONNECTED + PA_SOURCE_OUTPUT_UNLINKED } pa_source_output_state_t; +static inline int PA_SOURCE_OUTPUT_LINKED(pa_source_output_state_t x) { + return x == PA_SOURCE_OUTPUT_RUNNING || x == PA_SOURCE_OUTPUT_CORKED; +} + typedef enum pa_source_output_flags { - PA_SOURCE_OUTPUT_VARIABLE_RATE = 1 + PA_SOURCE_OUTPUT_VARIABLE_RATE = 1, + PA_SOURCE_OUTPUT_DONT_MOVE = 2, + PA_SOURCE_OUTPUT_START_CORKED = 4 } pa_source_output_flags_t; struct pa_source_output { @@ -62,8 +69,37 @@ struct pa_source_output { pa_sample_spec sample_spec; pa_channel_map channel_map; + /* Pushes a new memchunk into the output. Called from IO thread + * context. */ void (*push)(pa_source_output *o, const pa_memchunk *chunk); + + /* 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_source_output *o); /* may be NULL */ + + /* If non-NULL this function is called when the output is first + * connected to a source. Called from IO thread context */ + void (*attach) (pa_source_output *o); /* may be NULL */ + + /* If non-NULL this function is called when the output is + * disconnected from its source. Called from IO thread context */ + void (*detach) (pa_source_output *o); /* may be NULL */ + + /* If non-NULL called whenever the the source this output is attached + * to suspends or resumes. Called from main context */ + void (*suspend) (pa_source_output *o, int b); /* may be NULL */ + + /* Supposed to unlink and destroy this stream. Called from main + * context. */ void (*kill)(pa_source_output* o); /* may be NULL */ + + /* Return the current latency (i.e. length of bufferd audio) of + this stream. Called from main context. If NULL a + PA_SOURCE_OUTPUT_MESSAGE_GET_LATENCY message is sent to the IO + thread instead. */ pa_usec_t (*get_latency) (pa_source_output *o); /* may be NULL */ pa_resample_method_t resample_method; @@ -102,8 +138,6 @@ typedef struct pa_source_output_new_data { int channel_map_is_set; pa_resample_method_t resample_method; - - int start_corked; } pa_source_output_new_data; pa_source_output_new_data* pa_source_output_new_data_init(pa_source_output_new_data *data); @@ -119,7 +153,7 @@ pa_source_output* pa_source_output_new( pa_source_output_flags_t flags); void pa_source_output_put(pa_source_output *o); -void pa_source_output_disconnect(pa_source_output*o); +void pa_source_output_unlink(pa_source_output*o); void pa_source_output_set_name(pa_source_output *i, const char *name); |