[vlc-commits] stream_filter: dash: simplify MPD factory
Francois Cartegnie
git at videolan.org
Thu Dec 18 22:39:51 CET 2014
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Nov 25 13:15:24 2014 +0100| [3240284781e1d9409694fc79e5da32cb03169b9e] | committer: Francois Cartegnie
stream_filter: dash: simplify MPD factory
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3240284781e1d9409694fc79e5da32cb03169b9e
---
modules/stream_filter/dash/mpd/MPDFactory.cpp | 43 ++++++++++++-------------
modules/stream_filter/dash/mpd/MPDFactory.h | 4 ---
2 files changed, 21 insertions(+), 26 deletions(-)
diff --git a/modules/stream_filter/dash/mpd/MPDFactory.cpp b/modules/stream_filter/dash/mpd/MPDFactory.cpp
index 9225b89..f31b64b 100644
--- a/modules/stream_filter/dash/mpd/MPDFactory.cpp
+++ b/modules/stream_filter/dash/mpd/MPDFactory.cpp
@@ -33,32 +33,31 @@ using namespace dash::mpd;
MPD* MPDFactory::create (dash::xml::Node *root, stream_t *p_stream, Profile profile)
{
+ IMPDParser *parser = NULL;
+
switch( profile )
{
- case dash::mpd::Profile::Full:
- return MPDFactory::createBasicCMMPD(root, p_stream);
- case dash::mpd::Profile::ISOOnDemand:
- case dash::mpd::Profile::ISOMain:
- return MPDFactory::createIsoffMainMPD(root, p_stream);
-
- default: return NULL;
+ case Profile::Full:
+ parser = new BasicCMParser(root, p_stream);
+ break;
+ case Profile::ISOOnDemand:
+ case Profile::ISOMain:
+ parser = new IsoffMainParser(root, p_stream);
+ default:
+ break;
}
-}
-MPD* MPDFactory::createBasicCMMPD (dash::xml::Node *root, stream_t *p_stream)
-{
- dash::mpd::BasicCMParser mpdParser(root, p_stream);
- if(mpdParser.parse() == false || mpdParser.getMPD() == NULL)
+ if(!parser)
return NULL;
- mpdParser.getMPD()->setProfile( Profile(Profile::ISOOnDemand) );
- return mpdParser.getMPD();
-}
-MPD* MPDFactory::createIsoffMainMPD (dash::xml::Node *root, stream_t *p_stream)
-{
- dash::mpd::IsoffMainParser mpdParser(root, p_stream);
- if(mpdParser.parse() == false || mpdParser.getMPD() == NULL)
- return NULL;
- mpdParser.getMPD()->setProfile( Profile(Profile::ISOMain) );
- return mpdParser.getMPD();
+ MPD* mpd = NULL;
+ if(parser->parse())
+ mpd = parser->getMPD();
+
+ delete parser;
+
+ if (mpd)
+ mpd->setProfile(profile);
+
+ return mpd;
}
diff --git a/modules/stream_filter/dash/mpd/MPDFactory.h b/modules/stream_filter/dash/mpd/MPDFactory.h
index a3842a4..d5576c9 100644
--- a/modules/stream_filter/dash/mpd/MPDFactory.h
+++ b/modules/stream_filter/dash/mpd/MPDFactory.h
@@ -37,10 +37,6 @@ namespace dash
{
public:
static MPD* create(dash::xml::Node *root, stream_t *p_stream, Profile profile);
-
- private:
- static MPD* createBasicCMMPD (dash::xml::Node *root, stream_t *p_stream);
- static MPD* createIsoffMainMPD (dash::xml::Node *root, stream_t *p_stream);
};
}
}
More information about the vlc-commits
mailing list