Starting to connect active mode with disable standby.

This commit is contained in:
Mike Brady
2019-02-08 09:04:33 +00:00
parent 79e22063ef
commit c86823c343
4 changed files with 35 additions and 6 deletions
+5 -1
View File
@@ -42,7 +42,7 @@
#include "common.h"
#include "rtsp.h"
enum am_state { am_inactive, am_active, am_timing_out } state;
enum am_state state;
enum ps_state { ps_inactive, ps_active } player_state;
int activity_monitor_running = 0;
@@ -217,6 +217,10 @@ void *activity_monitor_thread_code(void *arg) {
pthread_exit(NULL);
}
enum am_state activity_status() {
return (state);
}
void activity_monitor_start() {
// debug(1,"activity_monitor_start");
pthread_create(&activity_monitor_thread, NULL, activity_monitor_thread_code, NULL);
+4
View File
@@ -1,4 +1,8 @@
#pragma once
enum am_state { am_inactive, am_active, am_timing_out };
void activity_monitor_start();
void activity_monitor_stop();
void activity_monitor_signify_activity(int active); // 0 means inactive, non-zero means active
enum am_state activity_status(); // true if non inactive; false if inactive
+19 -5
View File
@@ -975,12 +975,26 @@ static int init(int argc, char **argv) {
}
}
// Get the optional "Keep DAC Busy setting"
int kdb;
if (config_set_lookup_bool(config.cfg, "alsa.disable_standby_mode", &kdb)) {
config.keep_dac_busy = kdb;
/* Get the optional disable_standby_mode setting. */
config.disable_standby_mode = disable_standby_while_active;
config.keep_dac_busy = 0;
if (config_lookup_string(config.cfg, "alsa.disable_standby_mode", &str)) {
if ((strcasecmp(str, "no") == 0) || (strcasecmp(str, "off") == 0) || (strcasecmp(str, "never") == 0))
config.disable_standby_mode = disable_standby_off;
else if ((strcasecmp(str, "yes") == 0) || (strcasecmp(str, "on") == 0) || (strcasecmp(str, "always") == 0)) {
config.disable_standby_mode = disable_standby_on;
config.keep_dac_busy = 1;
} else if (strcasecmp(str, "while active") == 0)
config.disable_standby_mode = disable_standby_while_active;
else {
warn("Invalid disable_standby_mode option choice \"%s\". It should be "
"\"always\", \"while active\" or \"never\". "
"It is set to \"while active\".");
}
}
debug(1, "alsa: disable_standby_mode is %s.", config.keep_dac_busy ? "on" : "off");
debug(1, "alsa: disable_standby_mode is %d.", config.disable_standby_mode);
}
optind = 1; // optind=0 is equivalent to optind=1 plus special behaviour
+7
View File
@@ -62,6 +62,12 @@ enum decoders_supported_type {
decoder_apple_alac,
} decoders_supported_type;
enum disable_standby_mode_type {
disable_standby_off = 0,
disable_standby_while_active,
disable_standby_always
}
// the following enum is for the formats recognised -- currently only S16LE is recognised for input,
// so these are output only for the present
@@ -201,6 +207,7 @@ typedef struct {
float loudness_reference_volume_db;
int alsa_use_hardware_mute;
double alsa_maximum_stall_time;
enum disable_standby_mode_type disable_standby_mode;
volatile int keep_dac_busy;
#if defined(CONFIG_DBUS_INTERFACE)