mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-24 16:31:22 +01:00
Cache the last emitted state from the engine to fix some invalid values being emitted over DBUS while a last.fm stream is buffering. Fixes issue #374
This commit is contained in:
parent
2b77c894db
commit
01cccc0468
@ -62,6 +62,7 @@ Player::Player(MainWindow* main_window, PlaylistManager* playlists,
|
||||
lastfm_(lastfm),
|
||||
engine_(CreateEngine(engine)),
|
||||
stream_change_type_(Engine::First),
|
||||
last_state_(Engine::Empty),
|
||||
volume_before_mute_(50)
|
||||
{
|
||||
// Loads album art and saves it to a file in /tmp for MPRIS clients and those
|
||||
@ -75,7 +76,6 @@ Player::Player(MainWindow* main_window, PlaylistManager* playlists,
|
||||
qDBusRegisterMetaType<TrackMetadata>();
|
||||
qDBusRegisterMetaType<TrackIds>();
|
||||
|
||||
|
||||
//MPRIS 1.0 implementation
|
||||
mpris1_ = new mpris::Mpris1(this, art_loader_, this);
|
||||
|
||||
@ -279,6 +279,7 @@ void Player::EngineStateChanged(Engine::State state) {
|
||||
case Engine::Empty:
|
||||
case Engine::Idle: emit Stopped(); break;
|
||||
}
|
||||
last_state_ = state;
|
||||
}
|
||||
|
||||
void Player::SetVolume(int value) {
|
||||
@ -298,10 +299,6 @@ int Player::GetVolume() const {
|
||||
return engine_->volume();
|
||||
}
|
||||
|
||||
Engine::State Player::GetState() const {
|
||||
return engine_->state();
|
||||
}
|
||||
|
||||
void Player::PlayAt(int index, Engine::TrackChangeType change, bool reshuffle) {
|
||||
if (change == Engine::Manual && engine_->position() != engine_->length()) {
|
||||
emit TrackSkipped(current_item_);
|
||||
|
@ -57,7 +57,7 @@ class Player : public QObject {
|
||||
void Init();
|
||||
|
||||
EngineBase* engine() const { return engine_.get(); }
|
||||
Engine::State GetState() const;
|
||||
Engine::State GetState() const { return last_state_; }
|
||||
int GetVolume() const;
|
||||
|
||||
PlaylistItemPtr GetCurrentItem() const { return current_item_; }
|
||||
@ -131,6 +131,7 @@ class Player : public QObject {
|
||||
|
||||
boost::scoped_ptr<EngineBase> engine_;
|
||||
Engine::TrackChangeType stream_change_type_;
|
||||
Engine::State last_state_;
|
||||
|
||||
QUrl loading_async_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user