From e338939c8b1c9cb3654d822664904a1b7310a944 Mon Sep 17 00:00:00 2001 From: Jim Broadus Date: Wed, 19 Feb 2020 22:51:22 -0800 Subject: [PATCH] Add optional auth info to LoadResult. Add auth_header_ to LoadResult. If it exists, populate the MediaPlaybackRequests headers with an Authorization header with that value. --- src/core/player.cpp | 2 ++ src/core/urlhandler.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/core/player.cpp b/src/core/player.cpp index a090cc376..2e1a91a6a 100644 --- a/src/core/player.cpp +++ b/src/core/player.cpp @@ -147,6 +147,8 @@ void Player::HandleLoadResult(const UrlHandler::LoadResult& result) { app_->playlist_manager()->active()->InformOfCurrentSongChange(); } MediaPlaybackRequest req(result.media_url_); + if (!result.auth_header_.isEmpty()) + req.headers_["Authorization"] = result.auth_header_; engine_->Play(req, stream_change_type_, item->Metadata().has_cue(), item->Metadata().beginning_nanosec(), item->Metadata().end_nanosec()); diff --git a/src/core/urlhandler.h b/src/core/urlhandler.h index f827a03ce..721119dcf 100644 --- a/src/core/urlhandler.h +++ b/src/core/urlhandler.h @@ -66,6 +66,9 @@ class UrlHandler : public QObject { // Track length, if we are able to get it only now qint64 length_nanosec_; + + // If non-empty, value for an Authorization header. + QByteArray auth_header_; }; // Called by the Player when a song starts loading - gives the handler