summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-11-26 12:02:08 +0100
committerMax Kellermann <max@musicpd.org>2017-11-26 12:02:08 +0100
commit624e679e35f8cd3ff6bdf86e7de11db58285e586 (patch)
treedb1a62b0cb42fe98ab70c3fcd015327639c39ec9 /src
parent618704f50497f22bc02235648a56c50f651afc47 (diff)
player/Control: add "noexcept"
Diffstat (limited to 'src')
-rw-r--r--src/player/Control.cxx38
-rw-r--r--src/player/Control.hxx92
-rw-r--r--src/player/Thread.cxx2
3 files changed, 66 insertions, 66 deletions
diff --git a/src/player/Control.cxx b/src/player/Control.cxx
index 013b57bf5..a34b8b22a 100644
--- a/src/player/Control.cxx
+++ b/src/player/Control.cxx
@@ -32,7 +32,7 @@ PlayerControl::PlayerControl(PlayerListener &_listener,
unsigned _buffer_chunks,
unsigned _buffered_before_play,
AudioFormat _configured_audio_format,
- const ReplayGainConfig &_replay_gain_config)
+ const ReplayGainConfig &_replay_gain_config) noexcept
:listener(_listener), outputs(_outputs),
buffer_chunks(_buffer_chunks),
buffered_before_play(_buffered_before_play),
@@ -42,14 +42,14 @@ PlayerControl::PlayerControl(PlayerListener &_listener,
{
}
-PlayerControl::~PlayerControl()
+PlayerControl::~PlayerControl() noexcept
{
delete next_song;
delete tagged_song;
}
bool
-PlayerControl::WaitOutputConsumed(unsigned threshold)
+PlayerControl::WaitOutputConsumed(unsigned threshold) noexcept
{
bool result = outputs.Check() < threshold;
if (!result && command == PlayerCommand::NONE) {
@@ -75,14 +75,14 @@ PlayerControl::Play(DetachedSong *song)
}
void
-PlayerControl::LockCancel()
+PlayerControl::LockCancel() noexcept
{
LockSynchronousCommand(PlayerCommand::CANCEL);
assert(next_song == nullptr);
}
void
-PlayerControl::LockStop()
+PlayerControl::LockStop() noexcept
{
LockSynchronousCommand(PlayerCommand::CLOSE_AUDIO);
assert(next_song == nullptr);
@@ -91,13 +91,13 @@ PlayerControl::LockStop()
}
void
-PlayerControl::LockUpdateAudio()
+PlayerControl::LockUpdateAudio() noexcept
{
LockSynchronousCommand(PlayerCommand::UPDATE_AUDIO);
}
void
-PlayerControl::Kill()
+PlayerControl::Kill() noexcept
{
assert(thread.IsDefined());
@@ -108,7 +108,7 @@ PlayerControl::Kill()
}
void
-PlayerControl::PauseLocked()
+PlayerControl::PauseLocked() noexcept
{
if (state != PlayerState::STOP) {
SynchronousCommand(PlayerCommand::PAUSE);
@@ -117,14 +117,14 @@ PlayerControl::PauseLocked()
}
void
-PlayerControl::LockPause()
+PlayerControl::LockPause() noexcept
{
const std::lock_guard<Mutex> protect(mutex);
PauseLocked();
}
void
-PlayerControl::LockSetPause(bool pause_flag)
+PlayerControl::LockSetPause(bool pause_flag) noexcept
{
const std::lock_guard<Mutex> protect(mutex);
@@ -145,7 +145,7 @@ PlayerControl::LockSetPause(bool pause_flag)
}
void
-PlayerControl::LockSetBorderPause(bool _border_pause)
+PlayerControl::LockSetBorderPause(bool _border_pause) noexcept
{
const std::lock_guard<Mutex> protect(mutex);
border_pause = _border_pause;
@@ -172,7 +172,7 @@ PlayerControl::LockGetStatus() noexcept
}
void
-PlayerControl::SetError(PlayerError type, std::exception_ptr &&_error)
+PlayerControl::SetError(PlayerError type, std::exception_ptr &&_error) noexcept
{
assert(type != PlayerError::NONE);
assert(_error);
@@ -182,14 +182,14 @@ PlayerControl::SetError(PlayerError type, std::exception_ptr &&_error)
}
void
-PlayerControl::LockClearError()
+PlayerControl::LockClearError() noexcept
{
const std::lock_guard<Mutex> protect(mutex);
ClearError();
}
void
-PlayerControl::LockSetTaggedSong(const DetachedSong &song)
+PlayerControl::LockSetTaggedSong(const DetachedSong &song) noexcept
{
const std::lock_guard<Mutex> protect(mutex);
delete tagged_song;
@@ -197,14 +197,14 @@ PlayerControl::LockSetTaggedSong(const DetachedSong &song)
}
void
-PlayerControl::ClearTaggedSong()
+PlayerControl::ClearTaggedSong() noexcept
{
delete tagged_song;
tagged_song = nullptr;
}
void
-PlayerControl::LockEnqueueSong(DetachedSong *song)
+PlayerControl::LockEnqueueSong(DetachedSong *song) noexcept
{
assert(song != nullptr);
@@ -255,7 +255,7 @@ PlayerControl::LockSeek(DetachedSong *song, SongTime t)
}
void
-PlayerControl::SetCrossFade(float _cross_fade_seconds)
+PlayerControl::SetCrossFade(float _cross_fade_seconds) noexcept
{
if (_cross_fade_seconds < 0)
_cross_fade_seconds = 0;
@@ -265,7 +265,7 @@ PlayerControl::SetCrossFade(float _cross_fade_seconds)
}
void
-PlayerControl::SetMixRampDb(float _mixramp_db)
+PlayerControl::SetMixRampDb(float _mixramp_db) noexcept
{
cross_fade.mixramp_db = _mixramp_db;
@@ -273,7 +273,7 @@ PlayerControl::SetMixRampDb(float _mixramp_db)
}
void
-PlayerControl::SetMixRampDelay(float _mixramp_delay_seconds)
+PlayerControl::SetMixRampDelay(float _mixramp_delay_seconds) noexcept
{
cross_fade.mixramp_delay = _mixramp_delay_seconds;
diff --git a/src/player/Control.hxx b/src/player/Control.hxx
index 39e24e4f8..e5a0e27be 100644
--- a/src/player/Control.hxx
+++ b/src/player/Control.hxx
@@ -194,20 +194,20 @@ struct PlayerControl final : AudioOutputClient {
unsigned buffer_chunks,
unsigned buffered_before_play,
AudioFormat _configured_audio_format,
- const ReplayGainConfig &_replay_gain_config);
- ~PlayerControl();
+ const ReplayGainConfig &_replay_gain_config) noexcept;
+ ~PlayerControl() noexcept;
/**
* Locks the object.
*/
- void Lock() const {
+ void Lock() const noexcept {
mutex.lock();
}
/**
* Unlocks the object.
*/
- void Unlock() const {
+ void Unlock() const noexcept {
mutex.unlock();
}
@@ -215,7 +215,7 @@ struct PlayerControl final : AudioOutputClient {
* Signals the object. The object should be locked prior to
* calling this function.
*/
- void Signal() {
+ void Signal() noexcept {
cond.signal();
}
@@ -223,7 +223,7 @@ struct PlayerControl final : AudioOutputClient {
* Signals the object. The object is temporarily locked by
* this function.
*/
- void LockSignal() {
+ void LockSignal() noexcept {
const std::lock_guard<Mutex> protect(mutex);
Signal();
}
@@ -233,7 +233,7 @@ struct PlayerControl final : AudioOutputClient {
* valid in the player thread. The object must be locked
* prior to calling this function.
*/
- void Wait() {
+ void Wait() noexcept {
assert(thread.IsInside());
cond.wait(mutex);
@@ -244,7 +244,7 @@ struct PlayerControl final : AudioOutputClient {
*
* Caller must lock the object.
*/
- void ClientSignal() {
+ void ClientSignal() noexcept {
assert(thread.IsInside());
client_cond.signal();
@@ -256,7 +256,7 @@ struct PlayerControl final : AudioOutputClient {
*
* Caller must lock the object.
*/
- void ClientWait() {
+ void ClientWait() noexcept {
assert(!thread.IsInside());
client_cond.wait(mutex);
@@ -269,14 +269,14 @@ struct PlayerControl final : AudioOutputClient {
* To be called from the player thread. Caller must lock the
* object.
*/
- void CommandFinished() {
+ void CommandFinished() noexcept {
assert(command != PlayerCommand::NONE);
command = PlayerCommand::NONE;
ClientSignal();
}
- void LockCommandFinished() {
+ void LockCommandFinished() noexcept {
const std::lock_guard<Mutex> protect(mutex);
CommandFinished();
}
@@ -291,9 +291,9 @@ struct PlayerControl final : AudioOutputClient {
* @param threshold the maximum number of chunks in the pipe
* @return true if there are less than #threshold chunks in the pipe
*/
- bool WaitOutputConsumed(unsigned threshold);
+ bool WaitOutputConsumed(unsigned threshold) noexcept;
- bool LockWaitOutputConsumed(unsigned threshold) {
+ bool LockWaitOutputConsumed(unsigned threshold) noexcept {
const std::lock_guard<Mutex> protect(mutex);
return WaitOutputConsumed(threshold);
}
@@ -305,7 +305,7 @@ private:
* To be called from the main thread. Caller must lock the
* object.
*/
- void WaitCommandLocked() {
+ void WaitCommandLocked() noexcept {
while (command != PlayerCommand::NONE)
ClientWait();
}
@@ -349,43 +349,43 @@ public:
/**
* see PlayerCommand::CANCEL
*/
- void LockCancel();
+ void LockCancel() noexcept;
- void LockSetPause(bool pause_flag);
+ void LockSetPause(bool pause_flag) noexcept;
private:
- void PauseLocked();
+ void PauseLocked() noexcept;
- void ClearError() {
+ void ClearError() noexcept {
error_type = PlayerError::NONE;
error = std::exception_ptr();
}
public:
- void LockPause();
+ void LockPause() noexcept;
/**
* Set the player's #border_pause flag.
*/
- void LockSetBorderPause(bool border_pause);
+ void LockSetBorderPause(bool border_pause) noexcept;
- bool ApplyBorderPause() {
+ bool ApplyBorderPause() noexcept {
if (border_pause)
state = PlayerState::PAUSE;
return border_pause;
}
- bool LockApplyBorderPause() {
+ bool LockApplyBorderPause() noexcept {
const std::lock_guard<Mutex> lock(mutex);
return ApplyBorderPause();
}
- void Kill();
+ void Kill() noexcept;
gcc_pure
player_status LockGetStatus() noexcept;
- PlayerState GetState() const {
+ PlayerState GetState() const noexcept {
return state;
}
@@ -396,12 +396,12 @@ public:
*
* @param type the error type; must not be #PlayerError::NONE
*/
- void SetError(PlayerError type, std::exception_ptr &&_error);
+ void SetError(PlayerError type, std::exception_ptr &&_error) noexcept;
/**
* Set the error and set state to PlayerState::PAUSE.
*/
- void SetOutputError(std::exception_ptr &&_error) {
+ void SetOutputError(std::exception_ptr &&_error) noexcept {
SetError(PlayerError::OUTPUT, std::move(_error));
/* pause: the user may resume playback as soon as an
@@ -409,7 +409,7 @@ public:
state = PlayerState::PAUSE;
}
- void LockSetOutputError(std::exception_ptr &&_error) {
+ void LockSetOutputError(std::exception_ptr &&_error) noexcept {
const std::lock_guard<Mutex> lock(mutex);
SetOutputError(std::move(_error));
}
@@ -433,9 +433,9 @@ public:
CheckRethrowError();
}
- void LockClearError();
+ void LockClearError() noexcept;
- PlayerError GetErrorType() const {
+ PlayerError GetErrorType() const noexcept {
return error_type;
}
@@ -443,16 +443,16 @@ public:
* Set the #tagged_song attribute to a newly allocated copy of
* the given #DetachedSong. Locks and unlocks the object.
*/
- void LockSetTaggedSong(const DetachedSong &song);
+ void LockSetTaggedSong(const DetachedSong &song) noexcept;
- void ClearTaggedSong();
+ void ClearTaggedSong() noexcept;
/**
* Read and clear the #tagged_song attribute.
*
* Caller must lock the object.
*/
- DetachedSong *ReadTaggedSong() {
+ DetachedSong *ReadTaggedSong() noexcept {
DetachedSong *result = tagged_song;
tagged_song = nullptr;
return result;
@@ -461,17 +461,17 @@ public:
/**
* Like ReadTaggedSong(), but locks and unlocks the object.
*/
- DetachedSong *LockReadTaggedSong() {
+ DetachedSong *LockReadTaggedSong() noexcept {
const std::lock_guard<Mutex> protect(mutex);
return ReadTaggedSong();
}
- void LockStop();
+ void LockStop() noexcept;
- void LockUpdateAudio();
+ void LockUpdateAudio() noexcept;
private:
- void EnqueueSongLocked(DetachedSong *song) {
+ void EnqueueSongLocked(DetachedSong *song) noexcept {
assert(song != nullptr);
assert(next_song == nullptr);
@@ -490,7 +490,7 @@ public:
* @param song the song to be queued; the given instance will be owned
* and freed by the player
*/
- void LockEnqueueSong(DetachedSong *song);
+ void LockEnqueueSong(DetachedSong *song) noexcept;
/**
* Makes the player thread seek the specified song to a position.
@@ -502,30 +502,30 @@ public:
*/
void LockSeek(DetachedSong *song, SongTime t);
- void SetCrossFade(float cross_fade_seconds);
+ void SetCrossFade(float cross_fade_seconds) noexcept;
- float GetCrossFade() const {
+ float GetCrossFade() const noexcept {
return cross_fade.duration;
}
- void SetMixRampDb(float mixramp_db);
+ void SetMixRampDb(float mixramp_db) noexcept;
- float GetMixRampDb() const {
+ float GetMixRampDb() const noexcept {
return cross_fade.mixramp_db;
}
- void SetMixRampDelay(float mixramp_delay_seconds);
+ void SetMixRampDelay(float mixramp_delay_seconds) noexcept;
- float GetMixRampDelay() const {
+ float GetMixRampDelay() const noexcept {
return cross_fade.mixramp_delay;
}
- void LockSetReplayGainMode(ReplayGainMode _mode) {
+ void LockSetReplayGainMode(ReplayGainMode _mode) noexcept {
const std::lock_guard<Mutex> protect(mutex);
replay_gain_mode = _mode;
}
- double GetTotalPlayTime() const {
+ double GetTotalPlayTime() const noexcept {
return total_play_time;
}
@@ -539,7 +539,7 @@ public:
}
private:
- void RunThread();
+ void RunThread() noexcept;
};
#endif
diff --git a/src/player/Thread.cxx b/src/player/Thread.cxx
index 90431ef90..de8b80803 100644
--- a/src/player/Thread.cxx
+++ b/src/player/Thread.cxx
@@ -1146,7 +1146,7 @@ do_play(PlayerControl &pc, DecoderControl &dc,
}
void
-PlayerControl::RunThread()
+PlayerControl::RunThread() noexcept
{
SetThreadName("player");