output/Thread: move MusicPipe code to class SharedPipeConsumer

This commit is contained in:
Max Kellermann
2016-12-12 15:24:38 +01:00
parent 99659e4cf9
commit 2775d747ac
8 changed files with 177 additions and 82 deletions

View File

@@ -20,6 +20,7 @@
#ifndef MPD_OUTPUT_INTERNAL_HXX
#define MPD_OUTPUT_INTERNAL_HXX
#include "SharedPipeConsumer.hxx"
#include "AudioFormat.hxx"
#include "pcm/PcmBuffer.hxx"
#include "pcm/PcmDither.hxx"
@@ -247,13 +248,7 @@ struct AudioOutput {
Command command = Command::NONE;
/**
* The music pipe which provides music chunks to be played.
*/
const MusicPipe *pipe;
/**
* This mutex protects #open, #fail_timer, #current_chunk and
* #current_chunk_finished.
* This mutex protects #open, #fail_timer, #pipe.
*/
Mutex mutex;
@@ -270,17 +265,9 @@ struct AudioOutput {
PlayerControl *player_control;
/**
* The #MusicChunk which is currently being played. All
* chunks before this one may be returned to the
* #music_buffer, because they are not going to be used by
* this output anymore.
* A reference to the #MusicPipe and the current position.
*/
const MusicChunk *current_chunk;
/**
* Has the output finished playing #current_chunk?
*/
bool current_chunk_finished;
SharedPipeConsumer pipe;
/**
* Throws #std::runtime_error on error.
@@ -445,9 +432,6 @@ private:
*/
bool WaitForDelay();
gcc_pure
const MusicChunk *GetNextChunk() const;
bool PlayChunk(const MusicChunk *chunk);
/**