mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-11 01:14:24 +01:00
player: Add original request URL to playback request
This commit is contained in:
parent
2339404852
commit
bde6d9cc5b
@ -146,7 +146,7 @@ void Player::HandleLoadResult(const UrlHandler::LoadResult& result) {
|
||||
item->SetTemporaryMetadata(song);
|
||||
app_->playlist_manager()->active()->InformOfCurrentSongChange();
|
||||
}
|
||||
MediaPlaybackRequest req(result.media_url_);
|
||||
MediaPlaybackRequest req(result.original_url_, result.media_url_);
|
||||
if (!result.auth_header_.isEmpty())
|
||||
req.headers_["Authorization"] = result.auth_header_;
|
||||
engine_->Play(req, stream_change_type_, item->Metadata().has_cue(),
|
||||
@ -643,25 +643,25 @@ void Player::TrackAboutToEnd() {
|
||||
// gap between songs.
|
||||
if (!has_next_row || !next_item) return;
|
||||
|
||||
QUrl url = next_item->Url();
|
||||
MediaPlaybackRequest req(next_item->Url());
|
||||
|
||||
// Get the actual track URL rather than the stream URL.
|
||||
if (url_handlers_.contains(url.scheme())) {
|
||||
UrlHandler::LoadResult result = url_handlers_[url.scheme()]->LoadNext(url);
|
||||
UrlHandler* handler = url_handlers_.value(req.RequestUrl().scheme(), nullptr);
|
||||
if (handler != nullptr) {
|
||||
UrlHandler::LoadResult result = handler->LoadNext(req.RequestUrl());
|
||||
switch (result.type_) {
|
||||
case UrlHandler::LoadResult::NoMoreTracks:
|
||||
return;
|
||||
|
||||
case UrlHandler::LoadResult::WillLoadAsynchronously:
|
||||
loading_async_ = url;
|
||||
loading_async_ = req.RequestUrl();
|
||||
return;
|
||||
|
||||
case UrlHandler::LoadResult::TrackAvailable:
|
||||
url = result.media_url_;
|
||||
req.SetMediaUrl(result.media_url_);
|
||||
break;
|
||||
}
|
||||
}
|
||||
MediaPlaybackRequest req(url);
|
||||
engine_->StartPreloading(req, next_item->Metadata().has_cue(),
|
||||
next_item->Metadata().beginning_nanosec(),
|
||||
next_item->Metadata().end_nanosec());
|
||||
|
@ -23,9 +23,17 @@
|
||||
|
||||
class MediaPlaybackRequest {
|
||||
public:
|
||||
MediaPlaybackRequest(const QUrl& url) : url_(url) {}
|
||||
// For local songs and raw streams, the request and media URLs are the same.
|
||||
MediaPlaybackRequest(const QUrl& url) : request_url_(url), url_(url) {}
|
||||
MediaPlaybackRequest(const QUrl& request_url, const QUrl& media_url)
|
||||
: request_url_(request_url), url_(media_url) {}
|
||||
MediaPlaybackRequest() {}
|
||||
|
||||
const QUrl& RequestUrl() const { return request_url_; }
|
||||
const QUrl& MediaUrl() const { return url_; }
|
||||
void SetMediaUrl(const QUrl& url) { url_ = url; }
|
||||
|
||||
QUrl request_url_;
|
||||
QUrl url_;
|
||||
|
||||
typedef QMap<QByteArray, QByteArray> HeaderList;
|
||||
|
Loading…
Reference in New Issue
Block a user