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.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.h')
| -rw-r--r-- | src/pulsecore/source.h | 38 | 
1 files changed, 26 insertions, 12 deletions
| diff --git a/src/pulsecore/source.h b/src/pulsecore/source.h index ffe51079..ddc66156 100644 --- a/src/pulsecore/source.h +++ b/src/pulsecore/source.h @@ -42,26 +42,36 @@ typedef struct pa_source pa_source;  #include <pulsecore/module.h>  #include <pulsecore/asyncmsgq.h>  #include <pulsecore/msgobject.h> +#include <pulsecore/rtpoll.h>  #define PA_MAX_OUTPUTS_PER_SOURCE 32  typedef enum pa_source_state { +    PA_SOURCE_INIT,      PA_SOURCE_RUNNING,      PA_SOURCE_SUSPENDED,      PA_SOURCE_IDLE, -    PA_SOURCE_DISCONNECTED +    PA_SOURCE_UNLINKED  } pa_source_state_t; +static inline int PA_SOURCE_OPENED(pa_source_state_t x) { +    return x == PA_SOURCE_RUNNING || x == PA_SOURCE_IDLE; +} + +static inline int PA_SOURCE_LINKED(pa_source_state_t x) { +    return x == PA_SOURCE_RUNNING || x == PA_SOURCE_IDLE || x == PA_SOURCE_SUSPENDED; +} +  struct pa_source {      pa_msgobject parent;      uint32_t index;      pa_core *core;      pa_source_state_t state; +    pa_source_flags_t flags;      char *name;      char *description, *driver;              /* may be NULL */ -    int is_hardware;      pa_module *module;                        /* may be NULL */ @@ -76,7 +86,7 @@ struct pa_source {      int refresh_volume;      int refresh_muted; -    int (*set_state)(pa_source*source, pa_source_state_t state);          /* may be NULL */ +    int (*set_state)(pa_source*source, pa_source_state_t state); /* may be NULL */      int (*set_volume)(pa_source *s);         /* dito */      int (*get_volume)(pa_source *s);         /* dito */      int (*set_mute)(pa_source *s);           /* dito */ @@ -84,7 +94,10 @@ struct pa_source {      pa_usec_t (*get_latency)(pa_source *s);  /* dito */      pa_asyncmsgq *asyncmsgq; +    pa_rtpoll *rtpoll; +    /* Contains copies of the above data so that the real-time worker +     * thread can work without access locking */      struct {          pa_source_state_t state;          pa_hashmap *outputs; @@ -111,7 +124,7 @@ typedef enum pa_source_message {      PA_SOURCE_MESSAGE_MAX  } pa_source_message_t; -/* To be used exclusively by the source driver */ +/* To be called exclusively by the source driver, from main context */  pa_source* pa_source_new(          pa_core *core, @@ -121,18 +134,22 @@ pa_source* pa_source_new(          const pa_sample_spec *spec,          const pa_channel_map *map); -void pa_source_disconnect(pa_source *s); +void pa_source_put(pa_source *s); +void pa_source_unlink(pa_source *s);  void pa_source_set_module(pa_source *s, pa_module *m);  void pa_source_set_description(pa_source *s, const char *description);  void pa_source_set_asyncmsgq(pa_source *s, pa_asyncmsgq *q); +void pa_source_set_rtpoll(pa_source *s, pa_rtpoll *p); -/* Callable by everyone */ +/* May be called by everyone, from main context */  pa_usec_t pa_source_get_latency(pa_source *s);  int pa_source_update_status(pa_source*s);  int pa_source_suspend(pa_source *s, int suspend); +int pa_source_suspend_all(pa_core *c, int suspend); +  void pa_source_ping(pa_source *s);  void pa_source_set_volume(pa_source *source, const pa_cvolume *volume); @@ -143,15 +160,12 @@ int pa_source_get_mute(pa_source *source);  unsigned pa_source_used_by(pa_source *s);  #define pa_source_get_state(s) ((pa_source_state_t) (s)->state) -/* To be used exclusively by the source driver thread */ +/* To be called exclusively by the source driver, from IO context */  void pa_source_post(pa_source*s, const pa_memchunk *b); -int pa_source_process_msg(pa_msgobject *o, int code, void *userdata, int64_t, pa_memchunk *chunk); -static inline int PA_SOURCE_OPENED(pa_source_state_t x) { -    return x == PA_SOURCE_RUNNING || x == PA_SOURCE_IDLE; -} +int pa_source_process_outputs(pa_source *o); -int pa_source_suspend_all(pa_core *c, int suspend); +int pa_source_process_msg(pa_msgobject *o, int code, void *userdata, int64_t, pa_memchunk *chunk);  #endif | 
