Update taglib
This commit is contained in:
parent
12bd6f0d9b
commit
61253b5551
25
3rdparty/taglib/mp4/mp4tag.cpp
vendored
25
3rdparty/taglib/mp4/mp4tag.cpp
vendored
@ -74,9 +74,20 @@ MP4::Tag::Tag(Strawberry_TagLib::TagLib::File *file, MP4::Atoms *atoms) :
|
||||
atom->name == "hdvd" || atom->name == "shwm") {
|
||||
parseBool(atom);
|
||||
}
|
||||
else if(atom->name == "tmpo" || atom->name == "rate" || atom->name == "\251mvi" || atom->name == "\251mvc") {
|
||||
else if(atom->name == "tmpo" || atom->name == "\251mvi" || atom->name == "\251mvc") {
|
||||
parseInt(atom);
|
||||
}
|
||||
else if(atom->name == "rate") {
|
||||
AtomDataList data = parseData2(atom);
|
||||
if(!data.isEmpty()) {
|
||||
AtomData val = data[0];
|
||||
if (val.type == TypeUTF8) {
|
||||
addItem(atom->name, StringList(String(val.data, String::UTF8)));
|
||||
} else {
|
||||
addItem(atom->name, (int)(val.data.toShort()));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(atom->name == "tvsn" || atom->name == "tves" || atom->name == "cnID" ||
|
||||
atom->name == "sfID" || atom->name == "atID" || atom->name == "geID" ||
|
||||
atom->name == "cmID") {
|
||||
@ -480,9 +491,19 @@ MP4::Tag::save()
|
||||
name == "shwm") {
|
||||
data.append(renderBool(name.data(String::Latin1), it->second));
|
||||
}
|
||||
else if(name == "tmpo" || name == "rate" || name == "\251mvi" || name == "\251mvc") {
|
||||
else if(name == "tmpo" || name == "\251mvi" || name == "\251mvc") {
|
||||
data.append(renderInt(name.data(String::Latin1), it->second));
|
||||
}
|
||||
else if (name == "rate") {
|
||||
const MP4::Item& item = it->second;
|
||||
StringList value = item.toStringList();
|
||||
if (value.isEmpty()) {
|
||||
data.append(renderInt(name.data(String::Latin1), item));
|
||||
}
|
||||
else {
|
||||
data.append(renderText(name.data(String::Latin1), item));
|
||||
}
|
||||
}
|
||||
else if(name == "tvsn" || name == "tves" || name == "cnID" ||
|
||||
name == "sfID" || name == "atID" || name == "geID" ||
|
||||
name == "cmID") {
|
||||
|
9
3rdparty/taglib/mpeg/id3v2/id3v2frame.cpp
vendored
9
3rdparty/taglib/mpeg/id3v2/id3v2frame.cpp
vendored
@ -111,8 +111,8 @@ Frame *Frame::createTextualFrame(const String &key, const StringList &values) //
|
||||
// check if the key is contained in the key<=>frameID mapping
|
||||
ByteVector frameID = keyToFrameID(key);
|
||||
if(!frameID.isEmpty()) {
|
||||
// Apple proprietary WFED (Podcast URL), MVNM (Movement Name), MVIN (Movement Number) are in fact text frames.
|
||||
if(frameID[0] == 'T' || frameID == "WFED" || frameID == "MVNM" || frameID == "MVIN"){ // text frame
|
||||
// Apple proprietary WFED (Podcast URL), MVNM (Movement Name), MVIN (Movement Number), GRP1 (Grouping) are in fact text frames.
|
||||
if(frameID[0] == 'T' || frameID == "WFED" || frameID == "MVNM" || frameID == "MVIN" || frameID == "GRP1"){ // text frame
|
||||
TextIdentificationFrame *frame = new TextIdentificationFrame(frameID, String::UTF8);
|
||||
frame->setText(values);
|
||||
return frame;
|
||||
@ -394,6 +394,7 @@ namespace
|
||||
{ "WFED", "PODCASTURL" },
|
||||
{ "MVNM", "MOVEMENTNAME" },
|
||||
{ "MVIN", "MOVEMENTNUMBER" },
|
||||
{ "GRP1", "GROUPING" },
|
||||
};
|
||||
const size_t frameTranslationSize = sizeof(frameTranslation) / sizeof(frameTranslation[0]);
|
||||
|
||||
@ -476,8 +477,8 @@ PropertyMap Frame::asProperties() const
|
||||
// workaround until this function is virtual
|
||||
if(id == "TXXX")
|
||||
return dynamic_cast< const UserTextIdentificationFrame* >(this)->asProperties();
|
||||
// Apple proprietary WFED (Podcast URL), MVNM (Movement Name), MVIN (Movement Number) are in fact text frames.
|
||||
else if(id[0] == 'T' || id == "WFED" || id == "MVNM" || id == "MVIN")
|
||||
// Apple proprietary WFED (Podcast URL), MVNM (Movement Name), MVIN (Movement Number), GRP1 (Grouping) are in fact text frames.
|
||||
else if(id[0] == 'T' || id == "WFED" || id == "MVNM" || id == "MVIN" || id == "GRP1")
|
||||
return dynamic_cast< const TextIdentificationFrame* >(this)->asProperties();
|
||||
else if(id == "WXXX")
|
||||
return dynamic_cast< const UserUrlLinkFrame* >(this)->asProperties();
|
||||
|
@ -198,8 +198,8 @@ Frame *FrameFactory::createFrame(const ByteVector &origData, Header *tagHeader)
|
||||
|
||||
// Text Identification (frames 4.2)
|
||||
|
||||
// Apple proprietary WFED (Podcast URL), MVNM (Movement Name), MVIN (Movement Number) are in fact text frames.
|
||||
if(frameID.startsWith("T") || frameID == "WFED" || frameID == "MVNM" || frameID == "MVIN") {
|
||||
// Apple proprietary WFED (Podcast URL), MVNM (Movement Name), MVIN (Movement Number), GRP1 (Grouping) are in fact text frames.
|
||||
if(frameID.startsWith("T") || frameID == "WFED" || frameID == "MVNM" || frameID == "MVIN" || frameID == "GRP1") {
|
||||
|
||||
TextIdentificationFrame *f = frameID != "TXXX"
|
||||
? new TextIdentificationFrame(data, header)
|
||||
@ -459,6 +459,7 @@ namespace
|
||||
{ "WFD", "WFED" },
|
||||
{ "MVN", "MVNM" },
|
||||
{ "MVI", "MVIN" },
|
||||
{ "GP1", "GRP1" },
|
||||
};
|
||||
const size_t frameConversion2Size = sizeof(frameConversion2) / sizeof(frameConversion2[0]);
|
||||
|
||||
|
12
3rdparty/taglib/mpeg/mpegfile.cpp
vendored
12
3rdparty/taglib/mpeg/mpegfile.cpp
vendored
@ -109,8 +109,8 @@ bool MPEG::File::isSupported(IOStream *stream)
|
||||
const ByteVector buffer = Utils::readHeader(stream, bufferSize(), true, &headerOffset);
|
||||
|
||||
if(buffer.isEmpty())
|
||||
return false;
|
||||
|
||||
return false;
|
||||
|
||||
const long originalPosition = stream->tell();
|
||||
AdapterFile file(stream);
|
||||
|
||||
@ -182,7 +182,7 @@ PropertyMap MPEG::File::setProperties(const PropertyMap &properties)
|
||||
{
|
||||
// update ID3v1 tag if it exists, but ignore the return value
|
||||
|
||||
if(ID3v1Tag())
|
||||
if(hasID3v1Tag())
|
||||
ID3v1Tag()->setProperties(properties);
|
||||
|
||||
return ID3v2Tag(true)->setProperties(properties);
|
||||
@ -195,7 +195,11 @@ MPEG::Properties *MPEG::File::audioProperties() const
|
||||
|
||||
bool MPEG::File::save()
|
||||
{
|
||||
return save(AllTags);
|
||||
if (hasID3v1Tag() || !ID3v1Tag()->isEmpty()) {
|
||||
return save(AllTags, true, 4, true);
|
||||
} else {
|
||||
return save(AllTags, true, 4, false);
|
||||
}
|
||||
}
|
||||
|
||||
bool MPEG::File::save(int tags)
|
||||
|
9
3rdparty/taglib/mpeg/mpegfile.h
vendored
9
3rdparty/taglib/mpeg/mpegfile.h
vendored
@ -164,14 +164,15 @@ namespace TagLib {
|
||||
virtual Properties *audioProperties() const;
|
||||
|
||||
/*!
|
||||
* Save the file. If at least one tag -- ID3v1 or ID3v2 -- exists this
|
||||
* will duplicate its content into the other tag. This returns true
|
||||
* if saving was successful.
|
||||
* Save the file. If an ID3v1 tag exists this will duplicate the tag
|
||||
* content into the other tag. This returns true if saving was
|
||||
* successful.
|
||||
*
|
||||
* If neither exists or if both tags are empty, this will strip the tags
|
||||
* from the file.
|
||||
*
|
||||
* This is the same as calling save(AllTags);
|
||||
* This is the same as calling save(AllTags, true, 4, false); or if an
|
||||
* ID3v1 tag exists, save(AllTags, true, 4, true).
|
||||
*
|
||||
* If you would like more granular control over the content of the tags,
|
||||
* with the concession of generality, use parameterized save call below.
|
||||
|
1
3rdparty/taglib/toolkit/tfilestream.cpp
vendored
1
3rdparty/taglib/toolkit/tfilestream.cpp
vendored
@ -493,6 +493,7 @@ void FileStream::truncate(long length)
|
||||
|
||||
#else
|
||||
|
||||
fflush(d->file);
|
||||
const int error = ftruncate(fileno(d->file), length);
|
||||
if(error != 0)
|
||||
debug("FileStream::truncate() -- Coundn't truncate the file.");
|
||||
|
Loading…
x
Reference in New Issue
Block a user