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 = \
mpd/CommonAttributesElements.h \
mpd/ContentDescription.cpp \
mpd/ContentDescription.h \
mpd/Group.cpp \
mpd/Group.h \
mpd/IMPDManager.h \
mpd/IMPDParser.h \
mpd/IsoffMainParser.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>
* Christian Timmerer <christian.timmerer@itec.uni-klu.ac.at>
*
......@@ -28,20 +28,76 @@
#include "AdaptationSet.h"
#include <vlc_common.h>
#include <vlc_arrays.h>
#include "SegmentInfoDefault.h"
using namespace dash::mpd;
AdaptationSet::AdaptationSet () :
isBitstreamSwitching (false)
AdaptationSet::AdaptationSet() :
subsegmentAlignmentFlag( false ),
segmentInfoDefault( NULL ),
isBitstreamSwitching( false )
{
}
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)
{
this->isBitstreamSwitching = value;
}
bool AdaptationSet::getBitstreamSwitching () const
{
return this->isBitstreamSwitching;
......
/*
* 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>
* Christian Timmerer <christian.timmerer@itec.uni-klu.ac.at>
*
......@@ -25,23 +25,40 @@
#ifndef 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 mpd
{
class AdaptationSet : public Group
class SegmentInfoDefault;
class AdaptationSet : public CommonAttributesElements
{
public:
AdaptationSet ();
virtual ~AdaptationSet ();
AdaptationSet();
virtual ~AdaptationSet();
void setBitstreamSwitching (bool value);
bool getBitstreamSwitching () const;
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 setBitstreamSwitching(bool value);
bool getBitstreamSwitching() const;
void addRepresentation( Representation *rep );
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
Representation* BasicCMManager::getBestRepresentation (Period *period)
{
std::vector<Group *> groups = period->getGroups();
std::vector<AdaptationSet *> adaptSet = period->getAdaptationSets();
uint64_t bitrate = 0;
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++)
{
uint64_t currentBitrate = reps.at(j)->getBandwidth();
......@@ -92,13 +92,13 @@ Period* BasicCMManager::getFirstPeriod ()
Representation* BasicCMManager::getRepresentation(Period *period, uint64_t bitrate ) const
{
std::vector<Group *> groups = period->getGroups();
std::vector<AdaptationSet *> adaptSet = period->getAdaptationSets();
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++ )
{
uint64_t currentBitrate = reps.at(j)->getBandwidth();
......
......@@ -31,7 +31,6 @@
#include "mpd/MPD.h"
#include "mpd/Period.h"
#include "mpd/Group.h"
#include "mpd/Representation.h"
#include "mpd/SegmentInfo.h"
#include "mpd/Segment.h"
......
......@@ -154,7 +154,7 @@ void BasicCMParser::setPeriods (Node *root)
for(size_t i = 0; i < periods.size(); i++)
{
Period *period = new Period();
this->setGroups(periods.at(i), period);
this->setAdaptationSet(periods.at(i), period);
this->mpd->addPeriod(period);
}
}
......@@ -230,7 +230,7 @@ void BasicCMParser::parseSegmentInfoCommon(Node *node, SegmentInfoCommon *segmen
this->parseSegmentTimeline( node, segmentInfo );
}
void BasicCMParser::parseSegmentInfoDefault(Node *node, Group *group)
void BasicCMParser::parseSegmentInfoDefault(Node *node, AdaptationSet *group)
{
Node* segmentInfoDefaultNode = DOMHelper::getFirstChildElementByName( node, "SegmentInfoDefault" );
......@@ -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();
Group *group = new Group;
if ( this->parseCommonAttributesElements( groups.at( i ), group, NULL ) == false )
const std::map<std::string, std::string> attr = adaptSets.at(i)->getAttributes();
AdaptationSet *adaptSet = new AdaptationSet;
if ( this->parseCommonAttributesElements( adaptSets.at( i ), adaptSet, NULL ) == false )
{
delete group;
delete adaptSet;
continue ;
}
std::map<std::string, std::string>::const_iterator it = attr.find( "subsegmentAlignmentFlag" );
if ( it != attr.end() && it->second == "true" )
group->setSubsegmentAlignmentFlag( true ); //Otherwise it is false by default.
this->parseSegmentInfoDefault( groups.at( i ), group );
this->setRepresentations(groups.at(i), group);
period->addGroup(group);
adaptSet->setSubsegmentAlignmentFlag( true ); //Otherwise it is false by default.
this->parseSegmentInfoDefault( adaptSets.at( i ), adaptSet );
this->setRepresentations(adaptSets.at(i), adaptSet);
period->addAdaptationSet(adaptSet);
}
}
......@@ -284,7 +286,7 @@ void BasicCMParser::parseTrickMode(Node *node, Representation *repr)
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);
......@@ -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 )
return ;
......@@ -343,7 +345,7 @@ void BasicCMParser::handleDependencyId( Representation *rep, const Group *gro
{
std::string id;
s >> id;
const Representation *dep = group->getRepresentationById( id );
const Representation *dep = adaptationSet->getRepresentationById( id );
if ( dep )
rep->addDependency( dep );
}
......
......@@ -30,7 +30,7 @@
#include "mpd/IMPDParser.h"
#include "mpd/MPD.h"
#include "mpd/Period.h"
#include "mpd/Group.h"
#include "mpd/AdaptationSet.h"
#include "mpd/Representation.h"
#include "mpd/BaseUrl.h"
#include "mpd/SegmentInfo.h"
......@@ -52,17 +52,17 @@ namespace dash
MPD* getMPD ();
private:
void handleDependencyId( Representation* rep, const Group* group, const std::string& dependencyId );
void handleDependencyId( Representation* rep, const AdaptationSet* adaptationSet, const std::string& dependencyId );
private:
bool setMPD ();
void setPeriods (dash::xml::Node *root);
void parseSegmentTimeline( xml::Node* node, SegmentInfoCommon *segmentInfo );
void parseSegmentInfoCommon( xml::Node* node, SegmentInfoCommon *segmentInfo );
void parseSegmentInfoDefault( xml::Node* node, Group* group );
void setGroups (dash::xml::Node *root, Period *period);
void parseSegmentInfoDefault( xml::Node* node, AdaptationSet* group );
void setAdaptationSet (dash::xml::Node *root, Period *period);
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);
void setInitSegment (dash::xml::Node *root, SegmentInfoCommon *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()
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
{
return this->adaptationSets;
......
......@@ -27,7 +27,6 @@
#include <vector>
#include <string>
#include "mpd/Group.h"
#include "mpd/AdaptationSet.h"
namespace dash
......@@ -40,13 +39,10 @@ namespace dash
Period();
virtual ~Period ();
const std::vector<Group *>& getGroups () const;
void addGroup (Group *group);
const std::vector<AdaptationSet *>& getAdaptationSets () const;
void addAdaptationSet (AdaptationSet *AdaptationSet);
private:
std::vector<Group *> groups;
std::vector<AdaptationSet *> adaptationSets;
};
}
......
......@@ -87,12 +87,12 @@ void Representation::setTrickMode (TrickModeType *trickMod
this->trickModeType = trickModeType;
}
const Group *Representation::getParentGroup() const
const AdaptationSet *Representation::getParentGroup() const
{
return this->parentGroup;
}
void Representation::setParentGroup(const Group *group)
void Representation::setParentGroup(const AdaptationSet *group)
{
if ( group != NULL )
this->parentGroup = group;
......
......@@ -37,7 +37,7 @@ namespace dash
{
namespace mpd
{
class Group;
class AdaptationSet;
class Representation : public CommonAttributesElements
{
......@@ -69,8 +69,8 @@ namespace dash
void setSegmentInfo( SegmentInfo *info );
void setTrickMode( TrickModeType *trickModeType );
const Group* getParentGroup() const;
void setParentGroup( const Group *group );
const AdaptationSet* getParentGroup() const;
void setParentGroup( const AdaptationSet *group );
SegmentList* getSegmentList () const;
void setSegmentList (SegmentList *list);
......@@ -88,7 +88,7 @@ namespace dash
std::list<const Representation*> dependencies;
SegmentInfo *segmentInfo;
TrickModeType *trickModeType;
const Group *parentGroup;
const AdaptationSet *parentGroup;
SegmentBase *segmentBase;
SegmentList *segmentList;
int width;
......
......@@ -27,7 +27,7 @@
#include "SegmentTemplate.h"
#include "SegmentTimeline.h"
#include "Representation.h"
#include "Group.h"
#include "AdaptationSet.h"
#include "SegmentInfoDefault.h"
#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