diff --git a/OpenHome/Av/Tests/TestMediaPlayer.cpp b/OpenHome/Av/Tests/TestMediaPlayer.cpp index e46e6b7c7..5ba8358d8 100755 --- a/OpenHome/Av/Tests/TestMediaPlayer.cpp +++ b/OpenHome/Av/Tests/TestMediaPlayer.cpp @@ -161,7 +161,7 @@ const TUint TestMediaPlayer::kDsdPadBytesPerChunk; TestMediaPlayer::TestMediaPlayer(Net::DvStack& aDvStack, Net::CpStack& aCpStack, const Brx& aUdn, const TChar* aRoom, const TChar* aProductName, const Brx& aTuneInPartnerId, const Brx& aTidalId, const Brx& aQobuzIdSecret, const Brx& aUserAgent, - const TChar* aStoreFile, TUint aMaxTidalAudioQuality, TUint aOdpPort, TUint aWebUiPort, + const TChar* aStoreFile, TUint aOdpPort, TUint aWebUiPort, TUint aMinWebUiResourceThreads, TUint aMaxWebUiTabs, TUint aUiSendQueueSize, TUint aUiMsgBufCount, TUint aUiMsgBufBytes) : iPullableClock(nullptr) @@ -184,7 +184,6 @@ TestMediaPlayer::TestMediaPlayer(Net::DvStack& aDvStack, Net::CpStack& aCpStack, , iUiSendQueueSize(aUiSendQueueSize) , iUiMsgBufCount(aUiMsgBufCount) , iUiMsgBufBytes(aUiMsgBufBytes) - , iMaxTidalAudioQuality(aMaxTidalAudioQuality) { Log::Print("Shell running on port %u\n", aDvStack.Env().Shell()->Port()); iInfoLogger = new Media::AllocatorInfoLogger(); @@ -499,7 +498,7 @@ void TestMediaPlayer::RegisterPlugins(Environment& aEnv) Log::Print(" App: ID: %.*s - ClientId = %.*s, Secret = %.*s\n", PBUF(v.AppId()), PBUF(v.ClientId()), PBUF(v.ClientSecret())); } - iMediaPlayer->Add(ProtocolFactory::NewTidal(aEnv, ssl, clientId, clientSecret, apps, iMaxTidalAudioQuality, *iMediaPlayer)); + iMediaPlayer->Add(ProtocolFactory::NewTidal(aEnv, ssl, clientId, clientSecret, apps, *iMediaPlayer)); } // ...likewise, only add Qobuz if we have ids for login if (iQobuzIdSecret.Bytes() > 0) { diff --git a/OpenHome/Av/Tests/TestMediaPlayer.h b/OpenHome/Av/Tests/TestMediaPlayer.h index 776700c7a..ca16f9905 100644 --- a/OpenHome/Av/Tests/TestMediaPlayer.h +++ b/OpenHome/Av/Tests/TestMediaPlayer.h @@ -134,11 +134,10 @@ class TestMediaPlayer : private Net::IResourceManager, public IPowerHandler/*, p static const TUint kDsdMaxSampleRate = 11289600; // DSD256 static const TUint kDsdSampleBlockWords = 6; // Specifies if the test player outputs DSD as 16xL, 16xR [32 bits = 1 word] or 4 x (24xL, 24xR) [192 bits = 6] static const TUint kDsdPadBytesPerChunk = 2; - static const TUint kDefaultMaxTidalAudioQuality = 13034431; // Suitably large so we're clamped to the highest. Revisit if TIDAL ever offer more than this number of qualities public: TestMediaPlayer(Net::DvStack& aDvStack, Net::CpStack& aCpStack, const Brx& aUdn, const TChar* aRoom, const TChar* aProductName, const Brx& aTuneInPartnerId, const Brx& aTidalId, const Brx& aQobuzIdSecret, const Brx& aUserAgent, - const TChar* aStoreFile, TUint aMaxTidalAudioQuality = kDefaultMaxTidalAudioQuality, TUint aOdpPort=0, TUint aWebUiPort=0, + const TChar* aStoreFile, TUint aOdpPort=0, TUint aWebUiPort=0, TUint aMinWebUiResourceThreads=kMinWebUiResourceThreads, TUint aMaxWebUiTabs=kMaxWebUiTabs, TUint aUiSendQueueSize=kUiSendQueueSize, TUint aUiMsgBufCount=kUiMsgBufCount, TUint aUiMsgBufBytes=kUiMsgBufBytes); virtual ~TestMediaPlayer(); void SetPullableClock(Media::IPullableClock& aPullableClock); @@ -217,7 +216,6 @@ class TestMediaPlayer : private Net::IResourceManager, public IPowerHandler/*, p TUint iUiSendQueueSize; TUint iUiMsgBufCount; TUint iUiMsgBufBytes; - const TUint iMaxTidalAudioQuality; }; class TestMediaPlayerOptions @@ -241,7 +239,6 @@ class TestMediaPlayerOptions const TestFramework::OptionUint& OptionOdp() const; const TestFramework::OptionUint& OptionWebUi() const; const TestFramework::OptionUint& Shell() const; - const TestFramework::OptionUint& TidalMaxAudioQuality() const; private: TestFramework::OptionParser iParser; TestFramework::OptionString iOptionRoom; @@ -259,7 +256,6 @@ class TestMediaPlayerOptions TestFramework::OptionUint iOptionOdp; TestFramework::OptionUint iOptionWebUi; TestFramework::OptionUint iOptionShell; - TestFramework::OptionUint iOptionTidalMaxAudioQuality; }; // Not very nice, but only to allow reusable test functions. diff --git a/OpenHome/Av/Tests/TestMediaPlayerMain.cpp b/OpenHome/Av/Tests/TestMediaPlayerMain.cpp index e6398a804..5ffa09c57 100644 --- a/OpenHome/Av/Tests/TestMediaPlayerMain.cpp +++ b/OpenHome/Av/Tests/TestMediaPlayerMain.cpp @@ -74,7 +74,7 @@ void TestMediaPlayerThread::RunInThread() // Create TestMediaPlayer. TestMediaPlayer* tmp = new TestMediaPlayer(*dvStack, *cpStack, udn, iOptions.Room().CString(), iOptions.Name().CString(), iOptions.TuneIn().Value(), iOptions.Tidal().Value(), iOptions.Qobuz().Value(), - iOptions.UserAgent().Value(), iOptions.StoreFile().CString(), iOptions.TidalMaxAudioQuality().Value(), iOptions.OptionOdp().Value(), iOptions.OptionWebUi().Value()); + iOptions.UserAgent().Value(), iOptions.StoreFile().CString(), iOptions.OptionOdp().Value(), iOptions.OptionWebUi().Value()); Media::AnimatorBasic* animator = new Media::AnimatorBasic( dvStack->Env(), tmp->Pipeline(), diff --git a/OpenHome/Av/Tests/TestMediaPlayerOptions.cpp b/OpenHome/Av/Tests/TestMediaPlayerOptions.cpp index a44bec64b..4e8f4c836 100644 --- a/OpenHome/Av/Tests/TestMediaPlayerOptions.cpp +++ b/OpenHome/Av/Tests/TestMediaPlayerOptions.cpp @@ -7,10 +7,6 @@ using namespace OpenHome; using namespace OpenHome::TestFramework; using namespace OpenHome::Av::Test; -// NOTE: We set this to a suitably high number as default so that internally TIDAL clamp to the highest available, unless otherwise specified -// It's really unlikely that TIDAL will offer that many qualities in the future, but we can revisit this in the future if it does -static const TUint kDefaultTidalMaxAudioQuality = 13043431; - TestMediaPlayerOptions::TestMediaPlayerOptions() : iOptionRoom("-r", "--room", Brn(""), "room the Product service will report") , iOptionName("-n", "--name", Brn("SoftPlayer"), "Product name") @@ -27,7 +23,6 @@ TestMediaPlayerOptions::TestMediaPlayerOptions() , iOptionOdp("", "--odp", 0, "Port for ODP server") , iOptionWebUi("", "--webui", 0, "Port for Web UI server") , iOptionShell("", "--shell", 0, "Port for shell") - , iOptionTidalMaxAudioQuality("", "--tidalMaxAudioQuality", kDefaultTidalMaxAudioQuality, "Default audio quality for TIDAL streaming. 0 = LOSSY ... 3 = HI_RES") { iParser.AddOption(&iOptionRoom); iParser.AddOption(&iOptionName); @@ -44,7 +39,6 @@ TestMediaPlayerOptions::TestMediaPlayerOptions() iParser.AddOption(&iOptionOdp); iParser.AddOption(&iOptionWebUi); iParser.AddOption(&iOptionShell); - iParser.AddOption(&iOptionTidalMaxAudioQuality); } void TestMediaPlayerOptions::AddOption(Option* aOption) @@ -131,8 +125,3 @@ const OptionUint& TestMediaPlayerOptions::Shell() const { return iOptionShell; } - -const OptionUint& TestMediaPlayerOptions::TidalMaxAudioQuality() const -{ - return iOptionTidalMaxAudioQuality; -} diff --git a/OpenHome/Av/Tidal/ProtocolTidal.cpp b/OpenHome/Av/Tidal/ProtocolTidal.cpp index a815b91c9..fca0691fb 100644 --- a/OpenHome/Av/Tidal/ProtocolTidal.cpp +++ b/OpenHome/Av/Tidal/ProtocolTidal.cpp @@ -99,7 +99,6 @@ Protocol* ProtocolFactory::NewTidal(Environment& aEnv, const Brx& aClientId, const Brx& aClientSecret, std::vector& aAppDetails, - TUint aMaxAudioQuality, Av::IMediaPlayer& aMediaPlayer) { // static; const TBool hasOAuthDeets = aClientId.Bytes() > 0; //NOTE - secret is optional, depending on the OAuth flow used. @@ -109,8 +108,7 @@ Protocol* ProtocolFactory::NewTidal(Environment& aEnv, { aClientId, aClientSecret, - aAppDetails, - aMaxAudioQuality, + aAppDetails }; return new ProtocolTidal(aEnv, aSsl, config, aMediaPlayer.ConfigInitialiser(), aMediaPlayer.Device(), diff --git a/OpenHome/Av/Tidal/Tidal.cpp b/OpenHome/Av/Tidal/Tidal.cpp index d2dec3756..ece3f952e 100644 --- a/OpenHome/Av/Tidal/Tidal.cpp +++ b/OpenHome/Av/Tidal/Tidal.cpp @@ -26,6 +26,8 @@ using namespace OpenHome::Av; using namespace OpenHome::Configuration; static const TChar* kSoundQualities[4] = {"LOW", "HIGH", "LOSSLESS", "HI_RES"}; +static const TUint kNumSoundQualities = sizeof(kSoundQualities) / sizeof(kSoundQualities[0]); + // Staging = XXXX.stage.tidal.com const Brn Tidal::kHost("api.tidal.com"); @@ -137,17 +139,10 @@ Tidal::Tidal(Environment& aEnv, choices.push_back(ENABLED_YES); iConfigEnable = new ConfigChoice(aConfigInitialiser, kConfigKeyEnabled, choices, ENABLED_YES); - iMaxSoundQuality = std::min(static_cast(3), aTidalConfig.maxSoundQualityOption); - Log::Print("TIDAL: MaxSoundQuality limited to: %u\n", iMaxSoundQuality); - - std::vector qualities; - qualities.reserve(4); - for(TUint i = 0; i <= iMaxSoundQuality; ++i) { - qualities.emplace_back(i); - } - - const TUint defaultOption = qualities.back(); - iConfigQuality = new ConfigChoice(aConfigInitialiser, kConfigKeySoundQuality, qualities, defaultOption); + const int arr[] = {0, 1, 2, 3}; + std::vector qualities(arr, arr + sizeof(arr)/sizeof(arr[0])); + iConfigQuality = new ConfigChoice(aConfigInitialiser, kConfigKeySoundQuality, qualities, 3); + iMaxSoundQuality = kNumSoundQualities - 1; iSubscriberIdQuality = iConfigQuality->Subscribe(MakeFunctorConfigChoice(*this, &Tidal::QualityChanged)); iPollHandle = aThreadPool.CreateHandle(MakeFunctor(*this, &Tidal::DoPollForToken), "Tidal-POLL", ThreadPoolPriority::Low); diff --git a/OpenHome/Av/Tidal/Tidal.h b/OpenHome/Av/Tidal/Tidal.h index e0bb99b7d..ceda3c070 100644 --- a/OpenHome/Av/Tidal/Tidal.h +++ b/OpenHome/Av/Tidal/Tidal.h @@ -66,10 +66,9 @@ class Tidal : public IOAuthAuthenticator struct ConfigurationValues { - const Brx& clientId; // Used for OAuth authentication, directly by the DS + const Brx& clientId; //Used for OAuth authentication, directly by the DS const Brx& clientSecret; const std::vector appDetails; // All other supported CPs - const TUint maxSoundQualityOption; // Used to set the max sound quality. See Tidal.cpp for details }; diff --git a/OpenHome/Media/Protocol/ProtocolFactory.h b/OpenHome/Media/Protocol/ProtocolFactory.h index 9c3199bad..522e169c1 100644 --- a/OpenHome/Media/Protocol/ProtocolFactory.h +++ b/OpenHome/Media/Protocol/ProtocolFactory.h @@ -36,7 +36,7 @@ class ProtocolFactory static Protocol* NewFile(Environment& aEnv); static Protocol* NewTone(Environment& aEnv); static Protocol* NewRtsp(Environment& aEnv, const Brx& aGuid); - static Protocol* NewTidal(Environment& aEnv, SslContext& aSsl, const Brx& aClientId, const Brx& aClientSecret, std::vector& aAppDetails, TUint aMaxAudioQuality, Av::IMediaPlayer& aMediaPlayer); + static Protocol* NewTidal(Environment& aEnv, SslContext& aSsl, const Brx& aClientId, const Brx& aClientSecret, std::vector& aAppDetails, Av::IMediaPlayer& aMediaPlayer); static Protocol* NewQobuz(const Brx& aAppId, const Brx& aAppSecret, Av::IMediaPlayer& aMediaPlayer, const Brx& aUserAgent); // UA is optional so can be empty static Protocol* NewCalmRadio(Environment& aEnv, SslContext& aSsl, const Brx& aUserAgent, Av::IMediaPlayer& aMediaPlayer); // UA is optional so can be empty };