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