mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-06 11:36:59 +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 UNLOCK_D mutex_unlock(decode.mutex);
|
||||
|
||||
enum { DECODE_BT = 1, DECODE_AIRPLAY };
|
||||
|
||||
extern struct outputstate output;
|
||||
extern struct decodestate decode;
|
||||
extern struct buffer *outputbuf;
|
||||
@@ -114,14 +116,16 @@ static void bt_sink_cmd_handler(bt_sink_cmd_t cmd, ...)
|
||||
|
||||
switch(cmd) {
|
||||
case BT_SINK_CONNECTED:
|
||||
output.external = true;
|
||||
output.external = DECODE_BT;
|
||||
output.state = OUTPUT_STOPPED;
|
||||
LOG_INFO("BT sink started");
|
||||
break;
|
||||
case BT_SINK_DISCONNECTED:
|
||||
output.external = false;
|
||||
output.state = OUTPUT_OFF;
|
||||
LOG_INFO("BT sink stopped");
|
||||
if (output.external == DECODE_BT) {
|
||||
output.external = 0;
|
||||
output.state = OUTPUT_OFF;
|
||||
LOG_INFO("BT sink stopped");
|
||||
}
|
||||
break;
|
||||
case BT_SINK_PLAY:
|
||||
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.start = true;
|
||||
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.state = OUTPUT_STOPPED;
|
||||
break;
|
||||
case RAOP_STOP:
|
||||
LOG_INFO("Stop", NULL);
|
||||
output.external = false;
|
||||
output.external = 0;
|
||||
output.state = OUTPUT_OFF;
|
||||
output.frames_played = 0;
|
||||
raop_state = event;
|
||||
|
||||
@@ -371,7 +371,7 @@ static void process_strm(u8_t *pkt, int len) {
|
||||
sendSTAT("STMc", 0);
|
||||
sentSTMu = sentSTMo = sentSTMl = false;
|
||||
LOCK_O;
|
||||
output.external = false;
|
||||
output.external = 0;
|
||||
_buf_resize(outputbuf, output.init_size);
|
||||
output.threshold = strm->output_threshold;
|
||||
output.next_replay_gain = unpackN(&strm->replay_gain);
|
||||
|
||||
@@ -659,7 +659,7 @@ struct outputstate {
|
||||
output_state state;
|
||||
output_format format;
|
||||
const char *device;
|
||||
bool external;
|
||||
int external;
|
||||
u32_t init_size;
|
||||
#if ALSA
|
||||
unsigned buffer;
|
||||
|
||||
Reference in New Issue
Block a user