diff --git a/src/core/player.cpp b/src/core/player.cpp index 425903a9d..a4981d347 100644 --- a/src/core/player.cpp +++ b/src/core/player.cpp @@ -199,7 +199,7 @@ bool Player::HandleStopAfter() { app_->playlist_manager()->active()->StopAfter(-1); - Stop(); + Stop(true); return true; } return false; @@ -264,8 +264,8 @@ void Player::RestartOrPrevious() { SeekTo(0); } -void Player::Stop() { - engine_->Stop(); +void Player::Stop(bool stop_after) { + engine_->Stop(stop_after); app_->playlist_manager()->active()->set_current_row(-1); current_item_.reset(); } diff --git a/src/core/player.h b/src/core/player.h index 9dd26eab4..d300b5cb3 100644 --- a/src/core/player.h +++ b/src/core/player.h @@ -78,7 +78,7 @@ class PlayerInterface : public QObject { virtual void Mute() = 0; virtual void Pause() = 0; - virtual void Stop() = 0; + virtual void Stop(bool stop_after = false) = 0; virtual void Play() = 0; virtual void ShowOSD() = 0; @@ -143,7 +143,7 @@ class Player : public PlayerInterface { void Mute(); void Pause(); - void Stop(); + void Stop(bool stop_after = false); void StopAfterCurrent(); void Play(); void ShowOSD(); diff --git a/src/engines/enginebase.h b/src/engines/enginebase.h index 29c199f73..7dc3c6b06 100644 --- a/src/engines/enginebase.h +++ b/src/engines/enginebase.h @@ -47,7 +47,7 @@ class Base : public QObject { virtual void StartPreloading(const QUrl&, bool, qint64, qint64) {} virtual bool Play(quint64 offset_nanosec) = 0; - virtual void Stop() = 0; + virtual void Stop(bool stop_after = false) = 0; virtual void Pause() = 0; virtual void Unpause() = 0; virtual void Seek(quint64 offset_nanosec) = 0; diff --git a/src/engines/gstengine.cpp b/src/engines/gstengine.cpp index 56b166e71..105092f4d 100644 --- a/src/engines/gstengine.cpp +++ b/src/engines/gstengine.cpp @@ -433,13 +433,13 @@ void GstEngine::PlayDone() { emit ValidSongRequested(url_); } -void GstEngine::Stop() { +void GstEngine::Stop(bool stop_after) { StopTimers(); url_ = QUrl(); // To ensure we return Empty from state() beginning_nanosec_ = end_nanosec_ = 0; - if (fadeout_enabled_ && current_pipeline_) StartFadeout(); + if (fadeout_enabled_ && current_pipeline_ && !stop_after) StartFadeout(); current_pipeline_.reset(); BufferingFinished(); @@ -672,8 +672,8 @@ GstElement* GstEngine::CreateElement(const QString& factoryName, return element; } -GstEngine::PluginDetailsList GstEngine::GetPluginList(const QString& classname) - const { +GstEngine::PluginDetailsList GstEngine::GetPluginList( + const QString& classname) const { PluginDetailsList ret; GstRegistry* registry = gst_registry_get_default(); diff --git a/src/engines/gstengine.h b/src/engines/gstengine.h index 30d9d2c64..bd2ceb73d 100644 --- a/src/engines/gstengine.h +++ b/src/engines/gstengine.h @@ -96,7 +96,7 @@ class GstEngine : public Engine::Base, public BufferConsumer { bool force_stop_at_end, quint64 beginning_nanosec, qint64 end_nanosec); bool Play(quint64 offset_nanosec); - void Stop(); + void Stop(bool stop_after = false); void Pause(); void Unpause(); void Seek(quint64 offset_nanosec); @@ -219,7 +219,7 @@ class GstEngine : public Engine::Base, public BufferConsumer { int timer_id_; int next_element_id_; - QHash > background_streams_; + QHash> background_streams_; bool is_fading_out_to_pause_; bool has_faded_out_;