]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/source.h
sink, source: Assign to reference_volume from only one place
[pulseaudio] / src / pulsecore / source.h
index 6bdd4729325a89da87c79cc6ec028fc34fe4b599..63185950dffc6d3cbaf78a5580c70da802776ba3 100644 (file)
@@ -48,7 +48,7 @@ typedef struct pa_source_volume_change pa_source_volume_change;
 #include <pulsecore/thread-mq.h>
 #include <pulsecore/source-output.h>
 
-#define PA_MAX_OUTPUTS_PER_SOURCE 32
+#define PA_MAX_OUTPUTS_PER_SOURCE 256
 
 /* Returns true if source is linked: registered and accessible from client side. */
 static inline bool PA_SOURCE_IS_LINKED(pa_source_state_t x) {
@@ -187,7 +187,7 @@ struct pa_source {
 
     /* Called whenever the sampling frequency shall be changed. Called from
      * main thread. */
-    bool (*update_rate)(pa_source *s, uint32_t rate);
+    int (*update_rate)(pa_source *s, uint32_t rate);
 
     /* Contains copies of the above data so that the real-time worker
      * thread can work without access locking */
@@ -250,8 +250,6 @@ typedef enum pa_source_message {
     PA_SOURCE_MESSAGE_GET_LATENCY,
     PA_SOURCE_MESSAGE_GET_REQUESTED_LATENCY,
     PA_SOURCE_MESSAGE_SET_STATE,
-    PA_SOURCE_MESSAGE_ATTACH,
-    PA_SOURCE_MESSAGE_DETACH,
     PA_SOURCE_MESSAGE_SET_LATENCY_RANGE,
     PA_SOURCE_MESSAGE_GET_LATENCY_RANGE,
     PA_SOURCE_MESSAGE_SET_FIXED_LATENCY,
@@ -331,9 +329,6 @@ void pa_source_set_max_rewind(pa_source *s, size_t max_rewind);
 void pa_source_set_latency_range(pa_source *s, pa_usec_t min_latency, pa_usec_t max_latency);
 void pa_source_set_fixed_latency(pa_source *s, pa_usec_t latency);
 
-void pa_source_detach(pa_source *s);
-void pa_source_attach(pa_source *s);
-
 void pa_source_set_soft_volume(pa_source *s, const pa_cvolume *volume);
 void pa_source_volume_changed(pa_source *s, const pa_cvolume *new_volume);
 void pa_source_mute_changed(pa_source *s, bool new_muted);
@@ -382,7 +377,7 @@ bool pa_source_update_proplist(pa_source *s, pa_update_mode_t mode, pa_proplist
 int pa_source_set_port(pa_source *s, const char *name, bool save);
 void pa_source_set_mixer_dirty(pa_source *s, bool is_dirty);
 
-bool pa_source_update_rate(pa_source *s, uint32_t rate, bool passthrough);
+int pa_source_update_rate(pa_source *s, uint32_t rate, bool passthrough);
 
 unsigned pa_source_linked_by(pa_source *s); /* Number of connected streams */
 unsigned pa_source_used_by(pa_source *s); /* Number of connected streams that are not corked */
@@ -394,7 +389,13 @@ pa_queue *pa_source_move_all_start(pa_source *s, pa_queue *q);
 void pa_source_move_all_finish(pa_source *s, pa_queue *q, bool save);
 void pa_source_move_all_fail(pa_queue *q);
 
+/* Returns a copy of the source formats. TODO: Get rid of this function (or at
+ * least get rid of the copying). There's no good reason to copy the formats
+ * every time someone wants to know what formats the source supports. The
+ * formats idxset could be stored directly in the pa_source struct.
+ * https://bugs.freedesktop.org/show_bug.cgi?id=71924 */
 pa_idxset* pa_source_get_formats(pa_source *s);
+
 bool pa_source_check_format(pa_source *s, pa_format_info *f);
 pa_idxset* pa_source_check_formats(pa_source *s, pa_idxset *in_formats);
 
@@ -425,6 +426,13 @@ bool pa_source_volume_change_apply(pa_source *s, pa_usec_t *usec_to_next);
 void pa_source_invalidate_requested_latency(pa_source *s, bool dynamic);
 pa_usec_t pa_source_get_latency_within_thread(pa_source *s);
 
+/* Called from the main thread, from source-output.c only. The normal way to
+ * set the source reference volume is to call pa_source_set_volume(), but the
+ * flat volume logic in source-output.c needs also a function that doesn't do
+ * all the extra stuff that pa_source_set_volume() does. This function simply
+ * sets s->reference_volume and fires change notifications. */
+void pa_source_set_reference_volume_direct(pa_source *s, const pa_cvolume *volume);
+
 #define pa_source_assert_io_context(s) \
     pa_assert(pa_thread_mq_get() || !PA_SOURCE_IS_LINKED((s)->state))