Skip to content

Commit f7ab162

Browse files
committed
Make tags and properties more flexible
1 parent 5a6f1f9 commit f7ab162

8 files changed

Lines changed: 165 additions & 150 deletions

File tree

taglib/matroska/ebml/ebmlelement.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ namespace TagLib::EBML {
6969
inline constexpr Element::Id MkSimpleTag = 0x67C8;
7070
inline constexpr Element::Id MkTagName = 0x45A3;
7171
inline constexpr Element::Id MkTagLanguage = 0x447A;
72+
inline constexpr Element::Id MkTagBinary = 0x4485;
7273
inline constexpr Element::Id MkTagString = 0x4487;
7374
inline constexpr Element::Id MkTagsTagLanguage = 0x447A;
7475
inline constexpr Element::Id MkTagsLanguageDefault = 0x4484;

taglib/matroska/ebml/ebmlmktags.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
***************************************************************************/
2020

2121
#include "ebmlmktags.h"
22+
#include "ebmlbinaryelement.h"
2223
#include "ebmluintelement.h"
2324
#include "ebmlstringelement.h"
2425
#include "matroskatag.h"
@@ -79,7 +80,8 @@ Matroska::Tag *EBML::MkTags::parse()
7980
tagName = &(static_cast<UTF8StringElement *>(simpleTagChild)->getValue());
8081
else if(id == ElementIDs::MkTagString && !tagValueString)
8182
tagValueString = &(static_cast<UTF8StringElement *>(simpleTagChild)->getValue());
82-
// TODO implement binary
83+
else if(id == ElementIDs::MkTagBinary && !tagValueBinary)
84+
tagValueBinary = &(static_cast<BinaryElement *>(simpleTagChild)->getValue());
8385
else if(id == ElementIDs::MkTagsTagLanguage && !language)
8486
language = &(static_cast<Latin1StringElement *>(simpleTagChild)->getValue());
8587
else if(id == ElementIDs::MkTagsLanguageDefault)
@@ -96,7 +98,7 @@ Matroska::Tag *EBML::MkTags::parse()
9698
sTagString->setValue(*tagValueString);
9799
sTag = sTagString;
98100
}
99-
else if(tagValueBinary) {
101+
else { // tagValueBinary must be non null
100102
auto sTagBinary = new Matroska::SimpleTagBinary();
101103
sTagBinary->setTargetTypeValue(targetTypeValue);
102104
sTagBinary->setValue(*tagValueBinary);

taglib/matroska/matroskaattachments.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,15 @@ namespace TagLib {
4848
void removeAttachedFile(AttachedFile *file);
4949
void clear();
5050
const AttachedFileList &attachedFileList() const;
51-
bool render() override;
5251

5352
private:
5453
friend class EBML::MkAttachments;
5554
friend class File;
5655
class AttachmentsPrivate;
56+
57+
// private Element implementation
58+
bool render() override;
59+
5760
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
5861
std::unique_ptr<AttachmentsPrivate> d;
5962
};

taglib/matroska/matroskacues.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,5 +154,6 @@ bool Matroska::CueTrack::isValid(TagLib::File &file, offset_t segmentDataOffset)
154154

155155
bool Matroska::CueTrack::adjustOffset(offset_t, offset_t)
156156
{
157+
// TODO implement
157158
return false;
158159
}

taglib/matroska/matroskafile.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "ebmlmksegment.h"
2929
#include "tlist.h"
3030
#include "tdebug.h"
31+
#include "tagutils.h"
3132

3233
#include <memory>
3334
#include <vector>
@@ -57,10 +58,10 @@ class Matroska::File::FilePrivate
5758
// static members
5859
////////////////////////////////////////////////////////////////////////////////
5960

60-
bool Matroska::File::isSupported(IOStream *)
61+
bool Matroska::File::isSupported(IOStream *stream)
6162
{
62-
// TODO implement
63-
return false;
63+
const ByteVector id = Utils::readHeader(stream, 4, false);
64+
return id.startsWith("\x1A\x45\xDF\xA3");
6465
}
6566

6667
////////////////////////////////////////////////////////////////////////////////

taglib/matroska/matroskasegment.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,5 @@ namespace TagLib::Matroska {
4646
};
4747
}
4848

49-
5049
#endif
5150
#endif

0 commit comments

Comments
 (0)