diff options
author | Luca Muscariello <lumuscar+fdio@cisco.com> | 2017-02-25 23:42:31 +0100 |
---|---|---|
committer | Luca Muscariello <lumuscar+fdio@cisco.com> | 2017-02-25 23:42:31 +0100 |
commit | 05c1a838c881ea502888659848d8792843b28718 (patch) | |
tree | cf0b05b58bd725a1eb6c80325ba986c63dea42aa /MPD/AdaptationSetStream.cpp | |
parent | 9b30fc10fb1cbebe651e5a107e8ca5b24de54675 (diff) |
Initial commit: video player - viper
Change-Id: Id5aa33598ce34659bad4a7a9ae5006bfb84f9bd1
Signed-off-by: Luca Muscariello <lumuscar+fdio@cisco.com>
Diffstat (limited to 'MPD/AdaptationSetStream.cpp')
-rw-r--r-- | MPD/AdaptationSetStream.cpp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/MPD/AdaptationSetStream.cpp b/MPD/AdaptationSetStream.cpp new file mode 100644 index 00000000..62bc1912 --- /dev/null +++ b/MPD/AdaptationSetStream.cpp @@ -0,0 +1,82 @@ +/* + * AdaptationSetStream.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 "AdaptationSetStream.h" + +using namespace libdash::framework::mpd; +using namespace dash::mpd; + +AdaptationSetStream::AdaptationSetStream(IMPD *mpd, IPeriod *period, IAdaptationSet *adaptationSet) : + mpd (mpd), + period (period), + adaptationSet (adaptationSet) +{ + initialize(); +} + +AdaptationSetStream::~AdaptationSetStream() +{ + std::map<IRepresentation *, IRepresentationStream *>::iterator iter; + for (iter = representations.begin(); iter != representations.end(); ++iter) + { + delete(iter->second); + } +} + +IRepresentationStream* AdaptationSetStream::getRepresentationStream(IRepresentation *representation) +{ + return this->representations.find(representation)->second; +} + +RepresentationStreamType AdaptationSetStream::determineRepresentationStreamType (IRepresentation *representation) +{ + /* check on Representation Level */ + if (representation->GetSegmentList()) + return libdash::framework::mpd::SegmentList; + + if (representation->GetSegmentTemplate()) + return libdash::framework::mpd::SegmentTemplate; + + if (representation->GetSegmentBase() || representation->GetBaseURLs().size() > 0) + return libdash::framework::mpd::SingleMediaSegment; + + /* check on AdaptationSet Level */ + if (this->adaptationSet->GetSegmentList()) + return libdash::framework::mpd::SegmentList; + + if (this->adaptationSet->GetSegmentTemplate()) + return libdash::framework::mpd::SegmentTemplate; + + if (this->adaptationSet->GetSegmentBase()) + return libdash::framework::mpd::SingleMediaSegment; + + /* check on Period Level */ + if (this->period->GetSegmentList()) + return libdash::framework::mpd::SegmentList; + + if (this->period->GetSegmentTemplate()) + return libdash::framework::mpd::SegmentTemplate; + + if (this->period->GetSegmentBase()) + return libdash::framework::mpd::SingleMediaSegment; + + return libdash::framework::mpd::UNDEFINED; +} + +void AdaptationSetStream::initialize() +{ + for (size_t i = 0; i < adaptationSet->GetRepresentation().size(); i++) + { + IRepresentation *representation = adaptationSet->GetRepresentation().at(i); + RepresentationStreamType type = determineRepresentationStreamType(representation); + representations[representation] = RepresentationStreamFactory::create(type, mpd, period, adaptationSet, representation); + } +} |