[vlc-commits] dash: Reworking profile handling.

Hugo Beauzée-Luyssen git at videolan.org
Fri Dec 30 18:15:33 CET 2011


vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Fri Dec 30 17:37:51 2011 +0100| [a640bad9819dad53ffa74a4776ff33bd75c47f6c] | committer: 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=320162

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a640bad9819dad53ffa74a4776ff33bd75c47f6c
---

 modules/stream_filter/dash/Modules.am              |    2 -
 modules/stream_filter/dash/mpd/IMPDManager.h       |    4 +-
 modules/stream_filter/dash/mpd/MPD.cpp             |    6 +-
 .../stream_filter/dash/mpd/MPDManagerFactory.cpp   |   15 +++--
 modules/stream_filter/dash/mpd/MPDManagerFactory.h |    1 -
 modules/stream_filter/dash/mpd/NullManager.cpp     |   59 --------------------
 modules/stream_filter/dash/mpd/NullManager.h       |   56 -------------------
 7 files changed, 14 insertions(+), 129 deletions(-)

diff --git a/modules/stream_filter/dash/Modules.am b/modules/stream_filter/dash/Modules.am
index 92070dd..3003089 100644
--- a/modules/stream_filter/dash/Modules.am
+++ b/modules/stream_filter/dash/Modules.am
@@ -37,8 +37,6 @@ SOURCES_stream_filter_dash = \
     mpd/MPD.h \
     mpd/MPDManagerFactory.cpp \
     mpd/MPDManagerFactory.h \
-    mpd/NullManager.cpp \
-    mpd/NullManager.h \
     mpd/Period.cpp \
     mpd/Period.h \
     mpd/ProgramInformation.cpp \
diff --git a/modules/stream_filter/dash/mpd/IMPDManager.h b/modules/stream_filter/dash/mpd/IMPDManager.h
index 270928b..6bf16a7 100644
--- a/modules/stream_filter/dash/mpd/IMPDManager.h
+++ b/modules/stream_filter/dash/mpd/IMPDManager.h
@@ -19,10 +19,10 @@ namespace dash
 
         enum Profile
         {
-            NotValid,
+            UnknownProfile,
             Full2011,
             Basic,
-            BasicCM,
+            BasicCM
         };
         class IMPDManager
         {
diff --git a/modules/stream_filter/dash/mpd/MPD.cpp b/modules/stream_filter/dash/mpd/MPD.cpp
index 2973787..7f81586 100644
--- a/modules/stream_filter/dash/mpd/MPD.cpp
+++ b/modules/stream_filter/dash/mpd/MPD.cpp
@@ -31,7 +31,7 @@ using namespace dash::mpd;
 using namespace dash::exception;
 
 MPD::MPD () :
-    profile( dash::mpd::NotValid ),
+    profile( dash::mpd::UnknownProfile ),
     live( false ),
     availabilityStartTime( -1 ),
     availabilityEndTime( -1 ),
@@ -173,6 +173,8 @@ void MPD::setProfile( const std::string &strProfile )
 {
     if( strProfile == "urn:mpeg:mpegB:profile:dash:isoff-basic-on-demand:cm" )
         this->profile = dash::mpd::BasicCM;
+    else if ( strProfile == "urn:mpeg:mpegB:profile:dash:full:2011" )
+        this->profile = dash::mpd::Full2011;
     else
-        this->profile = dash::mpd::NotValid;
+        this->profile = dash::mpd::UnknownProfile;
 }
diff --git a/modules/stream_filter/dash/mpd/MPDManagerFactory.cpp b/modules/stream_filter/dash/mpd/MPDManagerFactory.cpp
index ada43b2..cc79f29 100644
--- a/modules/stream_filter/dash/mpd/MPDManagerFactory.cpp
+++ b/modules/stream_filter/dash/mpd/MPDManagerFactory.cpp
@@ -35,16 +35,17 @@ IMPDManager* MPDManagerFactory::create( Node *root )
     BasicCMParser parser(root);
 
     if ( parser.parse() == false )
-        return new NullManager();
+        return NULL;
 
     Profile profile = parser.getMPD()->getProfile();
     switch( profile )
     {
-        case mpd::Basic:    return new NullManager();
-        case mpd::BasicCM:  return new BasicCMManager( parser.getMPD() );
-        case mpd::Full2011: return new NullManager();
-        case mpd::NotValid: return new NullManager();
-
-        default:            return new NullManager();
+        case mpd::BasicCM:
+        case mpd::Full2011:
+            return new BasicCMManager( parser.getMPD() );
+        case mpd::Basic:
+        case mpd::UnknownProfile:
+        default:
+            return NULL;
     }
 }
diff --git a/modules/stream_filter/dash/mpd/MPDManagerFactory.h b/modules/stream_filter/dash/mpd/MPDManagerFactory.h
index 31a3ba1..5c8114b 100644
--- a/modules/stream_filter/dash/mpd/MPDManagerFactory.h
+++ b/modules/stream_filter/dash/mpd/MPDManagerFactory.h
@@ -26,7 +26,6 @@
 #define MPDMANAGERFACTORY_H_
 
 #include "mpd/IMPDManager.h"
-#include "mpd/NullManager.h"
 #include "mpd/BasicCMManager.h"
 #include "mpd/BasicCMParser.h"
 #include "xml/Node.h"
diff --git a/modules/stream_filter/dash/mpd/NullManager.cpp b/modules/stream_filter/dash/mpd/NullManager.cpp
deleted file mode 100644
index 875cd9f..0000000
--- a/modules/stream_filter/dash/mpd/NullManager.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * NullManager.cpp
- *****************************************************************************
- * Copyright (C) 2010 - 2011 Klagenfurt University
- *
- * Created on: Apr 20, 2011
- * Authors: Christopher Mueller <christopher.mueller at itec.uni-klu.ac.at>
- *          Christian Timmerer  <christian.timmerer at 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;
-}
diff --git a/modules/stream_filter/dash/mpd/NullManager.h b/modules/stream_filter/dash/mpd/NullManager.h
deleted file mode 100644
index 8b14e3e..0000000
--- a/modules/stream_filter/dash/mpd/NullManager.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * NullManager.h
- *****************************************************************************
- * Copyright (C) 2010 - 2011 Klagenfurt University
- *
- * Created on: Apr 20, 2011
- * Authors: Christopher Mueller <christopher.mueller at itec.uni-klu.ac.at>
- *          Christian Timmerer  <christian.timmerer at 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_ */



More information about the vlc-commits mailing list