[vlc-commits] demux: dash: handle bitswitchable property
Francois Cartegnie
git at videolan.org
Mon Dec 22 19:04:01 CET 2014
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Dec 22 16:16:39 2014 +0100| [57cca51db01124e7b0e3667191c033ed18ffb968] | committer: Francois Cartegnie
demux: dash: handle bitswitchable property
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=57cca51db01124e7b0e3667191c033ed18ffb968
---
.../dash/adaptationlogic/AbstractAdaptationLogic.cpp | 9 ++++++++-
.../dash/adaptationlogic/AbstractAdaptationLogic.h | 2 +-
modules/stream_filter/dash/mpd/IsoffMainParser.cpp | 2 ++
modules/stream_filter/dash/mpd/SegmentInformation.cpp | 15 +++++++++++++++
modules/stream_filter/dash/mpd/SegmentInformation.hpp | 9 +++++++++
5 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp b/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp
index 43ac0f6..3fcabf1 100644
--- a/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp
+++ b/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp
@@ -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);
}
diff --git a/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.h b/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.h
index abb153f..8bb311d 100644
--- a/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.h
+++ b/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.h
@@ -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;
diff --git a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
index fdaff37..ee07cd9 100644
--- a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
+++ b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
@@ -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;
}
diff --git a/modules/stream_filter/dash/mpd/SegmentInformation.cpp b/modules/stream_filter/dash/mpd/SegmentInformation.cpp
index 315600c..6cb1630 100644
--- a/modules/stream_filter/dash/mpd/SegmentInformation.cpp
+++ b/modules/stream_filter/dash/mpd/SegmentInformation.cpp
@@ -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)
diff --git a/modules/stream_filter/dash/mpd/SegmentInformation.hpp b/modules/stream_filter/dash/mpd/SegmentInformation.hpp
index 50db1c3..3968111 100644
--- a/modules/stream_filter/dash/mpd/SegmentInformation.hpp
+++ b/modules/stream_filter/dash/mpd/SegmentInformation.hpp
@@ -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;
};
}
}
More information about the vlc-commits
mailing list