[vlc-devel] [PATCH 2/8] dash: added resolution interpretation

Hugo Beauzée-Luyssen beauze.h at gmail.com
Sun Feb 5 22:29:19 CET 2012


On Sun, Feb 5, 2012 at 10:34 AM, Christopher Mueller
<christopher.mueller at itec.aau.at> wrote:
> ---
>  modules/stream_filter/dash/DASHManager.cpp         |    7 ++-
>  modules/stream_filter/dash/DASHManager.h           |    3 +-
>  .../adaptationlogic/AbstractAdaptationLogic.cpp    |   10 +++--
>  .../dash/adaptationlogic/AbstractAdaptationLogic.h |    5 ++-
>  .../adaptationlogic/AdaptationLogicFactory.cpp     |    6 +-
>  .../dash/adaptationlogic/AdaptationLogicFactory.h  |    4 +-
>  .../adaptationlogic/AlwaysBestAdaptationLogic.cpp  |    3 +-
>  .../adaptationlogic/AlwaysBestAdaptationLogic.h    |    2 +-
>  .../adaptationlogic/RateBasedAdaptationLogic.cpp   |   16 ++++---
>  .../adaptationlogic/RateBasedAdaptationLogic.h     |    7 +++-
>  modules/stream_filter/dash/dash.cpp                |   10 ++++-
>  modules/stream_filter/dash/mpd/BasicCMManager.cpp  |    7 ++-
>  modules/stream_filter/dash/mpd/BasicCMManager.h    |    4 +-
>  modules/stream_filter/dash/mpd/IMPDManager.h       |   17 ++++---
>  .../stream_filter/dash/mpd/IsoffMainManager.cpp    |   47 +++++++++++++++++++-
>  modules/stream_filter/dash/mpd/IsoffMainManager.h  |    4 +-
>  modules/stream_filter/dash/mpd/IsoffMainParser.cpp |   21 ++++++---
>  modules/stream_filter/dash/mpd/Representation.cpp  |   20 ++++++++-
>  modules/stream_filter/dash/mpd/Representation.h    |    6 +++
>  19 files changed, 157 insertions(+), 42 deletions(-)
>
> diff --git a/modules/stream_filter/dash/DASHManager.cpp b/modules/stream_filter/dash/DASHManager.cpp
> index 4033be7..7060d3e 100644
> --- a/modules/stream_filter/dash/DASHManager.cpp
> +++ b/modules/stream_filter/dash/DASHManager.cpp
> @@ -35,18 +35,19 @@ using namespace dash::mpd;
>  using namespace dash::exception;
>
>  DASHManager::DASHManager    ( HTTPConnectionManager *conManager, MPD *mpd,
> -                              IAdaptationLogic::LogicType type ) :
> +                              IAdaptationLogic::LogicType type, stream_t *stream) :
>     conManager( conManager ),
>     currentChunk( NULL ),
>     adaptationLogic( NULL ),
>     logicType( type ),
>     mpdManager( NULL ),
> -    mpd( mpd )
> +    mpd( mpd ),
> +    stream(stream)
>  {
>     this->mpdManager        = mpd::MPDManagerFactory::create( mpd );
>     if ( this->mpdManager == NULL )
>         return ;
> -    this->adaptationLogic   = AdaptationLogicFactory::create( this->logicType, this->mpdManager );
> +    this->adaptationLogic   = AdaptationLogicFactory::create( this->logicType, this->mpdManager, this->stream);
>     if ( this->adaptationLogic == NULL )
>         return ;
>     this->conManager->attach(this->adaptationLogic);
> diff --git a/modules/stream_filter/dash/DASHManager.h b/modules/stream_filter/dash/DASHManager.h
> index 1fef884..8fc1c56 100644
> --- a/modules/stream_filter/dash/DASHManager.h
> +++ b/modules/stream_filter/dash/DASHManager.h
> @@ -40,7 +40,7 @@ namespace dash
>     {
>         public:
>             DASHManager( http::HTTPConnectionManager *conManager, mpd::MPD *mpd,
> -                         logic::IAdaptationLogic::LogicType type );
> +                         logic::IAdaptationLogic::LogicType type, stream_t *stream);
>             virtual ~DASHManager    ();
>
>             int read( void *p_buffer, size_t len );
> @@ -56,6 +56,7 @@ namespace dash
>             logic::IAdaptationLogic::LogicType  logicType;
>             mpd::IMPDManager                    *mpdManager;
>             mpd::MPD                            *mpd;
> +            stream_t                            *stream;
>     };
>  }
>
> diff --git a/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp b/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp
> index 5d54848..3945a9f 100644
> --- a/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp
> +++ b/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp
> @@ -32,11 +32,13 @@ using namespace dash::xml;
>  using namespace dash::mpd;
>  using namespace dash::exception;
>
> -AbstractAdaptationLogic::AbstractAdaptationLogic    (IMPDManager *mpdManager)
> +AbstractAdaptationLogic::AbstractAdaptationLogic    (IMPDManager *mpdManager, stream_t *stream) :
> +                         bpsAvg                     (-1),
> +                         bpsLastChunk               (0),
> +                         mpdManager                 (mpdManager),
> +                         stream                     (stream)
> +
>  {
> -    this->bpsAvg        = -1;
> -    this->bpsLastChunk  = 0;
> -    this->mpdManager    = mpdManager;
>  }
>  AbstractAdaptationLogic::~AbstractAdaptationLogic   ()
>  {
> diff --git a/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.h b/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.h
> index 216f7f1..7c46d14 100644
> --- a/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.h
> +++ b/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.h
> @@ -35,6 +35,8 @@
>  #include "mpd/Segment.h"
>  #include "exceptions/EOFException.h"
>
> +struct stream_t;
> +
>  namespace dash
>  {
>     namespace logic
> @@ -42,7 +44,7 @@ namespace dash
>         class AbstractAdaptationLogic : public IAdaptationLogic
>         {
>             public:
> -                AbstractAdaptationLogic             (dash::mpd::IMPDManager *mpdManager);
> +                AbstractAdaptationLogic             (dash::mpd::IMPDManager *mpdManager, stream_t *stream);
>                 virtual ~AbstractAdaptationLogic    ();
>
>                 virtual void                downloadRateChanged     (long bpsAvg, long bpsLastChunk);
> @@ -54,6 +56,7 @@ namespace dash
>                 int                     bpsAvg;
>                 long                    bpsLastChunk;
>                 dash::mpd::IMPDManager  *mpdManager;
> +                stream_t                *stream;
>         };
>     }
>  }
> diff --git a/modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.cpp b/modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.cpp
> index 341c739..066436d 100644
> --- a/modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.cpp
> +++ b/modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.cpp
> @@ -32,12 +32,12 @@ using namespace dash::xml;
>  using namespace dash::mpd;
>
>  IAdaptationLogic* AdaptationLogicFactory::create ( IAdaptationLogic::LogicType logic,
> -                                                  IMPDManager *mpdManager )
> +                                                  IMPDManager *mpdManager, stream_t *stream)
>  {
>     switch(logic)
>     {
> -        case IAdaptationLogic::AlwaysBest:      return new AlwaysBestAdaptationLogic    (mpdManager);
> -        case IAdaptationLogic::RateBased:       return new RateBasedAdaptationLogic     (mpdManager);
> +        case IAdaptationLogic::AlwaysBest:      return new AlwaysBestAdaptationLogic    (mpdManager, stream);
> +        case IAdaptationLogic::RateBased:       return new RateBasedAdaptationLogic     (mpdManager, stream);
>         case IAdaptationLogic::Default:
>         case IAdaptationLogic::AlwaysLowest:
>         default:
> diff --git a/modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.h b/modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.h
> index f27cf25..440ca09 100644
> --- a/modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.h
> +++ b/modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.h
> @@ -31,6 +31,8 @@
>  #include "adaptationlogic/AlwaysBestAdaptationLogic.h"
>  #include "adaptationlogic/RateBasedAdaptationLogic.h"
>
> +struct stream_t;
> +
>  namespace dash
>  {
>     namespace logic
> @@ -38,7 +40,7 @@ namespace dash
>         class AdaptationLogicFactory
>         {
>             public:
> -                static IAdaptationLogic* create (IAdaptationLogic::LogicType logic, dash::mpd::IMPDManager *mpdManager);
> +                static IAdaptationLogic* create (IAdaptationLogic::LogicType logic, dash::mpd::IMPDManager *mpdManager, stream_t *stream);
>         };
>     }
>  }
> diff --git a/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
> index e37c00a..01d7c44 100644
> --- a/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
> +++ b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
> @@ -33,7 +33,8 @@ using namespace dash::http;
>  using namespace dash::mpd;
>  using namespace dash::exception;
>
> -AlwaysBestAdaptationLogic::AlwaysBestAdaptationLogic    (IMPDManager *mpdManager) : AbstractAdaptationLogic(mpdManager)
> +AlwaysBestAdaptationLogic::AlwaysBestAdaptationLogic    (IMPDManager *mpdManager, stream_t *stream) :
> +                           AbstractAdaptationLogic      (mpdManager, stream)
>  {
>     this->mpdManager    = mpdManager;
>     this->count         = 0;
> diff --git a/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
> index bf16de3..3b577f7 100644
> --- a/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
> +++ b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
> @@ -42,7 +42,7 @@ namespace dash
>         class AlwaysBestAdaptationLogic : public AbstractAdaptationLogic
>         {
>             public:
> -                AlwaysBestAdaptationLogic           (dash::mpd::IMPDManager *mpdManager);
> +                AlwaysBestAdaptationLogic           (dash::mpd::IMPDManager *mpdManager, stream_t *stream);
>                 virtual ~AlwaysBestAdaptationLogic  ();
>
>                 dash::http::Chunk* getNextChunk() throw(dash::exception::EOFException);
> diff --git a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
> index 0eb7887..c331e05 100644
> --- a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
> +++ b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
> @@ -33,12 +33,16 @@ using namespace dash::http;
>  using namespace dash::mpd;
>  using namespace dash::exception;
>
> -RateBasedAdaptationLogic::RateBasedAdaptationLogic  (IMPDManager *mpdManager) :
> -    AbstractAdaptationLogic( mpdManager ),
> -    mpdManager( mpdManager ),
> -    count( 0 ),
> -    currentPeriod( mpdManager->getFirstPeriod() )
> +RateBasedAdaptationLogic::RateBasedAdaptationLogic  (IMPDManager *mpdManager, stream_t *stream) :
> +                          AbstractAdaptationLogic   (mpdManager, stream),
> +                          mpdManager                (mpdManager),
> +                          count                     (0),
> +                          currentPeriod             (mpdManager->getFirstPeriod()),
> +                          width                     (0),
> +                          height                    (0)
>  {
> +    this->width  = var_InheritInteger(stream, "dash-prefwidth");
> +    this->height = var_InheritInteger(stream, "dash-prefheight");
>  }
>
>  Chunk*  RateBasedAdaptationLogic::getNextChunk() throw(EOFException)
> @@ -51,7 +55,7 @@ Chunk*  RateBasedAdaptationLogic::getNextChunk() throw(EOFException)
>
>     long bitrate = this->getBpsAvg();
>
> -    Representation *rep = this->mpdManager->getRepresentation(this->currentPeriod, bitrate);
> +    Representation *rep = this->mpdManager->getRepresentation(this->currentPeriod, bitrate, this->width, this->height);
>
>     if ( rep == NULL )
>         throw EOFException();
> diff --git a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h
> index 913ec41..44d5be4 100644
> --- a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h
> +++ b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h
> @@ -32,6 +32,9 @@
>  #include "exceptions/EOFException.h"
>  #include "mpd/BasicCMManager.h"
>
> +#include <vlc_common.h>
> +#include <vlc_stream.h>
> +
>  namespace dash
>  {
>     namespace logic
> @@ -39,7 +42,7 @@ namespace dash
>         class RateBasedAdaptationLogic : public AbstractAdaptationLogic
>         {
>             public:
> -                RateBasedAdaptationLogic            (dash::mpd::IMPDManager *mpdManager);
> +                RateBasedAdaptationLogic            (dash::mpd::IMPDManager *mpdManager, stream_t *stream);
>
>                 dash::http::Chunk*      getNextChunk() throw(dash::exception::EOFException);
>                 const dash::mpd::Representation *getCurrentRepresentation() const;
> @@ -48,6 +51,8 @@ namespace dash
>                 dash::mpd::IMPDManager  *mpdManager;
>                 size_t                  count;
>                 dash::mpd::Period       *currentPeriod;
> +                int                     width;
> +                int                     height;
>         };
>     }
>  }
> diff --git a/modules/stream_filter/dash/dash.cpp b/modules/stream_filter/dash/dash.cpp
> index fb2c052..3b1ac7a 100644
> --- a/modules/stream_filter/dash/dash.cpp
> +++ b/modules/stream_filter/dash/dash.cpp
> @@ -48,12 +48,20 @@
>  static int  Open    (vlc_object_t *);
>  static void Close   (vlc_object_t *);
>
> +#define DASH_WIDTH_TEXT N_("Preferred Width")
> +#define DASH_WIDTH_LONGTEXT N_("Preferred Width")
> +
> +#define DASH_HEIGHT_TEXT N_("Preferred Height")
> +#define DASH_HEIGHT_LONGTEXT N_("Preferred Height")
> +
>  vlc_module_begin ()
>         set_shortname( N_("DASH"))
>         set_description( N_("Dynamic Adaptive Streaming over HTTP") )
>         set_capability( "stream_filter", 19 )
>         set_category( CAT_INPUT )
>         set_subcategory( SUBCAT_INPUT_STREAM_FILTER )
> +        add_integer( "dash-prefwidth",  480, DASH_WIDTH_TEXT,  DASH_WIDTH_LONGTEXT,  true )
> +        add_integer( "dash-prefheight", 360, DASH_HEIGHT_TEXT, DASH_HEIGHT_LONGTEXT, true )
>         set_callbacks( Open, Close )
>  vlc_module_end ()
>
> @@ -106,7 +114,7 @@ static int Open(vlc_object_t *p_obj)
>                               new dash::http::HTTPConnectionManager( p_stream );
>     dash::DASHManager*p_dashManager =
>             new dash::DASHManager( p_conManager, p_sys->p_mpd,
> -                                   dash::logic::IAdaptationLogic::RateBased );
> +                                   dash::logic::IAdaptationLogic::RateBased, p_stream);
>
>     if ( p_dashManager->getMpdManager() == NULL ||
>          p_dashManager->getMpdManager()->getMPD() == NULL ||
> diff --git a/modules/stream_filter/dash/mpd/BasicCMManager.cpp b/modules/stream_filter/dash/mpd/BasicCMManager.cpp
> index 855dc50..8140247 100644
> --- a/modules/stream_filter/dash/mpd/BasicCMManager.cpp
> +++ b/modules/stream_filter/dash/mpd/BasicCMManager.cpp
> @@ -91,7 +91,7 @@ Period*                 BasicCMManager::getFirstPeriod          ()
>     return periods.at(0);
>  }
>
> -Representation*         BasicCMManager::getRepresentation(Period *period, int bitrate )
> +Representation*         BasicCMManager::getRepresentation(Period *period, int bitrate ) const
>  {
>     std::vector<Group *>    groups = period->getGroups();
>
> @@ -134,4 +134,7 @@ const MPD*      BasicCMManager::getMPD() const
>  {
>     return this->mpd;
>  }
> -
> +Representation*         BasicCMManager::getRepresentation (Period *period, int bitrate, int width, int height) const
> +{
> +    return this->getRepresentation(period, bitrate);
> +}
> diff --git a/modules/stream_filter/dash/mpd/BasicCMManager.h b/modules/stream_filter/dash/mpd/BasicCMManager.h
> index 98fb832..cea9387 100644
> --- a/modules/stream_filter/dash/mpd/BasicCMManager.h
> +++ b/modules/stream_filter/dash/mpd/BasicCMManager.h
> @@ -52,8 +52,10 @@ namespace dash
>                 Period*                         getNextPeriod( Period *period );
>                 Representation*                 getBestRepresentation( Period *period );
>                 std::vector<Segment *>          getSegments( const Representation *rep );
> -                Representation*                 getRepresentation( Period *period, int bitrate );
> +                Representation*                 getRepresentation( Period *period, int bitrate ) const;
>                 const MPD*                      getMPD() const;
> +                Representation*                 getRepresentation (Period *period, int bitrate,
> +                                                                   int width, int height) const;
>
>             private:
>                 MPD *mpd;
> diff --git a/modules/stream_filter/dash/mpd/IMPDManager.h b/modules/stream_filter/dash/mpd/IMPDManager.h
> index eb51b6c..dc8ef12 100644
> --- a/modules/stream_filter/dash/mpd/IMPDManager.h
> +++ b/modules/stream_filter/dash/mpd/IMPDManager.h
> @@ -45,14 +45,17 @@ namespace dash
>         class IMPDManager
>         {
>             public:
> -                virtual const std::vector<Period *>&   getPeriods              () const                 = 0;
> -                virtual Period*                 getFirstPeriod          ()                              = 0;
> -                virtual Period*                 getNextPeriod           (Period *period)                = 0;
> -                virtual Representation*         getBestRepresentation   (Period *period)                = 0;
> -                virtual std::vector<Segment *>  getSegments( const Representation *rep ) = 0;
> -                virtual Representation*         getRepresentation       (Period *period, int bitrate)   = 0;
> -                virtual const MPD*              getMPD                  () const = 0;
>                 virtual ~IMPDManager(){}
> +
> +                virtual const std::vector<Period *>&    getPeriods              () const                            = 0;
> +                virtual Period*                         getFirstPeriod          ()                                  = 0;
> +                virtual Period*                         getNextPeriod           (Period *period)                    = 0;
> +                virtual Representation*                 getBestRepresentation   (Period *period)                    = 0;
> +                virtual std::vector<Segment *>          getSegments             (const Representation *rep)         = 0;
> +                virtual Representation*                 getRepresentation       (Period *period, int bitrate) const = 0;
> +                virtual const MPD*                      getMPD                  () const                            = 0;
> +                virtual Representation*                 getRepresentation       (Period *period, int bitrate,
> +                                                                                 int width, int height) const       = 0;
>         };
>     }
>  }
> diff --git a/modules/stream_filter/dash/mpd/IsoffMainManager.cpp b/modules/stream_filter/dash/mpd/IsoffMainManager.cpp
> index c55c684..480f9f4 100644
> --- a/modules/stream_filter/dash/mpd/IsoffMainManager.cpp
> +++ b/modules/stream_filter/dash/mpd/IsoffMainManager.cpp
> @@ -87,7 +87,7 @@ Period*                     IsoffMainManager::getFirstPeriod        ()
>
>     return periods.at(0);
>  }
> -Representation*             IsoffMainManager::getRepresentation     (Period *period, int bitrate )
> +Representation*             IsoffMainManager::getRepresentation     (Period *period, int bitrate) const
>  {
>     std::vector<AdaptationSet *> adaptationSets = period->getAdaptationSets();
>
> @@ -126,3 +126,48 @@ const MPD*                  IsoffMainManager::getMPD                () const
>  {
>     return this->mpd;
>  }
> +Representation*             IsoffMainManager::getRepresentation     (Period *period, int bitrate, int width, int height) const
> +{
> +    std::vector<AdaptationSet *> adaptationSets = period->getAdaptationSets();
> +
> +    std::cout << "Searching for best representation with bitrate: " << bitrate << " and resolution: " << width << "x" << height << std::endl;
> +
> +    std::vector<Representation *> resMatchReps;
> +
> +    int lowerWidth  = 0;
> +    int lowerHeight = 0;
> +
> +    for(size_t i = 0; i < adaptationSets.size(); i++)
> +    {
> +        std::vector<Representation *> reps = adaptationSets.at(i)->getRepresentations();
> +        for( size_t j = 0; j < reps.size(); j++ )
> +        {
> +            if(reps.at(j)->getWidth() == width && reps.at(j)->getHeight() == height)
> +                resMatchReps.push_back(reps.at(j));
> +
> +            if(reps.at(j)->getHeight() < height)
> +            {
> +                lowerWidth  = reps.at(j)->getWidth();
> +                lowerHeight = reps.at(j)->getHeight();
> +            }
> +        }
> +    }
> +
> +    if(resMatchReps.size() == 0)
> +        return this->getRepresentation(period, bitrate, lowerWidth, lowerHeight);
> +
> +    Representation  *best = NULL;
> +    for( size_t j = 0; j < resMatchReps.size(); j++ )
> +    {
> +        int currentBitrate = resMatchReps.at(j)->getBandwidth();
> +
> +        if(best == NULL || (currentBitrate > best->getBandwidth() && currentBitrate < bitrate))
> +        {
> +            std::cout << "Found a better Representation bandwidth=" << resMatchReps.at(j)->getBandwidth()
> +                      << " and resolution: " << resMatchReps.at(j)->getWidth() << "x" << resMatchReps.at(j)->getHeight() << std::endl;
> +            best = resMatchReps.at(j);
> +        }
> +    }
> +
> +    return best;
> +}
> diff --git a/modules/stream_filter/dash/mpd/IsoffMainManager.h b/modules/stream_filter/dash/mpd/IsoffMainManager.h
> index 933e9f1..bdee2ef 100644
> --- a/modules/stream_filter/dash/mpd/IsoffMainManager.h
> +++ b/modules/stream_filter/dash/mpd/IsoffMainManager.h
> @@ -52,8 +52,10 @@ namespace dash
>                 Period*                         getNextPeriod           (Period *period);
>                 Representation*                 getBestRepresentation   (Period *period);
>                 std::vector<Segment *>          getSegments             (const Representation *rep);
> -                Representation*                 getRepresentation       (Period *period, int bitrate);
> +                Representation*                 getRepresentation       (Period *period, int bitrate) const;
>                 const MPD*                      getMPD                  () const;
> +                Representation*                 getRepresentation       (Period *period, int bitrate,
> +                                                                         int width, int height) const;
>
>             private:
>                 MPD *mpd;
> diff --git a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
> index 6d8058c..888c347 100644
> --- a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
> +++ b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
> @@ -113,12 +113,21 @@ void    IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
>
>     for(size_t i = 0; i < representations.size(); i++)
>     {
> -        Representation *rep = new Representation;
> -        this->currentRepresentation = rep;
> -        this->setSegmentBase(representations.at(i), rep);
> -        this->setSegmentList(representations.at(i), rep);
> -        rep->setBandwidth(atoi(representations.at(i)->getAttributeValue("bandwidth").c_str()));
> -        adaptationSet->addRepresentation(rep);
> +        this->currentRepresentation = new Representation;
> +        Node *repNode = representations.at(i);
> +
> +        if(repNode->hasAttribute("width"))
> +            this->currentRepresentation->setWidth(atoi(repNode->getAttributeValue("width").c_str()));
> +
> +        if(repNode->hasAttribute("height"))
> +            this->currentRepresentation->setHeight(atoi(repNode->getAttributeValue("height").c_str()));
> +
> +        if(repNode->hasAttribute("bandwidth"))
> +            this->currentRepresentation->setBandwidth(atoi(repNode->getAttributeValue("bandwidth").c_str()));
> +
> +        this->setSegmentBase(repNode, this->currentRepresentation);
> +        this->setSegmentList(repNode, this->currentRepresentation);
> +        adaptationSet->addRepresentation(this->currentRepresentation);
>     }
>  }
>  void    IsoffMainParser::setSegmentBase     (dash::xml::Node *repNode, Representation *rep)
> diff --git a/modules/stream_filter/dash/mpd/Representation.cpp b/modules/stream_filter/dash/mpd/Representation.cpp
> index e358e34..9f31f5c 100644
> --- a/modules/stream_filter/dash/mpd/Representation.cpp
> +++ b/modules/stream_filter/dash/mpd/Representation.cpp
> @@ -37,7 +37,9 @@ Representation::Representation  () :
>                 trickModeType   ( NULL ),
>                 parentGroup     ( NULL ),
>                 segmentBase     ( NULL ),
> -                segmentList     ( NULL )
> +                segmentList     ( NULL ),
> +                width           (0),
> +                height          (0)
>
>  {
>  }
> @@ -139,3 +141,19 @@ void                Representation::setSegmentBase          (SegmentBase *base)
>  {
>     this->segmentBase = base;
>  }
> +void                Representation::setWidth                (int width)
> +{
> +    this->width = width;
> +}
> +int                 Representation::getWidth                () const
> +{
> +    return this->width;
> +}
> +void                Representation::setHeight               (int height)
> +{
> +    this->height = height;
> +}
> +int                 Representation::getHeight               () const
> +{
> +    return this->height;
> +}
> diff --git a/modules/stream_filter/dash/mpd/Representation.h b/modules/stream_filter/dash/mpd/Representation.h
> index 15cd62d..710e2f4 100644
> --- a/modules/stream_filter/dash/mpd/Representation.h
> +++ b/modules/stream_filter/dash/mpd/Representation.h
> @@ -76,6 +76,10 @@ namespace dash
>                 void                setSegmentList          (SegmentList *list);
>                 SegmentBase*        getSegmentBase          () const;
>                 void                setSegmentBase          (SegmentBase *base);
> +                void                setWidth                (int width);
> +                int                 getWidth                () const;
> +                void                setHeight               (int height);
> +                int                 getHeight               () const;
>
>             private:
>                 int                                 bandwidth;
> @@ -87,6 +91,8 @@ namespace dash
>                 const Group                         *parentGroup;
>                 SegmentBase                         *segmentBase;
>                 SegmentList                         *segmentList;
> +                int                                 width;
> +                int                                 height;
>         };
>     }
>  }
> --
> 1.7.0.4
>

Works for me.

Best regards,

-- 
Hugo Beauzée-Luyssen


More information about the vlc-devel mailing list