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
a753a8d3
Unverified
Commit
a753a8d3
authored
May 04, 2023
by
Wolle
Committed by
GitHub
May 04, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
m4a header, skip big atom
parent
b824804a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
src/Audio.cpp
src/Audio.cpp
+9
-8
No files found.
src/Audio.cpp
View file @
a753a8d3
...
...
@@ -3,7 +3,7 @@
*
* Created on: Oct 26.2018
*
* Version 3.0.1
r
* Version 3.0.1
s
* Updated on: May 03.2023
* Author: Wolle (schreibfaul1)
*
...
...
@@ -1879,8 +1879,8 @@ int Audio::read_M4A_Header(uint8_t *data, size_t len) {
static
size_t
audioDataPos
=
0
;
if
(
retvalue
)
{
if
(
len
>
InBuff
.
getMaxBlockSize
())
len
=
InBuff
.
getMaxBlockSize
();
if
(
retvalue
>
len
)
{
// if returnvalue > bufferfillsize
if
(
len
>
InBuff
.
getMaxBlockSize
())
len
=
InBuff
.
getMaxBlockSize
();
retvalue
-=
len
;
// and wait for more bufferdata
return
len
;
}
...
...
@@ -1940,7 +1940,7 @@ int Audio::read_M4A_Header(uint8_t *data, size_t len) {
return
0
;
}
else
{
char
atomName
[
5
];
char
atomName
[
5
]
=
{
0
}
;
(
void
)
atomName
;
atomName
[
0
]
=
*
data
;
atomName
[
1
]
=
*
(
data
+
1
);
...
...
@@ -2062,11 +2062,11 @@ int Audio::read_M4A_Header(uint8_t *data, size_t len) {
if
(
m_controlCounter
==
M4A_ILST
)
{
// ilst
const
char
info
[
12
][
6
]
=
{
"nam
\0
"
,
"ART
\0
"
,
"alb
\0
"
,
"too
\0
"
,
"cmt
\0
"
,
"wrt
\0
"
,
"tmpo
\0
"
,
"trkn
\0
"
,
"day
\0
"
,
"cpil
\0
"
,
"aART
\0
"
,
"gen
\0
"
};
int
offset
;
int
offset
=
0
;
// If it's a local file, the metadata has already been read, even if it comes after the audio block.
// In the event that they are in front of the audio block in a web stream, read them now
if
(
!
m_f_m4aID3dataAreRead
){
for
(
int
i
=
0
;
i
<
12
;
i
++
){
for
(
int
i
=
0
;
i
<
12
;
i
++
){
offset
=
specialIndexOf
(
data
,
info
[
i
],
len
,
true
);
// seek info[] with '\0'
if
(
offset
>
0
)
{
offset
+=
19
;
if
(
*
(
data
+
offset
)
==
0
)
offset
++
;
...
...
@@ -2074,8 +2074,8 @@ int Audio::read_M4A_Header(uint8_t *data, size_t len) {
size_t
tmp
=
strlen
((
const
char
*
)
data
+
offset
);
if
(
tmp
>
254
)
tmp
=
254
;
memcpy
(
value
,
(
data
+
offset
),
tmp
);
value
[
tmp
]
=
0
;
m_chbuf
[
0
]
=
0
;
value
[
tmp
]
=
'\0'
;
m_chbuf
[
0
]
=
'\0'
;
if
(
i
==
0
)
sprintf
(
m_chbuf
,
"Title: %s"
,
value
);
if
(
i
==
1
)
sprintf
(
m_chbuf
,
"Artist: %s"
,
value
);
if
(
i
==
2
)
sprintf
(
m_chbuf
,
"Album: %s"
,
value
);
...
...
@@ -5245,7 +5245,7 @@ void Audio::seek_m4a_ilst(){
if
(
len
>
1024
)
len
=
1024
;
// log_i("found at pos %i, len %i", seekpos, len);
uint8_t
*
data
=
(
uint8_t
*
)
malloc
(
len
);
uint8_t
*
data
=
(
uint8_t
*
)
calloc
(
len
,
sizeof
(
uint8_t
)
);
if
(
!
data
){
log_e
(
"out od memory"
);
audiofile
.
seek
(
0
);
...
...
@@ -5263,6 +5263,7 @@ void Audio::seek_m4a_ilst(){
size_t
temp
=
strlen
((
const
char
*
)
data
+
offset
);
if
(
temp
>
254
)
temp
=
254
;
memcpy
(
value
,
(
data
+
offset
),
temp
);
log_w
(
"value %s, temp %i"
,
value
,
temp
);
value
[
temp
]
=
'\0'
;
m_chbuf
[
0
]
=
'\0'
;
if
(
i
==
0
)
sprintf
(
m_chbuf
,
"Title: %s"
,
value
);
...
...
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