Commit d7ace43f authored by François Cartegnie's avatar François Cartegnie 🤞
Browse files

demux: dash: add MPD merging for updates

parent ec5b75ba
......@@ -28,6 +28,7 @@
#include "MPD.h"
#include "Helper.h"
#include "dash.hpp"
#include "SegmentTimeline.h"
#include <vlc_common.h>
#include <vlc_stream.h>
......@@ -59,7 +60,7 @@ MPD::~MPD ()
delete(programInfo.Get());
}
const std::vector<Period*>& MPD::getPeriods () const
const std::vector<Period*>& MPD::getPeriods ()
{
return this->periods;
}
......@@ -110,7 +111,7 @@ vlc_object_t * MPD::getVLCObject() const
return VLC_OBJECT(stream);
}
Period* MPD::getFirstPeriod() const
Period* MPD::getFirstPeriod()
{
std::vector<Period *> periods = getPeriods();
......@@ -132,3 +133,19 @@ Period* MPD::getNextPeriod(Period *period)
return NULL;
}
void MPD::mergeWith(MPD *updatedMPD)
{
availabilityEndTime.Set(updatedMPD->availabilityEndTime.Get());
/* Only merge timelines for now */
for(size_t i = 0; i < periods.size() && i < updatedMPD->periods.size(); i++)
{
std::vector<SegmentTimeline *> timelines;
std::vector<SegmentTimeline *> timelinesUpdate;
periods.at(i)->collectTimelines(&timelines);
updatedMPD->periods.at(i)->collectTimelines(&timelinesUpdate);
for(size_t j = 0; j < timelines.size() && j < timelinesUpdate.size(); j++)
timelines.at(j)->mergeWith(*timelinesUpdate.at(j));
}
}
......@@ -56,10 +56,12 @@ namespace dash
virtual Url getUrlSegment() const; /* impl */
vlc_object_t * getVLCObject() const;
virtual const std::vector<Period *>& getPeriods() const;
virtual Period* getFirstPeriod() const;
virtual const std::vector<Period *>& getPeriods();
virtual Period* getFirstPeriod();
virtual Period* getNextPeriod(Period *period);
void mergeWith(MPD *);
Property<time_t> duration;
Property<time_t> playbackStart;
Property<time_t> availabilityEndTime;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment