[vlc-commits] demux: dash: set SegmentBase as segment itself
Francois Cartegnie
git at videolan.org
Thu May 7 23:44:07 CEST 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu May 7 17:17:27 2015 +0200| [d8a926a2b8fb6b0a94c0be8b19b4fcfcd8cc08aa] | committer: Francois Cartegnie
demux: dash: set SegmentBase as segment itself
Fixes playback with single file, simple profile
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d8a926a2b8fb6b0a94c0be8b19b4fcfcd8cc08aa
---
modules/demux/adaptative/playlist/SegmentBase.cpp | 3 +-
modules/demux/adaptative/playlist/SegmentBase.h | 7 ++-
.../adaptative/playlist/SegmentInformation.cpp | 4 ++
modules/demux/dash/mpd/IsoffMainParser.cpp | 49 ++++++--------------
4 files changed, 26 insertions(+), 37 deletions(-)
diff --git a/modules/demux/adaptative/playlist/SegmentBase.cpp b/modules/demux/adaptative/playlist/SegmentBase.cpp
index 1900f54..573751c 100644
--- a/modules/demux/adaptative/playlist/SegmentBase.cpp
+++ b/modules/demux/adaptative/playlist/SegmentBase.cpp
@@ -26,7 +26,8 @@
using namespace adaptative::playlist;
-SegmentBase::SegmentBase () :
+SegmentBase::SegmentBase(ICanonicalUrl *parent) :
+ Segment(parent),
Initializable(),
Indexable()
{
diff --git a/modules/demux/adaptative/playlist/SegmentBase.h b/modules/demux/adaptative/playlist/SegmentBase.h
index be6f41b..f9c55ad 100644
--- a/modules/demux/adaptative/playlist/SegmentBase.h
+++ b/modules/demux/adaptative/playlist/SegmentBase.h
@@ -27,16 +27,19 @@
#include "Segment.h"
#include "SegmentInfoCommon.h"
+#include "../tools/Properties.hpp"
namespace adaptative
{
namespace playlist
{
- class SegmentBase : public Initializable<Segment>,
+ /* SegmentBase can contain only one segment */
+ class SegmentBase : public Segment,
+ public Initializable<Segment>,
public Indexable<Segment>
{
public:
- SegmentBase ();
+ SegmentBase (ICanonicalUrl *);
virtual ~SegmentBase ();
};
}
diff --git a/modules/demux/adaptative/playlist/SegmentInformation.cpp b/modules/demux/adaptative/playlist/SegmentInformation.cpp
index ec4b49a..350d460 100644
--- a/modules/demux/adaptative/playlist/SegmentInformation.cpp
+++ b/modules/demux/adaptative/playlist/SegmentInformation.cpp
@@ -101,6 +101,10 @@ vector<ISegment *> SegmentInformation::getSegments(SegmentInfoType type) const
retSegments.insert( retSegments.end(), list.begin(), list.end() );
}
}
+ else if( segmentBase )
+ {
+ retSegments.push_back( segmentBase );
+ }
}
break;
diff --git a/modules/demux/dash/mpd/IsoffMainParser.cpp b/modules/demux/dash/mpd/IsoffMainParser.cpp
index d024bad..1ba08be 100644
--- a/modules/demux/dash/mpd/IsoffMainParser.cpp
+++ b/modules/demux/dash/mpd/IsoffMainParser.cpp
@@ -257,51 +257,32 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
}
size_t IsoffMainParser::parseSegmentBase(Node * segmentBaseNode, SegmentInformation *info)
{
- size_t list_count = 0;
+ SegmentBase *base;
- if(!segmentBaseNode)
+ if(!segmentBaseNode || !(base = new (std::nothrow) SegmentBase(info)))
return 0;
- else if(segmentBaseNode->hasAttribute("indexRange"))
+ if(segmentBaseNode->hasAttribute("indexRange"))
{
- SegmentList *list = new SegmentList();
- Segment *seg;
-
size_t start = 0, end = 0;
if (std::sscanf(segmentBaseNode->getAttributeValue("indexRange").c_str(), "%zu-%zu", &start, &end) == 2)
{
- IndexSegment *index = new DashIndexSegment(info);
- index->setByteRange(start, end);
- list->indexSegment.Set(index);
- /* index must be before data, so data starts at index end */
- seg = new Segment(info);
- seg->setByteRange(end + 1, 0);
- }
- else
- {
- seg = new Segment(info);
+ IndexSegment *index = new (std::nothrow) DashIndexSegment(info);
+ if(index)
+ {
+ index->setByteRange(start, end);
+ base->indexSegment.Set(index);
+ /* index must be before data, so data starts at index end */
+ base->setByteRange(end + 1, 0);
+ }
}
+ }
- list_count++;
- list->addSegment(seg);
- info->setSegmentList(list);
+ parseInitSegment(DOMHelper::getFirstChildElementByName(segmentBaseNode, "Initialization"), base, info);
- Node *initSeg = DOMHelper::getFirstChildElementByName(segmentBaseNode, "Initialization");
- if(initSeg)
- {
- SegmentBase *base = new SegmentBase();
- parseInitSegment(initSeg, base, info);
- info->setSegmentBase(base);
- }
- }
- else
- {
- SegmentBase *base = new SegmentBase();
- parseInitSegment(DOMHelper::getFirstChildElementByName(segmentBaseNode, "Initialization"), base, info);
- info->setSegmentBase(base);
- }
+ info->setSegmentBase(base);
- return list_count;
+ return 1;
}
size_t IsoffMainParser::parseSegmentList(Node * segListNode, SegmentInformation *info)
More information about the vlc-commits
mailing list