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
2be905b2
Commit
2be905b2
authored
Jun 23, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MusicPipe: eliminate the unused MusicBuffer reference
This requires re-adding the reference to struct DecoderControl, which was removed recently by commit
9f14e7a9
parent
076be809
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
17 additions
and
42 deletions
+17
-42
MusicPipe.hxx
src/MusicPipe.hxx
+0
-21
Bridge.cxx
src/decoder/Bridge.cxx
+1
-1
DecoderControl.cxx
src/decoder/DecoderControl.cxx
+2
-1
DecoderControl.hxx
src/decoder/DecoderControl.hxx
+5
-1
MultipleOutputs.cxx
src/output/MultipleOutputs.cxx
+2
-5
MultipleOutputs.hxx
src/output/MultipleOutputs.hxx
+1
-3
Outputs.hxx
src/player/Outputs.hxx
+1
-5
Thread.cxx
src/player/Thread.cxx
+5
-5
No files found.
src/MusicPipe.hxx
View file @
2be905b2
...
...
@@ -30,18 +30,11 @@
#include <assert.h>
class
MusicBuffer
;
/**
* A queue of #MusicChunk objects. One party appends chunks at the
* tail, and the other consumes them from the head.
*/
class
MusicPipe
{
/**
* The #MusicBuffer where all chunks must be returned.
*/
MusicBuffer
&
buffer
;
/** the first chunk */
MusicChunkPtr
head
;
...
...
@@ -59,24 +52,10 @@ class MusicPipe {
#endif
public
:
/**
* Creates a new #MusicPipe object. It is empty.
*/
explicit
MusicPipe
(
MusicBuffer
&
_buffer
)
noexcept
:
buffer
(
_buffer
)
{}
MusicPipe
(
const
MusicPipe
&
)
=
delete
;
~
MusicPipe
()
noexcept
{
Clear
();
}
MusicPipe
&
operator
=
(
const
MusicPipe
&
)
=
delete
;
MusicBuffer
&
GetBuffer
()
noexcept
{
return
buffer
;
}
#ifndef NDEBUG
/**
* Checks if the audio format if the chunk is equal to the specified
...
...
src/decoder/Bridge.cxx
View file @
2be905b2
...
...
@@ -98,7 +98,7 @@ DecoderBridge::GetChunk() noexcept
return
current_chunk
.
get
();
do
{
current_chunk
=
dc
.
pipe
->
GetBuffer
().
Allocate
();
current_chunk
=
dc
.
buffer
->
Allocate
();
if
(
current_chunk
!=
nullptr
)
{
current_chunk
->
replay_gain_serial
=
replay_gain_serial
;
if
(
replay_gain_serial
!=
0
)
...
...
src/decoder/DecoderControl.cxx
View file @
2be905b2
...
...
@@ -92,7 +92,7 @@ DecoderControl::IsCurrentSong(const DetachedSong &_song) const noexcept
void
DecoderControl
::
Start
(
std
::
unique_ptr
<
DetachedSong
>
_song
,
SongTime
_start_time
,
SongTime
_end_time
,
MusicPipe
&
_pipe
)
noexcept
Music
Buffer
&
_buffer
,
Music
Pipe
&
_pipe
)
noexcept
{
assert
(
_song
!=
nullptr
);
assert
(
_pipe
.
IsEmpty
());
...
...
@@ -100,6 +100,7 @@ DecoderControl::Start(std::unique_ptr<DetachedSong> _song,
song
=
std
::
move
(
_song
);
start_time
=
_start_time
;
end_time
=
_end_time
;
buffer
=
&
_buffer
;
pipe
=
&
_pipe
;
ClearError
();
...
...
src/decoder/DecoderControl.hxx
View file @
2be905b2
...
...
@@ -44,6 +44,7 @@
#endif
class
DetachedSong
;
class
MusicBuffer
;
class
MusicPipe
;
enum
class
DecoderState
:
uint8_t
{
...
...
@@ -151,6 +152,9 @@ struct DecoderControl final : InputStreamHandler {
SignedSongTime
total_time
;
/** the #MusicChunk allocator */
MusicBuffer
*
buffer
;
/**
* The destination pipe for decoded chunks. The caller thread
* owns this object, and is responsible for freeing it.
...
...
@@ -379,7 +383,7 @@ public:
*/
void
Start
(
std
::
unique_ptr
<
DetachedSong
>
song
,
SongTime
start_time
,
SongTime
end_time
,
MusicPipe
&
pipe
)
noexcept
;
Music
Buffer
&
buffer
,
Music
Pipe
&
pipe
)
noexcept
;
/**
* Caller must lock the object.
...
...
src/output/MultipleOutputs.cxx
View file @
2be905b2
...
...
@@ -221,19 +221,16 @@ MultipleOutputs::Play(MusicChunkPtr chunk)
}
void
MultipleOutputs
::
Open
(
const
AudioFormat
audio_format
,
MusicBuffer
&
buffer
)
MultipleOutputs
::
Open
(
const
AudioFormat
audio_format
)
{
bool
ret
=
false
,
enabled
=
false
;
assert
(
pipe
==
nullptr
||
&
pipe
->
GetBuffer
()
==
&
buffer
);
/* the audio format must be the same as existing chunks in the
pipe */
assert
(
pipe
==
nullptr
||
pipe
->
CheckFormat
(
audio_format
));
if
(
pipe
==
nullptr
)
pipe
=
new
MusicPipe
(
buffer
);
pipe
=
new
MusicPipe
();
else
/* if the pipe hasn't been cleared, the the audio
format must not have changed */
...
...
src/output/MultipleOutputs.hxx
View file @
2be905b2
...
...
@@ -38,7 +38,6 @@
#include <assert.h>
class
MusicBuffer
;
class
MusicPipe
;
class
EventLoop
;
class
MixerListener
;
...
...
@@ -181,8 +180,7 @@ private:
/* virtual methods from class PlayerOutputs */
void
EnableDisable
()
override
;
void
Open
(
const
AudioFormat
audio_format
,
MusicBuffer
&
_buffer
)
override
;
void
Open
(
const
AudioFormat
audio_format
)
override
;
void
Close
()
noexcept
override
;
void
Release
()
noexcept
override
;
void
Play
(
MusicChunkPtr
chunk
)
override
;
...
...
src/player/Outputs.hxx
View file @
2be905b2
...
...
@@ -26,7 +26,6 @@
struct
AudioFormat
;
struct
MusicChunk
;
class
MusicBuffer
;
/**
* An interface for the player thread to control all outputs. This
...
...
@@ -50,11 +49,8 @@ public:
* Throws on error.
*
* @param audio_format the preferred audio format
* @param buffer the #MusicBuffer where consumed #MusicChunk
* objects should be returned
*/
virtual
void
Open
(
const
AudioFormat
audio_format
,
MusicBuffer
&
buffer
)
=
0
;
virtual
void
Open
(
const
AudioFormat
audio_format
)
=
0
;
/**
* Closes all audio outputs.
...
...
src/player/Thread.cxx
View file @
2be905b2
...
...
@@ -343,7 +343,7 @@ Player::StartDecoder(MusicPipe &_pipe) noexcept
dc
.
Start
(
std
::
make_unique
<
DetachedSong
>
(
*
pc
.
next_song
),
start_time
,
pc
.
next_song
->
GetEndTime
(),
_pipe
);
buffer
,
_pipe
);
}
void
...
...
@@ -445,7 +445,7 @@ Player::OpenOutput() noexcept
try
{
const
ScopeUnlock
unlock
(
pc
.
mutex
);
pc
.
outputs
.
Open
(
play_audio_format
,
buffer
);
pc
.
outputs
.
Open
(
play_audio_format
);
}
catch
(...)
{
LogError
(
std
::
current_exception
());
...
...
@@ -661,7 +661,7 @@ Player::ProcessCommand() noexcept
pc
.
CommandFinished
();
if
(
dc
.
IsIdle
())
StartDecoder
(
*
new
MusicPipe
(
buffer
));
StartDecoder
(
*
new
MusicPipe
());
break
;
...
...
@@ -932,7 +932,7 @@ Player::SongBorder() noexcept
inline
void
Player
::
Run
()
noexcept
{
pipe
=
new
MusicPipe
(
buffer
);
pipe
=
new
MusicPipe
();
const
std
::
lock_guard
<
Mutex
>
lock
(
pc
.
mutex
);
...
...
@@ -979,7 +979,7 @@ Player::Run() noexcept
assert
(
dc
.
pipe
==
nullptr
||
dc
.
pipe
==
pipe
);
StartDecoder
(
*
new
MusicPipe
(
buffer
));
StartDecoder
(
*
new
MusicPipe
());
}
if
(
/* no cross-fading if MPD is going to pause at the
...
...
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