Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tags framesize endless loop #336

Merged
merged 2 commits into from
Nov 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/AudioFileSourceFS.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
class AudioFileSourceFS : public AudioFileSource
{
public:
AudioFileSourceFS(FS &fs) { filesystem = &fs; }
AudioFileSourceFS(FS &fs, const char *filename);
AudioFileSourceFS(fs::FS &fs) { filesystem = &fs; }
AudioFileSourceFS(fs::FS &fs, const char *filename);
virtual ~AudioFileSourceFS() override;

virtual bool open(const char *filename) override;
Expand All @@ -42,8 +42,8 @@ class AudioFileSourceFS : public AudioFileSource
virtual uint32_t getPos() override { if (!f) return 0; else return f.position(); };

private:
FS *filesystem;
File f;
fs::FS *filesystem;
fs::File f;
};


Expand Down
17 changes: 16 additions & 1 deletion src/AudioFileSourceID3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ uint32_t AudioFileSourceID3::read(void *data, uint32_t len)
if (ret<10) return ret;

if ((buff[0]!='I') || (buff[1]!='D') || (buff[2]!='3') || (buff[3]>0x04) || (buff[3]<0x02) || (buff[4]!=0)) {
cb.md("eof", false, "id3");
return 10 + src->read(buff+10, len-10);
}

Expand Down Expand Up @@ -212,7 +213,7 @@ uint32_t AudioFileSourceID3::read(void *data, uint32_t len)

// Read the value and send to callback
char value[64];
uint16_t i;
uint32_t i;
bool isUnicode = (id3.getByte()==1) ? true : false;
for (i=0; i<framesize-1; i++) {
if (i<sizeof(value)-1) value[i] = id3.getByte();
Expand All @@ -231,10 +232,24 @@ uint32_t AudioFileSourceID3::read(void *data, uint32_t len)
} else if ( (frameid[0]=='T' && frameid[1]=='Y' && frameid[2]=='E' && frameid[3] == 'R') ||
(frameid[0]=='T' && frameid[1]=='Y' && frameid[2]=='E' && rev==2) ) {
cb.md("Year", isUnicode, value);
} else if ( (frameid[0]=='T' && frameid[1]=='R' && frameid[2]=='C' && frameid[3] == 'K') ||
(frameid[0]=='T' && frameid[1]=='R' && frameid[2]=='K' && rev==2) ) {
cb.md("track", isUnicode, value);
} else if ( (frameid[0]=='T' && frameid[1]=='P' && frameid[2]=='O' && frameid[3] == 'S') ||
(frameid[0]=='T' && frameid[1]=='P' && frameid[2]=='A' && rev==2) ) {
cb.md("Set", isUnicode, value);
} else if ( (frameid[0]=='P' && frameid[1]=='O' && frameid[2]=='P' && frameid[3] == 'M') ||
(frameid[0]=='P' && frameid[1]=='O' && frameid[2]=='P' && rev==2) ) {
cb.md("Popularimeter", isUnicode, value);
} else if ( (frameid[0]=='T' && frameid[1]=='C' && frameid[2]=='M' && frameid[3] == 'P') ) {
cb.md("Compilation", isUnicode, value);
}
}
} while (!id3.eof());

// use callback function to signal end of tags and beginning of content.
cb.md("eof", false, "id3");

// All ID3 processing done, return to main caller
return src->read(data, len);
}
Expand Down