mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-10-27 08:58:31 -04:00
WiP: mp3 decoder optimization
This commit is contained in:
1 parent
749c14c7c6
commit
655fe5fd06
6 files changed
+46
-80
No files matched your search
@@ -77,10 +77,15 @@ namespace audio {
|
||||
vfs.rewind(fd);
|
||||
|
||||
// Parse ID3 tags
|
||||
// Allocate buffer for fetching initial part of MP3, 1Mbyte should be sufficient to fetch all necessary tags
|
||||
// Allocate buffer for fetching two parts of MP3: init and last, 1Mbyte should be sufficient to fetch all necessary tags
|
||||
auto source = std::make_unique<std::array<char, 1024 * 1024>>();
|
||||
|
||||
vfs.fread(&(*source)[0], 1, source->size(), fd);
|
||||
// Read beginning of MP3(512kbytes)
|
||||
vfs.fread(&(*source)[0], 1, source->size()/2, fd);
|
||||
|
||||
// Read last section of MP3(512kbytes)
|
||||
vfs.fseek(fd,-(source->size()/2),SEEK_END);
|
||||
vfs.fread(&(*source)[source->size()/2], 1, source->size()/2, fd);
|
||||
|
||||
if (atag::id3v2::is_tagged(*source)) {
|
||||
|
||||
|
||||
Reference in new issue
Block a user