return false;
}
-Segment* BasicCMParser::parseSegment( Node* node )
+Segment* BasicCMParser::parseSegment( Node* node, bool init )
{
const std::map<std::string, std::string> attr = node->getAttributes();
std::map<std::string, std::string>::const_iterator it;
seg = new SegmentTemplate( runtimeToken, this->currentRepresentation );
}
else
- seg = new Segment( this->currentRepresentation );
+ seg = new Segment( this->currentRepresentation, init );
if ( url.find( this->p_stream->psz_access ) != 0 ) //Relative url
url = this->url + url;
seg->setSourceUrl( url );
" other InitialisationSegmentURL will be dropped." );
if ( initSeg.size() == 1 )
{
- Segment *seg = parseSegment( initSeg.at(0) );
+ Segment *seg = parseSegment( initSeg.at(0), true );
if ( seg != NULL )
info->setInitialisationSegment( seg );
}
bool parseCommonAttributesElements( dash::xml::Node *node,
CommonAttributesElements *common,
CommonAttributesElements *parent ) const;
- Segment* parseSegment( xml::Node* node );
+ Segment* parseSegment( xml::Node* node, bool init = false );
ProgramInformation* parseProgramInformation();
private:
if(initSeg.size() > 0)
{
- Segment *seg = new Segment( this->currentRepresentation );
+ Segment *seg = new Segment( currentRepresentation, true );
seg->setSourceUrl(initSeg.at(0)->getAttributeValue("sourceURL"));
if(initSeg.at(0)->hasAttribute("range"))
{
std::vector<std::string> ret;
ret.push_back(std::string(" Representation"));
- ret.push_back(std::string(" InitSeg url=")
- .append(segmentBase->getInitSegment()->getSourceUrl()));
- if (segmentList)
+ std::vector<Segment *> list = getSegments();
+ std::vector<Segment *>::const_iterator l;
+ for(l = list.begin(); l < list.end(); l++)
{
- std::vector<Segment *>::const_iterator l;
- for(l = segmentList->getSegments().begin();
- l < segmentList->getSegments().end(); l++)
- {
+ if ((*l)->isInit())
+ ret.push_back(std::string(" InitSeg url=")
+ .append((*l)->getUrlSegment()));
+ else
ret.push_back(std::string(" Segment url=")
- .append((*l)->getSourceUrl()));
- }
+ .append((*l)->getUrlSegment()));
}
return ret;
}
using namespace dash::mpd;
using namespace dash::http;
-Segment::Segment(const Representation *parent) :
+Segment::Segment(const Representation *parent, bool isinit) :
ICanonicalUrl( parent ),
startByte (-1),
endByte (-1),
- parentRepresentation( parent )
+ parentRepresentation( parent ),
+ init( isinit )
{
assert( parent != NULL );
if ( parent->getSegmentInfo() != NULL && parent->getSegmentInfo()->getDuration() >= 0 )
ret.append(sourceUrl);
return ret;
}
+
+bool Segment::isInit() const
+{
+ return init;
+}
class Segment : public ICanonicalUrl
{
public:
- Segment( const Representation *parent );
+ Segment( const Representation *parent, bool isinit = false );
virtual ~Segment(){}
virtual void setSourceUrl( const std::string &url );
/**
* when using an UrlTemplate
*/
virtual bool isSingleShot () const;
+ virtual bool isInit () const;
virtual void done ();
virtual void setByteRange (int start, int end);
virtual dash::http::Chunk* toChunk ();
int endByte;
const Representation* parentRepresentation;
int size;
+ bool init;
};
}
}