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
6db6d3c5
Commit
6db6d3c5
authored
Sep 21, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
player/Thread: move StartPlayerThread() into PlayerControl
parent
0e2c5978
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
60 deletions
+28
-60
Makefile.am
Makefile.am
+1
-1
Main.cxx
src/Main.cxx
+1
-2
PartitionCommands.cxx
src/command/PartitionCommands.cxx
+1
-2
Control.hxx
src/player/Control.hxx
+7
-0
Thread.cxx
src/player/Thread.cxx
+18
-10
Thread.hxx
src/player/Thread.hxx
+0
-45
No files found.
Makefile.am
View file @
6db6d3c5
...
...
@@ -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
\
...
...
src/Main.cxx
View file @
6db6d3c5
...
...
@@ -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
)
{
...
...
src/command/PartitionCommands.cxx
View file @
6db6d3c5
...
...
@@ -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
);
...
...
src/player/Control.hxx
View file @
6db6d3c5
...
...
@@ -238,6 +238,13 @@ struct PlayerControl final : AudioOutputClient {
~
PlayerControl
()
noexcept
;
/**
* Throws on error.
*/
void
StartThread
()
{
thread
.
Start
();
}
/**
* Locks the object.
*/
void
Lock
()
const
noexcept
{
...
...
src/player/Thread.cxx
View file @
6db6d3c5
...
...
@@ -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
();
}
src/player/Thread.hxx
deleted
100644 → 0
View file @
0e2c5978
/*
* 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
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