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
e1349cca
Commit
e1349cca
authored
Dec 28, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
player/Thread: ProcessCommand() returns bool
Allows signalling a failed seek, and replaces several redundant command checks after the ProcessCommand() call.
parent
8838bdc1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
Thread.cxx
src/player/Thread.cxx
+13
-13
No files found.
src/player/Thread.cxx
View file @
e1349cca
...
...
@@ -339,8 +339,10 @@ private:
/**
* Player lock must be held before calling.
*
* @return false to stop playback
*/
void
ProcessCommand
()
noexcept
;
bool
ProcessCommand
()
noexcept
;
/**
* This is called at the border between two songs: the audio output
...
...
@@ -673,15 +675,17 @@ Player::SeekDecoder() noexcept
return
true
;
}
inline
void
inline
bool
Player
::
ProcessCommand
()
noexcept
{
switch
(
pc
.
command
)
{
case
PlayerCommand
:
:
NONE
:
break
;
case
PlayerCommand
:
:
STOP
:
case
PlayerCommand
:
:
EXIT
:
case
PlayerCommand
:
:
CLOSE_AUDIO
:
break
;
return
false
;
case
PlayerCommand
:
:
UPDATE_AUDIO
:
{
...
...
@@ -724,17 +728,14 @@ Player::ProcessCommand() noexcept
break
;
case
PlayerCommand
:
:
SEEK
:
SeekDecoder
();
break
;
return
SeekDecoder
();
case
PlayerCommand
:
:
CANCEL
:
if
(
pc
.
next_song
==
nullptr
)
{
if
(
pc
.
next_song
==
nullptr
)
/* the cancel request arrived too late, we're
already playing the queued song... stop
everything now */
pc
.
command
=
PlayerCommand
::
STOP
;
return
;
}
return
false
;
if
(
IsDecoderAtNextSong
())
/* the decoder is already decoding the song -
...
...
@@ -759,6 +760,8 @@ Player::ProcessCommand() noexcept
pc
.
CommandFinished
();
break
;
}
return
true
;
}
static
void
...
...
@@ -986,10 +989,7 @@ Player::Run() noexcept
pc
.
CommandFinished
();
while
(
true
)
{
ProcessCommand
();
if
(
pc
.
command
==
PlayerCommand
::
STOP
||
pc
.
command
==
PlayerCommand
::
EXIT
||
pc
.
command
==
PlayerCommand
::
CLOSE_AUDIO
)
{
if
(
!
ProcessCommand
())
{
const
ScopeUnlock
unlock
(
pc
.
mutex
);
pc
.
outputs
.
Cancel
();
break
;
...
...
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