]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/source-output.h
core: add functions to query max_rewind/max_request values from streams
[pulseaudio] / src / pulsecore / source-output.h
index aba2510b1abbae2b6c63929c21aae9a551a746a9..4bf88ca4d29b16eb8c57b5641b61cba5ea93062e 100644 (file)
@@ -8,7 +8,7 @@
 
   PulseAudio is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published
-  by the Free Software Foundation; either version 2 of the License,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -116,13 +116,19 @@ struct pa_source_output {
      * 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
+    /* If non-NULL called whenever the source this output is attached
      * to suspends or resumes. Called from main context */
     void (*suspend) (pa_source_output *o, pa_bool_t b);   /* may be NULL */
 
-    /* If non-NULL called whenever the the source this output is attached
-     * to changes. Called from main context */
-    void (*moved) (pa_source_output *o);   /* may be NULL */
+    /* If non-NULL called whenever the source this output is attached
+     * to suspends or resumes. Called from IO context */
+    void (*suspend_within_thread) (pa_source_output *o, pa_bool_t b);   /* may be NULL */
+
+    /* If non-NULL called whenever the source output is moved to a new
+     * source. Called from main context after the stream was detached
+     * from the old source and before it is attached to the new
+     * source. */
+    void (*moving) (pa_source_output *o, pa_source *dest);   /* may be NULL */
 
     /* Supposed to unlink and destroy this stream. Called from main
      * context. */
@@ -143,6 +149,10 @@ struct pa_source_output {
      * will not be allowed */
     pa_bool_t (*may_move_to) (pa_source_output *o, pa_source *s); /* may be NULL */
 
+    /* If non-NULL this function is used to dispatch asynchronous
+     * control events. */
+    void (*send_event)(pa_source_output *o, const char *event, pa_proplist* data);
+
     struct {
         pa_source_output_state_t state;
 
@@ -177,6 +187,12 @@ enum {
     PA_SOURCE_OUTPUT_MESSAGE_MAX
 };
 
+typedef struct pa_source_output_send_event_hook_data {
+    pa_source_output *source_output;
+    const char *event;
+    pa_proplist *data;
+} pa_source_output_send_event_hook_data;
+
 typedef struct pa_source_output_new_data {
     pa_proplist *proplist;
     pa_sink_input *direct_on_input;
@@ -222,6 +238,8 @@ void pa_source_output_cork(pa_source_output *o, pa_bool_t b);
 
 int pa_source_output_set_rate(pa_source_output *o, uint32_t rate);
 
+size_t pa_source_output_get_max_rewind(pa_source_output *o);
+
 /* Callable by everyone */
 
 /* External code may request disconnection with this funcion */
@@ -233,6 +251,8 @@ void pa_source_output_update_proplist(pa_source_output *o, pa_update_mode_t mode
 
 pa_resample_method_t pa_source_output_get_resample_method(pa_source_output *o);
 
+void pa_source_output_send_event(pa_source_output *o, const char *name, pa_proplist *data);
+
 pa_bool_t pa_source_output_may_move(pa_source_output *o);
 pa_bool_t pa_source_output_may_move_to(pa_source_output *o, pa_source *dest);
 int pa_source_output_move_to(pa_source_output *o, pa_source *dest, pa_bool_t save);
@@ -259,4 +279,7 @@ int pa_source_output_process_msg(pa_msgobject *mo, int code, void *userdata, int
 
 pa_usec_t pa_source_output_set_requested_latency_within_thread(pa_source_output *o, pa_usec_t usec);
 
+#define pa_source_output_assert_io_context(s) \
+    pa_assert(pa_thread_mq_get() || !PA_SOURCE_OUTPUT_IS_LINKED((s)->state))
+
 #endif