mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-06 11:36:59 +03:00
vorbis works
with a funny workaround I need to think about better
This commit is contained in:
@@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
#include "squeezelite.h"
|
#include "squeezelite.h"
|
||||||
|
|
||||||
|
#define MAX_FRAMES 4096
|
||||||
|
|
||||||
#if BYTES_PER_FRAME == 4
|
#if BYTES_PER_FRAME == 4
|
||||||
#define ALIGN(n) (n)
|
#define ALIGN(n) (n)
|
||||||
#else
|
#else
|
||||||
@@ -181,6 +183,10 @@ static decode_state vorbis_decode(void) {
|
|||||||
write_buf = process.inbuf;
|
write_buf = process.inbuf;
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// should be fine to unlock here. This is needed b/c other tasks need to tip intot the output buf
|
||||||
|
UNLOCK_O_direct;
|
||||||
|
|
||||||
|
frames = min(frames, MAX_FRAMES);
|
||||||
bytes = frames * 2 * channels; // samples returned are 16 bits
|
bytes = frames * 2 * channels; // samples returned are 16 bits
|
||||||
|
|
||||||
// write the decoded frames into outputbuf even though they are 16 bits per sample, then unpack them
|
// write the decoded frames into outputbuf even though they are 16 bits per sample, then unpack them
|
||||||
@@ -199,7 +205,7 @@ static decode_state vorbis_decode(void) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
frames_t count;
|
frames_t count;
|
||||||
s16_t *iptr;
|
s16_t *iptr;
|
||||||
@@ -212,9 +218,7 @@ static decode_state vorbis_decode(void) {
|
|||||||
optr = (ISAMPLE_T *)write_buf + frames * 2;
|
optr = (ISAMPLE_T *)write_buf + frames * 2;
|
||||||
|
|
||||||
if (channels == 2) {
|
if (channels == 2) {
|
||||||
#if BYTES_PER_FRAME == 4
|
#if BYTES_PER_FRAME == 8
|
||||||
memcpy(optr, iptr, count * BYTES_PER_FRAME / 2);
|
|
||||||
#else
|
|
||||||
while (count--) {
|
while (count--) {
|
||||||
*--optr = *--iptr << 16;
|
*--optr = *--iptr << 16;
|
||||||
}
|
}
|
||||||
@@ -226,19 +230,20 @@ static decode_state vorbis_decode(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOCK_O_direct;
|
||||||
IF_DIRECT(
|
IF_DIRECT(
|
||||||
_buf_inc_writep(outputbuf, frames * BYTES_PER_FRAME);
|
_buf_inc_writep(outputbuf, frames * BYTES_PER_FRAME);
|
||||||
);
|
);
|
||||||
IF_PROCESS(
|
IF_PROCESS(
|
||||||
process.in_frames = frames;
|
process.in_frames = frames;
|
||||||
);
|
);
|
||||||
|
UNLOCK_O_direct;
|
||||||
|
|
||||||
LOG_SDEBUG("wrote %u frames", frames);
|
LOG_SDEBUG("wrote %u frames", frames);
|
||||||
|
|
||||||
} else if (n == 0) {
|
} else if (n == 0) {
|
||||||
|
|
||||||
LOG_INFO("end of stream");
|
LOG_INFO("end of stream");
|
||||||
UNLOCK_O_direct;
|
|
||||||
return DECODE_COMPLETE;
|
return DECODE_COMPLETE;
|
||||||
|
|
||||||
} else if (n == OV_HOLE) {
|
} else if (n == OV_HOLE) {
|
||||||
@@ -249,12 +254,9 @@ static decode_state vorbis_decode(void) {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
LOG_INFO("ov_read error: %d", n);
|
LOG_INFO("ov_read error: %d", n);
|
||||||
UNLOCK_O_direct;
|
|
||||||
return DECODE_COMPLETE;
|
return DECODE_COMPLETE;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNLOCK_O_direct;
|
|
||||||
|
|
||||||
return DECODE_RUNNING;
|
return DECODE_RUNNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user