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