[vlc-commits] demux: dash: add MPD merging for updates
Francois Cartegnie
git at videolan.org
Mon Jan 12 20:22:08 CET 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Jan 10 21:23:45 2015 +0100| [d7ace43f1867e8ea7aab790a17a1352769c7b8ae] | committer: Francois Cartegnie
demux: dash: add MPD merging for updates
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d7ace43f1867e8ea7aab790a17a1352769c7b8ae
---
modules/demux/dash/mpd/MPD.cpp | 21 +++++++++++++++++++--
modules/demux/dash/mpd/MPD.h | 6 ++++--
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/modules/demux/dash/mpd/MPD.cpp b/modules/demux/dash/mpd/MPD.cpp
index c0cd432..21d5159 100644
--- a/modules/demux/dash/mpd/MPD.cpp
+++ b/modules/demux/dash/mpd/MPD.cpp
@@ -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));
+ }
+}
diff --git a/modules/demux/dash/mpd/MPD.h b/modules/demux/dash/mpd/MPD.h
index 96c2100..0f9eb02 100644
--- a/modules/demux/dash/mpd/MPD.h
+++ b/modules/demux/dash/mpd/MPD.h
@@ -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;
More information about the vlc-commits
mailing list