Commit 57cca51d authored by Francois Cartegnie's avatar Francois Cartegnie

demux: dash: handle bitswitchable property

parent 6713191a
......@@ -50,7 +50,13 @@ Chunk* AbstractAdaptationLogic::getNextChunk(Streams::Type type)
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;
......@@ -68,6 +74,7 @@ Chunk* AbstractAdaptationLogic::getNextChunk(Streams::Type type)
if (count == segments.size() && !b_templated)
{
currentPeriod = mpd->getNextPeriod(currentPeriod);
prevRepresentation = NULL;
count = 0;
return getNextChunk(type);
}
......
......@@ -54,7 +54,7 @@ namespace dash
dash::mpd::MPD *mpd;
dash::mpd::Period *currentPeriod;
size_t count;
const mpd::Representation *prevRepresentation;
mpd::Representation *prevRepresentation;
private:
mtime_t bufferedMicroSec;
......
......@@ -143,6 +143,8 @@ size_t IsoffMainParser::parseSegmentInformation(Node *node, SegmentInformation *
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;
}
......
......@@ -35,6 +35,7 @@ SegmentInformation::SegmentInformation(SegmentInformation *parent_) :
segmentList = NULL;
for(int i=0; i<InfoTypeCount; i++)
segmentTemplate[i] = NULL;
bitswitch_policy = BITSWITCH_INHERIT;
}
SegmentInformation::SegmentInformation(ICanonicalUrl * parent_) :
......@@ -45,6 +46,7 @@ SegmentInformation::SegmentInformation(ICanonicalUrl * parent_) :
segmentList = NULL;
for(int i=0; i<InfoTypeCount; i++)
segmentTemplate[i] = NULL;
bitswitch_policy = BITSWITCH_INHERIT;
}
SegmentInformation::~SegmentInformation()
......@@ -94,6 +96,14 @@ vector<ISegment *> SegmentInformation::getSegments() const
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;
......@@ -156,6 +166,11 @@ void SegmentInformation::SplitUsingIndex(std::vector<SplitPoint> &splitlist)
}
}
void SegmentInformation::setBitstreamSwitching(bool bitswitch)
{
bitswitch_policy = (bitswitch) ? BITSWITCH_YES : BITSWITCH_NO;
}
SegmentBase * SegmentInformation::inheritSegmentBase() const
{
if(segmentBase)
......
......@@ -48,6 +48,7 @@ namespace dash
explicit SegmentInformation( ICanonicalUrl * );
virtual ~SegmentInformation();
std::vector<ISegment *> getSegments() const;
bool canBitswitch() const;
class SplitPoint
{
......@@ -69,6 +70,7 @@ namespace dash
void setSegmentList(SegmentList *);
void setSegmentBase(SegmentBase *);
void setSegmentTemplate(SegmentTemplate *, SegmentInfoType);
void setBitstreamSwitching(bool);
SegmentBase * inheritSegmentBase() const;
SegmentList * inheritSegmentList() const;
......@@ -78,6 +80,13 @@ namespace dash
SegmentBase *segmentBase;
SegmentList *segmentList;
SegmentTemplate *segmentTemplate[InfoTypeCount];
enum BitswitchPolicy
{
BITSWITCH_INHERIT,
BITSWITCH_YES,
BITSWITCH_NO
} bitswitch_policy;
};
}
}
......
Markdown is supported
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