Add Ogg stream serial number to tag target when parsing Vorbis comments
So the stream the Vorbis comment belongs to is shown in the tag editor GUI. Otherwise it shouldn't change the behavior.
This commit is contained in:
parent
84b4d06f53
commit
5106d94f2a
|
@ -5,6 +5,7 @@
|
||||||
#include "../backuphelper.h"
|
#include "../backuphelper.h"
|
||||||
#include "../mediafileinfo.h"
|
#include "../mediafileinfo.h"
|
||||||
#include "../progressfeedback.h"
|
#include "../progressfeedback.h"
|
||||||
|
#include "../tagtarget.h"
|
||||||
|
|
||||||
#include <c++utilities/conversion/stringbuilder.h>
|
#include <c++utilities/conversion/stringbuilder.h>
|
||||||
#include <c++utilities/io/copy.h>
|
#include <c++utilities/io/copy.h>
|
||||||
|
@ -317,8 +318,9 @@ void OggContainer::internalParseTags(Diagnostics &diag, AbortableProgressFeedbac
|
||||||
*/
|
*/
|
||||||
void OggContainer::announceComment(std::size_t pageIndex, std::size_t segmentIndex, bool lastMetaDataBlock, GeneralMediaFormat mediaFormat)
|
void OggContainer::announceComment(std::size_t pageIndex, std::size_t segmentIndex, bool lastMetaDataBlock, GeneralMediaFormat mediaFormat)
|
||||||
{
|
{
|
||||||
m_tags.emplace_back(make_unique<OggVorbisComment>());
|
auto &tag = m_tags.emplace_back(make_unique<OggVorbisComment>());
|
||||||
m_tags.back()->oggParams().set(pageIndex, segmentIndex, lastMetaDataBlock, mediaFormat);
|
tag->oggParams().set(pageIndex, segmentIndex, lastMetaDataBlock, mediaFormat);
|
||||||
|
tag->target().tracks().emplace_back(m_iterator.pages()[pageIndex].streamSerialNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
void OggContainer::internalParseTracks(Diagnostics &diag, AbortableProgressFeedback &progress)
|
void OggContainer::internalParseTracks(Diagnostics &diag, AbortableProgressFeedback &progress)
|
||||||
|
|
|
@ -97,6 +97,9 @@ inline TagType OggVorbisComment::type() const
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Returns true; the target is used to specify the stream.
|
* \brief Returns true; the target is used to specify the stream.
|
||||||
|
* \remarks At this point, one cannot move a tag from one stream to another by changing the target. So
|
||||||
|
* the target is only evaluated when invoking createTag() and added to parsed tags for informative
|
||||||
|
* purposes.
|
||||||
* \sa OggContainer::createTag(), TagTarget
|
* \sa OggContainer::createTag(), TagTarget
|
||||||
*/
|
*/
|
||||||
inline bool OggVorbisComment::supportsTarget() const
|
inline bool OggVorbisComment::supportsTarget() const
|
||||||
|
|
6
tag.h
6
tag.h
|
@ -193,6 +193,7 @@ public:
|
||||||
std::uint64_t size() const;
|
std::uint64_t size() const;
|
||||||
virtual bool supportsTarget() const;
|
virtual bool supportsTarget() const;
|
||||||
const TagTarget &target() const;
|
const TagTarget &target() const;
|
||||||
|
TagTarget &target();
|
||||||
void setTarget(const TagTarget &target);
|
void setTarget(const TagTarget &target);
|
||||||
virtual TagTargetLevel targetLevel() const;
|
virtual TagTargetLevel targetLevel() const;
|
||||||
std::string_view targetLevelName() const;
|
std::string_view targetLevelName() const;
|
||||||
|
@ -255,6 +256,11 @@ inline const TagTarget &Tag::target() const
|
||||||
return m_target;
|
return m_target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline TagTarget &Tag::target()
|
||||||
|
{
|
||||||
|
return m_target;
|
||||||
|
}
|
||||||
|
|
||||||
inline void Tag::setTarget(const TagTarget &target)
|
inline void Tag::setTarget(const TagTarget &target)
|
||||||
{
|
{
|
||||||
m_target = target;
|
m_target = target;
|
||||||
|
|
|
@ -42,6 +42,7 @@ void OverallTests::checkOggTestfile1()
|
||||||
CPPUNIT_ASSERT(m_fileInfo.hasAnyTag());
|
CPPUNIT_ASSERT(m_fileInfo.hasAnyTag());
|
||||||
CPPUNIT_ASSERT_EQUAL(1_st, tags.size());
|
CPPUNIT_ASSERT_EQUAL(1_st, tags.size());
|
||||||
CPPUNIT_ASSERT_EQUAL("ffmpeg2theora 0.13"s, tags.front()->value(KnownField::Encoder).toString());
|
CPPUNIT_ASSERT_EQUAL("ffmpeg2theora 0.13"s, tags.front()->value(KnownField::Encoder).toString());
|
||||||
|
CPPUNIT_ASSERT_EQUAL(std::vector<std::uint64_t>{0x68a1ea7f}, tags.front()->target().tracks());
|
||||||
// Theora tags are currently not supported and hence only the Vorbis comment is
|
// Theora tags are currently not supported and hence only the Vorbis comment is
|
||||||
// taken into account here
|
// taken into account here
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue