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
aebee6d9
Unverified
Commit
aebee6d9
authored
Apr 08, 2023
by
Wolle
Committed by
GitHub
Apr 08, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ogg in webfiles
parent
1c7b1eb5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
src/Audio.cpp
src/Audio.cpp
+14
-5
src/Audio.h
src/Audio.h
+2
-2
No files found.
src/Audio.cpp
View file @
aebee6d9
...
...
@@ -3,7 +3,7 @@
*
* Created on: Oct 26.2018
*
* Version 3.0.1
m
* Version 3.0.1
n
* Updated on: Apr 07.2023
* Author: Wolle (schreibfaul1)
*
...
...
@@ -519,6 +519,7 @@ bool Audio::connecttohost(const char* host, const char* user, const char* pwd) {
if
(
endsWith
(
extension
,
".aac"
))
m_expectedCodec
=
CODEC_AAC
;
if
(
endsWith
(
extension
,
".wav"
))
m_expectedCodec
=
CODEC_WAV
;
if
(
endsWith
(
extension
,
".m4a"
))
m_expectedCodec
=
CODEC_M4A
;
if
(
endsWith
(
extension
,
".ogg"
))
m_expectedCodec
=
CODEC_OGG
;
if
(
endsWith
(
extension
,
".flac"
))
m_expectedCodec
=
CODEC_FLAC
;
if
(
endsWith
(
extension
,
"-flac"
))
m_expectedCodec
=
CODEC_FLAC
;
if
(
endsWith
(
extension
,
".opus"
))
m_expectedCodec
=
CODEC_OPUS
;
...
...
@@ -3038,6 +3039,14 @@ void Audio::processWebFile() {
}
if
(
!
f_stream
)
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
){
...
...
@@ -5437,12 +5446,12 @@ uint8_t Audio::determineOggCodec(uint8_t* data, uint16_t len){
return
CODEC_NONE
;
}
data
+=
27
;
idx = specialIndexOf(data, "OpusHead",
2
0);
idx
=
specialIndexOf
(
data
,
"OpusHead"
,
4
0
);
if
(
idx
>=
0
)
return
CODEC_OPUS
;
idx = specialIndexOf(data, "
FLAC", 2
0);
idx
=
specialIndexOf
(
data
,
"
fLaC"
,
4
0
);
if
(
idx
>=
0
)
return
CODEC_FLAC
;
idx = specialIndexOf(data, "vorbis",
2
0);
if(idx >= 0)
return CODEC_VORBIS;
idx
=
specialIndexOf
(
data
,
"vorbis"
,
4
0
);
if
(
idx
>=
0
)
{
log_i
(
"vorbis"
);
return
CODEC_VORBIS
;}
return
CODEC_NONE
;
}
//----------------------------------------------------------------------------------------------------------------------
...
...
src/Audio.h
View file @
aebee6d9
...
...
@@ -3,8 +3,8 @@
*
* Created on: Oct 28,2018
*
* Version 3.0.1
k
* Updated on: Apr 0
6
,2023
* Version 3.0.1
n
* Updated on: Apr 0
7
,2023
* Author: Wolle (schreibfaul1)
*/
...
...
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