]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Add the ability to read and change the stuffing threshold
authorMike Brady <mikebrady@eircom.net>
Mon, 13 Aug 2018 13:05:14 +0000 (14:05 +0100)
committerMike Brady <mikebrady@eircom.net>
Mon, 13 Aug 2018 13:05:14 +0000 (14:05 +0100)
dbus-service.c
org.gnome.ShairportSync.xml

index 03afadb07aa237f16eeae7f8387d16511d23d1a7..59dff59e05fd63ab3ecb4502c4b9ba16fdc98226 100644 (file)
@@ -404,6 +404,19 @@ gboolean notify_loudness_threshold_callback(ShairportSync *skeleton,
   return TRUE;
 }
 
+gboolean notify_drift_tolerance_callback(ShairportSync *skeleton,
+                                            __attribute__((unused)) gpointer user_data) {
+  gdouble dt = shairport_sync_get_drift_tolerance(skeleton);
+  if ((dt >= 0.0) && (dt <= 2.0)) {
+    debug(1, "Setting drift tolerance to %f.", dt);
+    config.tolerance = dt;
+  } else {
+    debug(1, "Invalid drift tolerance: %f. Ignored.", dt);
+    shairport_sync_set_drift_tolerance(skeleton, config.tolerance);
+  }
+  return TRUE;
+}
+
 gboolean notify_alacdecoder_callback(ShairportSync *skeleton,
                                      __attribute__((unused)) gpointer user_data) {
   char *th = (char *)shairport_sync_get_alacdecoder(skeleton);
@@ -602,6 +615,8 @@ static void on_dbus_name_acquired(GDBusConnection *connection, const gchar *name
                    G_CALLBACK(notify_loudness_filter_active_callback), NULL);
   g_signal_connect(shairportSyncSkeleton, "notify::loudness-threshold",
                    G_CALLBACK(notify_loudness_threshold_callback), NULL);
+  g_signal_connect(shairportSyncSkeleton, "notify::drift-tolerance",
+                   G_CALLBACK(notify_drift_tolerance_callback), NULL);
 
   g_signal_connect(shairportSyncSkeleton, "handle-quit", G_CALLBACK(on_handle_quit), NULL);
 
@@ -660,6 +675,8 @@ static void on_dbus_name_acquired(GDBusConnection *connection, const gchar *name
 
   shairport_sync_set_loudness_threshold(SHAIRPORT_SYNC(shairportSyncSkeleton),
                                         config.loudness_reference_volume_db);
+  shairport_sync_set_drift_tolerance(SHAIRPORT_SYNC(shairportSyncSkeleton),
+                                        config.tolerance);
 
 #ifdef HAVE_APPLE_ALAC
   if (config.use_apple_decoder == 0) {
index 1b734bffe03e41d4a300ccd61f5cf6d276678372..44d90a27449d8b6e0bb2379817fc485e7e53d98a 100644 (file)
@@ -4,6 +4,7 @@
     <method name="Quit"/>
     <property name="LoudnessFilterActive" type="b" access="readwrite" />
     <property name="LoudnessThreshold" type="d" access="readwrite" />
+    <property name="DriftTolerance" type="d" access="readwrite" />
     <method name="RemoteCommand">
       <arg name="command" type="s" direction="in" />
     </method>