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
9f33c6fe
Commit
9f33c6fe
authored
Dec 20, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/Bridge: use std::unique_ptr<Tag>
parent
73e69eda
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
20 deletions
+13
-20
Bridge.cxx
src/decoder/Bridge.cxx
+6
-14
Bridge.hxx
src/decoder/Bridge.hxx
+6
-5
DecoderThread.cxx
src/decoder/DecoderThread.cxx
+1
-1
No files found.
src/decoder/Bridge.cxx
View file @
9f33c6fe
...
@@ -47,10 +47,6 @@ DecoderBridge::~DecoderBridge()
...
@@ -47,10 +47,6 @@ DecoderBridge::~DecoderBridge()
convert
->
Close
();
convert
->
Close
();
delete
convert
;
delete
convert
;
}
}
delete
song_tag
;
delete
stream_tag
;
delete
decoder_tag
;
}
}
bool
bool
...
@@ -222,11 +218,11 @@ DecoderBridge::DoSendTag(const Tag &tag)
...
@@ -222,11 +218,11 @@ DecoderBridge::DoSendTag(const Tag &tag)
bool
bool
DecoderBridge
::
UpdateStreamTag
(
InputStream
*
is
)
DecoderBridge
::
UpdateStreamTag
(
InputStream
*
is
)
{
{
auto
*
tag
=
is
!=
nullptr
auto
tag
=
is
!=
nullptr
?
is
->
LockReadTag
()
.
release
()
?
is
->
LockReadTag
()
:
nullptr
;
:
nullptr
;
if
(
tag
==
nullptr
)
{
if
(
tag
==
nullptr
)
{
tag
=
s
ong_tag
;
tag
=
s
td
::
move
(
song_tag
)
;
if
(
tag
==
nullptr
)
if
(
tag
==
nullptr
)
return
false
;
return
false
;
...
@@ -234,12 +230,9 @@ DecoderBridge::UpdateStreamTag(InputStream *is)
...
@@ -234,12 +230,9 @@ DecoderBridge::UpdateStreamTag(InputStream *is)
instead */
instead */
}
else
}
else
/* discard the song tag; we don't need it */
/* discard the song tag; we don't need it */
delete
song_tag
;
song_tag
.
reset
();
song_tag
=
nullptr
;
delete
stream_tag
;
stream_tag
=
std
::
move
(
tag
);
stream_tag
=
tag
;
return
true
;
return
true
;
}
}
...
@@ -540,8 +533,7 @@ DecoderBridge::SubmitTag(InputStream *is, Tag &&tag)
...
@@ -540,8 +533,7 @@ DecoderBridge::SubmitTag(InputStream *is, Tag &&tag)
/* save the tag */
/* save the tag */
delete
decoder_tag
;
decoder_tag
=
std
::
make_unique
<
Tag
>
(
std
::
move
(
tag
));
decoder_tag
=
new
Tag
(
std
::
move
(
tag
));
/* check for a new stream tag */
/* check for a new stream tag */
...
...
src/decoder/Bridge.hxx
View file @
9f33c6fe
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include "ReplayGainInfo.hxx"
#include "ReplayGainInfo.hxx"
#include <exception>
#include <exception>
#include <memory>
class
PcmConvert
;
class
PcmConvert
;
struct
MusicChunk
;
struct
MusicChunk
;
...
@@ -74,13 +75,13 @@ public:
...
@@ -74,13 +75,13 @@ public:
* files, because we expect the stream server to send us a new
* files, because we expect the stream server to send us a new
* tag each time we play it.
* tag each time we play it.
*/
*/
Tag
*
song_tag
;
std
::
unique_ptr
<
Tag
>
song_tag
;
/** the last tag received from the stream */
/** the last tag received from the stream */
Tag
*
stream_tag
=
nullptr
;
std
::
unique_ptr
<
Tag
>
stream_tag
;
/** the last tag received from the decoder plugin */
/** the last tag received from the decoder plugin */
Tag
*
decoder_tag
=
nullptr
;
std
::
unique_ptr
<
Tag
>
decoder_tag
;
/** the chunk currently being written to */
/** the chunk currently being written to */
MusicChunk
*
current_chunk
=
nullptr
;
MusicChunk
*
current_chunk
=
nullptr
;
...
@@ -100,10 +101,10 @@ public:
...
@@ -100,10 +101,10 @@ public:
std
::
exception_ptr
error
;
std
::
exception_ptr
error
;
DecoderBridge
(
DecoderControl
&
_dc
,
bool
_initial_seek_pending
,
DecoderBridge
(
DecoderControl
&
_dc
,
bool
_initial_seek_pending
,
Tag
*
_tag
)
std
::
unique_ptr
<
Tag
>
_tag
)
:
dc
(
_dc
),
:
dc
(
_dc
),
initial_seek_pending
(
_initial_seek_pending
),
initial_seek_pending
(
_initial_seek_pending
),
song_tag
(
_tag
)
{}
song_tag
(
std
::
move
(
_tag
)
)
{}
~
DecoderBridge
();
~
DecoderBridge
();
...
...
src/decoder/DecoderThread.cxx
View file @
9f33c6fe
...
@@ -447,7 +447,7 @@ decoder_run_song(DecoderControl &dc,
...
@@ -447,7 +447,7 @@ decoder_run_song(DecoderControl &dc,
file - tags on "stream" songs are just
file - tags on "stream" songs are just
remembered from the last time we
remembered from the last time we
played it*/
played it*/
song
.
IsFile
()
?
new
Tag
(
song
.
GetTag
())
:
nullptr
);
song
.
IsFile
()
?
std
::
make_unique
<
Tag
>
(
song
.
GetTag
())
:
nullptr
);
dc
.
state
=
DecoderState
::
START
;
dc
.
state
=
DecoderState
::
START
;
dc
.
CommandFinishedLocked
();
dc
.
CommandFinishedLocked
();
...
...
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