mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
And now make it work for non-existing RIFF chunks.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@808241 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
parent
1d1fab1122
commit
123aa8a775
@ -138,7 +138,11 @@ void RIFF::File::setChunkData(const ByteVector &name, const ByteVector &data)
|
||||
}
|
||||
}
|
||||
|
||||
debug("Could not find chunk.");
|
||||
// Couldn't find an existing chunk, so let's create a new one. First update
|
||||
// the global size:
|
||||
|
||||
insert(ByteVector::fromUInt(d->size + data.size() + 8, d->endianness == BigEndian), 4, 4);
|
||||
writeChunk(name, data, d->chunkOffsets.back() + d->chunkSizes.back());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -165,12 +169,10 @@ void RIFF::File::read()
|
||||
seek(chunkSize, Current);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RIFF::File::writeChunk(const ByteVector &name, const ByteVector &data,
|
||||
ulong offset, ulong replace)
|
||||
{
|
||||
debug("Writting chunk at " + String::number(offset));
|
||||
|
||||
ByteVector combined = name;
|
||||
combined.append(ByteVector::fromUInt(data.size(), d->endianness == BigEndian));
|
||||
combined.append(data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user