Commit a640bad9 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen Committed by Jean-Baptiste Kempf

dash: Reworking profile handling.

Adding Full2011 as a supported profile.
For other profiles, do not instantiate a NullManager.
Return NULL directly. This saves code and prevents us from maintaining an
extra interface implementation.
Also it prevents such problems :
http://forum.videolan.org/viewtopic.php?f=13&t=96335&p=320162Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent e16536dc
...@@ -37,8 +37,6 @@ SOURCES_stream_filter_dash = \ ...@@ -37,8 +37,6 @@ SOURCES_stream_filter_dash = \
mpd/MPD.h \ mpd/MPD.h \
mpd/MPDManagerFactory.cpp \ mpd/MPDManagerFactory.cpp \
mpd/MPDManagerFactory.h \ mpd/MPDManagerFactory.h \
mpd/NullManager.cpp \
mpd/NullManager.h \
mpd/Period.cpp \ mpd/Period.cpp \
mpd/Period.h \ mpd/Period.h \
mpd/ProgramInformation.cpp \ mpd/ProgramInformation.cpp \
......
...@@ -19,10 +19,10 @@ namespace dash ...@@ -19,10 +19,10 @@ namespace dash
enum Profile enum Profile
{ {
NotValid, UnknownProfile,
Full2011, Full2011,
Basic, Basic,
BasicCM, BasicCM
}; };
class IMPDManager class IMPDManager
{ {
......
...@@ -31,7 +31,7 @@ using namespace dash::mpd; ...@@ -31,7 +31,7 @@ using namespace dash::mpd;
using namespace dash::exception; using namespace dash::exception;
MPD::MPD () : MPD::MPD () :
profile( dash::mpd::NotValid ), profile( dash::mpd::UnknownProfile ),
live( false ), live( false ),
availabilityStartTime( -1 ), availabilityStartTime( -1 ),
availabilityEndTime( -1 ), availabilityEndTime( -1 ),
...@@ -173,6 +173,8 @@ void MPD::setProfile( const std::string &strProfile ) ...@@ -173,6 +173,8 @@ void MPD::setProfile( const std::string &strProfile )
{ {
if( strProfile == "urn:mpeg:mpegB:profile:dash:isoff-basic-on-demand:cm" ) if( strProfile == "urn:mpeg:mpegB:profile:dash:isoff-basic-on-demand:cm" )
this->profile = dash::mpd::BasicCM; this->profile = dash::mpd::BasicCM;
else if ( strProfile == "urn:mpeg:mpegB:profile:dash:full:2011" )
this->profile = dash::mpd::Full2011;
else else
this->profile = dash::mpd::NotValid; this->profile = dash::mpd::UnknownProfile;
} }
...@@ -35,16 +35,17 @@ IMPDManager* MPDManagerFactory::create( Node *root ) ...@@ -35,16 +35,17 @@ IMPDManager* MPDManagerFactory::create( Node *root )
BasicCMParser parser(root); BasicCMParser parser(root);
if ( parser.parse() == false ) if ( parser.parse() == false )
return new NullManager(); return NULL;
Profile profile = parser.getMPD()->getProfile(); Profile profile = parser.getMPD()->getProfile();
switch( profile ) switch( profile )
{ {
case mpd::Basic: return new NullManager(); case mpd::BasicCM:
case mpd::BasicCM: return new BasicCMManager( parser.getMPD() ); case mpd::Full2011:
case mpd::Full2011: return new NullManager(); return new BasicCMManager( parser.getMPD() );
case mpd::NotValid: return new NullManager(); case mpd::Basic:
case mpd::UnknownProfile:
default: return new NullManager(); default:
return NULL;
} }
} }
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#define MPDMANAGERFACTORY_H_ #define MPDMANAGERFACTORY_H_
#include "mpd/IMPDManager.h" #include "mpd/IMPDManager.h"
#include "mpd/NullManager.h"
#include "mpd/BasicCMManager.h" #include "mpd/BasicCMManager.h"
#include "mpd/BasicCMParser.h" #include "mpd/BasicCMParser.h"
#include "xml/Node.h" #include "xml/Node.h"
......
/*
* NullManager.cpp
*****************************************************************************
* Copyright (C) 2010 - 2011 Klagenfurt University
*
* Created on: Apr 20, 2011
* 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 "mpd/NullManager.h"
using namespace dash::mpd;
const std::vector<Period *>& NullManager::getPeriods () const
{
return this->periods;
}
Period* NullManager::getFirstPeriod ()
{
return NULL;
}
Period* NullManager::getNextPeriod (Period *)
{
return NULL;
}
Representation* NullManager::getBestRepresentation (Period *)
{
return NULL;
}
std::vector<Segment *> NullManager::getSegments (Representation *)
{
return this->segments;
}
Representation* NullManager::getRepresentation (Period *, long )
{
return NULL;
}
const MPD* NullManager::getMPD() const
{
return NULL;
}
/*
* NullManager.h
*****************************************************************************
* Copyright (C) 2010 - 2011 Klagenfurt University
*
* Created on: Apr 20, 2011
* 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 NULLMANAGER_H_
#define NULLMANAGER_H_
#include "mpd/IMPDManager.h"
#include "mpd/MPD.h"
#include "mpd/Period.h"
#include "mpd/Representation.h"
#include "mpd/IMPDManager.h"
namespace dash
{
namespace mpd
{
class NullManager : public IMPDManager
{
public:
const std::vector<Period *>& getPeriods () const;
Period* getFirstPeriod ();
Period* getNextPeriod (Period *period);
Representation* getBestRepresentation (Period *period);
std::vector<Segment *> getSegments (Representation *rep);
Representation* getRepresentation (Period *period, long bitrate);
const MPD* getMPD () const;
private:
std::vector<Period *> periods;
std::vector<Segment *> segments;
};
}
}
#endif /* NULLMANAGER_H_ */
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