[vlc-devel] [PATCH 19/27] dash: added resolution interpretation

Christopher Müller christopher.mueller at itec.uni-klu.ac.at
Sun Feb 5 10:36:37 CET 2012


Hi Hugo,

Merged the patches with your changes and rebased all against the new head.

BR
Chris

> Von: vlc-devel-bounces at videolan.org [mailto:vlc-devel-
> bounces at videolan.org] Im Auftrag von Hugo Beauzée-Luyssen
> Gesendet: Samstag, 04. Februar 2012 14:17
> An: Mailing list for VLC media player developers
> Betreff: Re: [vlc-devel] [PATCH 19/27] dash: added resolution
> interpretation
> 
> On Sat, Feb 4, 2012 at 2:16 PM, Hugo Beauzée-Luyssen
> <beauze.h at gmail.com> wrote:
> > On Fri, Feb 3, 2012 at 11:57 AM, Christopher Mueller
> > <christopher.mueller at itec.aau.at> wrote:
> >> Signed-off-by: Christopher Mueller <christopher.mueller at itec.aau.at>
> >> ---
> >>  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  |    6 ++-
> >>  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 |   18 ++++++--
> >>  modules/stream_filter/dash/mpd/Representation.cpp  |   20 ++++++++-
> >>  modules/stream_filter/dash/mpd/Representation.h    |    6 +++
> >>  19 files changed, 156 insertions(+), 39 deletions(-)
> >>
> >> diff --git a/modules/stream_filter/dash/DASHManager.cpp
> >> b/modules/stream_filter/dash/DASHManager.cpp
> >> index f14e1f7..9af2620 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 860eee2..928fbd3 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 ); @@ -55,6 +55,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 dab9019..67600b9 100644
> >> ---
> >>
> a/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.
> >> cpp
> >> +++
> b/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLo
> >> +++ gic.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 9187ea8..18d9615 100644
> >> ---
> >>
> a/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.
> >> h
> >> +++
> b/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLo
> >> +++ gic.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.c
> >> pp
> >>
> b/modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.c
> >> pp
> >> index 341c739..066436d 100644
> >> ---
> >>
> a/modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.c
> >> pp
> >> +++
> b/modules/stream_filter/dash/adaptationlogic/AdaptationLogicFacto
> >> +++ ry.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/AdaptationLogicFacto
> >> +++ ry.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/AlwaysBestAdaptationLogi
> >> c.cpp
> >>
> b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogi
> >> c.cpp
> >> index bafd05d..d608bbf 100644
> >> ---
> >>
> a/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogi
> >> c.cpp
> >> +++
> b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptation
> >> +++ Logic.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/AlwaysBestAdaptationLogi
> >> c.h
> >>
> b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogi
> >> c.h
> >> index 27282c9..e8775d6 100644
> >> ---
> >>
> a/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogi
> >> c.h
> >> +++
> b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptation
> >> +++ Logic.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 1833d05..8f6f984 100644
> >> ---
> >>
> a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic
> >> .cpp
> >> +++
> b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationL
> >> +++ ogic.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 58d3740..f41bdc2 100644
> >> ---
> >>
> a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic
> >> .h
> >> +++
> b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationL
> >> +++ ogic.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);
> >>
> >> @@ -47,6 +50,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 ab3acee..7c0ec9f 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 8b3c519..04c6d70 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,3 +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 fec5cec..8b27e90 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(
> >> 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 8a9d4e0..b08f2f8 100644
> >> --- a/modules/stream_filter/dash/mpd/IMPDManager.h
> >> +++ b/modules/stream_filter/dash/mpd/IMPDManager.h
> >> @@ -28,14 +28,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(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
> 
> >> + (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 e4a3b42..f6e067d 100644
> >> --- a/modules/stream_filter/dash/mpd/IsoffMainManager.cpp
> >> +++ b/modules/stream_filter/dash/mpd/IsoffMainManager.cpp
> >> @@ -83,7 +83,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();
> >>
> >> @@ -122,3 +122,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 6b17795..ec90a9c 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
> 
> >> (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 646edac..5cf9677 100644
> >> --- a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
> >> +++ b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
> >> @@ -108,10 +108,20 @@ void    IsoffMainParser::setRepresentations
> >> (Node *adaptationSetNode, Adaptation
> >>
> >>     for(size_t i = 0; i < representations.size(); i++)
> >>     {
> >> -        Representation *rep = new Representation;
> >> -        this->setSegmentBase(representations.at(i), rep);
> >> -        this->setSegmentList(representations.at(i), rep);
> >> -
> >> rep->setBandwidth(atoi(representations.at(i)-
> >getAttributeValue("band
> >> width").c_str()));
> >> +        Representation  *rep     = new Representation;
> >> +        Node            *repNode = representations.at(i);
> >> +
> >> +        if(repNode->hasAttribute("width"))
> >> +
> >> + rep->setWidth(atoi(repNode->getAttributeValue("width").c_str()));
> >> +
> >> +        if(repNode->hasAttribute("height"))
> >> +
> >> + rep->setHeight(atoi(repNode-
> >getAttributeValue("height").c_str()));
> >> +
> >> +        if(repNode->hasAttribute("bandwidth"))
> >> +
> >> + rep->setBandwidth(atoi(repNode-
> >getAttributeValue("bandwidth").c_st
> >> + r()));
> >> +
> >> +        this->setSegmentBase(repNode, rep);
> >> +        this->setSegmentList(repNode, rep);
> >>         adaptationSet->addRepresentation(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 89845d2..da0d4f5 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
> >>
> >> _______________________________________________
> >> vlc-devel mailing list
> >> To unsubscribe or modify your subscription options:
> >> http://mailman.videolan.org/listinfo/vlc-devel
> >
> 
> Oops, wrong mail... 18/27 was applied. This one doesn't apply.
> 
> 
> --
> Hugo Beauzée-Luyssen
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel




More information about the vlc-devel mailing list