player/Thread: move StartPlayerThread() into PlayerControl
This commit is contained in:
parent
0e2c597884
commit
6db6d3c50c
|
@ -142,7 +142,7 @@ libmpd_a_SOURCES = \
|
|||
src/Partition.cxx src/Partition.hxx \
|
||||
src/Permission.cxx src/Permission.hxx \
|
||||
src/player/CrossFade.cxx src/player/CrossFade.hxx \
|
||||
src/player/Thread.cxx src/player/Thread.hxx \
|
||||
src/player/Thread.cxx \
|
||||
src/player/Control.cxx src/player/Control.hxx \
|
||||
src/player/Listener.hxx \
|
||||
src/player/Outputs.hxx \
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "PlaylistFile.hxx"
|
||||
#include "MusicChunk.hxx"
|
||||
#include "StateFile.hxx"
|
||||
#include "player/Thread.hxx"
|
||||
#include "Mapper.hxx"
|
||||
#include "Permission.hxx"
|
||||
#include "Listen.hxx"
|
||||
|
@ -613,7 +612,7 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config)
|
|||
ZeroconfInit(raw_config, instance->event_loop);
|
||||
|
||||
for (auto &partition : instance->partitions)
|
||||
StartPlayerThread(partition.pc);
|
||||
partition.pc.StartThread();
|
||||
|
||||
#ifdef ENABLE_DATABASE
|
||||
if (create_db) {
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "IdleFlags.hxx"
|
||||
#include "client/Client.hxx"
|
||||
#include "client/Response.hxx"
|
||||
#include "player/Thread.hxx"
|
||||
#include "util/CharUtil.hxx"
|
||||
|
||||
CommandResult
|
||||
|
@ -111,7 +110,7 @@ handle_newpartition(Client &client, Request request, Response &response)
|
|||
ReplayGainConfig(),
|
||||
partition.pc);
|
||||
partition.UpdateEffectiveReplayGainMode();
|
||||
StartPlayerThread(partition.pc);
|
||||
partition.pc.StartThread();
|
||||
partition.pc.LockUpdateAudio();
|
||||
|
||||
instance.EmitIdle(IDLE_PARTITION);
|
||||
|
|
|
@ -237,6 +237,13 @@ struct PlayerControl final : AudioOutputClient {
|
|||
const ReplayGainConfig &_replay_gain_config) noexcept;
|
||||
~PlayerControl() noexcept;
|
||||
|
||||
/**
|
||||
* Throws on error.
|
||||
*/
|
||||
void StartThread() {
|
||||
thread.Start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Locks the object.
|
||||
*/
|
||||
|
|
|
@ -17,8 +17,25 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/* \file
|
||||
*
|
||||
* The player thread controls the playback. It acts as a bridge
|
||||
* between the decoder thread and the output thread(s): it receives
|
||||
* #MusicChunk objects from the decoder, optionally mixes them
|
||||
* (cross-fading), applies software volume, and sends them to the
|
||||
* audio outputs via audio_output_all_play().
|
||||
*
|
||||
* It is controlled by the main thread (the playlist code), see
|
||||
* Control.hxx. The playlist enqueues new songs into the player
|
||||
* thread and sends it commands.
|
||||
*
|
||||
* The player thread itself does not do any I/O. It synchronizes with
|
||||
* other threads via #GMutex and #GCond objects, and passes
|
||||
* #MusicChunk instances around in #MusicPipe objects.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "Thread.hxx"
|
||||
#include "Control.hxx"
|
||||
#include "Outputs.hxx"
|
||||
#include "Listener.hxx"
|
||||
#include "decoder/Control.hxx"
|
||||
|
@ -27,7 +44,6 @@
|
|||
#include "MusicChunk.hxx"
|
||||
#include "song/DetachedSong.hxx"
|
||||
#include "CrossFade.hxx"
|
||||
#include "Control.hxx"
|
||||
#include "tag/Tag.hxx"
|
||||
#include "Idle.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
|
@ -1170,11 +1186,3 @@ PlayerControl::RunThread() noexcept
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
StartPlayerThread(PlayerControl &pc)
|
||||
{
|
||||
assert(!pc.thread.IsDefined());
|
||||
|
||||
pc.thread.Start();
|
||||
}
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
* Copyright 2003-2017 The Music Player Daemon Project
|
||||
* http://www.musicpd.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/* \file
|
||||
*
|
||||
* The player thread controls the playback. It acts as a bridge
|
||||
* between the decoder thread and the output thread(s): it receives
|
||||
* #MusicChunk objects from the decoder, optionally mixes them
|
||||
* (cross-fading), applies software volume, and sends them to the
|
||||
* audio outputs via audio_output_all_play().
|
||||
*
|
||||
* It is controlled by the main thread (the playlist code), see
|
||||
* Control.hxx. The playlist enqueues new songs into the player
|
||||
* thread and sends it commands.
|
||||
*
|
||||
* The player thread itself does not do any I/O. It synchronizes with
|
||||
* other threads via #GMutex and #GCond objects, and passes
|
||||
* #MusicChunk instances around in #MusicPipe objects.
|
||||
*/
|
||||
|
||||
#ifndef MPD_PLAYER_THREAD_HXX
|
||||
#define MPD_PLAYER_THREAD_HXX
|
||||
|
||||
struct PlayerControl;
|
||||
|
||||
void
|
||||
StartPlayerThread(PlayerControl &pc);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue