[vlc-commits] demux: dash: drop mpdfactory

Francois Cartegnie git at videolan.org
Mon Nov 2 22:16:41 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Nov  2 19:23:28 2015 +0100| [4c6b8b7037b28e514c4828ab0b426e39b49b58ac] | committer: Francois Cartegnie

demux: dash: drop mpdfactory

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

 modules/demux/Makefile.am                  |    2 --
 modules/demux/adaptative/adaptative.cpp    |    6 ++--
 modules/demux/dash/DASHManager.cpp         |    7 ++--
 modules/demux/dash/mpd/IsoffMainParser.cpp |   11 ++----
 modules/demux/dash/mpd/IsoffMainParser.h   |    8 ++---
 modules/demux/dash/mpd/MPDFactory.cpp      |   49 --------------------------
 modules/demux/dash/mpd/MPDFactory.h        |   52 ----------------------------
 7 files changed, 13 insertions(+), 122 deletions(-)

diff --git a/modules/demux/Makefile.am b/modules/demux/Makefile.am
index 6b6c1e0..595ea00 100644
--- a/modules/demux/Makefile.am
+++ b/modules/demux/Makefile.am
@@ -352,8 +352,6 @@ libadaptative_dash_SOURCES = \
     demux/dash/mpd/IsoffMainParser.h \
     demux/dash/mpd/MPD.cpp \
     demux/dash/mpd/MPD.h \
-    demux/dash/mpd/MPDFactory.cpp \
-    demux/dash/mpd/MPDFactory.h \
     demux/dash/mpd/Period.cpp \
     demux/dash/mpd/Period.h \
     demux/dash/mpd/Profile.cpp \
diff --git a/modules/demux/adaptative/adaptative.cpp b/modules/demux/adaptative/adaptative.cpp
index 9cbbbbc..95dba2d 100644
--- a/modules/demux/adaptative/adaptative.cpp
+++ b/modules/demux/adaptative/adaptative.cpp
@@ -35,9 +35,9 @@
 #include "playlist/BasePeriod.h"
 #include "xml/DOMParser.h"
 
-#include "../dash/mpd/MPDFactory.h"
 #include "../dash/DASHManager.h"
 #include "../dash/DASHStream.hpp"
+#include "../dash/mpd/IsoffMainParser.h"
 
 #include "../hls/HLSManager.hpp"
 #include "../hls/HLSStreams.hpp"
@@ -133,8 +133,8 @@ static int Open(vlc_object_t *p_obj)
             return VLC_EGENERIC;
         }
 
-        //Begin the actual MPD parsing:
-        MPD *p_playlist = MPDFactory::create(parser.getRootNode(), p_demux->s, playlisturl);
+        IsoffMainParser mpdparser(parser.getRootNode(), p_demux->s, playlisturl);
+        MPD *p_playlist = mpdparser.parse();
         if(p_playlist == NULL)
         {
             msg_Err( p_demux, "Cannot create/unknown MPD for profile");
diff --git a/modules/demux/dash/DASHManager.cpp b/modules/demux/dash/DASHManager.cpp
index 0ed13cb..8383f9c 100644
--- a/modules/demux/dash/DASHManager.cpp
+++ b/modules/demux/dash/DASHManager.cpp
@@ -29,8 +29,8 @@
 #include <inttypes.h>
 
 #include "DASHManager.h"
-#include "mpd/MPDFactory.h"
 #include "mpd/ProgramInformation.h"
+#include "mpd/IsoffMainParser.h"
 #include "xml/DOMParser.h"
 #include "../adaptative/tools/Helper.h"
 #include "../adaptative/http/HTTPConnectionManager.h"
@@ -104,8 +104,9 @@ bool DASHManager::updatePlaylist()
                 minsegmentTime = segmentTime;
         }
 
-        MPD *newmpd = MPDFactory::create(parser.getRootNode(), mpdstream,
-                                         Helper::getDirectoryPath(url).append("/"));
+        IsoffMainParser mpdparser(parser.getRootNode(), mpdstream,
+                                Helper::getDirectoryPath(url).append("/"));
+        MPD *newmpd = mpdparser.parse();
         if(newmpd)
         {
             playlist->mergeWith(newmpd, minsegmentTime);
diff --git a/modules/demux/dash/mpd/IsoffMainParser.cpp b/modules/demux/dash/mpd/IsoffMainParser.cpp
index 2c1e97d..bae047f 100644
--- a/modules/demux/dash/mpd/IsoffMainParser.cpp
+++ b/modules/demux/dash/mpd/IsoffMainParser.cpp
@@ -72,14 +72,9 @@ void IsoffMainParser::setMPDBaseUrl(Node *root)
     mpd->setPlaylistUrl( Helper::getDirectoryPath(playlisturl).append("/") );
 }
 
-MPD* IsoffMainParser::getMPD()
+MPD * IsoffMainParser::parse()
 {
-    return mpd;
-}
-
-bool    IsoffMainParser::parse              (Profile profile)
-{
-    mpd = new MPD(p_stream, profile);
+    mpd = new MPD(p_stream, getProfile());
     setMPDAttributes();
     parseProgramInformation(DOMHelper::getFirstChildElementByName(root, "ProgramInformation"), mpd);
     setMPDBaseUrl(root);
@@ -87,7 +82,7 @@ bool    IsoffMainParser::parse              (Profile profile)
 
     if(mpd)
         mpd->debug();
-    return true;
+    return mpd;
 }
 
 void    IsoffMainParser::setMPDAttributes   ()
diff --git a/modules/demux/dash/mpd/IsoffMainParser.h b/modules/demux/dash/mpd/IsoffMainParser.h
index 653a207..bad3067 100644
--- a/modules/demux/dash/mpd/IsoffMainParser.h
+++ b/modules/demux/dash/mpd/IsoffMainParser.h
@@ -65,13 +65,11 @@ namespace dash
             public:
                 IsoffMainParser             (xml::Node *root, stream_t *p_stream, std::string &);
                 virtual ~IsoffMainParser    ();
-
-                bool            parse  (Profile profile);
-                virtual MPD*    getMPD ();
-                virtual void    setMPDBaseUrl(xml::Node *root);
-                mpd::Profile    getProfile() const;
+                MPD *   parse();
 
             private:
+                mpd::Profile getProfile     () const;
+                void    setMPDBaseUrl       (xml::Node *root);
                 void    setMPDAttributes    ();
                 void    setAdaptationSets   (xml::Node *periodNode, Period *period);
                 void    setRepresentations  (xml::Node *adaptationSetNode, AdaptationSet *adaptationSet);
diff --git a/modules/demux/dash/mpd/MPDFactory.cpp b/modules/demux/dash/mpd/MPDFactory.cpp
deleted file mode 100644
index 1be6262..0000000
--- a/modules/demux/dash/mpd/MPDFactory.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * MPDFactory.cpp
- *****************************************************************************
- * Copyright (C) 2010 - 2012 Klagenfurt University
- *
- * Created on: Jan 27, 2012
- * 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 Lesser 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 "MPDFactory.h"
-#include "IsoffMainParser.h"
-
-using namespace dash::mpd;
-using namespace adaptative::xml;
-
-MPD* MPDFactory::create(Node *root, stream_t *p_stream, std::string & playlisturl)
-{
-    IsoffMainParser *parser = new (std::nothrow) IsoffMainParser(root, p_stream, playlisturl);
-    if(!parser)
-        return NULL;
-
-    MPD* mpd = NULL;
-    Profile profile = parser->getProfile();
-    if(!(profile == Profile::Unknown) && parser->parse(profile))
-        mpd = parser->getMPD();
-
-    delete parser;
-
-    return mpd;
-}
diff --git a/modules/demux/dash/mpd/MPDFactory.h b/modules/demux/dash/mpd/MPDFactory.h
deleted file mode 100644
index 03c4ee9..0000000
--- a/modules/demux/dash/mpd/MPDFactory.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * MPDFactory.h
- *****************************************************************************
- * Copyright (C) 2010 - 2012 Klagenfurt University
- *
- * Created on: Jan 27, 2012
- * 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 Lesser 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 MPDFACTORY_H_
-#define MPDFACTORY_H_
-
-#include "MPD.h"
-#include "Profile.hpp"
-
-namespace adaptative
-{
-    namespace xml
-    {
-        class Node;
-    }
-}
-
-namespace dash
-{
-    namespace mpd
-    {
-        using namespace adaptative;
-
-        class MPDFactory
-        {
-            public:
-                static MPD* create(xml::Node *root, stream_t *p_stream, std::string &);
-        };
-    }
-}
-
-#endif /* MPDFACTORY_H_ */



More information about the vlc-commits mailing list