mirror of
https://github.com/taglib/taglib.git
synced 2025-11-17 07:02:53 -05:00
Support files over 2GB
This commit is contained in:
@ -66,10 +66,10 @@ public:
|
||||
delete properties;
|
||||
}
|
||||
|
||||
long APELocation;
|
||||
offset_t APELocation;
|
||||
uint APESize;
|
||||
|
||||
long ID3v1Location;
|
||||
offset_t ID3v1Location;
|
||||
|
||||
TagUnion tag;
|
||||
|
||||
@ -272,7 +272,7 @@ void APE::File::read(bool readProperties, Properties::ReadStyle /* propertiesSty
|
||||
}
|
||||
}
|
||||
|
||||
long APE::File::findAPE()
|
||||
offset_t APE::File::findAPE()
|
||||
{
|
||||
if(!isValid())
|
||||
return -1;
|
||||
@ -282,7 +282,7 @@ long APE::File::findAPE()
|
||||
else
|
||||
seek(-32, End);
|
||||
|
||||
long p = tell();
|
||||
offset_t p = tell();
|
||||
|
||||
if(readBlock(8) == APE::Tag::fileIdentifier())
|
||||
return p;
|
||||
@ -290,13 +290,13 @@ long APE::File::findAPE()
|
||||
return -1;
|
||||
}
|
||||
|
||||
long APE::File::findID3v1()
|
||||
offset_t APE::File::findID3v1()
|
||||
{
|
||||
if(!isValid())
|
||||
return -1;
|
||||
|
||||
seek(-128, End);
|
||||
long p = tell();
|
||||
offset_t p = tell();
|
||||
|
||||
if(readBlock(3) == ID3v1::Tag::fileIdentifier())
|
||||
return p;
|
||||
|
||||
@ -189,8 +189,8 @@ namespace TagLib {
|
||||
|
||||
void read(bool readProperties, Properties::ReadStyle propertiesStyle);
|
||||
void scan();
|
||||
long findID3v1();
|
||||
long findAPE();
|
||||
offset_t findID3v1();
|
||||
offset_t findAPE();
|
||||
|
||||
class FilePrivate;
|
||||
FilePrivate *d;
|
||||
|
||||
@ -39,7 +39,7 @@ using namespace TagLib;
|
||||
class APE::Properties::PropertiesPrivate
|
||||
{
|
||||
public:
|
||||
PropertiesPrivate(File *file, long streamLength) :
|
||||
PropertiesPrivate(File *file, offset_t streamLength) :
|
||||
length(0),
|
||||
bitrate(0),
|
||||
sampleRate(0),
|
||||
@ -58,7 +58,7 @@ public:
|
||||
int bitsPerSample;
|
||||
uint sampleFrames;
|
||||
File *file;
|
||||
long streamLength;
|
||||
offset_t streamLength;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -119,7 +119,7 @@ TagLib::uint APE::Properties::sampleFrames() const
|
||||
void APE::Properties::read()
|
||||
{
|
||||
// First we are searching the descriptor
|
||||
long offset = findDescriptor();
|
||||
offset_t offset = findDescriptor();
|
||||
if(offset < 0)
|
||||
return;
|
||||
|
||||
@ -138,9 +138,9 @@ void APE::Properties::read()
|
||||
}
|
||||
}
|
||||
|
||||
long APE::Properties::findDescriptor()
|
||||
offset_t APE::Properties::findDescriptor()
|
||||
{
|
||||
long ID3v2Location = findID3v2();
|
||||
offset_t ID3v2Location = findID3v2();
|
||||
long ID3v2OriginalSize = 0;
|
||||
bool hasID3v2 = false;
|
||||
if(ID3v2Location >= 0) {
|
||||
@ -150,7 +150,7 @@ long APE::Properties::findDescriptor()
|
||||
hasID3v2 = true;
|
||||
}
|
||||
|
||||
long offset = 0;
|
||||
offset_t offset = 0;
|
||||
if(hasID3v2)
|
||||
offset = d->file->find("MAC ", ID3v2Location + ID3v2OriginalSize);
|
||||
else
|
||||
@ -164,7 +164,7 @@ long APE::Properties::findDescriptor()
|
||||
return offset;
|
||||
}
|
||||
|
||||
long APE::Properties::findID3v2()
|
||||
offset_t APE::Properties::findID3v2()
|
||||
{
|
||||
if(!d->file->isValid())
|
||||
return -1;
|
||||
@ -201,7 +201,7 @@ void APE::Properties::analyzeCurrent()
|
||||
uint finalFrameBlocks = header.mid(8, 4).toUInt(false);
|
||||
d->sampleFrames = totalFrames > 0 ? (totalFrames - 1) * blocksPerFrame + finalFrameBlocks : 0;
|
||||
d->length = d->sampleRate > 0 ? d->sampleFrames / d->sampleRate : 0;
|
||||
d->bitrate = d->length > 0 ? ((d->streamLength * 8L) / d->length) / 1000 : 0;
|
||||
d->bitrate = d->length > 0 ? static_cast<int>(d->streamLength * 8L / d->length / 1000) : 0;
|
||||
}
|
||||
|
||||
void APE::Properties::analyzeOld()
|
||||
@ -226,6 +226,6 @@ void APE::Properties::analyzeOld()
|
||||
uint finalFrameBlocks = header.mid(22, 4).toUInt(false);
|
||||
uint totalBlocks = totalFrames > 0 ? (totalFrames - 1) * blocksPerFrame + finalFrameBlocks : 0;
|
||||
d->length = totalBlocks / d->sampleRate;
|
||||
d->bitrate = d->length > 0 ? ((d->streamLength * 8L) / d->length) / 1000 : 0;
|
||||
d->bitrate = d->length > 0 ? static_cast<int>(d->streamLength * 8L / d->length / 1000) : 0;
|
||||
}
|
||||
|
||||
|
||||
@ -84,8 +84,8 @@ namespace TagLib {
|
||||
|
||||
void read();
|
||||
|
||||
long findDescriptor();
|
||||
long findID3v2();
|
||||
offset_t findDescriptor();
|
||||
offset_t findID3v2();
|
||||
|
||||
void analyzeCurrent();
|
||||
void analyzeOld();
|
||||
|
||||
@ -49,7 +49,7 @@ public:
|
||||
TagPrivate() : file(0), footerLocation(-1), tagLength(0) {}
|
||||
|
||||
TagLib::File *file;
|
||||
long footerLocation;
|
||||
offset_t footerLocation;
|
||||
long tagLength;
|
||||
|
||||
Footer footer;
|
||||
@ -66,7 +66,7 @@ APE::Tag::Tag() : TagLib::Tag()
|
||||
d = new TagPrivate;
|
||||
}
|
||||
|
||||
APE::Tag::Tag(TagLib::File *file, long footerLocation) : TagLib::Tag()
|
||||
APE::Tag::Tag(TagLib::File *file, offset_t footerLocation) : TagLib::Tag()
|
||||
{
|
||||
d = new TagPrivate;
|
||||
d->file = file;
|
||||
|
||||
@ -66,7 +66,7 @@ namespace TagLib {
|
||||
* Create an APE tag and parse the data in \a file with APE footer at
|
||||
* \a tagOffset.
|
||||
*/
|
||||
Tag(TagLib::File *file, long footerLocation);
|
||||
Tag(TagLib::File *file, offset_t footerLocation);
|
||||
|
||||
/*!
|
||||
* Destroys this Tag instance.
|
||||
|
||||
Reference in New Issue
Block a user