Commit 54bbf8cf authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

dash: AdaptationSet is the new Group.

parent 33d29187
...@@ -32,8 +32,6 @@ SOURCES_stream_filter_dash = \ ...@@ -32,8 +32,6 @@ SOURCES_stream_filter_dash = \
mpd/CommonAttributesElements.h \ mpd/CommonAttributesElements.h \
mpd/ContentDescription.cpp \ mpd/ContentDescription.cpp \
mpd/ContentDescription.h \ mpd/ContentDescription.h \
mpd/Group.cpp \
mpd/Group.h \
mpd/IMPDManager.h \ mpd/IMPDManager.h \
mpd/IMPDParser.h \ mpd/IMPDParser.h \
mpd/IsoffMainParser.cpp \ mpd/IsoffMainParser.cpp \
......
/* /*
* AdaptationSet.cpp * AdaptationSet.cpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2010 - 2012 Klagenfurt University * Copyright (C) 2010 - 2011 Klagenfurt University
* *
* Created on: Jan 27, 2012 * Created on: Aug 10, 2010
* Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at> * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
* Christian Timmerer <christian.timmerer@itec.uni-klu.ac.at> * Christian Timmerer <christian.timmerer@itec.uni-klu.ac.at>
* *
...@@ -28,20 +28,76 @@ ...@@ -28,20 +28,76 @@
#include "AdaptationSet.h" #include "AdaptationSet.h"
#include <vlc_common.h>
#include <vlc_arrays.h>
#include "SegmentInfoDefault.h"
using namespace dash::mpd; using namespace dash::mpd;
AdaptationSet::AdaptationSet () : AdaptationSet::AdaptationSet() :
isBitstreamSwitching (false) subsegmentAlignmentFlag( false ),
segmentInfoDefault( NULL ),
isBitstreamSwitching( false )
{ {
} }
AdaptationSet::~AdaptationSet () AdaptationSet::~AdaptationSet ()
{ {
delete this->segmentInfoDefault;
vlc_delete_all( this->representations );
}
bool AdaptationSet::getSubsegmentAlignmentFlag() const
{
return this->subsegmentAlignmentFlag;
}
void AdaptationSet::setSubsegmentAlignmentFlag(bool alignment)
{
this->subsegmentAlignmentFlag = alignment;
}
std::vector<Representation*> AdaptationSet::getRepresentations ()
{
return this->representations;
}
const Representation *AdaptationSet::getRepresentationById(const std::string &id) const
{
std::vector<Representation*>::const_iterator it = this->representations.begin();
std::vector<Representation*>::const_iterator end = this->representations.end();
while ( it != end )
{
if ( (*it)->getId() == id )
return *it;
++it;
}
return NULL;
}
const SegmentInfoDefault *AdaptationSet::getSegmentInfoDefault() const
{
return this->segmentInfoDefault;
}
void AdaptationSet::setSegmentInfoDefault(const SegmentInfoDefault *seg)
{
if ( seg != NULL )
this->segmentInfoDefault = seg;
}
void AdaptationSet::addRepresentation (Representation *rep)
{
this->representations.push_back(rep);
} }
void AdaptationSet::setBitstreamSwitching (bool value) void AdaptationSet::setBitstreamSwitching (bool value)
{ {
this->isBitstreamSwitching = value; this->isBitstreamSwitching = value;
} }
bool AdaptationSet::getBitstreamSwitching () const bool AdaptationSet::getBitstreamSwitching () const
{ {
return this->isBitstreamSwitching; return this->isBitstreamSwitching;
......
/* /*
* AdaptationSet.h * AdaptationSet.h
***************************************************************************** *****************************************************************************
* Copyright (C) 2010 - 2012 Klagenfurt University * Copyright (C) 2010 - 2011 Klagenfurt University
* *
* Created on: Jan 27, 2012 * Created on: Aug 10, 2010
* Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at> * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
* Christian Timmerer <christian.timmerer@itec.uni-klu.ac.at> * Christian Timmerer <christian.timmerer@itec.uni-klu.ac.at>
* *
...@@ -25,23 +25,40 @@ ...@@ -25,23 +25,40 @@
#ifndef ADAPTATIONSET_H_ #ifndef ADAPTATIONSET_H_
#define ADAPTATIONSET_H_ #define ADAPTATIONSET_H_
#include "mpd/Group.h" #include <vector>
#include <string>
#include <map>
#include "mpd/Representation.h"
#include "mpd/CommonAttributesElements.h"
namespace dash namespace dash
{ {
namespace mpd namespace mpd
{ {
class AdaptationSet : public Group class SegmentInfoDefault;
class AdaptationSet : public CommonAttributesElements
{ {
public: public:
AdaptationSet (); AdaptationSet();
virtual ~AdaptationSet (); virtual ~AdaptationSet();
void setBitstreamSwitching (bool value); bool getSubsegmentAlignmentFlag() const;
bool getBitstreamSwitching () const; void setSubsegmentAlignmentFlag( bool alignment );
std::vector<Representation *> getRepresentations ();
const Representation* getRepresentationById ( const std::string &id ) const;
const SegmentInfoDefault* getSegmentInfoDefault() const;
void setSegmentInfoDefault( const SegmentInfoDefault* seg );
void setBitstreamSwitching(bool value);
bool getBitstreamSwitching() const;
void addRepresentation( Representation *rep );
private: private:
bool isBitstreamSwitching; bool subsegmentAlignmentFlag;
std::vector<Representation *> representations;
const SegmentInfoDefault* segmentInfoDefault;
bool isBitstreamSwitching;
}; };
} }
} }
......
...@@ -59,14 +59,14 @@ const std::vector<Period*>& BasicCMManager::getPeriods () const ...@@ -59,14 +59,14 @@ const std::vector<Period*>& BasicCMManager::getPeriods () const
Representation* BasicCMManager::getBestRepresentation (Period *period) Representation* BasicCMManager::getBestRepresentation (Period *period)
{ {
std::vector<Group *> groups = period->getGroups(); std::vector<AdaptationSet *> adaptSet = period->getAdaptationSets();
uint64_t bitrate = 0; uint64_t bitrate = 0;
Representation *best = NULL; Representation *best = NULL;
for(size_t i = 0; i < groups.size(); i++) for(size_t i = 0; i < adaptSet.size(); i++)
{ {
std::vector<Representation *> reps = groups.at(i)->getRepresentations(); std::vector<Representation *> reps = adaptSet.at(i)->getRepresentations();
for(size_t j = 0; j < reps.size(); j++) for(size_t j = 0; j < reps.size(); j++)
{ {
uint64_t currentBitrate = reps.at(j)->getBandwidth(); uint64_t currentBitrate = reps.at(j)->getBandwidth();
...@@ -92,13 +92,13 @@ Period* BasicCMManager::getFirstPeriod () ...@@ -92,13 +92,13 @@ Period* BasicCMManager::getFirstPeriod ()
Representation* BasicCMManager::getRepresentation(Period *period, uint64_t bitrate ) const Representation* BasicCMManager::getRepresentation(Period *period, uint64_t bitrate ) const
{ {
std::vector<Group *> groups = period->getGroups(); std::vector<AdaptationSet *> adaptSet = period->getAdaptationSets();
Representation *best = NULL; Representation *best = NULL;
for(size_t i = 0; i < groups.size(); i++) for(size_t i = 0; i < adaptSet.size(); i++)
{ {
std::vector<Representation *> reps = groups.at(i)->getRepresentations(); std::vector<Representation *> reps = adaptSet.at(i)->getRepresentations();
for( size_t j = 0; j < reps.size(); j++ ) for( size_t j = 0; j < reps.size(); j++ )
{ {
uint64_t currentBitrate = reps.at(j)->getBandwidth(); uint64_t currentBitrate = reps.at(j)->getBandwidth();
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "mpd/MPD.h" #include "mpd/MPD.h"
#include "mpd/Period.h" #include "mpd/Period.h"
#include "mpd/Group.h"
#include "mpd/Representation.h" #include "mpd/Representation.h"
#include "mpd/SegmentInfo.h" #include "mpd/SegmentInfo.h"
#include "mpd/Segment.h" #include "mpd/Segment.h"
......
...@@ -154,7 +154,7 @@ void BasicCMParser::setPeriods (Node *root) ...@@ -154,7 +154,7 @@ void BasicCMParser::setPeriods (Node *root)
for(size_t i = 0; i < periods.size(); i++) for(size_t i = 0; i < periods.size(); i++)
{ {
Period *period = new Period(); Period *period = new Period();
this->setGroups(periods.at(i), period); this->setAdaptationSet(periods.at(i), period);
this->mpd->addPeriod(period); this->mpd->addPeriod(period);
} }
} }
...@@ -230,7 +230,7 @@ void BasicCMParser::parseSegmentInfoCommon(Node *node, SegmentInfoCommon *segmen ...@@ -230,7 +230,7 @@ void BasicCMParser::parseSegmentInfoCommon(Node *node, SegmentInfoCommon *segmen
this->parseSegmentTimeline( node, segmentInfo ); this->parseSegmentTimeline( node, segmentInfo );
} }
void BasicCMParser::parseSegmentInfoDefault(Node *node, Group *group) void BasicCMParser::parseSegmentInfoDefault(Node *node, AdaptationSet *group)
{ {
Node* segmentInfoDefaultNode = DOMHelper::getFirstChildElementByName( node, "SegmentInfoDefault" ); Node* segmentInfoDefaultNode = DOMHelper::getFirstChildElementByName( node, "SegmentInfoDefault" );
...@@ -243,25 +243,27 @@ void BasicCMParser::parseSegmentInfoDefault(Node *node, Group *group) ...@@ -243,25 +243,27 @@ void BasicCMParser::parseSegmentInfoDefault(Node *node, Group *group)
} }
} }
void BasicCMParser::setGroups (Node *root, Period *period) void BasicCMParser::setAdaptationSet (Node *root, Period *period)
{ {
std::vector<Node *> groups = DOMHelper::getElementByTagName(root, "Group", false); std::vector<Node *> adaptSets = DOMHelper::getElementByTagName(root, "AdaptationSet", false);
if ( adaptSets.size() == 0 ) //In some old file, AdaptationSet may still be called Group
adaptSets = DOMHelper::getElementByTagName(root, "Group", false);
for(size_t i = 0; i < groups.size(); i++) for(size_t i = 0; i < adaptSets.size(); i++)
{ {
const std::map<std::string, std::string> attr = groups.at(i)->getAttributes(); const std::map<std::string, std::string> attr = adaptSets.at(i)->getAttributes();
Group *group = new Group; AdaptationSet *adaptSet = new AdaptationSet;
if ( this->parseCommonAttributesElements( groups.at( i ), group, NULL ) == false ) if ( this->parseCommonAttributesElements( adaptSets.at( i ), adaptSet, NULL ) == false )
{ {
delete group; delete adaptSet;
continue ; continue ;
} }
std::map<std::string, std::string>::const_iterator it = attr.find( "subsegmentAlignmentFlag" ); std::map<std::string, std::string>::const_iterator it = attr.find( "subsegmentAlignmentFlag" );
if ( it != attr.end() && it->second == "true" ) if ( it != attr.end() && it->second == "true" )
group->setSubsegmentAlignmentFlag( true ); //Otherwise it is false by default. adaptSet->setSubsegmentAlignmentFlag( true ); //Otherwise it is false by default.
this->parseSegmentInfoDefault( groups.at( i ), group ); this->parseSegmentInfoDefault( adaptSets.at( i ), adaptSet );
this->setRepresentations(groups.at(i), group); this->setRepresentations(adaptSets.at(i), adaptSet);
period->addGroup(group); period->addAdaptationSet(adaptSet);
} }
} }
...@@ -284,7 +286,7 @@ void BasicCMParser::parseTrickMode(Node *node, Representation *repr) ...@@ -284,7 +286,7 @@ void BasicCMParser::parseTrickMode(Node *node, Representation *repr)
repr->setTrickMode( trickMode ); repr->setTrickMode( trickMode );
} }
void BasicCMParser::setRepresentations (Node *root, Group *group) void BasicCMParser::setRepresentations (Node *root, AdaptationSet *group)
{ {
std::vector<Node *> representations = DOMHelper::getElementByTagName(root, "Representation", false); std::vector<Node *> representations = DOMHelper::getElementByTagName(root, "Representation", false);
...@@ -334,7 +336,7 @@ void BasicCMParser::setRepresentations (Node *root, Group *group) ...@@ -334,7 +336,7 @@ void BasicCMParser::setRepresentations (Node *root, Group *group)
} }
} }
void BasicCMParser::handleDependencyId( Representation *rep, const Group *group, const std::string &dependencyId ) void BasicCMParser::handleDependencyId(Representation *rep, const AdaptationSet *adaptationSet, const std::string &dependencyId )
{ {
if ( dependencyId.empty() == true ) if ( dependencyId.empty() == true )
return ; return ;
...@@ -343,7 +345,7 @@ void BasicCMParser::handleDependencyId( Representation *rep, const Group *gro ...@@ -343,7 +345,7 @@ void BasicCMParser::handleDependencyId( Representation *rep, const Group *gro
{ {
std::string id; std::string id;
s >> id; s >> id;
const Representation *dep = group->getRepresentationById( id ); const Representation *dep = adaptationSet->getRepresentationById( id );
if ( dep ) if ( dep )
rep->addDependency( dep ); rep->addDependency( dep );
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "mpd/IMPDParser.h" #include "mpd/IMPDParser.h"
#include "mpd/MPD.h" #include "mpd/MPD.h"
#include "mpd/Period.h" #include "mpd/Period.h"
#include "mpd/Group.h" #include "mpd/AdaptationSet.h"
#include "mpd/Representation.h" #include "mpd/Representation.h"
#include "mpd/BaseUrl.h" #include "mpd/BaseUrl.h"
#include "mpd/SegmentInfo.h" #include "mpd/SegmentInfo.h"
...@@ -52,17 +52,17 @@ namespace dash ...@@ -52,17 +52,17 @@ namespace dash
MPD* getMPD (); MPD* getMPD ();
private: private:
void handleDependencyId( Representation* rep, const Group* group, const std::string& dependencyId ); void handleDependencyId( Representation* rep, const AdaptationSet* adaptationSet, const std::string& dependencyId );
private: private:
bool setMPD (); bool setMPD ();
void setPeriods (dash::xml::Node *root); void setPeriods (dash::xml::Node *root);
void parseSegmentTimeline( xml::Node* node, SegmentInfoCommon *segmentInfo ); void parseSegmentTimeline( xml::Node* node, SegmentInfoCommon *segmentInfo );
void parseSegmentInfoCommon( xml::Node* node, SegmentInfoCommon *segmentInfo ); void parseSegmentInfoCommon( xml::Node* node, SegmentInfoCommon *segmentInfo );
void parseSegmentInfoDefault( xml::Node* node, Group* group ); void parseSegmentInfoDefault( xml::Node* node, AdaptationSet* group );
void setGroups (dash::xml::Node *root, Period *period); void setAdaptationSet (dash::xml::Node *root, Period *period);
void parseTrickMode( dash::xml::Node *node, Representation *repr ); void parseTrickMode( dash::xml::Node *node, Representation *repr );
void setRepresentations (dash::xml::Node *root, Group *group); void setRepresentations (dash::xml::Node *root, AdaptationSet *group);
bool setSegmentInfo (dash::xml::Node *root, Representation *rep); bool setSegmentInfo (dash::xml::Node *root, Representation *rep);
void setInitSegment (dash::xml::Node *root, SegmentInfoCommon *info); void setInitSegment (dash::xml::Node *root, SegmentInfoCommon *info);
bool setSegments (dash::xml::Node *root, SegmentInfo *info ); bool setSegments (dash::xml::Node *root, SegmentInfo *info );
......
/*
* Group.cpp
*****************************************************************************
* Copyright (C) 2010 - 2011 Klagenfurt University
*
* Created on: Aug 10, 2010
* Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
* Christian Timmerer <christian.timmerer@itec.uni-klu.ac.at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "Group.h"
#include <vlc_common.h>
#include <vlc_arrays.h>
#include "SegmentInfoDefault.h"
using namespace dash::mpd;
Group::Group() :
subsegmentAlignmentFlag( false ),
segmentInfoDefault( NULL )
{
}
Group::~Group ()
{
delete this->segmentInfoDefault;
vlc_delete_all( this->representations );
}
bool Group::getSubsegmentAlignmentFlag() const
{
return this->subsegmentAlignmentFlag;
}
void Group::setSubsegmentAlignmentFlag(bool alignment)
{
this->subsegmentAlignmentFlag = alignment;
}
std::vector<Representation*> Group::getRepresentations ()
{
return this->representations;
}
const Representation *Group::getRepresentationById(const std::string &id) const
{
std::vector<Representation*>::const_iterator it = this->representations.begin();
std::vector<Representation*>::const_iterator end = this->representations.end();
while ( it != end )
{
if ( (*it)->getId() == id )
return *it;
++it;
}
return NULL;
}
const SegmentInfoDefault *Group::getSegmentInfoDefault() const
{
return this->segmentInfoDefault;
}
void Group::setSegmentInfoDefault(const SegmentInfoDefault *seg)
{
if ( seg != NULL )
this->segmentInfoDefault = seg;
}
void Group::addRepresentation (Representation *rep)
{
this->representations.push_back(rep);
}
/*
* Group.h
*****************************************************************************
* Copyright (C) 2010 - 2011 Klagenfurt University
*
* Created on: Aug 10, 2010
* Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
* Christian Timmerer <christian.timmerer@itec.uni-klu.ac.at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef GROUP_H_
#define GROUP_H_
#include <vector>
#include <string>
#include <map>
#include "mpd/Representation.h"
#include "mpd/CommonAttributesElements.h"
namespace dash
{
namespace mpd
{
class SegmentInfoDefault;
class Group : public CommonAttributesElements
{
public:
Group();
virtual ~Group();
bool getSubsegmentAlignmentFlag() const;
void setSubsegmentAlignmentFlag( bool alignment );
std::vector<Representation *> getRepresentations ();
const Representation* getRepresentationById ( const std::string &id ) const;
const SegmentInfoDefault* getSegmentInfoDefault() const;
void setSegmentInfoDefault( const SegmentInfoDefault* seg );
void addRepresentation( Representation *rep );
private:
bool subsegmentAlignmentFlag;
std::vector<Representation *> representations;
const SegmentInfoDefault* segmentInfoDefault;
};
}
}
#endif /* GROUP_H_ */
...@@ -39,19 +39,9 @@ Period::Period() ...@@ -39,19 +39,9 @@ Period::Period()
Period::~Period () Period::~Period ()
{ {
vlc_delete_all( this->groups ); vlc_delete_all( this->adaptationSets );
} }
const std::vector<Group*>& Period::getGroups() const
{
return this->groups;
}
void Period::addGroup(Group *group)
{
if ( group != NULL )
this->groups.push_back(group);
}
const std::vector<AdaptationSet*>& Period::getAdaptationSets() const const std::vector<AdaptationSet*>& Period::getAdaptationSets() const
{ {
return this->adaptationSets; return this->adaptationSets;
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include "mpd/Group.h"
#include "mpd/AdaptationSet.h" #include "mpd/AdaptationSet.h"
namespace dash namespace dash
...@@ -40,13 +39,10 @@ namespace dash ...@@ -40,13 +39,10 @@ namespace dash
Period(); Period();
virtual ~Period (); virtual ~Period ();
const std::vector<Group *>& getGroups () const;
void addGroup (Group *group);
const std::vector<AdaptationSet *>& getAdaptationSets () const; const std::vector<AdaptationSet *>& getAdaptationSets () const;
void addAdaptationSet (AdaptationSet *AdaptationSet); void addAdaptationSet (AdaptationSet *AdaptationSet);
private: private:
std::vector<Group *> groups;
std::vector<AdaptationSet *> adaptationSets; std::vector<AdaptationSet *> adaptationSets;
}; };
} }
......
...@@ -87,12 +87,12 @@ void Representation::setTrickMode (TrickModeType *trickMod ...@@ -87,12 +87,12 @@ void Representation::setTrickMode (TrickModeType *trickMod
this->trickModeType = trickModeType; this->trickModeType = trickModeType;
} }
const Group *Representation::getParentGroup() const const AdaptationSet *Representation::getParentGroup() const
{ {
return this->parentGroup; return this->parentGroup;
} }
void Representation::setParentGroup(const Group *group) void Representation::setParentGroup(const AdaptationSet *group)
{ {
if ( group != NULL ) if ( group != NULL )
this->parentGroup = group; this->parentGroup = group;
......
...@@ -37,7 +37,7 @@ namespace dash ...@@ -37,7 +37,7 @@ namespace dash
{ {
namespace mpd namespace mpd
{ {
class Group; class AdaptationSet;
class Representation : public CommonAttributesElements class Representation : public CommonAttributesElements
{ {
...@@ -69,8 +69,8 @@ namespace dash ...@@ -69,8 +69,8 @@ namespace dash
void setSegmentInfo( SegmentInfo *info ); void setSegmentInfo( SegmentInfo *info );
void setTrickMode( TrickModeType *trickModeType ); void setTrickMode( TrickModeType *trickModeType );
const Group* getParentGroup() const; const AdaptationSet* getParentGroup() const;
void setParentGroup( const Group *group ); void setParentGroup( const AdaptationSet *group );
SegmentList* getSegmentList () const; SegmentList* getSegmentList () const;
void setSegmentList (SegmentList *list); void setSegmentList (SegmentList *list);
...@@ -88,7 +88,7 @@ namespace dash ...@@ -88,7 +88,7 @@ namespace dash
std::list<const Representation*> dependencies; std::list<const Representation*> dependencies;
SegmentInfo *segmentInfo; SegmentInfo *segmentInfo;
TrickModeType *trickModeType; TrickModeType *trickModeType;
const Group *parentGroup; const AdaptationSet *parentGroup;
SegmentBase *segmentBase; SegmentBase *segmentBase;
SegmentList *segmentList; SegmentList *segmentList;
int width; int width;
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "SegmentTemplate.h" #include "SegmentTemplate.h"
#include "SegmentTimeline.h" #include "SegmentTimeline.h"
#include "Representation.h" #include "Representation.h"
#include "Group.h" #include "AdaptationSet.h"
#include "SegmentInfoDefault.h" #include "SegmentInfoDefault.h"
#include <cassert> #include <cassert>
......
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