1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Improved ID3 tag recognition in the MP3 decoder.

This commit is contained in:
jules 2011-11-30 14:43:48 +00:00
parent 5354dac0b5
commit b67c2ff240

View file

@ -1606,7 +1606,7 @@ struct MP3Stream
while (frameIndex >= frameStreamPositions.size() * storedStartPosInterval)
{
int dummy = 0;
int result = decodeNextBlock (nullptr, nullptr, dummy);
const int result = decodeNextBlock (nullptr, nullptr, dummy);
if (result < 0)
return false;
@ -3037,9 +3037,9 @@ public:
toSkip -= numReady;
}
}
currentPosition = startSampleInFile;
currentPosition = startSampleInFile;
}
}
while (numSamples > 0)
@ -3108,25 +3108,27 @@ private:
void skipID3()
{
const int64 originalPosition = stream.stream.getPosition();
const uint8 major = stream.stream.readInt() & 0xff;
uint8 buffer[6];
const uint32 firstWord = stream.stream.readInt();
if (major != 0xff
&& stream.stream.read (buffer, 6) == 6
&& buffer[0] != 0xff
&& ((buffer[2] | buffer[3] | buffer[4] | buffer[5]) & 0x80) == 0)
if ((firstWord & 0xffffff) == 0x334449)
{
const int length = (((uint32) buffer[2]) << 21)
| (((uint32) buffer[3]) << 14)
| (((uint32) buffer[4]) << 7)
| ((uint32) buffer[5]);
uint8 buffer[6];
stream.stream.skipNextBytes (length);
}
else
{
stream.stream.setPosition (originalPosition);
if (stream.stream.read (buffer, 6) == 6
&& buffer[0] != 0xff
&& ((buffer[2] | buffer[3] | buffer[4] | buffer[5]) & 0x80) == 0)
{
const int length = (((uint32) buffer[2]) << 21)
| (((uint32) buffer[3]) << 14)
| (((uint32) buffer[4]) << 7)
| ((uint32) buffer[5]);
stream.stream.skipNextBytes (length);
return;
}
}
stream.stream.setPosition (originalPosition);
}
int64 findLength (int64 streamStartPos)