if(!currentPeriod)
return NULL;
- Representation *rep = getCurrentRepresentation(type);
+ Representation *rep;
+
+ if(prevRepresentation && !prevRepresentation->canBitswitch())
+ rep = prevRepresentation;
+ else
+ rep = getCurrentRepresentation(type);
+
if ( rep == NULL )
return NULL;
if (count == segments.size() && !b_templated)
{
currentPeriod = mpd->getNextPeriod(currentPeriod);
+ prevRepresentation = NULL;
count = 0;
return getNextChunk(type);
}
dash::mpd::MPD *mpd;
dash::mpd::Period *currentPeriod;
size_t count;
- const mpd::Representation *prevRepresentation;
+ mpd::Representation *prevRepresentation;
private:
mtime_t bufferedMicroSec;
parseSegmentBase(DOMHelper::getFirstChildElementByName(node, "SegmentBase"), info);
total += parseSegmentList(DOMHelper::getFirstChildElementByName(node, "SegmentList"), info);
total += parseSegmentTemplate(DOMHelper::getFirstChildElementByName(node, "SegmentTemplate" ), info);
+ if(node->hasAttribute("bitstreamSwitching"))
+ info->setBitstreamSwitching(node->getAttributeValue("bitstreamSwitching") == "true");
return total;
}
segmentList = NULL;
for(int i=0; i<InfoTypeCount; i++)
segmentTemplate[i] = NULL;
+ bitswitch_policy = BITSWITCH_INHERIT;
}
SegmentInformation::SegmentInformation(ICanonicalUrl * parent_) :
segmentList = NULL;
for(int i=0; i<InfoTypeCount; i++)
segmentTemplate[i] = NULL;
+ bitswitch_policy = BITSWITCH_INHERIT;
}
SegmentInformation::~SegmentInformation()
return retSegments;
}
+bool SegmentInformation::canBitswitch() const
+{
+ if(bitswitch_policy == BITSWITCH_INHERIT)
+ return (parent) ? parent->canBitswitch() : false;
+ else
+ return (bitswitch_policy == BITSWITCH_YES);
+}
+
void SegmentInformation::setSegmentList(SegmentList *list)
{
segmentList = list;
}
}
+void SegmentInformation::setBitstreamSwitching(bool bitswitch)
+{
+ bitswitch_policy = (bitswitch) ? BITSWITCH_YES : BITSWITCH_NO;
+}
+
SegmentBase * SegmentInformation::inheritSegmentBase() const
{
if(segmentBase)
explicit SegmentInformation( ICanonicalUrl * );
virtual ~SegmentInformation();
std::vector<ISegment *> getSegments() const;
+ bool canBitswitch() const;
class SplitPoint
{
void setSegmentList(SegmentList *);
void setSegmentBase(SegmentBase *);
void setSegmentTemplate(SegmentTemplate *, SegmentInfoType);
+ void setBitstreamSwitching(bool);
SegmentBase * inheritSegmentBase() const;
SegmentList * inheritSegmentList() const;
SegmentBase *segmentBase;
SegmentList *segmentList;
SegmentTemplate *segmentTemplate[InfoTypeCount];
+
+ enum BitswitchPolicy
+ {
+ BITSWITCH_INHERIT,
+ BITSWITCH_YES,
+ BITSWITCH_NO
+ } bitswitch_policy;
};
}
}