mirror of
https://github.com/taglib/taglib.git
synced 2025-11-17 07:02:53 -05:00
Merge branch 'master' into merge-master
Conflicts: ConfigureChecks.cmake config-taglib.h.cmake taglib/CMakeLists.txt taglib/ape/apefooter.cpp taglib/ape/apeitem.cpp taglib/ape/apeproperties.cpp taglib/asf/asfattribute.cpp taglib/asf/asffile.cpp taglib/asf/asfpicture.cpp taglib/fileref.cpp taglib/flac/flacfile.cpp taglib/flac/flacpicture.cpp taglib/flac/flacproperties.cpp taglib/mp4/mp4atom.cpp taglib/mp4/mp4coverart.cpp taglib/mp4/mp4item.cpp taglib/mp4/mp4properties.cpp taglib/mp4/mp4tag.cpp taglib/mpc/mpcproperties.cpp taglib/mpeg/id3v2/frames/popularimeterframe.cpp taglib/mpeg/id3v2/frames/relativevolumeframe.cpp taglib/mpeg/id3v2/id3v2frame.cpp taglib/mpeg/id3v2/id3v2synchdata.cpp taglib/mpeg/xingheader.cpp taglib/ogg/flac/oggflacfile.cpp taglib/ogg/oggpageheader.cpp taglib/ogg/opus/opusproperties.cpp taglib/ogg/speex/speexproperties.cpp taglib/ogg/vorbis/vorbisproperties.cpp taglib/ogg/xiphcomment.cpp taglib/riff/aiff/aiffproperties.cpp taglib/riff/wav/infotag.cpp taglib/riff/wav/wavproperties.cpp taglib/toolkit/taglib.h taglib/toolkit/tbytevector.cpp taglib/toolkit/tbytevector.h taglib/toolkit/tfilestream.cpp taglib/toolkit/tiostream.h taglib/toolkit/tstring.cpp taglib/toolkit/tstringhandler.cpp taglib/trueaudio/trueaudioproperties.cpp taglib/wavpack/wavpackproperties.cpp
This commit is contained in:
@ -125,7 +125,7 @@ void APE::Properties::read()
|
||||
|
||||
// Then we read the header common for all versions of APE
|
||||
d->file->seek(offset);
|
||||
ByteVector commonHeader=d->file->readBlock(6);
|
||||
ByteVector commonHeader = d->file->readBlock(6);
|
||||
if(!commonHeader.startsWith("MAC "))
|
||||
return;
|
||||
d->version = commonHeader.toUInt16LE(4);
|
||||
@ -182,7 +182,7 @@ void APE::Properties::analyzeCurrent()
|
||||
// Read the descriptor
|
||||
d->file->seek(2, File::Current);
|
||||
ByteVector descriptor = d->file->readBlock(44);
|
||||
uint descriptorBytes = descriptor.toUInt32LE(0);
|
||||
const uint descriptorBytes = descriptor.toUInt32LE(0);
|
||||
|
||||
if ((descriptorBytes - 52) > 0)
|
||||
d->file->seek(descriptorBytes - 52, File::Current);
|
||||
@ -196,9 +196,10 @@ void APE::Properties::analyzeCurrent()
|
||||
d->bitsPerSample = header.toInt16LE(16);
|
||||
//d->compressionLevel =
|
||||
|
||||
uint totalFrames = header.toUInt32LE(12);
|
||||
uint blocksPerFrame = header.toUInt32LE(4);
|
||||
uint finalFrameBlocks = header.toUInt32LE(8);
|
||||
const uint totalFrames = header.toUInt32LE(12);
|
||||
const uint blocksPerFrame = header.toUInt32LE(4);
|
||||
const uint finalFrameBlocks = header.toUInt32LE(8);
|
||||
|
||||
d->sampleFrames = totalFrames > 0 ? (totalFrames - 1) * blocksPerFrame + finalFrameBlocks : 0;
|
||||
d->length = d->sampleRate > 0 ? d->sampleFrames / d->sampleRate : 0;
|
||||
d->bitrate = d->length > 0 ? static_cast<int>(d->streamLength * 8L / d->length / 1000) : 0;
|
||||
@ -207,13 +208,13 @@ void APE::Properties::analyzeCurrent()
|
||||
void APE::Properties::analyzeOld()
|
||||
{
|
||||
ByteVector header = d->file->readBlock(26);
|
||||
uint totalFrames = header.toUInt32LE(18);
|
||||
const uint totalFrames = header.toUInt32LE(18);
|
||||
|
||||
// Fail on 0 length APE files (catches non-finalized APE files)
|
||||
if(totalFrames == 0)
|
||||
return;
|
||||
|
||||
short compressionLevel = header.toUInt32LE(0);
|
||||
const short compressionLevel = header.toUInt32LE(0);
|
||||
uint blocksPerFrame;
|
||||
if(d->version >= 3950)
|
||||
blocksPerFrame = 73728 * 4;
|
||||
@ -221,6 +222,7 @@ void APE::Properties::analyzeOld()
|
||||
blocksPerFrame = 73728;
|
||||
else
|
||||
blocksPerFrame = 9216;
|
||||
|
||||
d->channels = header.toUInt16LE(4);
|
||||
d->sampleRate = header.toUInt32LE(6);
|
||||
const uint finalFrameBlocks = header.toUInt32LE(22);
|
||||
|
||||
Reference in New Issue
Block a user