diff --git a/forked-daapd.conf.in b/forked-daapd.conf.in index 44e403fc..f701a2fa 100644 --- a/forked-daapd.conf.in +++ b/forked-daapd.conf.in @@ -257,6 +257,14 @@ audio { # password = "s1kr3t" #} +# Chromecast settings +# (make sure you get the capitalization of the device name right) +#chromecast "My Chromecast device" { + # Enable this option to exclude a particular device from the speaker + # list +# exclude = false +#} + # Spotify settings (only have effect if Spotify enabled - see README/INSTALL) spotify { # Directory where user settings should be stored (credentials) diff --git a/src/conffile.c b/src/conffile.c index 4d31970b..d0d37f5a 100644 --- a/src/conffile.c +++ b/src/conffile.c @@ -127,6 +127,13 @@ static cfg_opt_t sec_airplay[] = CFG_END() }; +/* Chromecast device section structure */ +static cfg_opt_t sec_chromecast[] = + { + CFG_BOOL("exclude", cfg_false, CFGF_NONE), + CFG_END() + }; + /* FIFO section structure */ static cfg_opt_t sec_fifo[] = { @@ -178,6 +185,7 @@ static cfg_opt_t toplvl_cfg[] = CFG_SEC("library", sec_library, CFGF_NONE), CFG_SEC("audio", sec_audio, CFGF_NONE), CFG_SEC("airplay", sec_airplay, CFGF_MULTI | CFGF_TITLE), + CFG_SEC("chromecast", sec_chromecast, CFGF_MULTI | CFGF_TITLE), CFG_SEC("fifo", sec_fifo, CFGF_NONE), CFG_SEC("spotify", sec_spotify, CFGF_NONE), CFG_SEC("sqlite", sec_sqlite, CFGF_NONE), diff --git a/src/outputs/cast.c b/src/outputs/cast.c index 4a5d1214..f777cac9 100644 --- a/src/outputs/cast.c +++ b/src/outputs/cast.c @@ -1245,6 +1245,7 @@ cast_device_cb(const char *name, const char *type, const char *domain, const cha { struct output_device *device; const char *friendly_name; + cfg_t *chromecast; uint32_t id; id = djb_hash(name, strlen(name)); @@ -1260,6 +1261,13 @@ cast_device_cb(const char *name, const char *type, const char *domain, const cha DPRINTF(E_DBG, L_CAST, "Event for Chromecast device '%s' (port %d, id %" PRIu32 ")\n", name, port, id); + chromecast = cfg_gettsec(cfg, "chromecast", name); + if (chromecast && cfg_getbool(chromecast, "exclude")) + { + DPRINTF(E_LOG, L_CAST, "Excluding Chromecast device '%s' as set in config\n", name); + return; + } + device = calloc(1, sizeof(struct output_device)); if (!device) {