Fix misleading offset_bytes names
This commit is contained in:
parent
38c51508f2
commit
bb08a0f416
@ -30,6 +30,7 @@
|
||||
|
||||
#include "core/arraysize.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/timeconstants.h"
|
||||
#include "mediapipeline.h"
|
||||
#include "spotifykey.h"
|
||||
#include "spotifymessages.pb.h"
|
||||
@ -279,7 +280,7 @@ void SpotifyClient::MessageArrived(const pb::spotify::Message& message) {
|
||||
} else if (message.has_playback_request()) {
|
||||
StartPlayback(message.playback_request());
|
||||
} else if (message.has_seek_request()) {
|
||||
Seek(message.seek_request().offset_bytes());
|
||||
Seek(message.seek_request().offset_nsec());
|
||||
} else if (message.has_search_request()) {
|
||||
Search(message.search_request());
|
||||
} else if (message.has_image_request()) {
|
||||
@ -844,8 +845,9 @@ void SpotifyClient::StartPlayback(const pb::spotify::PlaybackRequest& req) {
|
||||
TryPlaybackAgain(pending_playback);
|
||||
}
|
||||
|
||||
void SpotifyClient::Seek(qint64 offset_bytes) {
|
||||
if (sp_session_player_seek(session_, offset_bytes) != SP_ERROR_OK) {
|
||||
void SpotifyClient::Seek(qint64 offset_nsec) {
|
||||
if (sp_session_player_seek(session_, offset_nsec / kNsecPerMsec)
|
||||
!= SP_ERROR_OK) {
|
||||
qLog(Error) << "Seek error";
|
||||
return;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ class SpotifyClient : public AbstractMessageHandler<pb::spotify::Message> {
|
||||
void LoadPlaylist(const pb::spotify::LoadPlaylistRequest& req);
|
||||
void SyncPlaylist(const pb::spotify::SyncPlaylistRequest& req);
|
||||
void StartPlayback(const pb::spotify::PlaybackRequest& req);
|
||||
void Seek(qint64 offset_bytes);
|
||||
void Seek(qint64 offset_nsec);
|
||||
void LoadImage(const QString& id_b64);
|
||||
void BrowseAlbum(const QString& uri);
|
||||
void BrowseToplist(const pb::spotify::BrowseToplistRequest& req);
|
||||
|
@ -170,7 +170,7 @@ message BrowseToplistResponse {
|
||||
}
|
||||
|
||||
message SeekRequest {
|
||||
optional int64 offset_bytes = 1;
|
||||
optional int64 offset_nsec = 1;
|
||||
}
|
||||
|
||||
message SeekCompleted {
|
||||
|
@ -947,11 +947,10 @@ bool GstEnginePipeline::Seek(qint64 nanosec) {
|
||||
SpotifyService* spotify = InternetModel::Service<SpotifyService>();
|
||||
// Need to schedule this in the spotify service's thread
|
||||
QMetaObject::invokeMethod(spotify, "Seek", Qt::QueuedConnection,
|
||||
Q_ARG(int, nanosec / kNsecPerMsec));
|
||||
Q_ARG(qint64, nanosec));
|
||||
// Need to reset spotify_offset_ to get the real pipeline position, as it is
|
||||
// used in position()
|
||||
spotify_offset_ = 0;
|
||||
spotify_offset_ = nanosec - position() ;
|
||||
spotify_offset_ = nanosec - position();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -224,11 +224,11 @@ void SpotifyServer::StartPlayback(const QString& uri, quint16 port) {
|
||||
SendOrQueueMessage(message);
|
||||
}
|
||||
|
||||
void SpotifyServer::Seek(qint64 offset_bytes) {
|
||||
void SpotifyServer::Seek(qint64 offset_nsec) {
|
||||
pb::spotify::Message message;
|
||||
pb::spotify::SeekRequest* req = message.mutable_seek_request();
|
||||
|
||||
req->set_offset_bytes(offset_bytes);
|
||||
req->set_offset_nsec(offset_nsec);
|
||||
SendOrQueueMessage(message);
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ class SpotifyServer : public AbstractMessageHandler<pb::spotify::Message> {
|
||||
|
||||
public slots:
|
||||
void StartPlayback(const QString& uri, quint16 port);
|
||||
void Seek(qint64 offset_bytes);
|
||||
void Seek(qint64 offset_nsec);
|
||||
|
||||
signals:
|
||||
void LoginCompleted(bool success, const QString& error,
|
||||
|
@ -693,14 +693,14 @@ void SpotifyService::LoadImage(const QString& id) {
|
||||
server_->LoadImage(id);
|
||||
}
|
||||
|
||||
void SpotifyService::SetPaused(const bool paused) {
|
||||
void SpotifyService::SetPaused(bool paused) {
|
||||
EnsureServerCreated();
|
||||
server_->SetPaused(paused);
|
||||
}
|
||||
|
||||
void SpotifyService::Seek(const int offset /* in msec */) {
|
||||
void SpotifyService::Seek(qint64 offset_nsec) {
|
||||
EnsureServerCreated();
|
||||
server_->Seek(offset);
|
||||
server_->Seek(offset_nsec);
|
||||
}
|
||||
|
||||
void SpotifyService::SyncPlaylistProgress(
|
||||
|
@ -58,8 +58,8 @@ class SpotifyService : public InternetService {
|
||||
void Logout();
|
||||
void Login(const QString& username, const QString& password);
|
||||
Q_INVOKABLE void LoadImage(const QString& id);
|
||||
Q_INVOKABLE void SetPaused(const bool paused);
|
||||
Q_INVOKABLE void Seek(const int offset /* in msec */);
|
||||
Q_INVOKABLE void SetPaused(bool paused);
|
||||
Q_INVOKABLE void Seek(qint64 offset_nsec);
|
||||
|
||||
SpotifyServer* server() const;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user