]> code.delx.au - pulseaudio/blobdiff - src/modules/module-equalizer-sink.c
Remove unnecessary #includes
[pulseaudio] / src / modules / module-equalizer-sink.c
index bb350c381bc9353ef1b3fa3cd75897449b1c943b..e7d8790a3ad1a696693a48bd2417bda0e00ffec8 100644 (file)
@@ -36,7 +36,6 @@
 #include <math.h>
 #include <string.h>
 #include <stdint.h>
-#include <time.h>
 
 //#undef __SSE2__
 #ifdef __SSE2__
 
 #include <pulsecore/core-rtclock.h>
 #include <pulsecore/aupdate.h>
-#include <pulsecore/core-error.h>
 #include <pulsecore/namereg.h>
 #include <pulsecore/sink.h>
 #include <pulsecore/module.h>
 #include <pulsecore/core-util.h>
 #include <pulsecore/modargs.h>
 #include <pulsecore/log.h>
-#include <pulsecore/thread.h>
-#include <pulsecore/thread-mq.h>
 #include <pulsecore/rtpoll.h>
 #include <pulsecore/sample-util.h>
 #include <pulsecore/shared.h>
@@ -79,18 +75,22 @@ PA_MODULE_LOAD_ONCE(FALSE);
 PA_MODULE_USAGE(
         _("sink_name=<name of the sink> "
           "sink_properties=<properties for the sink> "
-          "master=<sink to connect to> "
+          "sink_master=<sink to connect to> "
           "format=<sample format> "
           "rate=<sample rate> "
           "channels=<number of channels> "
-          "channel_map=<channel map>"));
+          "channel_map=<channel map> "
+          "autoloaded=<set if this module is being loaded automatically> "
+         ));
 
 #define MEMBLOCKQ_MAXLENGTH (16*1024*1024)
+#define DEFAULT_AUTOLOADED FALSE
 
 struct userdata {
     pa_module *module;
     pa_sink *sink;
     pa_sink_input *sink_input;
+    pa_bool_t autoloaded;
 
     size_t channels;
     size_t fft_size;//length (res) of fft
@@ -133,11 +133,12 @@ struct userdata {
 static const char* const valid_modargs[] = {
     "sink_name",
     "sink_properties",
-    "master",
+    "sink_master",
     "format",
     "rate",
     "channels",
     "channel_map",
+    "autoloaded",
     NULL
 };
 
@@ -1088,7 +1089,7 @@ int pa__init(pa_module*m) {
         goto fail;
     }
 
-    if (!(master = pa_namereg_get(m->core, pa_modargs_get_value(ma, "master", NULL), PA_NAMEREG_SINK))) {
+    if (!(master = pa_namereg_get(m->core, pa_modargs_get_value(ma, "sink_master", NULL), PA_NAMEREG_SINK))) {
         pa_log("Master sink not found");
         goto fail;
     }
@@ -1170,6 +1171,12 @@ int pa__init(pa_module*m) {
         goto fail;
     }
 
+    u->autoloaded = DEFAULT_AUTOLOADED;
+    if (pa_modargs_get_value_boolean(ma, "autoloaded", &u->autoloaded) < 0) {
+        pa_log("Failed to parse autoloaded value");
+        goto fail;
+    }
+
     u->sink = pa_sink_new(m->core, &sink_data,
                           PA_SINK_HW_MUTE_CTRL|PA_SINK_HW_VOLUME_CTRL|PA_SINK_DECIBEL_VOLUME|
                           (master->flags & (PA_SINK_LATENCY|PA_SINK_DYNAMIC_LATENCY)));
@@ -1201,7 +1208,7 @@ int pa__init(pa_module*m) {
     pa_sink_input_new_data_init(&sink_input_data);
     sink_input_data.driver = __FILE__;
     sink_input_data.module = m;
-    sink_input_data.sink = master;
+    pa_sink_input_new_data_set_sink(&sink_input_data, master, FALSE);
     sink_input_data.origin_sink = u->sink;
     pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Equalized Stream");
     pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");