Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ESP32-audioI2S
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ESP32-audioI2S
Commits
a0747df0
Commit
a0747df0
authored
Jul 23, 2023
by
schreibfaul1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
localFile: allow (flac).ogg, (opus).ogg and *.oga
parent
74b7c4d8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
13 deletions
+26
-13
src/Audio.cpp
src/Audio.cpp
+22
-11
src/flac_decoder/flac_decoder.cpp
src/flac_decoder/flac_decoder.cpp
+4
-2
No files found.
src/Audio.cpp
View file @
a0747df0
...
...
@@ -3,8 +3,8 @@
*
* Created on: Oct 26.2018
*
* Version 3.0.
3b
* Updated on: Jul 2
0
.2023
* Version 3.0.
4
* Updated on: Jul 2
3
.2023
* Author: Wolle (schreibfaul1)
*
*/
...
...
@@ -764,7 +764,8 @@ bool Audio::connecttoFS(fs::FS &fs, const char* path, int32_t resumeFilePos) {
if
(
endsWith
(
afn
,
".wav"
))
m_codec
=
CODEC_WAV
;
if
(
endsWith
(
afn
,
".flac"
))
m_codec
=
CODEC_FLAC
;
if
(
endsWith
(
afn
,
".opus"
))
m_codec
=
CODEC_OPUS
;
if
(
endsWith
(
afn
,
".ogg"
))
m_codec
=
CODEC_VORBIS
;
if
(
endsWith
(
afn
,
".ogg"
))
m_codec
=
CODEC_OGG
;
if
(
endsWith
(
afn
,
".oga"
))
m_codec
=
CODEC_OGG
;
if
(
m_codec
==
CODEC_NONE
)
AUDIO_INFO
(
"The %s format is not supported"
,
afn
+
dotPos
);
...
...
@@ -2808,6 +2809,14 @@ void Audio::processLocalFile() {
InBuff
.
bytesWritten
(
bytesAddedToBuffer
);
}
if
(
!
f_stream
){
if
(
m_codec
==
CODEC_OGG
){
// log_i("determine correct codec here");
uint8_t
codec
=
determineOggCodec
(
InBuff
.
getReadPtr
(),
maxFrameSize
);
if
(
codec
==
CODEC_FLAC
)
{
m_codec
=
CODEC_FLAC
;
initializeDecoder
();
return
;}
if
(
codec
==
CODEC_OPUS
)
{
m_codec
=
CODEC_OPUS
;
initializeDecoder
();
return
;}
if
(
codec
==
CODEC_VORBIS
)
{
m_codec
=
CODEC_VORBIS
;
initializeDecoder
();
return
;}
stopSong
();
return
;
}
if
(
m_controlCounter
!=
100
)
{
if
((
millis
()
-
ctime
)
>
timeout
)
{
log_e
(
"audioHeader reading timeout"
);
...
...
@@ -3047,14 +3056,7 @@ void Audio::processWebFile() {
return
;
}
if
(
m_codec
==
CODEC_OGG
){
// log_i("determine correct codec here");
uint8_t
codec
=
determineOggCodec
(
InBuff
.
getReadPtr
(),
maxFrameSize
);
if
(
codec
==
CODEC_FLAC
)
{
m_codec
=
CODEC_FLAC
;
initializeDecoder
();
return
;}
if
(
codec
==
CODEC_OPUS
)
{
m_codec
=
CODEC_OPUS
;
initializeDecoder
();
return
;}
if
(
codec
==
CODEC_VORBIS
)
{
m_codec
=
CODEC_VORBIS
;
initializeDecoder
();
return
;}
stopSong
();
return
;
}
// we have a webfile, read the file header first - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if
(
m_controlCounter
!=
100
){
...
...
@@ -3065,6 +3067,15 @@ void Audio::processWebFile() {
return
;
}
if
(
m_codec
==
CODEC_OGG
){
// log_i("determine correct codec here");
uint8_t
codec
=
determineOggCodec
(
InBuff
.
getReadPtr
(),
maxFrameSize
);
if
(
codec
==
CODEC_FLAC
)
{
m_codec
=
CODEC_FLAC
;
initializeDecoder
();
return
;}
if
(
codec
==
CODEC_OPUS
)
{
m_codec
=
CODEC_OPUS
;
initializeDecoder
();
return
;}
if
(
codec
==
CODEC_VORBIS
)
{
m_codec
=
CODEC_VORBIS
;
initializeDecoder
();
return
;}
stopSong
();
return
;
}
// end of webfile reached? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if
(
f_webFileDataComplete
&&
InBuff
.
bufferFilled
()
<
InBuff
.
getMaxBlockSize
()){
if
(
InBuff
.
bufferFilled
()){
...
...
src/flac_decoder/flac_decoder.cpp
View file @
a0747df0
...
...
@@ -4,7 +4,7 @@
* adapted to ESP32
*
* Created on: Jul 03,2020
* Updated on:
Apr 10
,2023
* Updated on:
Jul 23
,2023
*
* Author: Wolle
*
...
...
@@ -405,7 +405,9 @@ int8_t flacDecodeFrame(uint8_t *inbuf, int *bytesLeft){
else
{
return
ERR_FLAC_RESERVED_BLOCKSIZE_UNSUPPORTED
;
}
if
(
m_blockSize
>
8192
){
uint16_t
maxBS
=
8192
;
if
(
psramFound
())
maxBS
=
8192
*
4
;
if
(
m_blockSize
>
maxBS
){
log_e
(
"Error: blockSize too big ,%i bytes"
,
m_blockSize
);
return
ERR_FLAC_BLOCKSIZE_TOO_BIG
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment