tag/Tag: Merge() returns Tag, MergePtr() returns std::unique_ptr<Tag>
This commit is contained in:
@@ -474,8 +474,8 @@ DecoderBridge::SubmitData(InputStream *is,
|
|||||||
if (UpdateStreamTag(is)) {
|
if (UpdateStreamTag(is)) {
|
||||||
if (decoder_tag != nullptr)
|
if (decoder_tag != nullptr)
|
||||||
/* merge with tag from decoder plugin */
|
/* merge with tag from decoder plugin */
|
||||||
cmd = DoSendTag(*Tag::Merge(*decoder_tag,
|
cmd = DoSendTag(Tag::Merge(*decoder_tag,
|
||||||
*stream_tag));
|
*stream_tag));
|
||||||
else
|
else
|
||||||
/* send only the stream tag */
|
/* send only the stream tag */
|
||||||
cmd = DoSendTag(*stream_tag);
|
cmd = DoSendTag(*stream_tag);
|
||||||
@@ -598,7 +598,7 @@ DecoderBridge::SubmitTag(InputStream *is, Tag &&tag) noexcept
|
|||||||
|
|
||||||
if (stream_tag != nullptr)
|
if (stream_tag != nullptr)
|
||||||
/* merge with tag from input stream */
|
/* merge with tag from input stream */
|
||||||
cmd = DoSendTag(*Tag::Merge(*stream_tag, *decoder_tag));
|
cmd = DoSendTag(Tag::Merge(*stream_tag, *decoder_tag));
|
||||||
else
|
else
|
||||||
/* send only the decoder tag */
|
/* send only the decoder tag */
|
||||||
cmd = DoSendTag(*decoder_tag);
|
cmd = DoSendTag(*decoder_tag);
|
||||||
|
@@ -92,7 +92,7 @@ IcyInputStream::ReadTag() noexcept
|
|||||||
if (icy_tag == nullptr)
|
if (icy_tag == nullptr)
|
||||||
return std::make_unique<Tag>(*input_tag);
|
return std::make_unique<Tag>(*input_tag);
|
||||||
|
|
||||||
return Tag::Merge(*input_tag, *icy_tag);
|
return Tag::MergePtr(*input_tag, *icy_tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
|
@@ -53,8 +53,16 @@ Tag::Tag(const Tag &other) noexcept
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Tag>
|
Tag
|
||||||
Tag::Merge(const Tag &base, const Tag &add) noexcept
|
Tag::Merge(const Tag &base, const Tag &add) noexcept
|
||||||
|
{
|
||||||
|
TagBuilder builder(add);
|
||||||
|
builder.Complement(base);
|
||||||
|
return builder.Commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<Tag>
|
||||||
|
Tag::MergePtr(const Tag &base, const Tag &add) noexcept
|
||||||
{
|
{
|
||||||
TagBuilder builder(add);
|
TagBuilder builder(add);
|
||||||
builder.Complement(base);
|
builder.Complement(base);
|
||||||
@@ -70,7 +78,7 @@ Tag::Merge(std::unique_ptr<Tag> base, std::unique_ptr<Tag> add) noexcept
|
|||||||
if (base == nullptr)
|
if (base == nullptr)
|
||||||
return add;
|
return add;
|
||||||
|
|
||||||
return Merge(*base, *add);
|
return MergePtr(*base, *add);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
@@ -117,8 +117,11 @@ struct Tag {
|
|||||||
*
|
*
|
||||||
* @return a newly allocated tag
|
* @return a newly allocated tag
|
||||||
*/
|
*/
|
||||||
static std::unique_ptr<Tag> Merge(const Tag &base,
|
static Tag Merge(const Tag &base,
|
||||||
const Tag &add) noexcept;
|
const Tag &add) noexcept;
|
||||||
|
|
||||||
|
static std::unique_ptr<Tag> MergePtr(const Tag &base,
|
||||||
|
const Tag &add) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Merges the data from two tags. Any of the two may be nullptr. Both
|
* Merges the data from two tags. Any of the two may be nullptr. Both
|
||||||
|
Reference in New Issue
Block a user