aboutsummaryrefslogtreecommitdiffstats
path: root/UI
diff options
context:
space:
mode:
authorLuca Muscariello <lumuscar+fdio@cisco.com>2017-06-19 12:30:20 +0000
committerGerrit Code Review <gerrit@fd.io>2017-06-19 12:30:20 +0000
commite207b82a2b7e70e2700cf1c4237a2e819c655809 (patch)
treead1565a5d9aabb3c699a80404f60aa68ea56d914 /UI
parent0b0fe36cbc95a483d205d3f86fea579f0cdd5f59 (diff)
parentf8907f0a7a84928800adbbfd8e66e500794aa5d5 (diff)
Merge "Adding handling for different kind of MPDs (previously the front end could only handle MPD with SegmentList) Now can handle: MPD with SegmentTemplate in Representation (VOD) MPD with SegmentTemplate and SegmentTimeline (live)" into viper/master
Diffstat (limited to 'UI')
-rw-r--r--UI/DASHPlayer.cpp47
-rw-r--r--UI/DASHPlayer.h1
2 files changed, 38 insertions, 10 deletions
diff --git a/UI/DASHPlayer.cpp b/UI/DASHPlayer.cpp
index b87dde74..0f1db8cc 100644
--- a/UI/DASHPlayer.cpp
+++ b/UI/DASHPlayer.cpp
@@ -26,10 +26,11 @@ DASHPlayer::DASHPlayer(ViperGui &gui, Config *config) :
{
InitializeCriticalSection(&this->monitorMutex);
this->offset = 0;
- this->url = NULL;
- this->icn = false;
+ this->url = NULL;
+ this->icn = false;
this->adaptLogic = LogicType::RateBased;
- this->seek = false;
+ this->seek = false;
+ this->isLive = false;
this->reloadParameters();
this->setSettings(0, 0, 0, 0, 0);
this->multimediaManager = new MultimediaManager(this->gui, this->parametersAdaptation->segmentBufferSize, config->getConfigPath().toStdString() + QString::fromLatin1("/").toStdString());
@@ -207,13 +208,39 @@ bool DASHPlayer::downloadMPD(const QString &url, const QString &adaptationLogic,
IPeriod *period = this->multimediaManager->getMPD()->GetPeriods().at(0);
IAdaptationSet *adaptation = period->GetAdaptationSets().at(0);
IRepresentation *representation = adaptation->GetRepresentation().at(0);
- uint32_t duration = representation->GetSegmentList()->GetDuration();
- uint32_t timescale = representation->GetSegmentList()->GetTimescale();
- this->gui->setListSegmentSize(representation->GetSegmentList()->GetSegmentURLs().size());
- this->segmentDuration = 1.0*duration/(1.0*timescale) * 1000;
- this->gui->setSegmentDuration(this->segmentDuration);
- this->parametersAdaptation->segmentDuration = this->segmentDuration;
- this->parametersAdaptation->segmentDuration = 1.0*duration/(1.0*timescale) * 1000;
+ if(!strcmp(this->multimediaManager->getMPD()->GetType().c_str(), "static")) // VOD MPD
+ {
+ if(representation->GetSegmentList())
+ {
+ uint32_t duration = representation->GetSegmentList()->GetDuration();
+ uint32_t timescale = representation->GetSegmentList()->GetTimescale();
+ this->gui->setListSegmentSize(representation->GetSegmentList()->GetSegmentURLs().size());
+ this->segmentDuration = 1.0*duration/(1.0*timescale) * 1000;
+ this->gui->setSegmentDuration(this->segmentDuration);
+ this->parametersAdaptation->segmentDuration = this->segmentDuration;
+ }
+ else //SegmentTemplate
+ {
+ uint32_t duration = representation->GetSegmentTemplate()->GetDuration();
+ uint32_t timescale = representation->GetSegmentTemplate()->GetTimescale();
+ this->segmentDuration = 1.0*duration/(1.0*timescale) * 1000;
+ this->gui->setSegmentDuration(this->segmentDuration);
+ this->gui->setListSegmentSize(TimeResolver::getDurationInSec(period->GetDuration())*1000/this->segmentDuration + 1);
+ this->parametersAdaptation->segmentDuration = this->segmentDuration;
+ }
+ }
+ else //Live MPD
+ {
+ //SegmentTemplate->SegmentTimeline
+ this->isLive = true;
+ //Assuming here that the segment duration doesn't change. If so, need to do an average over all segments.
+ uint32_t duration = representation->GetSegmentTemplate()->GetSegmentTimeline()->GetTimelines().at(0)->GetDuration();
+ uint32_t timescale = representation->GetSegmentTemplate()->GetTimescale();
+ this->segmentDuration = 1.0*duration/(1.0*timescale) * 1000;
+ this->gui->setSegmentDuration(this->segmentDuration);
+ this->gui->setListSegmentSize(1);
+ this->parametersAdaptation->segmentDuration = this->segmentDuration;
+ }
this->onSettingsChanged(0,0,0,0,0);
int j =0;
std::string temp = adaptationLogic.toStdString();
diff --git a/UI/DASHPlayer.h b/UI/DASHPlayer.h
index 8913a843..fad28710 100644
--- a/UI/DASHPlayer.h
+++ b/UI/DASHPlayer.h
@@ -164,6 +164,7 @@ private:
float beta;
float drop;
bool seek;
+ bool isLive;
Config *config;
bool repeat;
float segmentDuration;