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
36239895
Commit
36239895
authored
Nov 11, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
player/Control: add Lock prefix to locking method names
parent
738583e3
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
44 additions
and
44 deletions
+44
-44
Main.cxx
src/Main.cxx
+1
-1
PlayerCommands.cxx
src/command/PlayerCommands.cxx
+4
-4
OutputCommand.cxx
src/output/OutputCommand.cxx
+3
-3
Control.cxx
src/player/Control.cxx
+10
-10
Control.hxx
src/player/Control.hxx
+10
-10
Playlist.cxx
src/queue/Playlist.cxx
+4
-4
PlaylistControl.cxx
src/queue/PlaylistControl.cxx
+6
-6
PlaylistEdit.cxx
src/queue/PlaylistEdit.cxx
+2
-2
PlaylistState.cxx
src/queue/PlaylistState.cxx
+4
-4
No files found.
src/Main.cxx
View file @
36239895
...
...
@@ -646,7 +646,7 @@ static int mpd_main_after_fork(struct options options)
/* enable all audio outputs (if not already done by
playlist_state_restore() */
instance
->
partition
->
pc
.
UpdateAudio
();
instance
->
partition
->
pc
.
Lock
UpdateAudio
();
#ifdef WIN32
win32_app_started
();
...
...
src/command/PlayerCommands.cxx
View file @
36239895
...
...
@@ -100,9 +100,9 @@ handle_pause(Client &client, Request args, Response &r)
if
(
!
args
.
Parse
(
0
,
pause_flag
,
r
))
return
CommandResult
::
ERROR
;
client
.
player_control
.
SetPause
(
pause_flag
);
client
.
player_control
.
Lock
SetPause
(
pause_flag
);
}
else
client
.
player_control
.
Pause
();
client
.
player_control
.
Lock
Pause
();
return
CommandResult
::
OK
;
}
...
...
@@ -113,7 +113,7 @@ handle_status(Client &client, gcc_unused Request args, Response &r)
const
char
*
state
=
nullptr
;
int
song
;
const
auto
player_status
=
client
.
player_control
.
GetStatus
();
const
auto
player_status
=
client
.
player_control
.
Lock
GetStatus
();
switch
(
player_status
.
state
)
{
case
PlayerState
:
:
STOP
:
...
...
@@ -284,7 +284,7 @@ CommandResult
handle_clearerror
(
Client
&
client
,
gcc_unused
Request
args
,
gcc_unused
Response
&
r
)
{
client
.
player_control
.
ClearError
();
client
.
player_control
.
Lock
ClearError
();
return
CommandResult
::
OK
;
}
...
...
src/output/OutputCommand.cxx
View file @
36239895
...
...
@@ -53,7 +53,7 @@ audio_output_enable_index(MultipleOutputs &outputs, unsigned idx)
idle_add
(
IDLE_MIXER
);
}
ao
.
player_control
->
UpdateAudio
();
ao
.
player_control
->
Lock
UpdateAudio
();
++
audio_output_state_version
;
...
...
@@ -80,7 +80,7 @@ audio_output_disable_index(MultipleOutputs &outputs, unsigned idx)
idle_add
(
IDLE_MIXER
);
}
ao
.
player_control
->
UpdateAudio
();
ao
.
player_control
->
Lock
UpdateAudio
();
++
audio_output_state_version
;
...
...
@@ -106,7 +106,7 @@ audio_output_toggle_index(MultipleOutputs &outputs, unsigned idx)
}
}
ao
.
player_control
->
UpdateAudio
();
ao
.
player_control
->
Lock
UpdateAudio
();
++
audio_output_state_version
;
...
...
src/player/Control.cxx
View file @
36239895
...
...
@@ -69,14 +69,14 @@ PlayerControl::Play(DetachedSong *song)
}
void
PlayerControl
::
Cancel
()
PlayerControl
::
Lock
Cancel
()
{
LockSynchronousCommand
(
PlayerCommand
::
CANCEL
);
assert
(
next_song
==
nullptr
);
}
void
PlayerControl
::
Stop
()
PlayerControl
::
Lock
Stop
()
{
LockSynchronousCommand
(
PlayerCommand
::
CLOSE_AUDIO
);
assert
(
next_song
==
nullptr
);
...
...
@@ -85,7 +85,7 @@ PlayerControl::Stop()
}
void
PlayerControl
::
UpdateAudio
()
PlayerControl
::
Lock
UpdateAudio
()
{
LockSynchronousCommand
(
PlayerCommand
::
UPDATE_AUDIO
);
}
...
...
@@ -111,7 +111,7 @@ PlayerControl::PauseLocked()
}
void
PlayerControl
::
Pause
()
PlayerControl
::
Lock
Pause
()
{
Lock
();
PauseLocked
();
...
...
@@ -119,7 +119,7 @@ PlayerControl::Pause()
}
void
PlayerControl
::
SetPause
(
bool
pause_flag
)
PlayerControl
::
Lock
SetPause
(
bool
pause_flag
)
{
Lock
();
...
...
@@ -142,7 +142,7 @@ PlayerControl::SetPause(bool pause_flag)
}
void
PlayerControl
::
SetBorderPause
(
bool
_border_pause
)
PlayerControl
::
Lock
SetBorderPause
(
bool
_border_pause
)
{
Lock
();
border_pause
=
_border_pause
;
...
...
@@ -150,7 +150,7 @@ PlayerControl::SetBorderPause(bool _border_pause)
}
player_status
PlayerControl
::
GetStatus
()
PlayerControl
::
Lock
GetStatus
()
{
player_status
status
;
...
...
@@ -182,7 +182,7 @@ PlayerControl::SetError(PlayerError type, Error &&_error)
}
void
PlayerControl
::
ClearError
()
PlayerControl
::
Lock
ClearError
()
{
Lock
();
...
...
@@ -211,7 +211,7 @@ PlayerControl::ClearTaggedSong()
}
void
PlayerControl
::
EnqueueSong
(
DetachedSong
*
song
)
PlayerControl
::
Lock
EnqueueSong
(
DetachedSong
*
song
)
{
assert
(
song
!=
nullptr
);
...
...
@@ -221,7 +221,7 @@ PlayerControl::EnqueueSong(DetachedSong *song)
}
bool
PlayerControl
::
Seek
(
DetachedSong
*
song
,
SongTime
t
)
PlayerControl
::
Lock
Seek
(
DetachedSong
*
song
,
SongTime
t
)
{
assert
(
song
!=
nullptr
);
...
...
src/player/Control.hxx
View file @
36239895
...
...
@@ -319,25 +319,25 @@ public:
/**
* see PlayerCommand::CANCEL
*/
void
Cancel
();
void
Lock
Cancel
();
void
SetPause
(
bool
pause_flag
);
void
Lock
SetPause
(
bool
pause_flag
);
private
:
void
PauseLocked
();
public
:
void
Pause
();
void
Lock
Pause
();
/**
* Set the player's #border_pause flag.
*/
void
SetBorderPause
(
bool
border_pause
);
void
Lock
SetBorderPause
(
bool
border_pause
);
void
Kill
();
gcc_pure
player_status
GetStatus
();
player_status
Lock
GetStatus
();
PlayerState
GetState
()
const
{
return
state
;
...
...
@@ -378,7 +378,7 @@ public:
return
result
;
}
void
ClearError
();
void
Lock
ClearError
();
PlayerError
GetErrorType
()
const
{
return
error_type
;
...
...
@@ -413,9 +413,9 @@ public:
return
result
;
}
void
Stop
();
void
Lock
Stop
();
void
UpdateAudio
();
void
Lock
UpdateAudio
();
private
:
void
EnqueueSongLocked
(
DetachedSong
*
song
)
{
...
...
@@ -432,7 +432,7 @@ public:
* @param song the song to be queued; the given instance will be owned
* and freed by the player
*/
void
EnqueueSong
(
DetachedSong
*
song
);
void
Lock
EnqueueSong
(
DetachedSong
*
song
);
/**
* Makes the player thread seek the specified song to a position.
...
...
@@ -442,7 +442,7 @@ public:
* @return true on success, false on failure (e.g. if MPD isn't
* playing currently)
*/
bool
Seek
(
DetachedSong
*
song
,
SongTime
t
);
bool
Lock
Seek
(
DetachedSong
*
song
,
SongTime
t
);
void
SetCrossFade
(
float
cross_fade_seconds
);
...
...
src/queue/Playlist.cxx
View file @
36239895
...
...
@@ -57,7 +57,7 @@ playlist::QueueSongOrder(PlayerControl &pc, unsigned order)
FormatDebug
(
playlist_domain
,
"queue song %i:
\"
%s
\"
"
,
queued
,
song
.
GetURI
());
pc
.
EnqueueSong
(
new
DetachedSong
(
song
));
pc
.
Lock
EnqueueSong
(
new
DetachedSong
(
song
));
}
void
...
...
@@ -140,7 +140,7 @@ playlist::UpdateQueuedSong(PlayerControl &pc, const DetachedSong *prev)
if
(
prev
!=
nullptr
&&
next_song
!=
prev
)
{
/* clear the currently queued song */
pc
.
Cancel
();
pc
.
Lock
Cancel
();
queued
=
-
1
;
}
...
...
@@ -235,7 +235,7 @@ playlist::SetRepeat(PlayerControl &pc, bool status)
queue
.
repeat
=
status
;
pc
.
SetBorderPause
(
queue
.
single
&&
!
queue
.
repeat
);
pc
.
Lock
SetBorderPause
(
queue
.
single
&&
!
queue
.
repeat
);
/* if the last song is currently being played, the "next song"
might change when repeat mode is toggled */
...
...
@@ -262,7 +262,7 @@ playlist::SetSingle(PlayerControl &pc, bool status)
queue
.
single
=
status
;
pc
.
SetBorderPause
(
queue
.
single
&&
!
queue
.
repeat
);
pc
.
Lock
SetBorderPause
(
queue
.
single
&&
!
queue
.
repeat
);
/* if the last song is currently being played, the "next song"
might change when single mode is toggled */
...
...
src/queue/PlaylistControl.cxx
View file @
36239895
...
...
@@ -38,7 +38,7 @@ playlist::Stop(PlayerControl &pc)
assert
(
current
>=
0
);
FormatDebug
(
playlist_domain
,
"stop"
);
pc
.
Stop
();
pc
.
Lock
Stop
();
queued
=
-
1
;
playing
=
false
;
...
...
@@ -59,7 +59,7 @@ playlist::Stop(PlayerControl &pc)
PlaylistResult
playlist
::
PlayPosition
(
PlayerControl
&
pc
,
int
song
)
{
pc
.
ClearError
();
pc
.
Lock
ClearError
();
unsigned
i
=
song
;
if
(
song
==
-
1
)
{
...
...
@@ -71,7 +71,7 @@ playlist::PlayPosition(PlayerControl &pc, int song)
if
(
playing
)
{
/* already playing: unpause playback, just in
case it was paused, and return */
pc
.
SetPause
(
false
);
pc
.
Lock
SetPause
(
false
);
return
PlaylistResult
::
SUCCESS
;
}
...
...
@@ -196,7 +196,7 @@ playlist::SeekSongOrder(PlayerControl &pc, unsigned i, SongTime seek_time)
const
DetachedSong
*
queued_song
=
GetQueuedSong
();
pc
.
ClearError
();
pc
.
Lock
ClearError
();
stop_on_error
=
true
;
error_count
=
0
;
...
...
@@ -210,7 +210,7 @@ playlist::SeekSongOrder(PlayerControl &pc, unsigned i, SongTime seek_time)
queued_song
=
nullptr
;
}
if
(
!
pc
.
Seek
(
new
DetachedSong
(
queue
.
GetOrder
(
i
)),
seek_time
))
{
if
(
!
pc
.
Lock
Seek
(
new
DetachedSong
(
queue
.
GetOrder
(
i
)),
seek_time
))
{
UpdateQueuedSong
(
pc
,
queued_song
);
return
PlaylistResult
::
NOT_PLAYING
;
...
...
@@ -254,7 +254,7 @@ playlist::SeekCurrent(PlayerControl &pc,
return
PlaylistResult
::
NOT_PLAYING
;
if
(
relative
)
{
const
auto
status
=
pc
.
GetStatus
();
const
auto
status
=
pc
.
Lock
GetStatus
();
if
(
status
.
state
!=
PlayerState
::
PLAY
&&
status
.
state
!=
PlayerState
::
PAUSE
)
...
...
src/queue/PlaylistEdit.cxx
View file @
36239895
...
...
@@ -252,7 +252,7 @@ playlist::DeleteInternal(PlayerControl &pc,
else
{
/* stop the player */
pc
.
Stop
();
pc
.
Lock
Stop
();
playing
=
false
;
}
...
...
@@ -457,7 +457,7 @@ playlist::SetSongIdRange(PlayerControl &pc, unsigned id,
/* if we're manipulating the "queued" song,
the decoder thread may be decoding it
already; cancel that */
pc
.
Cancel
();
pc
.
Lock
Cancel
();
queued
=
-
1
;
}
}
...
...
src/queue/PlaylistState.cxx
View file @
36239895
...
...
@@ -61,7 +61,7 @@ void
playlist_state_save
(
BufferedOutputStream
&
os
,
const
struct
playlist
&
playlist
,
PlayerControl
&
pc
)
{
const
auto
player_status
=
pc
.
GetStatus
();
const
auto
player_status
=
pc
.
Lock
GetStatus
();
os
.
Write
(
PLAYLIST_STATE_FILE_STATE
);
...
...
@@ -191,7 +191,7 @@ playlist_state_restore(const char *line, TextFile &file,
called here, after the audio output states were
restored, before playback begins */
if
(
state
!=
PlayerState
::
STOP
)
pc
.
UpdateAudio
();
pc
.
Lock
UpdateAudio
();
if
(
state
==
PlayerState
::
STOP
/* && config_option */
)
playlist
.
current
=
current
;
...
...
@@ -201,7 +201,7 @@ playlist_state_restore(const char *line, TextFile &file,
playlist
.
SeekSongPosition
(
pc
,
current
,
seek_time
);
if
(
state
==
PlayerState
::
PAUSE
)
pc
.
Pause
();
pc
.
Lock
Pause
();
}
return
true
;
...
...
@@ -211,7 +211,7 @@ unsigned
playlist_state_get_hash
(
const
playlist
&
playlist
,
PlayerControl
&
pc
)
{
const
auto
player_status
=
pc
.
GetStatus
();
const
auto
player_status
=
pc
.
Lock
GetStatus
();
return
playlist
.
queue
.
version
^
(
player_status
.
state
!=
PlayerState
::
STOP
...
...
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