mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-09 13:07:03 +03:00
Compare commits
5 Commits
v0.5.656-v
...
v0.5.662-v
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e3fde6f6e | ||
|
|
26d3d99738 | ||
|
|
ff5fb3a7d1 | ||
|
|
c3bf7f4a04 | ||
|
|
3df6568b6a |
@@ -426,7 +426,8 @@ Use 'idf monitor' to monitor the application (see esp-idf documentation)
|
||||
- LINKALL (mandatory)
|
||||
- NO_FAAD unless you want to us faad, which currently overloads the CPU
|
||||
- TREMOR_ONLY (mandatory)
|
||||
- better use helixaac
|
||||
- better use helixaac
|
||||
- libmad has been patched to avoid using a lot of stack. There is an issue with sycn detection in 1.15.1b from where the original stack patch was done but since a few fixes have been made wrt sync detection. This 1.15.1b-10 found on debian fixes the issue where mad thinks it has reached sync but has not and so returns a wrong sample rate. It comes at the expense of 8KB (!) of code where a simple check in squeezelite/mad.c that next_frame[0] is 0xff and next_frame[1] & 0xf0 is 0xf0 does the trick ...
|
||||
- When initially cloning the repo, make sure you do it recursively. For example:
|
||||
- git clone --recursive https://github.com/sle118/squeezelite-esp32.git
|
||||
- If you have already cloned the repository and you are getting compile errors on one of the submodules (e.g. telnet), run the following git command in the root of the repository location
|
||||
|
||||
Binary file not shown.
@@ -90,7 +90,7 @@ static void Update16( struct GDS_Device* Device ) {
|
||||
for (int i = FirstRow; i <= LastRow; i++) {
|
||||
memcpy(optr, Private->Shadowbuffer + (i * Device->Width + FirstCol) * 2, ChunkSize);
|
||||
optr += ChunkSize;
|
||||
if (optr - Private->iRAM < PAGE_BLOCK && i < LastRow) continue;
|
||||
if (optr - Private->iRAM <= (PAGE_BLOCK - ChunkSize) && i < LastRow) continue;
|
||||
Device->WriteData(Device, Private->iRAM, optr - Private->iRAM);
|
||||
optr = Private->iRAM;
|
||||
}
|
||||
@@ -157,7 +157,7 @@ static void Update24( struct GDS_Device* Device ) {
|
||||
for (int i = FirstRow; i <= LastRow; i++) {
|
||||
memcpy(optr, Private->Shadowbuffer + (i * Device->Width + FirstCol) * 3, ChunkSize);
|
||||
optr += ChunkSize;
|
||||
if (optr - Private->iRAM < PAGE_BLOCK && i < LastRow) continue;
|
||||
if (optr - Private->iRAM <= (PAGE_BLOCK - ChunkSize) && i < LastRow) continue;
|
||||
Device->WriteData(Device, Private->iRAM, optr - Private->iRAM);
|
||||
optr = Private->iRAM;
|
||||
}
|
||||
|
||||
@@ -585,7 +585,7 @@ void draw_VU(struct GDS_Device * display, const uint8_t *data, int level, int x,
|
||||
int scale = 8 - GDS_GetDepth(display);
|
||||
|
||||
// use "fast" version as we are not beyond screen boundaries
|
||||
if (visu.rotate) {
|
||||
if (rotate) {
|
||||
for (int r = 0; r < width; r++) {
|
||||
for (int c = VU_HEIGHT; --c >= 0;) {
|
||||
GDS_DrawPixelFast(display, c + x, r + y, *data++ >> scale);
|
||||
@@ -594,13 +594,13 @@ void draw_VU(struct GDS_Device * display, const uint8_t *data, int level, int x,
|
||||
} else {
|
||||
for (int r = 0; r < width; r++) {
|
||||
for (int c = 0; c < VU_HEIGHT; c++) {
|
||||
GDS_DrawPixelFast(display, r + x, c + y, *data++ >> scale);
|
||||
GDS_DrawPixelFast(display, r + x, c + y, *data++ >> scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// use "fast" version as we are not beyond screen boundaries
|
||||
if (visu.rotate) {
|
||||
if (rotate) {
|
||||
for (int r = 0; r < width; r++) {
|
||||
for (int c = VU_HEIGHT; --c >= 0;) {
|
||||
GDS_DrawPixelFast(display, c + x, r + y, grayMap[*data++]);
|
||||
@@ -609,11 +609,10 @@ void draw_VU(struct GDS_Device * display, const uint8_t *data, int level, int x,
|
||||
} else {
|
||||
for (int r = 0; r < width; r++) {
|
||||
for (int c = 0; c < VU_HEIGHT; c++) {
|
||||
GDS_DrawPixelFast(display, r + x, c + y, grayMap[*data++]);
|
||||
GDS_DrawPixelFast(display, r + x, c + y, grayMap[*data++]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// need to manually set dirty flag as DrawPixel does not do it
|
||||
@@ -629,8 +628,9 @@ static void grfe_handler( u8_t *data, int len) {
|
||||
|
||||
scroller.active = false;
|
||||
|
||||
// visu has priority when full screen on small screens
|
||||
if ((visu.mode & VISU_ESP32) && !visu.col && visu.row < displayer.height) {
|
||||
// full screen artwork or for small screen, full screen visu has priority
|
||||
if (((visu.mode & VISU_ESP32) && !visu.col && visu.row < displayer.height) ||
|
||||
(artwork.enable && artwork.x == 0 && artwork.y == 0)) {
|
||||
xSemaphoreGive(displayer.mutex);
|
||||
return;
|
||||
}
|
||||
@@ -752,8 +752,11 @@ static void grfg_handler(u8_t *data, int len) {
|
||||
|
||||
LOG_DEBUG("gfrg s:%hu w:%hu (len:%u)", htons(pkt->screen), htons(pkt->width), len);
|
||||
|
||||
// on small screen, visu has priority when full screen
|
||||
if ((visu.mode & VISU_ESP32) && !visu.col && visu.row < displayer.height) return;
|
||||
// full screen artwork or for small screen, visu has priority when full screen
|
||||
if (((visu.mode & VISU_ESP32) && !visu.col && visu.row < displayer.height) ||
|
||||
(artwork.enable && artwork.x == 0 && artwork.y == 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
xSemaphoreTake(displayer.mutex, portMAX_DELAY);
|
||||
|
||||
@@ -796,7 +799,7 @@ static void grfa_handler(u8_t *data, int len) {
|
||||
|
||||
// when using full screen visualizer on small screen there is a brief overlay
|
||||
artwork.enable = (length != 0);
|
||||
|
||||
|
||||
// just a config or an actual artwork
|
||||
if (length < 32) {
|
||||
if (artwork.enable) {
|
||||
@@ -841,8 +844,10 @@ static void grfa_handler(u8_t *data, int len) {
|
||||
* Update visualization bars
|
||||
*/
|
||||
static void visu_update(void) {
|
||||
// no need to protect against no woning the display as we are playing
|
||||
if (pthread_mutex_trylock(&visu_export.mutex)) return;
|
||||
// no update when artwork is full screen (but no need to protect against not owning the display as we are playing
|
||||
if ((artwork.enable && artwork.x == 0 && artwork.y == 0) || pthread_mutex_trylock(&visu_export.mutex)) {
|
||||
return;
|
||||
}
|
||||
|
||||
int mode = visu.mode & ~VISU_ESP32;
|
||||
|
||||
@@ -966,9 +971,13 @@ static void visu_update(void) {
|
||||
}
|
||||
}
|
||||
} else if (displayer.width / 2 > 3 * VU_WIDTH / 4) {
|
||||
int width = visu.rotate ? visu.height : visu.width;
|
||||
draw_VU(display, vu_bitmap, visu.bars[0].current, 0, visu.row, width / 2, visu.rotate);
|
||||
draw_VU(display, vu_bitmap, visu.bars[1].current, width / 2, visu.row, width / 2, visu.rotate);
|
||||
if (visu.rotate) {
|
||||
draw_VU(display, vu_bitmap, visu.bars[0].current, 0, visu.row, visu.height / 2, visu.rotate);
|
||||
draw_VU(display, vu_bitmap, visu.bars[1].current, 0, visu.row + visu.height / 2, visu.height / 2, visu.rotate);
|
||||
} else {
|
||||
draw_VU(display, vu_bitmap, visu.bars[0].current, 0, visu.row, visu.width / 2, visu.rotate);
|
||||
draw_VU(display, vu_bitmap, visu.bars[1].current, visu.width / 2, visu.row, visu.width / 2, visu.rotate);
|
||||
}
|
||||
} else {
|
||||
int level = (visu.bars[0].current + visu.bars[1].current) / 2;
|
||||
draw_VU(display, vu_bitmap, level, 0, visu.row, visu.rotate ? visu.height : visu.width, visu.rotate);
|
||||
|
||||
@@ -234,6 +234,11 @@ void output_init_i2s(log_level level, char *device, unsigned output_buf_size, ch
|
||||
set_i2s_pin(spdif_config, &i2s_spdif_pin);
|
||||
set_i2s_pin(dac_config, &i2s_dac_pin);
|
||||
|
||||
/* BEWARE: i2s. must be patched to set tx_msb_right/rx_msb_right to 1
|
||||
* or SPDIF will not work. These settings are not accessible from
|
||||
* userland and I don't know why
|
||||
*/
|
||||
|
||||
// common I2S initialization
|
||||
i2s_config.mode = I2S_MODE_MASTER | I2S_MODE_TX;
|
||||
i2s_config.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT;
|
||||
|
||||
@@ -42,9 +42,21 @@ static log_level loglevel;
|
||||
static struct buffer buf;
|
||||
struct buffer *streambuf = &buf;
|
||||
|
||||
#define LOCK mutex_lock(streambuf->mutex)
|
||||
#define UNLOCK mutex_unlock(streambuf->mutex)
|
||||
#define LOCK mutex_lock(streambuf->mutex)
|
||||
#define UNLOCK mutex_unlock(streambuf->mutex)
|
||||
|
||||
/*
|
||||
When LMS sends a close/open sequence very quickly, the stream thread might
|
||||
still be waiting in the poll() on the closed socket. It is never recommended
|
||||
to have a thread closing a socket used by another thread but it works, as
|
||||
opposed to an infinite select().
|
||||
In stream_sock() a new socket is created and full OS will allocate a different
|
||||
one but on RTOS and simple IP stack, the same might be re-used and that causes
|
||||
an exception as a thread is already waiting on a newly allocated socket
|
||||
A simple variable that forces stream_sock() to wait until we are out of poll()
|
||||
is enough and much faster than a mutex
|
||||
*/
|
||||
static bool polling;
|
||||
static sockfd fd;
|
||||
|
||||
struct streamstate stream;
|
||||
@@ -187,6 +199,7 @@ static void *stream_thread() {
|
||||
|
||||
} else {
|
||||
|
||||
polling = true;
|
||||
pollinfo.fd = fd;
|
||||
pollinfo.events = POLLIN;
|
||||
if (stream.state == SEND_HEADERS) {
|
||||
@@ -195,9 +208,10 @@ static void *stream_thread() {
|
||||
}
|
||||
|
||||
UNLOCK;
|
||||
|
||||
|
||||
if (_poll(ssl, &pollinfo, 100)) {
|
||||
|
||||
polling = false;
|
||||
LOCK;
|
||||
|
||||
// check socket has not been closed while in poll
|
||||
@@ -350,7 +364,8 @@ static void *stream_thread() {
|
||||
UNLOCK;
|
||||
|
||||
} else {
|
||||
|
||||
// it is safe to set it unlocked
|
||||
polling = false;
|
||||
LOG_SDEBUG("poll timeout");
|
||||
}
|
||||
}
|
||||
@@ -438,7 +453,7 @@ void stream_file(const char *header, size_t header_len, unsigned threshold) {
|
||||
buf_flush(streambuf);
|
||||
|
||||
LOCK;
|
||||
|
||||
|
||||
stream.header_len = header_len;
|
||||
memcpy(stream.header, header, header_len);
|
||||
*(stream.header+header_len) = '\0';
|
||||
@@ -473,6 +488,12 @@ void stream_file(const char *header, size_t header_len, unsigned threshold) {
|
||||
void stream_sock(u32_t ip, u16_t port, const char *header, size_t header_len, unsigned threshold, bool cont_wait) {
|
||||
struct sockaddr_in addr;
|
||||
|
||||
#if EMBEDDED
|
||||
// wait till we are not polling anymore
|
||||
for (LOCK; running && polling; UNLOCK, usleep(10000), LOCK);
|
||||
UNLOCK;
|
||||
#endif
|
||||
|
||||
int sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
|
||||
if (sock < 0) {
|
||||
|
||||
Binary file not shown.
@@ -78,7 +78,7 @@ sub displayWidth {
|
||||
if ($display->widthOverride) {
|
||||
my $artwork = $prefs->client($client)->get('artwork');
|
||||
if ($artwork->{'enable'} && $artwork->{'y'} < 32 && ($client->isPlaying || $client->isPaused)) {
|
||||
return $artwork->{x} + ($display->modes->[$mode || 0]{_width} || 0);
|
||||
return ($artwork->{x} || $display->widthOverride) + ($display->modes->[$mode || 0]{_width} || 0);
|
||||
} else {
|
||||
return $display->widthOverride + ($display->modes->[$mode || 0]{_width} || 0);
|
||||
}
|
||||
@@ -113,9 +113,9 @@ sub build_modes {
|
||||
my $artwork = $cprefs->get('artwork');
|
||||
my $disp_width = $cprefs->get('width') || 128;
|
||||
|
||||
# if artwork is in main display, reduce width
|
||||
my $width = ($artwork->{'enable'} && $artwork->{'y'} < 32) ? $artwork->{'x'} : $disp_width;
|
||||
my $width_low = ($artwork->{'enable'} && ($artwork->{'y'} >= 32 || $disp_width - $artwork->{'x'} > 32)) ? $artwork->{'x'} : $disp_width;
|
||||
# if artwork is in main display, reduce width but when artwork is (0,0) fake it
|
||||
my $width = ($artwork->{'enable'} && $artwork->{'y'} < 32 && $artwork->{'x'}) ? $artwork->{'x'} : $disp_width;
|
||||
my $width_low = ($artwork->{'enable'} && $artwork->{'x'} && ($artwork->{'y'} >= 32 || $disp_width - $artwork->{'x'} > 32)) ? $artwork->{'x'} : $disp_width;
|
||||
|
||||
my $small_VU = $cprefs->get('small_VU');
|
||||
my $spectrum = $cprefs->get('spectrum');
|
||||
|
||||
@@ -221,6 +221,11 @@ sub clear_artwork {
|
||||
if ($artwork && $artwork->{'enable'}) {
|
||||
main::INFOLOG && $log->is_info && $log->info("artwork stop/clear " . $request->getRequestString());
|
||||
$client->pluginData('artwork_md5', '');
|
||||
# refresh screen and disable artwork when artwork was full screen (hack)
|
||||
if (!$artwork->{'x'} && !$artwork->{'y'}) {
|
||||
$client->sendFrame(grfa => \("\x00"x4)) unless $artwork->{'x'} || $artwork->{'y'};
|
||||
$client->display->update;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ sub page {
|
||||
sub prefs {
|
||||
my ($class, $client) = @_;
|
||||
my @prefs;
|
||||
push @prefs, qw(width small_VU) if $client->displayWidth;
|
||||
push @prefs, qw(width small_VU) if defined $client->displayWidth;
|
||||
return ($prefs->client($client), @prefs);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ sub handler {
|
||||
my ($cprefs, @prefs) = $class->prefs($client);
|
||||
|
||||
if ($paramRef->{'saveSettings'}) {
|
||||
if ($client->displayWidth) {
|
||||
if (defined $client->displayWidth) {
|
||||
$cprefs->set('small_VU', $paramRef->{'pref_small_VU'} || 15);
|
||||
my $spectrum = {
|
||||
scale => $paramRef->{'pref_spectrum_scale'} || 25,
|
||||
@@ -76,7 +76,7 @@ sub handler {
|
||||
$client->update_tones($equalizer);
|
||||
}
|
||||
|
||||
if ($client->displayWidth) {
|
||||
if (defined $client->displayWidth) {
|
||||
# the Settings super class can't handle anything but scalar values
|
||||
# we need to populate the $paramRef for the other prefs manually
|
||||
$paramRef->{'pref_spectrum'} = $cprefs->get('spectrum');
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
<name>PLUGIN_SQUEEZEESP32</name>
|
||||
<description>PLUGIN_SQUEEZEESP32_DESC</description>
|
||||
<module>Plugins::SqueezeESP32::Plugin</module>
|
||||
<version>0.103</version>
|
||||
<version>0.104</version>
|
||||
<creator>Philippe</creator>
|
||||
</extensions>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version='1.0' standalone='yes'?>
|
||||
<extensions>
|
||||
<plugins>
|
||||
<plugin version="0.103" name="SqueezeESP32" minTarget="7.9" maxTarget="*">
|
||||
<plugin version="0.104" name="SqueezeESP32" minTarget="7.9" maxTarget="*">
|
||||
<link>https://github.com/sle118/squeezelite-esp32</link>
|
||||
<creator>Philippe</creator>
|
||||
<sha>d07bb3b0a283fbde50e5533dca695a4505971f03</sha>
|
||||
<sha>79e505a30d7b6dbf43893acab176d57438e2a4a1</sha>
|
||||
<email>philippe_44@outlook.com</email>
|
||||
<desc lang="EN">SqueezeESP32 additional player id (100)</desc>
|
||||
<url>http://github.com/sle118/squeezelite-esp32/raw/master/plugin/SqueezeESP32.zip</url>
|
||||
|
||||
Reference in New Issue
Block a user