From aff4155325a95f0e1dce85426c18592b22062cfa Mon Sep 17 00:00:00 2001 From: Jacques Samain Date: Wed, 3 Jan 2018 14:21:23 +0100 Subject: Refactoring adaptation logic Refactoring GUI: removed prefix/suffix to have only one video URI Change-Id: Ie0add7c1d8ace89410917ab7cc414c668c528394 Signed-off-by: Jacques Samain --- UI/DASHPlayer.cpp | 67 +++++++------------------------------------------- UI/DASHPlayer.h | 19 +++----------- UI/DASHPlayerNoGUI.cpp | 2 +- 3 files changed, 14 insertions(+), 74 deletions(-) (limited to 'UI') diff --git a/UI/DASHPlayer.cpp b/UI/DASHPlayer.cpp index 331748b5..e2910ea8 100644 --- a/UI/DASHPlayer.cpp +++ b/UI/DASHPlayer.cpp @@ -175,7 +175,7 @@ void DASHPlayer::setSettings(int period, int videoAdaptationSet, int videoRepres this->currentSettings.audioRepresentation = audioRepresentation; } -bool DASHPlayer::downloadMPD(const QString &url, const QString &adaptationLogic, bool icn) +bool DASHPlayer::downloadMPD(const QString &adaptationLogic, bool icn) { if (this->gui->getStop()) @@ -191,15 +191,9 @@ bool DASHPlayer::downloadMPD(const QString &url, const QString &adaptationLogic, this->gui->initVideoPlayer(); this->icn = icn; this->segment = 0; - std::string mUrl; - if(this->icn) - { - mUrl = this->icnPrefix + url.toStdString() + this->icnSuffix; - } - else - { - mUrl = this->httpPrefix + url.toStdString() + this->httpSuffix; - } + std::string mUrl = this->videoURI; + + Debug("MPD is: %s\n", mUrl.c_str()); if (!this->onDownloadMPDPressed(mUrl)) return false; @@ -420,10 +414,7 @@ void DASHPlayer::reloadParameters() { this->beta = config->beta(); this->drop = config->drop(); - this->icnPrefix = config->icnPrefix().toStdString(); - this->httpPrefix = config->httpPrefix().toStdString(); - this->icnSuffix = config->icnSuffix().toStdString(); - this->httpSuffix = config->httpSuffix().toStdString(); + this->videoURI = config->videoURI().toStdString(); this->alpha = config->alpha(); this->repeat = config->repeat(); this->parametersAdaptation = (struct AdaptationParameters *)malloc(sizeof(struct AdaptationParameters)); @@ -450,16 +441,6 @@ void DASHPlayer::reloadParameters() this->parametersAdaptation->Panda_Epsilon = config->pandaParamEpsilon(); } -QString DASHPlayer::getLastPlayed() -{ - return config->lastPlayed(); -} - -void DASHPlayer::setLastPlayed(QString lastPlayed) -{ - config->setLastPlayed(lastPlayed); -} - QString DASHPlayer::getAdaptationLogic() { return config->adaptationLogic(); @@ -480,44 +461,14 @@ void DASHPlayer::setIcn(bool icn) config->setIcn(icn); } -QString DASHPlayer::getIcnPrefix() -{ - return config->icnPrefix(); -} - -void DASHPlayer::setIcnPrefix(QString icnPrefix) -{ - config->setIcnPrefix(icnPrefix); -} - -QString DASHPlayer::getHttpPrefix() -{ - return config->httpPrefix(); -} - -void DASHPlayer::setHttpPrefix(QString httpPrefix) -{ - config->setHttpPrefix(httpPrefix); -} - -QString DASHPlayer::getIcnSuffix() -{ - return config->icnSuffix(); -} - -void DASHPlayer::setIcnSuffix(QString icnSuffix) -{ - config->setIcnSuffix(icnSuffix); -} - -QString DASHPlayer::getHttpSuffix() +QString DASHPlayer::getVideoURI() { - return config->httpSuffix(); + return config->videoURI(); } -void DASHPlayer::setHttpSuffix(QString httpSuffix) +void DASHPlayer::setVideoURI(QString videoURI) { - config->setHttpSuffix(httpSuffix); + config->setVideoURI(videoURI); } qreal DASHPlayer::getAlpha() diff --git a/UI/DASHPlayer.h b/UI/DASHPlayer.h index 6204f46a..c85c2351 100644 --- a/UI/DASHPlayer.h +++ b/UI/DASHPlayer.h @@ -62,27 +62,19 @@ public: virtual bool onDownloadMPDPressed(const std::string &url); void setMPDWrapper(libdash::framework::mpd::MPDWrapper* mpdWrapper); void setConfig(Config *config); - Q_INVOKABLE bool downloadMPD(const QString &url, const QString &adaptationLogic, bool icn); + Q_INVOKABLE bool downloadMPD(const QString &adaptationLogic, bool icn); Q_INVOKABLE void pause(); Q_INVOKABLE void seekVideo(float value); Q_INVOKABLE void repeatVideo(bool repeat); Q_INVOKABLE void onStopButtonPressed(); Q_INVOKABLE void play(); Q_INVOKABLE void onStopped(); - Q_INVOKABLE QString getLastPlayed(); - Q_INVOKABLE void setLastPlayed(QString lastPlayed); Q_INVOKABLE QString getAdaptationLogic(); Q_INVOKABLE void setAdaptationLogic(QString adaptationLogic); Q_INVOKABLE bool getIcn(); Q_INVOKABLE void setIcn(bool icn); - Q_INVOKABLE QString getIcnPrefix(); - Q_INVOKABLE void setIcnPrefix(QString icnPrefix); - Q_INVOKABLE QString getHttpPrefix(); - Q_INVOKABLE void setHttpPrefix(QString httpPrefix); - Q_INVOKABLE QString getIcnSuffix(); - Q_INVOKABLE void setIcnSuffix(QString icnSuffix); - Q_INVOKABLE QString getHttpSuffix(); - Q_INVOKABLE void setHttpSuffix(QString httpSuffix); + Q_INVOKABLE QString getVideoURI(); + Q_INVOKABLE void setVideoURI(QString videoURI); Q_INVOKABLE qreal getAlpha(); Q_INVOKABLE void setAlpha(qreal alpha); Q_INVOKABLE qreal getSegmentBufferSize(); @@ -181,10 +173,7 @@ private: CRITICAL_SECTION monitorMutex; const char *url; bool icn; - std::string icnPrefix; - std::string httpPrefix; - std::string icnSuffix; - std::string httpSuffix; + std::string videoURI; double alpha; struct libdash::framework::adaptation::AdaptationParameters *parametersAdaptation; libdash::framework::adaptation::LogicType adaptLogic; diff --git a/UI/DASHPlayerNoGUI.cpp b/UI/DASHPlayerNoGUI.cpp index c6670f13..17948336 100644 --- a/UI/DASHPlayerNoGUI.cpp +++ b/UI/DASHPlayerNoGUI.cpp @@ -210,7 +210,7 @@ void DASHPlayerNoGUI::parseArgs(int argc, char ** argv) } if(!strcmp(argv[i], "-br")) { - this->adaptLogic = LogicType::BufferRateBased; + this->adaptLogic = LogicType::AdapTech; this->parameterAdaptation->Adaptech_Alpha = atof(argv[i+1]); this->parameterAdaptation->Adaptech_FirstThreshold = atoi(argv[i+2]); this->parameterAdaptation->Adaptech_SecondThreshold = atoi(argv[i+3]); -- cgit 1.2.3-korg