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
28fdf1e9
Commit
28fdf1e9
authored
7 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/Control: wrap DetachedSong* in std::unique_ptr
parent
9a8a3bea
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
12 deletions
+7
-12
DecoderControl.cxx
src/decoder/DecoderControl.cxx
+2
-5
DecoderControl.hxx
src/decoder/DecoderControl.hxx
+4
-6
Thread.cxx
src/player/Thread.cxx
+1
-1
No files found.
src/decoder/DecoderControl.cxx
View file @
28fdf1e9
...
...
@@ -38,8 +38,6 @@ DecoderControl::DecoderControl(Mutex &_mutex, Cond &_client_cond,
DecoderControl
::~
DecoderControl
()
noexcept
{
ClearError
();
delete
song
;
}
void
...
...
@@ -92,7 +90,7 @@ DecoderControl::IsCurrentSong(const DetachedSong &_song) const noexcept
}
void
DecoderControl
::
Start
(
DetachedSong
*
_song
,
DecoderControl
::
Start
(
std
::
unique_ptr
<
DetachedSong
>
_song
,
SongTime
_start_time
,
SongTime
_end_time
,
MusicBuffer
&
_buffer
,
MusicPipe
&
_pipe
)
noexcept
{
...
...
@@ -101,8 +99,7 @@ DecoderControl::Start(DetachedSong *_song,
assert
(
_song
!=
nullptr
);
assert
(
_pipe
.
IsEmpty
());
delete
song
;
song
=
_song
;
song
=
std
::
move
(
_song
);
start_time
=
_start_time
;
end_time
=
_end_time
;
buffer
=
&
_buffer
;
...
...
This diff is collapsed.
Click to expand it.
src/decoder/DecoderControl.hxx
View file @
28fdf1e9
...
...
@@ -31,8 +31,8 @@
#include "ReplayGainMode.hxx"
#include <exception>
#include <utility>
#include <memory>
#include <assert.h>
#include <stdint.h>
...
...
@@ -130,11 +130,8 @@ struct DecoderControl {
* The song currently being decoded. This attribute is set by
* the player thread, when it sends the #DecoderCommand::START
* command.
*
* This is a duplicate, and must be freed when this attribute
* is cleared.
*/
DetachedSong
*
song
=
nullptr
;
std
::
unique_ptr
<
DetachedSong
>
song
;
/**
* The initial seek position, e.g. to the start of a sub-track
...
...
@@ -382,7 +379,8 @@ public:
* @param pipe the pipe which receives the decoded chunks (owned by
* the caller)
*/
void
Start
(
DetachedSong
*
song
,
SongTime
start_time
,
SongTime
end_time
,
void
Start
(
std
::
unique_ptr
<
DetachedSong
>
song
,
SongTime
start_time
,
SongTime
end_time
,
MusicBuffer
&
buffer
,
MusicPipe
&
pipe
)
noexcept
;
void
Stop
()
noexcept
;
...
...
This diff is collapsed.
Click to expand it.
src/player/Thread.cxx
View file @
28fdf1e9
...
...
@@ -360,7 +360,7 @@ Player::StartDecoder(MusicPipe &_pipe)
SongTime
start_time
=
pc
.
next_song
->
GetStartTime
()
+
pc
.
seek_time
;
dc
.
Start
(
new
DetachedSong
(
*
pc
.
next_song
),
dc
.
Start
(
std
::
make_unique
<
DetachedSong
>
(
*
pc
.
next_song
),
start_time
,
pc
.
next_song
->
GetEndTime
(),
buffer
,
_pipe
);
}
...
...
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