diff options
author | Jacques Samain <jsamain+fdio@cisco.com> | 2018-01-03 14:21:23 +0100 |
---|---|---|
committer | Jacques Samain <jsamain+fdio@cisco.com> | 2018-01-03 14:21:23 +0100 |
commit | aff4155325a95f0e1dce85426c18592b22062cfa (patch) | |
tree | aa8ad157fb1acecede747c1489864a430bc25317 | |
parent | 3abd95a2501be987eca0fa5c59f01e84a98cf202 (diff) |
Refactoring adaptation logic
Refactoring GUI: removed prefix/suffix to have only one video URI
Change-Id: Ie0add7c1d8ace89410917ab7cc414c668c528394
Signed-off-by: Jacques Samain <jsamain+fdio@cisco.com>
-rw-r--r-- | Adaptation/AdapTech.cpp (renamed from Adaptation/BufferBasedAdaptationWithRateBased.cpp) | 32 | ||||
-rw-r--r-- | Adaptation/AdapTech.h (renamed from Adaptation/BufferBasedAdaptationWithRateBased.h) | 14 | ||||
-rw-r--r-- | Adaptation/AdaptationLogicFactory.cpp | 6 | ||||
-rw-r--r-- | Adaptation/AdaptationLogicFactory.h | 2 | ||||
-rw-r--r-- | Adaptation/IAdaptationLogic.h | 2 | ||||
-rw-r--r-- | Common/Config.cpp | 88 | ||||
-rw-r--r-- | Common/Config.h | 24 | ||||
-rw-r--r-- | UI/DASHPlayer.cpp | 67 | ||||
-rw-r--r-- | UI/DASHPlayer.h | 19 | ||||
-rw-r--r-- | UI/DASHPlayerNoGUI.cpp | 2 | ||||
-rw-r--r-- | main.cpp | 1 | ||||
-rwxr-xr-x | qml/Viper/ControlPanel.qml | 7 | ||||
-rwxr-xr-x | qml/Viper/OpenMpd.qml | 123 | ||||
-rwxr-xr-x | qml/Viper/Options.qml | 122 | ||||
-rwxr-xr-x | qml/Viper/main.qml | 69 | ||||
-rw-r--r-- | viper.pro | 4 | ||||
-rw-r--r-- | viper.qrc | 3 |
17 files changed, 76 insertions, 509 deletions
diff --git a/Adaptation/BufferBasedAdaptationWithRateBased.cpp b/Adaptation/AdapTech.cpp index 3df1cf84..dc88fae6 100644 --- a/Adaptation/BufferBasedAdaptationWithRateBased.cpp +++ b/Adaptation/AdapTech.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "BufferBasedAdaptationWithRateBased.h" +#include "AdapTech.h" #include<stdio.h> using namespace dash::mpd; @@ -21,7 +21,7 @@ using namespace libdash::framework::adaptation; using namespace libdash::framework::input; using namespace libdash::framework::mpd; -BufferBasedAdaptationWithRateBased::BufferBasedAdaptationWithRateBased(viper::managers::StreamType type, MPDWrapper *mpdWrapper, struct AdaptationParameters *params) : +AdapTechAdaptation::AdapTechAdaptation(viper::managers::StreamType type, MPDWrapper *mpdWrapper, struct AdaptationParameters *params) : AbstractAdaptationLogic(type, mpdWrapper) { this->alphaRate = params->Adaptech_Alpha; @@ -45,35 +45,35 @@ BufferBasedAdaptationWithRateBased::BufferBasedAdaptationWithRateBased(viper::ma Debug("BufferRateBasedParams:\talpha:%f\tfirst threshold: %f\tsecond threshold: %f\tswitch-up margin: %d\tSlack: %f\n",this->alphaRate, (double)reservoirThreshold/100, (double)maxThreshold/100, this->switchUpThreshold, this->slackParam); Debug("Buffer Adaptation: STARTED\n"); } -BufferBasedAdaptationWithRateBased::~BufferBasedAdaptationWithRateBased () +AdapTechAdaptation::~AdapTechAdaptation() { } -LogicType BufferBasedAdaptationWithRateBased::getType() +LogicType AdapTechAdaptation::getType() { return adaptation::BufferBased; } -bool BufferBasedAdaptationWithRateBased::isUserDependent() +bool AdapTechAdaptation::isUserDependent() { return false; } -bool BufferBasedAdaptationWithRateBased::isRateBased() +bool AdapTechAdaptation::isRateBased() { return true; } -bool BufferBasedAdaptationWithRateBased::isBufferBased() +bool AdapTechAdaptation::isBufferBased() { return true; } -void BufferBasedAdaptationWithRateBased::setMultimediaManager(viper::managers::IMultimediaManagerBase *_mmManager) +void AdapTechAdaptation::setMultimediaManager(viper::managers::IMultimediaManagerBase *_mmManager) { this->multimediaManager = _mmManager; } -void BufferBasedAdaptationWithRateBased::notifyBitrateChange() +void AdapTechAdaptation::notifyBitrateChange() { this->mpdWrapper->setRepresentation(this->type, this->representation); if(this->multimediaManager) @@ -90,12 +90,12 @@ void BufferBasedAdaptationWithRateBased::notifyBitrateChange() // this->shouldAbort = false; } -uint64_t BufferBasedAdaptationWithRateBased::getBitrate() +uint64_t AdapTechAdaptation::getBitrate() { return this->currentBitrate; } -void BufferBasedAdaptationWithRateBased::setBitrate(uint32_t bufferFill) +void AdapTechAdaptation::setBitrate(uint32_t bufferFill) { uint32_t phi1, phi2; std::vector<IRepresentation *> representations; @@ -171,7 +171,7 @@ void BufferBasedAdaptationWithRateBased::setBitrate(uint32_t bufferFill) Debug("ADAPTATION_LOGIC:\tFor %s:\tlast_buffer: %f\tbuffer_level: %f, instantaneousBw: %lu, AverageBW: %lu, choice: %d\n",(this->type == viper::managers::StreamType::VIDEO) ? "video" : "audio",(double)lastBufferFill/100 , (double)bufferFill/100, this->instantBw, this->averageBw , this->myQuality); } -void BufferBasedAdaptationWithRateBased::bitrateUpdate(uint64_t bps, uint32_t segNum) +void AdapTechAdaptation::bitrateUpdate(uint64_t bps, uint32_t segNum) { Debug("rate estimation: %lu\n", bps); this->instantBw = bps; @@ -185,16 +185,16 @@ void BufferBasedAdaptationWithRateBased::bitrateUpdate(uint64_t bps, uint32_t se } } -void BufferBasedAdaptationWithRateBased::onEOS(bool value) +void AdapTechAdaptation::onEOS(bool value) { this->bufferEOS = value; } -void BufferBasedAdaptationWithRateBased::checkedByDASHReceiver() +void AdapTechAdaptation::checkedByDASHReceiver() { this->isCheckedForReceiver = false; } -void BufferBasedAdaptationWithRateBased::bufferUpdate(uint32_t bufferFill, int maxC) +void AdapTechAdaptation::bufferUpdate(uint32_t bufferFill, int maxC) { Debug("buffer update: %u\n", bufferFill); EnterCriticalSection(&this->monitorLock); @@ -203,7 +203,7 @@ void BufferBasedAdaptationWithRateBased::bufferUpdate(uint32_t bufferFill, int m LeaveCriticalSection(&this->monitorLock); } -void BufferBasedAdaptationWithRateBased::dLTimeUpdate(double time) +void AdapTechAdaptation::dLTimeUpdate(double time) { } diff --git a/Adaptation/BufferBasedAdaptationWithRateBased.h b/Adaptation/AdapTech.h index 45147ed2..c7f4e33c 100644 --- a/Adaptation/BufferBasedAdaptationWithRateBased.h +++ b/Adaptation/AdapTech.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef LIBDASH_FRAMEWORK_ADAPTATION_BUFFERBASEDADAPTATIONRATE_H_ -#define LIBDASH_FRAMEWORK_ADAPTATION_BUFFERBASEDADAPTATIONRATE_H_ +#ifndef LIBDASH_FRAMEWORK_ADAPTATION_ADAPTECH_H_ +#define LIBDASH_FRAMEWORK_ADAPTATION_ADAPTECH_H_ #include "AbstractAdaptationLogic.h" #include "../MPD/AdaptationSetStream.h" @@ -26,12 +26,12 @@ namespace framework { namespace adaptation { -class BufferBasedAdaptationWithRateBased : public AbstractAdaptationLogic +class AdapTechAdaptation : public AbstractAdaptationLogic { public: -// BufferBasedAdaptationWithRateBased(dash::mpd::IMPD *mpd, dash::mpd::IPeriod *period, dash::mpd::IAdaptationSet *adaptationSet, bool isVid, struct AdaptationParameters *params); - BufferBasedAdaptationWithRateBased(viper::managers::StreamType type, libdash::framework::mpd::MPDWrapper *mpdWrapper, struct AdaptationParameters *params); - virtual ~BufferBasedAdaptationWithRateBased(); +// AdapTech(dash::mpd::IMPD *mpd, dash::mpd::IPeriod *period, dash::mpd::IAdaptationSet *adaptationSet, bool isVid, struct AdaptationParameters *params); + AdapTechAdaptation(viper::managers::StreamType type, libdash::framework::mpd::MPDWrapper *mpdWrapper, struct AdaptationParameters *params); + virtual ~AdapTechAdaptation(); virtual LogicType getType(); virtual bool isUserDependent(); @@ -70,4 +70,4 @@ private: } } -#endif /* LIBDASH_FRAMEWORK_ADAPTATION_BUFFERBASEDADAPTATIONRATE_H_ */ +#endif /* LIBDASH_FRAMEWORK_ADAPTATION_ADAPTECH_H_ */ diff --git a/Adaptation/AdaptationLogicFactory.cpp b/Adaptation/AdaptationLogicFactory.cpp index b2cae9c1..f2029b5d 100644 --- a/Adaptation/AdaptationLogicFactory.cpp +++ b/Adaptation/AdaptationLogicFactory.cpp @@ -29,9 +29,9 @@ IAdaptationLogic* AdaptationLogicFactory::create(LogicType logic, viper::manager case BufferBased: Debug("Buffer based\n"); return new BufferBasedAdaptation(type, mpdWrapper, paramsForAdaptation); - case BufferRateBased: - Debug("Buffer Rate based\n"); - return new BufferBasedAdaptationWithRateBased(type, mpdWrapper, paramsForAdaptation); + case AdapTech: + Debug("AdapTech\n"); + return new AdapTechAdaptation(type, mpdWrapper, paramsForAdaptation); case BufferBasedThreeThreshold: Debug("Buffer based 3 threshold\n"); return new BufferBasedThreeThresholdAdaptation(type, mpdWrapper, paramsForAdaptation); diff --git a/Adaptation/AdaptationLogicFactory.h b/Adaptation/AdaptationLogicFactory.h index e78d2865..62d59360 100644 --- a/Adaptation/AdaptationLogicFactory.h +++ b/Adaptation/AdaptationLogicFactory.h @@ -16,7 +16,7 @@ #include "AlwaysLowestLogic.h" #include "RateBasedAdaptation.h" #include "BufferBasedAdaptation.h" -#include "BufferBasedAdaptationWithRateBased.h" +#include "AdapTech.h" #include "BufferBasedThreeThresholdAdaptation.h" #include "Panda.h" #include "Bola.h" diff --git a/Adaptation/IAdaptationLogic.h b/Adaptation/IAdaptationLogic.h index 081366dd..a8d885c1 100644 --- a/Adaptation/IAdaptationLogic.h +++ b/Adaptation/IAdaptationLogic.h @@ -32,7 +32,7 @@ namespace adaptation ADAPTATIONLOGIC(AlwaysLowest) \ ADAPTATIONLOGIC(RateBased) \ ADAPTATIONLOGIC(BufferBased) \ - ADAPTATIONLOGIC(BufferRateBased) \ + ADAPTATIONLOGIC(AdapTech) \ ADAPTATIONLOGIC(BufferBasedThreeThreshold) \ ADAPTATIONLOGIC(Panda) \ ADAPTATIONLOGIC(Bola) \ diff --git a/Common/Config.cpp b/Common/Config.cpp index 85278251..70b67765 100644 --- a/Common/Config.cpp +++ b/Common/Config.cpp @@ -157,10 +157,7 @@ public: settings.endGroup(); settings.beginGroup(QString::fromLatin1("backend")); - settings.setValue(QString::fromLatin1("icn_prefix"), icn_prefix); - settings.setValue(QString::fromLatin1("http_prefix"), http_prefix); - settings.setValue(QString::fromLatin1("icn_suffix"), icn_suffix); - settings.setValue(QString::fromLatin1("http_suffix"), http_suffix); + settings.setValue(QString::fromLatin1("video_uri"), video_uri); settings.setValue(QString::fromLatin1("segment_buffer_size"), segment_buffer_size); settings.endGroup(); @@ -285,10 +282,7 @@ public: QString frag_header; QString frag_sample; QString frag_pp; - QString icn_prefix; - QString http_prefix; - QString icn_suffix; - QString http_suffix; + QString video_uri; qreal segment_buffer_size; QString last_played; QString adaptation_logic; @@ -527,16 +521,12 @@ void Config::reload() settings.endGroup(); settings.beginGroup(QString::fromLatin1("backend")); - setIcnPrefix(settings.value(QString::fromLatin1("icn_prefix"), QString::fromLatin1("http://webserver/")).toString()); - setHttpPrefix(settings.value(QString::fromLatin1("http_prefix"), QString::fromLatin1("http://10.60.17.153:8080/")).toString()); - setIcnSuffix(settings.value(QString::fromLatin1("icn_suffix"), QString::fromLatin1("/mpd")).toString()); - setHttpSuffix(settings.value(QString::fromLatin1("http_suffix"), QString::fromLatin1("/mpd")).toString()); + setVideoURI(settings.value(QString::fromLatin1("video_uri"), QString::fromLatin1("http://webserver/sintel/mpd")).toString()); setSegmentBufferSize(settings.value(QString::fromLatin1("segment_buffer_size"), 20).toReal()); settings.endGroup(); settings.beginGroup(QString::fromLatin1("playback")); - setLastPlayed(settings.value(QString::fromLatin1("last_played"), QString::fromLatin1("sintel")).toString()); setAdaptationLogic(settings.value(QString::fromLatin1("adaptation_logic"), QString::fromLatin1("Buffer Based")).toString()); setIcn(settings.value(QString::fromLatin1("icn"), true).toBool()); settings.endGroup(); @@ -1297,62 +1287,17 @@ Config& Config::setAbortOnTimeout(bool value) return *this; } -QString Config::icnPrefix() const +QString Config::videoURI() const { - return mpData->icn_prefix; + return mpData->video_uri; } -Config& Config::setIcnPrefix(const QString &text) +Config& Config::setVideoURI(const QString &text) { - if (mpData->icn_prefix == text) + if (mpData->video_uri == text) return *this; - mpData->icn_prefix = text; - Q_EMIT icnPrefixChanged(); - Q_EMIT changed(); - return *this; -} - -QString Config::icnSuffix() const -{ - return mpData->icn_suffix; -} - -Config& Config::setIcnSuffix(const QString &text) -{ - if (mpData->icn_suffix == text) - return *this; - mpData->icn_suffix = text; - Q_EMIT icnSuffixChanged(); - Q_EMIT changed(); - return *this; -} - -QString Config::httpPrefix() const -{ - return mpData->http_prefix; -} - -Config& Config::setHttpPrefix(const QString &text) -{ - if (mpData->http_prefix == text) - return *this; - mpData->http_prefix = text; - Q_EMIT httpPrefixChanged(); - Q_EMIT changed(); - return *this; -} - -QString Config::httpSuffix() const -{ - return mpData->http_suffix; -} - -Config& Config::setHttpSuffix(const QString &text) -{ - if (mpData->http_suffix == text) - return *this; - mpData->http_suffix = text; - Q_EMIT httpSuffixChanged(); + mpData->video_uri = text; + Q_EMIT videoURIChanged(); Q_EMIT changed(); return *this; } @@ -1372,21 +1317,6 @@ Config& Config::setSegmentBufferSize(qreal value) return *this; } -QString Config::lastPlayed() const -{ - return mpData->last_played; -} - -Config& Config::setLastPlayed(const QString &text) -{ - if (mpData->last_played == text) - return *this; - mpData->last_played = text; - Q_EMIT lastPlayedChanged(); - Q_EMIT changed(); - return *this; -} - QString Config::adaptationLogic() const { return mpData->adaptation_logic; diff --git a/Common/Config.h b/Common/Config.h index 018b757f..059c6771 100644 --- a/Common/Config.h +++ b/Common/Config.h @@ -69,13 +69,9 @@ class COMMON_EXPORT Config : public QObject Q_PROPERTY(QString fragHeader READ fragHeader WRITE setFragHeader NOTIFY fragHeaderChanged) Q_PROPERTY(QString fragSample READ fragSample WRITE setFragSample NOTIFY fragSampleChanged) Q_PROPERTY(QString fragPostProcess READ fragPostProcess WRITE setFragPostProcess NOTIFY fragPostProcessChanged) - Q_PROPERTY(QString icnPrefix READ icnPrefix WRITE setIcnPrefix NOTIFY icnPrefixChanged) - Q_PROPERTY(QString httpPrefix READ httpPrefix WRITE setHttpPrefix NOTIFY httpPrefixChanged) - Q_PROPERTY(QString icnSuffix READ icnSuffix WRITE setIcnSuffix NOTIFY icnSuffixChanged) - Q_PROPERTY(QString httpSuffix READ httpSuffix WRITE setHttpSuffix NOTIFY httpSuffixChanged) + Q_PROPERTY(QString videoURI READ videoURI WRITE setVideoURI NOTIFY videoURIChanged) Q_PROPERTY(qreal segmentBufferSize READ segmentBufferSize WRITE setSegmentBufferSize NOTIFY segmentBufferSizeChanged) - Q_PROPERTY(QString lastPlayed READ lastPlayed WRITE setLastPlayed NOTIFY lastPlayedChanged) Q_PROPERTY(QString adaptationLogic READ adaptationLogic WRITE setAdaptationLogic NOTIFY adaptationLogicChanged) Q_PROPERTY(bool icn READ icn WRITE setIcn NOTIFY icnChanged) Q_PROPERTY(qreal rateAlpha READ rateAlpha WRITE setRateAlpha NOTIFY rateAlphaChanged) @@ -268,18 +264,10 @@ public: QString fragSample() const; Config& setFragPostProcess(const QString& text); QString fragPostProcess() const; - Config& setIcnPrefix(const QString &value); - QString icnPrefix() const; - Config& setIcnSuffix(const QString &value); - QString icnSuffix() const; - Config& setHttpPrefix(const QString &value); - QString httpPrefix() const; - Config& setHttpSuffix(const QString &value); - QString httpSuffix() const; + Config& setVideoURI(const QString &value); + QString videoURI() const; Config& setSegmentBufferSize(qreal value); qreal segmentBufferSize() const; - Config& setLastPlayed(const QString &value); - QString lastPlayed() const; Config& setAdaptationLogic(const QString &value); QString adaptationLogic() const; Config& setIcn(bool value); @@ -403,12 +391,8 @@ public: Q_SIGNAL void logLevelChanged(); Q_SIGNAL void languageChanged(); Q_SIGNAL void historyChanged(); - Q_SIGNAL void icnSuffixChanged(); - Q_SIGNAL void httpSuffixChanged(); - Q_SIGNAL void icnPrefixChanged(); - Q_SIGNAL void httpPrefixChanged(); + Q_SIGNAL void videoURIChanged(); Q_SIGNAL void segmentBufferSizeChanged(); - Q_SIGNAL void lastPlayedChanged(); Q_SIGNAL void adaptationLogicChanged(); Q_SIGNAL void icnChanged(); Q_SIGNAL void rateAlphaChanged(); 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]); @@ -218,7 +218,6 @@ int main(int argc, char *argv[]) QMetaObject::invokeMethod(viewer.rootObject(), "initGraph", Q_ARG(QVariant, (&Config::instance())->graph())); QMetaObject::invokeMethod(viewer.rootObject(), "initRepeat", Q_ARG(QVariant, (&Config::instance())->repeat())); QMetaObject::invokeMethod(viewer.rootObject(), "initFullScreen", Q_ARG(QVariant, (&Config::instance())->fullScreen())); - QMetaObject::invokeMethod(viewer.rootObject(), "setLastPlayed", Q_ARG(QVariant, (&Config::instance())->lastPlayed())); QMetaObject::invokeMethod(viewer.rootObject(), "setAdaptationLogic", Q_ARG(QVariant, (&Config::instance())->adaptationLogic())); QMetaObject::invokeMethod(viewer.rootObject(), "setIcn", Q_ARG(QVariant, (&Config::instance())->icn())); return app.exec(); diff --git a/qml/Viper/ControlPanel.qml b/qml/Viper/ControlPanel.qml index 4f5848d7..d54bd67a 100755 --- a/qml/Viper/ControlPanel.qml +++ b/qml/Viper/ControlPanel.qml @@ -199,8 +199,7 @@ Rectangle { onClicked: { if (checked === true) { console.log(adaptationLogic) - console.log(lastPlayed) - dashPlayer.downloadMPD(lastPlayed, adaptationLogic, icn) + dashPlayer.downloadMPD(adaptationLogic, icn) } else { dashPlayer.pause(); } @@ -309,7 +308,7 @@ Rectangle { } } - Button { + /* Button { id: openBtn bgColor: "transparent" bgColorSelected: "transparent" @@ -322,7 +321,7 @@ Rectangle { if(checked) openMpd() } - } + } */ Button { id: repeatBtn bgColor: "transparent" diff --git a/qml/Viper/OpenMpd.qml b/qml/Viper/OpenMpd.qml deleted file mode 100755 index c32fb7d7..00000000 --- a/qml/Viper/OpenMpd.qml +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2017 Cisco and/or its affiliates. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import QtQuick 2.5 -import QtQuick.Extras 1.4 -import QtQuick.Controls.Styles 1.4 -import QtQuick.Controls 2.0 -import QtQuick.Layouts 1.3 -import "utils.js" as Utils -Rectangle { - signal closeOpenMpd - signal saveAndPlayMpd(string newOpenMpd) - - id: root - color: "#88445566" - - opacity: 0 - radius: Utils.scaled(10) - height: Utils.scaled(100) - width: Utils.scaled(300) - enabled: false; - GridLayout { - id : grid - z: parent.z + 1 - anchors.fill: parent - rows : 2 - columns : 2 - anchors.leftMargin: Utils.scaled(12) - - anchors.rightMargin: Utils.scaled(12) - anchors.topMargin: Utils.scaled(12) - anchors.bottomMargin: Utils.scaled(12) - property double colMulti : grid.width / grid.columns - property double rowMulti : grid.height / grid.rows - - function prefWidth(item) - { - return colMulti * item.Layout.columnSpan - } - - function prefHeight(item) - { - return rowMulti * item.Layout.rowSpan - } - - TextInput { - - id: sourceTextInput - text: lastPlayed - Layout.rowSpan : 1 - Layout.columnSpan : 2 - Layout.preferredWidth : parent.colMulti * 2 + Utils.scaled(5) //grid.prefWidth(this) - Layout.preferredHeight : parent.rowMulti//grid.prefHeight(this) - color: "white" - } - // ComboBox { - // z: parent.z + 1 - // id: comboBoxList - // Layout.rowSpan : 1 - // Layout.columnSpan : 2 - // Layout.preferredWidth : parent.colMulti * 2 + Utils.scaled(5) //grid.prefWidth(this) - // Layout.preferredHeight : parent.rowMulti//grid.prefHeight(this) - // - // onCurrentIndexChanged: { - // } - - // model: ListModel { - // id: mpdItems - // ListElement { text: "gastown"; } - // ListElement { text: "sintel"; } - // } - // currentIndex: find(lastPlayed) - //} - - Button { - id: cancelBtn - z: parent.z + 1 - - text: "Cancel" - Layout.rowSpan : 1 - Layout.columnSpan: 1 - Layout.preferredWidth : grid.prefWidth(this) - Layout.preferredHeight : grid.prefHeight(this) - onClicked: { - - closeOpenMpd(); - } - } - - Button { - id: downloadBtn - z: parent.z + 1 - Layout.rowSpan : 1 - Layout.columnSpan: 1 - Layout.preferredWidth : grid.prefWidth(this) - Layout.preferredHeight : grid.prefHeight(this) - text: "Download" - onClicked: { - saveAndPlayMpd(sourceTextInput.text) - closeOpenMpd(); - } - - - } - - - - } - -} - diff --git a/qml/Viper/Options.qml b/qml/Viper/Options.qml index 82d3e3e7..f8ed0909 100755 --- a/qml/Viper/Options.qml +++ b/qml/Viper/Options.qml @@ -24,10 +24,7 @@ Rectangle { signal closeOptions signal saveAdaptationLogic(string selectedAdaptationLogic, int adaptationLogicKey) signal saveIcn(bool selectedIcn) - signal saveIcnPrefix(string selectedIcnPrefix) - signal saveHttpPrefix(string selectedHttpPrefix) - signal saveIcnSuffix(string selectedIcnSuffix) - signal saveHttpSuffix(string selectedHttpSuffix) + signal saveVideoURI(string selectedVideoURI) signal saveSegmentBufferSize(real selectedSegmentBufferSize) signal saveRateAlpha(real selectedRateAlpha) signal saveBufferReservoirThreshold(real selectedBufferReservoirThreshold) @@ -107,7 +104,7 @@ Rectangle { ListElement { text: "Always Lowest"; } ListElement { text: "Rate Based"; } ListElement { text: "Buffer Based"; } - ListElement { text: "Buffer Rate Based"; } + ListElement { text: "AdapTech"; } ListElement { text: "Buffer Based Three Threshold"; } ListElement { text: "Panda"; } ListElement { text: "Bola"; } @@ -407,128 +404,34 @@ Rectangle { } Item { - id: itemIcnPrefix + id: itemVideoURI anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right anchors.rightMargin: parent.width/2 - anchors.topMargin: Utils.scaled(12) + heightRow + anchors.topMargin: Utils.scaled(18) + heightRow Label { - text: "ICN Prefix:" - id: labelIcnPrefix + text: "Video URI:" + id: labelVideoURI color: " white" anchors.top: parent.top - anchors.right: textInputIcnPrefix.left + anchors.right: textInputVideoURI.left anchors.rightMargin: Utils.scaled(5) - anchors.topMargin: (textInputIcnPrefix.height - height)/2 + anchors.topMargin: (textInputVideoURI.height - height)/2 font.bold: true font.pixelSize: Utils.scaled(10); } TextInput { width: parent.width/4*3 - id: textInputIcnPrefix + id: textInputVideoURI anchors.top: parent.top anchors.left: parent.left anchors.leftMargin: Utils.scaled(200) font.pixelSize: Utils.scaled(20) color: "white" - text: icnPrefix - } - } - - Item { - id: itemIcnSuffix - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.leftMargin: parent.width/2 - anchors.topMargin: Utils.scaled(12) + heightRow - - Label { - text: "ICN Suffix:" - id: labelIcnSuffix - color: " white" - anchors.top: parent.top - anchors.right: textInputIcnSuffix.left - anchors.rightMargin: Utils.scaled(5) - anchors.topMargin: (textInputIcnSuffix.height - height)/2 - font.bold: true - font.pixelSize: Utils.scaled(10); - } - - TextInput { - width: parent.width/4*3 - id: textInputIcnSuffix - anchors.top: parent.top - anchors.right: parent.right - font.pixelSize: Utils.scaled(20) - color: "white" - text: icnSuffix - } - } - - Item { - id: itemHttpPrefix - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.rightMargin: parent.width/2 - anchors.topMargin: Utils.scaled(12) + 2*heightRow - - Label { - text: "TCP Prefix:" - id: labelHttpPrefix - color: " white" - anchors.top: parent.top - anchors.right: textInputHttpPrefix.left - anchors.rightMargin: Utils.scaled(5) - anchors.topMargin: (textInputHttpPrefix.height - height)/2 - font.bold: true - font.pixelSize: Utils.scaled(10); - } - - TextInput { - width: parent.width/4*3 - id: textInputHttpPrefix - anchors.top: parent.top - anchors.left: parent.left - anchors.leftMargin: Utils.scaled(200) - font.pixelSize: Utils.scaled(20) - color: "white" - text: httpPrefix - } - } - - Item { - id: itemHttpSuffix - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.leftMargin: parent.width/2 - anchors.topMargin: Utils.scaled(12) + 2*heightRow - - Label { - text: "TCP Suffix:" - id: labelHttpSuffix - color: " white" - anchors.top: parent.top - anchors.right: textInputHttpSuffix.left - anchors.rightMargin: Utils.scaled(5) - anchors.topMargin: (textInputHttpSuffix.height - height)/2 - font.bold: true - font.pixelSize: Utils.scaled(10); - } - - TextInput { - width: parent.width/4*3 - id: textInputHttpSuffix - anchors.top: parent.top - anchors.right: parent.right - font.pixelSize: Utils.scaled(20) - color: "white" - text: httpSuffix + text: videoURI } } @@ -1678,10 +1581,7 @@ Rectangle { onClicked: { saveAdaptationLogic(adaptationLogicModel.get(comboAdaptationSetList.currentIndex).text, comboAdaptationSetList.currentIndex); saveIcn(switchIcn.checked) - saveIcnPrefix(textInputIcnPrefix.text) - saveHttpPrefix(textInputHttpPrefix.text) - saveIcnSuffix(textInputIcnSuffix.text) - saveHttpSuffix(textInputHttpSuffix.text) + saveVideoURI(textInputVideoURI.text) saveSegmentBufferSize(spinboxSegmentBufferSize.value/100) saveRateAlpha(spinboxRateAlpha.value/100) saveBufferReservoirThreshold(spinboxBufferReservoirThreshold.value/100) diff --git a/qml/Viper/main.qml b/qml/Viper/main.qml index bd90103a..e170931b 100755 --- a/qml/Viper/main.qml +++ b/qml/Viper/main.qml @@ -35,12 +35,8 @@ Rectangle { property bool pause: false property bool stop: true property bool buffering: false - property string lastPlayed: "" property string adaptationLogic: "" - property string icnPrefix: "" - property string httpPrefix: "" - property string icnSuffix: "" - property string httpSuffix: "" + property string videoURI: "" property real alpha: 0 property real segmentBufferSize: 0 property bool icn: false @@ -122,11 +118,6 @@ Rectangle { buffering = false } - function setLastPlayed(initLastPlayed) - { - lastPlayed = initLastPlayed - } - function setAdaptationLogic(initAdaptationLogic) { adaptationLogic = initAdaptationLogic @@ -416,23 +407,11 @@ Rectangle { onPauseGraph:graphPanel.pauseTimer() onDownloadMPD: mpdList.downloadMpd() - onOpenMpd: { - lastPlayed = dashPlayer.getLastPlayed() - icn = dashPlayer.getIcn() - adaptationLogic = dashPlayer.getAdaptationLogic() - openMpd.enabled = true; - openMpd.opacity = 0.9 - enabled = false - } onOpenOptions: { - lastPlayed = dashPlayer.getLastPlayed() icn = dashPlayer.getIcn() adaptationLogic = dashPlayer.getAdaptationLogic() - icnPrefix = dashPlayer.getIcnPrefix() - httpPrefix = dashPlayer.getHttpPrefix() - icnSuffix = dashPlayer.getIcnSuffix() - httpSuffix = dashPlayer.getHttpSuffix() + videoURI = dashPlayer.getVideoURI() segmentBufferSize = dashPlayer.getSegmentBufferSize() rateAlpha = dashPlayer.getRateAlpha() bufferReservoirThreshold = dashPlayer.getBufferReservoirThreshold() @@ -555,30 +534,6 @@ Rectangle { } } - OpenMpd { - id: openMpd - enabled: false - objectName: "openMpd" - - - anchors.centerIn: root - - onCloseOpenMpd: { - control.uncheckOpenBtn(); - control.enabled = true; - enabled = false; - opacity = 0 - } - - onSaveAndPlayMpd: { - dashPlayer.setLastPlayed(newOpenMpd) - lastPlayed = newOpenMpd - console.log("SAVE AND PLAY THE MPD QUEEN\n") - console.log(adaptationLogic) - dashPlayer.downloadMPD(newOpenMpd, adaptationLogic, icn) - } - } - Options { id: options enabled: false @@ -614,23 +569,9 @@ Rectangle { icn = selectedIcn } - onSaveIcnPrefix: { - dashPlayer.setIcnPrefix(selectedIcnPrefix) - icnPrefix = selectedIcnPrefix - } - - onSaveHttpPrefix: { - dashPlayer.setHttpPrefix(selectedHttpPrefix) - httpPrefix = selectedHttpPrefix - } - onSaveIcnSuffix: { - dashPlayer.setIcnSuffix(selectedIcnSuffix) - icnSuffix = selectedIcnSuffix - } - - onSaveHttpSuffix: { - dashPlayer.setHttpSuffix(selectedHttpSuffix) - httpSuffix = selectedHttpSuffix + onSaveVideoURI: { + dashPlayer.setVideoURI(selectedVideoURI) + videoURI = selectedVideoURI } onSaveSegmentBufferSize: { @@ -38,7 +38,7 @@ SOURCES += \ Adaptation/AdaptationLogicFactory.cpp \ Adaptation/AlwaysLowestLogic.cpp \ Adaptation/BufferBasedAdaptation.cpp \ - Adaptation/BufferBasedAdaptationWithRateBased.cpp \ + Adaptation/AdapTech.cpp \ Adaptation/BufferBasedThreeThresholdAdaptation.cpp \ Adaptation/Panda.cpp \ Adaptation/Bola.cpp \ @@ -119,7 +119,7 @@ HEADERS *= \ Adaptation/AdaptationLogicFactory.h \ Adaptation/AlwaysLowestLogic.h \ Adaptation/BufferBasedAdaptation.h \ - Adaptation/BufferBasedAdaptationWithRateBased.h \ + Adaptation/AdapTech.h \ Adaptation/BufferBasedThreeThresholdAdaptation.h \ Adaptation/IAdaptationLogic.h \ Adaptation/Panda.h \ @@ -20,9 +20,6 @@ <file>qml/images/repeat-selected.png</file> <file>qml/images/fullscreen.png</file> <file>qml/images/fullscreen-selected.png</file> - <file>qml/images/open-selected.png</file> - <file>qml/images/open.png</file> - <file>qml/Viper/OpenMpd.qml</file> <file>qml/Viper/Options.qml</file> <file>qml/images/options-selected.png</file> <file>qml/images/options.png</file> |