Commit d8a926a2 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: dash: set SegmentBase as segment itself

Fixes playback with single file, simple profile
parent 21edb9b4
...@@ -26,7 +26,8 @@ ...@@ -26,7 +26,8 @@
using namespace adaptative::playlist; using namespace adaptative::playlist;
SegmentBase::SegmentBase () : SegmentBase::SegmentBase(ICanonicalUrl *parent) :
Segment(parent),
Initializable(), Initializable(),
Indexable() Indexable()
{ {
......
...@@ -27,16 +27,19 @@ ...@@ -27,16 +27,19 @@
#include "Segment.h" #include "Segment.h"
#include "SegmentInfoCommon.h" #include "SegmentInfoCommon.h"
#include "../tools/Properties.hpp"
namespace adaptative namespace adaptative
{ {
namespace playlist namespace playlist
{ {
class SegmentBase : public Initializable<Segment>, /* SegmentBase can contain only one segment */
class SegmentBase : public Segment,
public Initializable<Segment>,
public Indexable<Segment> public Indexable<Segment>
{ {
public: public:
SegmentBase (); SegmentBase (ICanonicalUrl *);
virtual ~SegmentBase (); virtual ~SegmentBase ();
}; };
} }
......
...@@ -101,6 +101,10 @@ vector<ISegment *> SegmentInformation::getSegments(SegmentInfoType type) const ...@@ -101,6 +101,10 @@ vector<ISegment *> SegmentInformation::getSegments(SegmentInfoType type) const
retSegments.insert( retSegments.end(), list.begin(), list.end() ); retSegments.insert( retSegments.end(), list.begin(), list.end() );
} }
} }
else if( segmentBase )
{
retSegments.push_back( segmentBase );
}
} }
break; break;
......
...@@ -257,51 +257,32 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation ...@@ -257,51 +257,32 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
} }
size_t IsoffMainParser::parseSegmentBase(Node * segmentBaseNode, SegmentInformation *info) 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; return 0;
else if(segmentBaseNode->hasAttribute("indexRange")) if(segmentBaseNode->hasAttribute("indexRange"))
{ {
SegmentList *list = new SegmentList();
Segment *seg;
size_t start = 0, end = 0; size_t start = 0, end = 0;
if (std::sscanf(segmentBaseNode->getAttributeValue("indexRange").c_str(), "%zu-%zu", &start, &end) == 2) if (std::sscanf(segmentBaseNode->getAttributeValue("indexRange").c_str(), "%zu-%zu", &start, &end) == 2)
{ {
IndexSegment *index = new DashIndexSegment(info); IndexSegment *index = new (std::nothrow) DashIndexSegment(info);
if(index)
{
index->setByteRange(start, end); index->setByteRange(start, end);
list->indexSegment.Set(index); base->indexSegment.Set(index);
/* index must be before data, so data starts at index end */ /* index must be before data, so data starts at index end */
seg = new Segment(info); base->setByteRange(end + 1, 0);
seg->setByteRange(end + 1, 0);
}
else
{
seg = new Segment(info);
} }
list_count++;
list->addSegment(seg);
info->setSegmentList(list);
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); 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) size_t IsoffMainParser::parseSegmentList(Node * segListNode, SegmentInformation *info)
......
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