mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2026-01-31 14:51:11 +03:00
differentiate BT and AP external decoder
This commit is contained in:
@@ -29,6 +29,8 @@
|
|||||||
#define LOCK_D mutex_lock(decode.mutex);
|
#define LOCK_D mutex_lock(decode.mutex);
|
||||||
#define UNLOCK_D mutex_unlock(decode.mutex);
|
#define UNLOCK_D mutex_unlock(decode.mutex);
|
||||||
|
|
||||||
|
enum { DECODE_BT = 1, DECODE_AIRPLAY };
|
||||||
|
|
||||||
extern struct outputstate output;
|
extern struct outputstate output;
|
||||||
extern struct decodestate decode;
|
extern struct decodestate decode;
|
||||||
extern struct buffer *outputbuf;
|
extern struct buffer *outputbuf;
|
||||||
@@ -114,14 +116,16 @@ static void bt_sink_cmd_handler(bt_sink_cmd_t cmd, ...)
|
|||||||
|
|
||||||
switch(cmd) {
|
switch(cmd) {
|
||||||
case BT_SINK_CONNECTED:
|
case BT_SINK_CONNECTED:
|
||||||
output.external = true;
|
output.external = DECODE_BT;
|
||||||
output.state = OUTPUT_STOPPED;
|
output.state = OUTPUT_STOPPED;
|
||||||
LOG_INFO("BT sink started");
|
LOG_INFO("BT sink started");
|
||||||
break;
|
break;
|
||||||
case BT_SINK_DISCONNECTED:
|
case BT_SINK_DISCONNECTED:
|
||||||
output.external = false;
|
if (output.external == DECODE_BT) {
|
||||||
output.state = OUTPUT_OFF;
|
output.external = 0;
|
||||||
LOG_INFO("BT sink stopped");
|
output.state = OUTPUT_OFF;
|
||||||
|
LOG_INFO("BT sink stopped");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case BT_SINK_PLAY:
|
case BT_SINK_PLAY:
|
||||||
output.state = OUTPUT_RUNNING;
|
output.state = OUTPUT_RUNNING;
|
||||||
@@ -226,13 +230,13 @@ void raop_sink_cmd_handler(raop_event_t event, void *param)
|
|||||||
raop_sync.error = 0;
|
raop_sync.error = 0;
|
||||||
raop_sync.start = true;
|
raop_sync.start = true;
|
||||||
raop_sync.enabled = !strcasestr(output.device, "BT");
|
raop_sync.enabled = !strcasestr(output.device, "BT");
|
||||||
output.external = true;
|
output.external = DECODE_AIRPLAY;
|
||||||
output.next_sample_rate = output.current_sample_rate = RAOP_SAMPLE_RATE;
|
output.next_sample_rate = output.current_sample_rate = RAOP_SAMPLE_RATE;
|
||||||
output.state = OUTPUT_STOPPED;
|
output.state = OUTPUT_STOPPED;
|
||||||
break;
|
break;
|
||||||
case RAOP_STOP:
|
case RAOP_STOP:
|
||||||
LOG_INFO("Stop", NULL);
|
LOG_INFO("Stop", NULL);
|
||||||
output.external = false;
|
output.external = 0;
|
||||||
output.state = OUTPUT_OFF;
|
output.state = OUTPUT_OFF;
|
||||||
output.frames_played = 0;
|
output.frames_played = 0;
|
||||||
raop_state = event;
|
raop_state = event;
|
||||||
|
|||||||
@@ -371,7 +371,7 @@ static void process_strm(u8_t *pkt, int len) {
|
|||||||
sendSTAT("STMc", 0);
|
sendSTAT("STMc", 0);
|
||||||
sentSTMu = sentSTMo = sentSTMl = false;
|
sentSTMu = sentSTMo = sentSTMl = false;
|
||||||
LOCK_O;
|
LOCK_O;
|
||||||
output.external = false;
|
output.external = 0;
|
||||||
_buf_resize(outputbuf, output.init_size);
|
_buf_resize(outputbuf, output.init_size);
|
||||||
output.threshold = strm->output_threshold;
|
output.threshold = strm->output_threshold;
|
||||||
output.next_replay_gain = unpackN(&strm->replay_gain);
|
output.next_replay_gain = unpackN(&strm->replay_gain);
|
||||||
|
|||||||
@@ -659,7 +659,7 @@ struct outputstate {
|
|||||||
output_state state;
|
output_state state;
|
||||||
output_format format;
|
output_format format;
|
||||||
const char *device;
|
const char *device;
|
||||||
bool external;
|
int external;
|
||||||
u32_t init_size;
|
u32_t init_size;
|
||||||
#if ALSA
|
#if ALSA
|
||||||
unsigned buffer;
|
unsigned buffer;
|
||||||
|
|||||||
Reference in New Issue
Block a user