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) ...@@ -50,7 +50,13 @@ Chunk* AbstractAdaptationLogic::getNextChunk(Streams::Type type)
if(!currentPeriod) if(!currentPeriod)
return NULL; return NULL;
Representation *rep = getCurrentRepresentation(type); Representation *rep;
if(prevRepresentation && !prevRepresentation->canBitswitch())
rep = prevRepresentation;
else
rep = getCurrentRepresentation(type);
if ( rep == NULL ) if ( rep == NULL )
return NULL; return NULL;
...@@ -68,6 +74,7 @@ Chunk* AbstractAdaptationLogic::getNextChunk(Streams::Type type) ...@@ -68,6 +74,7 @@ Chunk* AbstractAdaptationLogic::getNextChunk(Streams::Type type)
if (count == segments.size() && !b_templated) if (count == segments.size() && !b_templated)
{ {
currentPeriod = mpd->getNextPeriod(currentPeriod); currentPeriod = mpd->getNextPeriod(currentPeriod);
prevRepresentation = NULL;
count = 0; count = 0;
return getNextChunk(type); return getNextChunk(type);
} }
......
...@@ -54,7 +54,7 @@ namespace dash ...@@ -54,7 +54,7 @@ namespace dash
dash::mpd::MPD *mpd; dash::mpd::MPD *mpd;
dash::mpd::Period *currentPeriod; dash::mpd::Period *currentPeriod;
size_t count; size_t count;
const mpd::Representation *prevRepresentation; mpd::Representation *prevRepresentation;
private: private:
mtime_t bufferedMicroSec; mtime_t bufferedMicroSec;
......
...@@ -143,6 +143,8 @@ size_t IsoffMainParser::parseSegmentInformation(Node *node, SegmentInformation * ...@@ -143,6 +143,8 @@ size_t IsoffMainParser::parseSegmentInformation(Node *node, SegmentInformation *
parseSegmentBase(DOMHelper::getFirstChildElementByName(node, "SegmentBase"), info); parseSegmentBase(DOMHelper::getFirstChildElementByName(node, "SegmentBase"), info);
total += parseSegmentList(DOMHelper::getFirstChildElementByName(node, "SegmentList"), info); total += parseSegmentList(DOMHelper::getFirstChildElementByName(node, "SegmentList"), info);
total += parseSegmentTemplate(DOMHelper::getFirstChildElementByName(node, "SegmentTemplate" ), info); total += parseSegmentTemplate(DOMHelper::getFirstChildElementByName(node, "SegmentTemplate" ), info);
if(node->hasAttribute("bitstreamSwitching"))
info->setBitstreamSwitching(node->getAttributeValue("bitstreamSwitching") == "true");
return total; return total;
} }
......
...@@ -35,6 +35,7 @@ SegmentInformation::SegmentInformation(SegmentInformation *parent_) : ...@@ -35,6 +35,7 @@ SegmentInformation::SegmentInformation(SegmentInformation *parent_) :
segmentList = NULL; segmentList = NULL;
for(int i=0; i<InfoTypeCount; i++) for(int i=0; i<InfoTypeCount; i++)
segmentTemplate[i] = NULL; segmentTemplate[i] = NULL;
bitswitch_policy = BITSWITCH_INHERIT;
} }
SegmentInformation::SegmentInformation(ICanonicalUrl * parent_) : SegmentInformation::SegmentInformation(ICanonicalUrl * parent_) :
...@@ -45,6 +46,7 @@ SegmentInformation::SegmentInformation(ICanonicalUrl * parent_) : ...@@ -45,6 +46,7 @@ SegmentInformation::SegmentInformation(ICanonicalUrl * parent_) :
segmentList = NULL; segmentList = NULL;
for(int i=0; i<InfoTypeCount; i++) for(int i=0; i<InfoTypeCount; i++)
segmentTemplate[i] = NULL; segmentTemplate[i] = NULL;
bitswitch_policy = BITSWITCH_INHERIT;
} }
SegmentInformation::~SegmentInformation() SegmentInformation::~SegmentInformation()
...@@ -94,6 +96,14 @@ vector<ISegment *> SegmentInformation::getSegments() const ...@@ -94,6 +96,14 @@ vector<ISegment *> SegmentInformation::getSegments() const
return retSegments; 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) void SegmentInformation::setSegmentList(SegmentList *list)
{ {
segmentList = list; segmentList = list;
...@@ -156,6 +166,11 @@ void SegmentInformation::SplitUsingIndex(std::vector<SplitPoint> &splitlist) ...@@ -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 SegmentBase * SegmentInformation::inheritSegmentBase() const
{ {
if(segmentBase) if(segmentBase)
......
...@@ -48,6 +48,7 @@ namespace dash ...@@ -48,6 +48,7 @@ namespace dash
explicit SegmentInformation( ICanonicalUrl * ); explicit SegmentInformation( ICanonicalUrl * );
virtual ~SegmentInformation(); virtual ~SegmentInformation();
std::vector<ISegment *> getSegments() const; std::vector<ISegment *> getSegments() const;
bool canBitswitch() const;
class SplitPoint class SplitPoint
{ {
...@@ -69,6 +70,7 @@ namespace dash ...@@ -69,6 +70,7 @@ namespace dash
void setSegmentList(SegmentList *); void setSegmentList(SegmentList *);
void setSegmentBase(SegmentBase *); void setSegmentBase(SegmentBase *);
void setSegmentTemplate(SegmentTemplate *, SegmentInfoType); void setSegmentTemplate(SegmentTemplate *, SegmentInfoType);
void setBitstreamSwitching(bool);
SegmentBase * inheritSegmentBase() const; SegmentBase * inheritSegmentBase() const;
SegmentList * inheritSegmentList() const; SegmentList * inheritSegmentList() const;
...@@ -78,6 +80,13 @@ namespace dash ...@@ -78,6 +80,13 @@ namespace dash
SegmentBase *segmentBase; SegmentBase *segmentBase;
SegmentList *segmentList; SegmentList *segmentList;
SegmentTemplate *segmentTemplate[InfoTypeCount]; 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