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 @@
using namespace adaptative::playlist;
SegmentBase::SegmentBase () :
SegmentBase::SegmentBase(ICanonicalUrl *parent) :
Segment(parent),
Initializable(),
Indexable()
{
......
......@@ -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 ();
};
}
......
......@@ -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;
......
......@@ -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)
......
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