mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-10 13:37:03 +03:00
squeezelite cmdline error + cspot tweaks
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
* https://opensource.org/licenses/MIT
|
||||
*
|
||||
*/
|
||||
#include <setjmp.h>
|
||||
#include "squeezelite.h"
|
||||
#include "pthread.h"
|
||||
#include "esp_pthread.h"
|
||||
@@ -18,6 +19,7 @@
|
||||
#include "platform_config.h"
|
||||
|
||||
mutex_type slimp_mutex;
|
||||
static jmp_buf jumpbuf;
|
||||
|
||||
void get_mac(u8_t mac[]) {
|
||||
esp_read_mac(mac, ESP_MAC_WIFI_STA);
|
||||
@@ -49,12 +51,17 @@ extern bool sb_displayer_init(void);
|
||||
|
||||
u8_t custom_player_id = 12;
|
||||
|
||||
void embedded_init(void) {
|
||||
int embedded_init(void) {
|
||||
mutex_create(slimp_mutex);
|
||||
sb_controls_init();
|
||||
custom_player_id = sb_displayer_init() ? 100 : 101;
|
||||
return setjmp(jumpbuf);
|
||||
}
|
||||
|
||||
void embedded_exit(int code) {
|
||||
longjmp(jumpbuf, code + 1);
|
||||
}
|
||||
|
||||
u16_t get_RSSI(void) {
|
||||
wifi_ap_record_t wifidata;
|
||||
esp_wifi_sta_get_ap_info(&wifidata);
|
||||
|
||||
@@ -52,7 +52,8 @@ extern u8_t custom_player_id;
|
||||
#define EXT_BSS __attribute__((section(".ext_ram.bss")))
|
||||
|
||||
// all exit() calls are made from main thread (or a function called in main thread)
|
||||
#define exit(code) { int ret = code; pthread_exit(&ret); }
|
||||
void embedded_exit(int code);
|
||||
#define exit(code) do { embedded_exit(code); } while (0)
|
||||
#define gettime_ms _gettime_ms_
|
||||
#define mutex_create_p(m) mutex_create(m)
|
||||
|
||||
@@ -62,7 +63,7 @@ int pthread_create_name(pthread_t *thread, _CONST pthread_attr_t *attr,
|
||||
void *(*start_routine)( void * ), void *arg, char *name);
|
||||
|
||||
// must provide of #define as empty macros
|
||||
void embedded_init(void);
|
||||
int embedded_init(void);
|
||||
void register_external(void);
|
||||
void deregister_external(void);
|
||||
void decode_restore(int external);
|
||||
|
||||
@@ -316,6 +316,11 @@ int main(int argc, char **argv) {
|
||||
#if IR
|
||||
char *lircrc = NULL;
|
||||
#endif
|
||||
|
||||
#if EMBEDDED
|
||||
int err = embedded_init();
|
||||
if (err) return err;
|
||||
#endif
|
||||
|
||||
log_level log_output = lWARN;
|
||||
log_level log_stream = lWARN;
|
||||
@@ -674,6 +679,7 @@ int main(int argc, char **argv) {
|
||||
case 't':
|
||||
license();
|
||||
exit(0);
|
||||
break;
|
||||
case '?':
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
@@ -756,7 +762,6 @@ int main(int argc, char **argv) {
|
||||
stream_init(log_stream, stream_buf_size);
|
||||
|
||||
#if EMBEDDED
|
||||
embedded_init();
|
||||
output_init_embedded(log_output, output_device, output_buf_size, output_params, rates, rate_delay, idle);
|
||||
#else
|
||||
if (!strcmp(output_device, "-")) {
|
||||
|
||||
@@ -359,13 +359,13 @@ void output_init_common(log_level level, const char *device, unsigned output_buf
|
||||
buf_init(outputbuf, output_buf_size);
|
||||
if (!outputbuf->buf) {
|
||||
LOG_ERROR("unable to malloc output buffer");
|
||||
exit(0);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
silencebuf = malloc(MAX_SILENCE_FRAMES * BYTES_PER_FRAME);
|
||||
if (!silencebuf) {
|
||||
LOG_ERROR("unable to malloc silence buffer");
|
||||
exit(0);
|
||||
exit(2);
|
||||
}
|
||||
memset(silencebuf, 0, MAX_SILENCE_FRAMES * BYTES_PER_FRAME);
|
||||
|
||||
@@ -373,7 +373,7 @@ void output_init_common(log_level level, const char *device, unsigned output_buf
|
||||
silencebuf_dsd = malloc(MAX_SILENCE_FRAMES * BYTES_PER_FRAME);
|
||||
if (!silencebuf_dsd) {
|
||||
LOG_ERROR("unable to malloc silence dsd buffer");
|
||||
exit(0);
|
||||
exit(2);
|
||||
}
|
||||
dsd_silence_frames((u32_t *)silencebuf_dsd, MAX_SILENCE_FRAMES);
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user