mirror of
https://github.com/taglib/taglib.git
synced 2025-07-21 14:34:23 -04:00
Unify common functions for finding tags.
Several classes have exactly identical functions for finding tags. This also hides the functions from public headers.
This commit is contained in:
@ -32,6 +32,7 @@
|
||||
#include <tdebug.h>
|
||||
#include <tagunion.h>
|
||||
#include <tpropertymap.h>
|
||||
#include <tagutils.h>
|
||||
|
||||
#include "wavpackfile.h"
|
||||
#include "id3v1tag.h"
|
||||
@ -243,7 +244,7 @@ void WavPack::File::read(bool readProperties)
|
||||
{
|
||||
// Look for an ID3v1 tag
|
||||
|
||||
d->ID3v1Location = findID3v1();
|
||||
d->ID3v1Location = Utils::findID3v1(this);
|
||||
|
||||
if(d->ID3v1Location >= 0) {
|
||||
d->tag.set(WavID3v1Index, new ID3v1::Tag(this, d->ID3v1Location));
|
||||
@ -252,7 +253,7 @@ void WavPack::File::read(bool readProperties)
|
||||
|
||||
// Look for an APE tag
|
||||
|
||||
d->APELocation = findAPE();
|
||||
d->APELocation = Utils::findAPE(this, d->ID3v1Location);
|
||||
|
||||
if(d->APELocation >= 0) {
|
||||
d->tag.set(WavAPEIndex, new APE::Tag(this, d->APELocation));
|
||||
@ -280,35 +281,3 @@ void WavPack::File::read(bool readProperties)
|
||||
d->properties = new Properties(this, streamLength);
|
||||
}
|
||||
}
|
||||
|
||||
long WavPack::File::findAPE()
|
||||
{
|
||||
if(!isValid())
|
||||
return -1;
|
||||
|
||||
if(d->hasID3v1)
|
||||
seek(-160, End);
|
||||
else
|
||||
seek(-32, End);
|
||||
|
||||
long p = tell();
|
||||
|
||||
if(readBlock(8) == APE::Tag::fileIdentifier())
|
||||
return p;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
long WavPack::File::findID3v1()
|
||||
{
|
||||
if(!isValid())
|
||||
return -1;
|
||||
|
||||
seek(-128, End);
|
||||
long p = tell();
|
||||
|
||||
if(readBlock(3) == ID3v1::Tag::fileIdentifier())
|
||||
return p;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -208,8 +208,6 @@ namespace TagLib {
|
||||
File &operator=(const File &);
|
||||
|
||||
void read(bool readProperties);
|
||||
long findID3v1();
|
||||
long findAPE();
|
||||
|
||||
class FilePrivate;
|
||||
FilePrivate *d;
|
||||
|
Reference in New Issue
Block a user