mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
Make reading an ID3v2 tag out of a RIFF chunk possible.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@808235 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
parent
0d10ae449c
commit
a2aaf8a8e1
@ -38,15 +38,18 @@ using namespace TagLib;
|
||||
class RIFF::AIFF::File::FilePrivate
|
||||
{
|
||||
public:
|
||||
FilePrivate()
|
||||
FilePrivate() :
|
||||
tag(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
~FilePrivate()
|
||||
{
|
||||
|
||||
delete tag;
|
||||
}
|
||||
|
||||
ID3v2::Tag *tag;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -68,7 +71,7 @@ RIFF::AIFF::File::~File()
|
||||
|
||||
ID3v2::Tag *RIFF::AIFF::File::tag() const
|
||||
{
|
||||
return 0;
|
||||
return d->tag;
|
||||
}
|
||||
|
||||
RIFF::AIFF::Properties *RIFF::AIFF::File::audioProperties() const
|
||||
@ -92,7 +95,11 @@ bool RIFF::AIFF::File::save()
|
||||
|
||||
void RIFF::AIFF::File::read(bool readProperties, Properties::ReadStyle /* propertiesStyle */)
|
||||
{
|
||||
debug("Found " + String::number(chunkCount()) + " chunks.");
|
||||
for(int i = 0; i < chunkCount(); i++)
|
||||
debug("\t\"" + chunkName(i) + "\"");
|
||||
for(uint i = 0; i < chunkCount(); i++) {
|
||||
if(chunkName(i) == "ID3 ")
|
||||
d->tag = new ID3v2::Tag(this, chunkOffset(i));
|
||||
}
|
||||
|
||||
if(!d->tag)
|
||||
d->tag = new ID3v2::Tag;
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
ByteVector format;
|
||||
|
||||
ByteVectorList chunkNames;
|
||||
List<uint> chunkOffsets;
|
||||
List<uint> chunkSizes;
|
||||
};
|
||||
|
||||
@ -73,6 +74,11 @@ uint RIFF::File::chunkCount() const
|
||||
return d->chunkNames.size();
|
||||
}
|
||||
|
||||
uint RIFF::File::chunkOffset(uint i) const
|
||||
{
|
||||
return d->chunkOffsets[i];
|
||||
}
|
||||
|
||||
ByteVector RIFF::File::chunkName(uint i) const
|
||||
{
|
||||
if(i >= chunkCount())
|
||||
@ -117,6 +123,8 @@ void RIFF::File::read()
|
||||
d->chunkNames.append(chunkName);
|
||||
d->chunkSizes.append(chunkSize);
|
||||
|
||||
d->chunkOffsets.append(tell());
|
||||
|
||||
seek(chunkSize, Current);
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ namespace TagLib {
|
||||
File(FileName file, Endianness endianness);
|
||||
|
||||
uint chunkCount() const;
|
||||
uint chunkOffset(uint i) const;
|
||||
ByteVector chunkName(uint i) const;
|
||||
ByteVector chunkData(uint i);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user