player: Send request when reporting playback status
Modify the signals emitted by the engine when a url is determined to be valid or invalid to send the entire request. This will allow additional metadata to be added to the request, providing a mechanism to better identify the request source.
This commit is contained in:
parent
651eee13e2
commit
2339404852
|
@ -70,10 +70,10 @@ Player::Player(Application* app, QObject* parent)
|
||||||
|
|
||||||
connect(engine_.get(), SIGNAL(Error(QString)), SIGNAL(Error(QString)));
|
connect(engine_.get(), SIGNAL(Error(QString)), SIGNAL(Error(QString)));
|
||||||
|
|
||||||
connect(engine_.get(), SIGNAL(ValidSongRequested(QUrl)),
|
connect(engine_.get(), SIGNAL(ValidMediaRequested(MediaPlaybackRequest)),
|
||||||
SLOT(ValidSongRequested(QUrl)));
|
SLOT(ValidMediaRequested(MediaPlaybackRequest)));
|
||||||
connect(engine_.get(), SIGNAL(InvalidSongRequested(QUrl)),
|
connect(engine_.get(), SIGNAL(InvalidMediaRequested(MediaPlaybackRequest)),
|
||||||
SLOT(InvalidSongRequested(QUrl)));
|
SLOT(InvalidMediaRequested(MediaPlaybackRequest)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Player::~Player() {}
|
Player::~Player() {}
|
||||||
|
@ -669,13 +669,13 @@ void Player::TrackAboutToEnd() {
|
||||||
|
|
||||||
void Player::IntroPointReached() { NextInternal(Engine::Intro); }
|
void Player::IntroPointReached() { NextInternal(Engine::Intro); }
|
||||||
|
|
||||||
void Player::ValidSongRequested(const QUrl& url) {
|
void Player::ValidMediaRequested(const MediaPlaybackRequest& req) {
|
||||||
emit SongChangeRequestProcessed(url, true);
|
emit SongChangeRequestProcessed(req.url_, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::InvalidSongRequested(const QUrl& url) {
|
void Player::InvalidMediaRequested(const MediaPlaybackRequest& req) {
|
||||||
// first send the notification to others...
|
// first send the notification to others...
|
||||||
emit SongChangeRequestProcessed(url, false);
|
emit SongChangeRequestProcessed(req.url_, false);
|
||||||
// ... and now when our listeners have completed their processing of the
|
// ... and now when our listeners have completed their processing of the
|
||||||
// current item we can change the current item by skipping to the next song
|
// current item we can change the current item by skipping to the next song
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "playlist/playlistitem.h"
|
#include "playlist/playlistitem.h"
|
||||||
|
|
||||||
class Application;
|
class Application;
|
||||||
|
class MediaPlaybackRequest;
|
||||||
class Scrobbler;
|
class Scrobbler;
|
||||||
|
|
||||||
class PlayerInterface : public QObject {
|
class PlayerInterface : public QObject {
|
||||||
|
@ -191,8 +192,8 @@ class Player : public PlayerInterface {
|
||||||
void PlayPlaylistInternal(Engine::TrackChangeFlags,
|
void PlayPlaylistInternal(Engine::TrackChangeFlags,
|
||||||
const QString& playlistName);
|
const QString& playlistName);
|
||||||
|
|
||||||
void ValidSongRequested(const QUrl&);
|
void ValidMediaRequested(const MediaPlaybackRequest&);
|
||||||
void InvalidSongRequested(const QUrl&);
|
void InvalidMediaRequested(const MediaPlaybackRequest&);
|
||||||
|
|
||||||
void UrlHandlerDestroyed(QObject* object);
|
void UrlHandlerDestroyed(QObject* object);
|
||||||
void HandleLoadResult(const UrlHandler::LoadResult& result);
|
void HandleLoadResult(const UrlHandler::LoadResult& result);
|
||||||
|
|
|
@ -116,11 +116,11 @@ class Base : public QObject {
|
||||||
void StatusText(const QString&);
|
void StatusText(const QString&);
|
||||||
void Error(const QString&);
|
void Error(const QString&);
|
||||||
|
|
||||||
// Emitted when Engine was unable to play a song with the given QUrl.
|
// Emitted when Engine was unable to play a request.
|
||||||
void InvalidSongRequested(const QUrl&);
|
void InvalidMediaRequested(const MediaPlaybackRequest&);
|
||||||
// Emitted when Engine successfully started playing a song with the
|
// Emitted when Engine successfully started playing a song with the
|
||||||
// given QUrl.
|
// given request.
|
||||||
void ValidSongRequested(const QUrl&);
|
void ValidMediaRequested(const MediaPlaybackRequest&);
|
||||||
|
|
||||||
void MetaData(const Engine::SimpleMetaBundle&);
|
void MetaData(const Engine::SimpleMetaBundle&);
|
||||||
|
|
||||||
|
|
|
@ -522,8 +522,8 @@ void GstEngine::PlayDone(QFuture<GstStateChangeReturn> future,
|
||||||
}
|
}
|
||||||
|
|
||||||
emit StateChanged(Engine::Playing);
|
emit StateChanged(Engine::Playing);
|
||||||
// we've successfully started playing a media stream with this url
|
// we've successfully started playing this request
|
||||||
emit ValidSongRequested(playback_req_.url_);
|
emit ValidMediaRequested(playback_req_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEngine::Stop(bool stop_after) {
|
void GstEngine::Stop(bool stop_after) {
|
||||||
|
@ -727,8 +727,8 @@ void GstEngine::HandlePipelineError(int pipeline_id, const QString& message,
|
||||||
|
|
||||||
BufferingFinished();
|
BufferingFinished();
|
||||||
emit StateChanged(Engine::Error);
|
emit StateChanged(Engine::Error);
|
||||||
// unable to play media stream with this url
|
// Unable to play this media request
|
||||||
emit InvalidSongRequested(playback_req_.url_);
|
emit InvalidMediaRequested(playback_req_);
|
||||||
|
|
||||||
// TODO: the types of errors listed below won't be shown to user - they will
|
// TODO: the types of errors listed below won't be shown to user - they will
|
||||||
// get logged and the current song will be skipped; instead of maintaining
|
// get logged and the current song will be skipped; instead of maintaining
|
||||||
|
|
Loading…
Reference in New Issue