Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
c6a95395
Commit
c6a95395
authored
7 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag/Tag: Merge() returns std::unique_ptr<Tag>
parent
cb3042ff
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
20 deletions
+15
-20
Bridge.cxx
src/decoder/Bridge.cxx
+7
-13
IcyInputStream.cxx
src/input/IcyInputStream.cxx
+1
-1
Tag.cxx
src/tag/Tag.cxx
+4
-4
Tag.hxx
src/tag/Tag.hxx
+3
-2
No files found.
src/decoder/Bridge.cxx
View file @
c6a95395
...
@@ -450,13 +450,11 @@ DecoderBridge::SubmitData(InputStream *is,
...
@@ -450,13 +450,11 @@ DecoderBridge::SubmitData(InputStream *is,
/* send stream tags */
/* send stream tags */
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 */
Tag
*
tag
=
Tag
::
Merge
(
*
decoder_tag
,
cmd
=
DoSendTag
(
*
Tag
::
Merge
(
*
decoder_tag
,
*
stream_tag
);
*
stream_tag
));
cmd
=
DoSendTag
(
*
tag
);
else
delete
tag
;
}
else
/* send only the stream tag */
/* send only the stream tag */
cmd
=
DoSendTag
(
*
stream_tag
);
cmd
=
DoSendTag
(
*
stream_tag
);
...
@@ -559,14 +557,10 @@ DecoderBridge::SubmitTag(InputStream *is, Tag &&tag)
...
@@ -559,14 +557,10 @@ DecoderBridge::SubmitTag(InputStream *is, Tag &&tag)
/* send tag to music pipe */
/* send tag to music pipe */
if
(
stream_tag
!=
nullptr
)
{
if
(
stream_tag
!=
nullptr
)
/* merge with tag from input stream */
/* merge with tag from input stream */
Tag
*
merged
;
cmd
=
DoSendTag
(
*
Tag
::
Merge
(
*
stream_tag
,
*
decoder_tag
));
else
merged
=
Tag
::
Merge
(
*
stream_tag
,
*
decoder_tag
);
cmd
=
DoSendTag
(
*
merged
);
delete
merged
;
}
else
/* send only the decoder tag */
/* send only the decoder tag */
cmd
=
DoSendTag
(
*
decoder_tag
);
cmd
=
DoSendTag
(
*
decoder_tag
);
...
...
This diff is collapsed.
Click to expand it.
src/input/IcyInputStream.cxx
View file @
c6a95395
...
@@ -75,7 +75,7 @@ IcyInputStream::ReadTag()
...
@@ -75,7 +75,7 @@ IcyInputStream::ReadTag()
if
(
icy_tag
==
nullptr
)
if
(
icy_tag
==
nullptr
)
return
new
Tag
(
*
input_tag
);
return
new
Tag
(
*
input_tag
);
return
Tag
::
Merge
(
*
input_tag
,
*
icy_tag
);
return
Tag
::
Merge
(
*
input_tag
,
*
icy_tag
)
.
release
()
;
}
}
size_t
size_t
...
...
This diff is collapsed.
Click to expand it.
src/tag/Tag.cxx
View file @
c6a95395
...
@@ -55,12 +55,12 @@ Tag::Tag(const Tag &other)
...
@@ -55,12 +55,12 @@ Tag::Tag(const Tag &other)
}
}
}
}
Tag
*
std
::
unique_ptr
<
Tag
>
Tag
::
Merge
(
const
Tag
&
base
,
const
Tag
&
add
)
Tag
::
Merge
(
const
Tag
&
base
,
const
Tag
&
add
)
noexcept
{
{
TagBuilder
builder
(
add
);
TagBuilder
builder
(
add
);
builder
.
Complement
(
base
);
builder
.
Complement
(
base
);
return
builder
.
CommitNew
()
.
release
()
;
return
builder
.
CommitNew
();
}
}
Tag
*
Tag
*
...
@@ -72,7 +72,7 @@ Tag::MergeReplace(Tag *base, Tag *add)
...
@@ -72,7 +72,7 @@ Tag::MergeReplace(Tag *base, Tag *add)
if
(
base
==
nullptr
)
if
(
base
==
nullptr
)
return
add
;
return
add
;
Tag
*
tag
=
Merge
(
*
base
,
*
add
);
Tag
*
tag
=
Merge
(
*
base
,
*
add
)
.
release
()
;
delete
base
;
delete
base
;
delete
add
;
delete
add
;
...
...
This diff is collapsed.
Click to expand it.
src/tag/Tag.hxx
View file @
c6a95395
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include "Compiler.h"
#include "Compiler.h"
#include <algorithm>
#include <algorithm>
#include <memory>
/**
/**
* The meta information about a song file. It is a MPD specific
* The meta information about a song file. It is a MPD specific
...
@@ -116,8 +117,8 @@ struct Tag {
...
@@ -116,8 +117,8 @@ struct Tag {
*
*
* @return a newly allocated tag
* @return a newly allocated tag
*/
*/
gcc_malloc
gcc_returns_nonnull
static
std
::
unique_ptr
<
Tag
>
Merge
(
const
Tag
&
base
,
static
Tag
*
Merge
(
const
Tag
&
base
,
const
Tag
&
add
)
;
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
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment