summaryrefslogtreecommitdiffstats
path: root/MPD/SingleMediaSegmentStream.cpp
diff options
context:
space:
mode:
authorLuca Muscariello <lumuscar+fdio@cisco.com>2017-02-25 23:42:31 +0100
committerLuca Muscariello <lumuscar+fdio@cisco.com>2017-02-25 23:42:31 +0100
commit05c1a838c881ea502888659848d8792843b28718 (patch)
treecf0b05b58bd725a1eb6c80325ba986c63dea42aa /MPD/SingleMediaSegmentStream.cpp
parent9b30fc10fb1cbebe651e5a107e8ca5b24de54675 (diff)
Initial commit: video player - viper
Change-Id: Id5aa33598ce34659bad4a7a9ae5006bfb84f9bd1 Signed-off-by: Luca Muscariello <lumuscar+fdio@cisco.com>
Diffstat (limited to 'MPD/SingleMediaSegmentStream.cpp')
-rw-r--r--MPD/SingleMediaSegmentStream.cpp76
1 files changed, 76 insertions, 0 deletions
diff --git a/MPD/SingleMediaSegmentStream.cpp b/MPD/SingleMediaSegmentStream.cpp
new file mode 100644
index 00000000..ff4540e2
--- /dev/null
+++ b/MPD/SingleMediaSegmentStream.cpp
@@ -0,0 +1,76 @@
+/*
+ * SingleMediaSegmentStream.cpp
+ *****************************************************************************
+ * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
+ *
+ * Email: libdash-dev@vicky.bitmovin.net
+ *
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ *****************************************************************************/
+
+#include "SingleMediaSegmentStream.h"
+
+using namespace dash::mpd;
+using namespace libdash::framework::mpd;
+
+SingleMediaSegmentStream::SingleMediaSegmentStream(IMPD *mpd, IPeriod *period, IAdaptationSet *adaptationSet, IRepresentation *representation) :
+ AbstractRepresentationStream (mpd, period, adaptationSet, representation)
+{
+ this->baseUrls = BaseUrlResolver::resolveBaseUrl(mpd, period, adaptationSet, 0, 0, 0);
+}
+SingleMediaSegmentStream::~SingleMediaSegmentStream()
+{
+}
+ISegment* SingleMediaSegmentStream::getInitializationSegment()
+{
+ if (this->representation->GetSegmentBase())
+ {
+ /* TODO: check whether @sourceURL and/or @range is available in SegmentBase.Initialization, see Table 13 */
+
+ if (this->representation->GetSegmentBase()->GetInitialization())
+ return this->representation->GetSegmentBase()->GetInitialization()->ToSegment(baseUrls);
+ }
+
+ return NULL;
+}
+ISegment* SingleMediaSegmentStream::getIndexSegment(size_t segmentNumber)
+{
+ /* segmentNumber is not used in this case */
+ if (this->representation->GetSegmentBase())
+ {
+ if (this->representation->GetSegmentBase()->GetRepresentationIndex())
+ return this->representation->GetSegmentBase()->GetRepresentationIndex()->ToSegment(baseUrls);
+ }
+
+ return NULL;
+}
+ISegment* SingleMediaSegmentStream::getMediaSegment(size_t segmentNumber)
+{
+ /* segmentNumber equals the desired BaseUrl */
+ if (this->representation->GetBaseURLs().size() > segmentNumber)
+ return this->representation->GetBaseURLs().at(segmentNumber)->ToMediaSegment(baseUrls);
+
+ return this->representation->GetBaseURLs().at(0)->ToMediaSegment(baseUrls);
+}
+ISegment* SingleMediaSegmentStream::getBitstreamSwitchingSegment()
+{
+ /* not possible */
+ return NULL;
+}
+RepresentationStreamType SingleMediaSegmentStream::getStreamType()
+{
+ return SingleMediaSegment;
+}
+uint32_t SingleMediaSegmentStream::getFirstSegmentNumber()
+{
+ return 0;
+}
+uint32_t SingleMediaSegmentStream::getCurrentSegmentNumber()
+{
+ return 0;
+}
+uint32_t SingleMediaSegmentStream::getLastSegmentNumber()
+{
+ return 0;
+}