Continue hooking up active mode and disable standby stuff

This commit is contained in:
Mike Brady
2019-02-08 16:57:39 +00:00
parent 8b589879be
commit 34351a99cb
3 changed files with 79 additions and 1 deletions
+23
View File
@@ -40,6 +40,7 @@
#include "activity_monitor.h"
#include "common.h"
#include "dbus-service.h"
#include "rtsp.h"
enum am_state state;
@@ -60,6 +61,17 @@ void going_active(int block) {
debug(2, "abeg"); // active mode begin
send_ssnc_metadata('pend', NULL, 0, 1); // contains cancellation points
#endif
#ifdef CONFIG_DBUS_INTERFACE
shairport_sync_set_active(SHAIRPORT_SYNC(shairportSyncSkeleton), TRUE);
#endif
if (config.disable_standby_mode == disable_standby_while_active) {
config.keep_dac_busy = 1;
#ifdef CONFIG_DBUS_INTERFACE
shairport_sync_set_disable_standby(SHAIRPORT_SYNC(shairportSyncSkeleton), TRUE);
#endif
}
}
void going_inactive(int block) {
@@ -71,6 +83,17 @@ void going_inactive(int block) {
debug(2, "aend"); // active mode end
send_ssnc_metadata('pend', NULL, 0, 1); // contains cancellation points
#endif
#ifdef CONFIG_DBUS_INTERFACE
shairport_sync_set_active(SHAIRPORT_SYNC(shairportSyncSkeleton), FALSE);
#endif
if (config.disable_standby_mode == disable_standby_while_active) {
config.keep_dac_busy = 0;
#ifdef CONFIG_DBUS_INTERFACE
shairport_sync_set_disable_standby(SHAIRPORT_SYNC(shairportSyncSkeleton), FALSE);
#endif
}
}
void activity_monitor_signify_activity(int active) {
+54 -1
View File
@@ -430,6 +430,36 @@ gboolean notify_drift_tolerance_callback(ShairportSync *skeleton,
return TRUE;
}
gboolean notify_disable_standby_mode_callback(ShairportSync *skeleton,
__attribute__((unused)) gpointer user_data) {
char *th = (char *)shairport_sync_get_disable_standby_mode(skeleton);
if ((strcasecmp(th, "no") == 0) || (strcasecmp(th, "off") == 0) || (strcasecmp(th, "never") == 0)) {
config.disable_standby_mode = disable_standby_off;
config.keep_dac_busy = 0;
} else if ((strcasecmp(th, "yes") == 0) || (strcasecmp(th, "on") == 0) || (strcasecmp(th, "always") == 0)) {
config.disable_standby_mode = disable_standby_always;
config.keep_dac_busy = 1;
} else if (strcasecmp(th, "while active") == 0)
config.disable_standby_mode = disable_standby_while_active;
else {
warn("An unrecognised disable_standby_mode: \"%s\" was requested via D-Bus interface.", th);
switch (config.disable_standby_mode) {
case disable_standby_off:
shairport_sync_set_disable_standby_mode(skeleton, "off");
break;
case disable_standby_always:
shairport_sync_set_disable_standby_mode(skeleton, "always");
break;
case disable_standby_while_active:
shairport_sync_set_disable_standby_mode(skeleton, "while active");
break;
default:
break;
}
}
return TRUE;
}
gboolean notify_alacdecoder_callback(ShairportSync *skeleton,
__attribute__((unused)) gpointer user_data) {
char *th = (char *)shairport_sync_get_alacdecoder(skeleton);
@@ -622,7 +652,9 @@ static void on_dbus_name_acquired(GDBusConnection *connection, const gchar *name
G_CALLBACK(notify_interpolation_callback), NULL);
g_signal_connect(shairportSyncSkeleton, "notify::alacdecoder",
G_CALLBACK(notify_alacdecoder_callback), NULL);
g_signal_connect(shairportSyncSkeleton, "notify::volume-control-profile",
g_signal_connect(shairportSyncSkeleton, "notify::disable-standby-mode",
G_CALLBACK(notify_disable_standby_mode_callback), NULL);
g_signal_connect(shairportSyncSkeleton, "notify::volume-control-profile",
G_CALLBACK(notify_volume_control_profile_callback), NULL);
g_signal_connect(shairportSyncSkeleton, "notify::disable-standby",
G_CALLBACK(notify_disable_standby_callback), NULL);
@@ -706,6 +738,27 @@ static void on_dbus_name_acquired(GDBusConnection *connection, const gchar *name
#endif
shairport_sync_set_active(SHAIRPORT_SYNC(shairportSyncSkeleton), FALSE);
debug(1, ">> Active set to \"false\"");
switch (config.disable_standby_mode) {
case disable_standby_off:
shairport_sync_set_disable_standby_mode(SHAIRPORT_SYNC(shairportSyncSkeleton), "off");
debug(1, ">> disable standby mode set to \"off\"");
break;
case disable_standby_always:
shairport_sync_set_disable_standby_mode(SHAIRPORT_SYNC(shairportSyncSkeleton), "always");
debug(1, ">> disable standby mode set to \"always\"");
break;
case disable_standby_while_active:
shairport_sync_set_disable_standby_mode(SHAIRPORT_SYNC(shairportSyncSkeleton), "while active");
debug(1, ">> disable standby mode set to \"while active\"");
break;
default:
debug(1,"invalid disable_standby mode!");
break;
}
#ifdef CONFIG_SOXR
if (config.packet_stuffing == ST_basic) {
shairport_sync_set_interpolation(SHAIRPORT_SYNC(shairportSyncSkeleton), "basic");
+2
View File
@@ -2,7 +2,9 @@
<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
<interface name="org.gnome.ShairportSync">
<method name="Quit"/>
<property name='Active' type='b' access='read'/>
<property name="DisableStandby" type="b" access="readwrite" />
<property name="DisableStandbyMode" type="s" access="readwrite" />
<property name="LoudnessFilterActive" type="b" access="readwrite" />
<property name="LoudnessThreshold" type="d" access="readwrite" />
<property name="DriftTolerance" type="d" access="readwrite" />