[vlc-commits] demux: adaptative: remove duplicated logic creation

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 18:49:57 2015 +0100| [877863da9ff201cc04b84c3b78e0e25df3295953] | committer: Francois Cartegnie

demux: adaptative: remove duplicated logic creation

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

 modules/demux/adaptative/PlaylistManager.cpp |   12 +++++++++---
 modules/demux/dash/DASHManager.cpp           |   25 -------------------------
 modules/demux/dash/DASHManager.h             |    3 ---
 modules/demux/hls/HLSManager.cpp             |   24 ------------------------
 modules/demux/hls/HLSManager.hpp             |    3 ---
 modules/demux/smooth/SmoothManager.cpp       |   23 -----------------------
 modules/demux/smooth/SmoothManager.hpp       |    3 ---
 7 files changed, 9 insertions(+), 84 deletions(-)

diff --git a/modules/demux/adaptative/PlaylistManager.cpp b/modules/demux/adaptative/PlaylistManager.cpp
index dbbf524..129bf36 100644
--- a/modules/demux/adaptative/PlaylistManager.cpp
+++ b/modules/demux/adaptative/PlaylistManager.cpp
@@ -395,15 +395,21 @@ AbstractAdaptationLogic *PlaylistManager::createLogic(AbstractAdaptationLogic::L
 {
     switch(type)
     {
-        case AbstractAdaptationLogic::AlwaysBest:
-            return new (std::nothrow) AlwaysBestAdaptationLogic();
         case AbstractAdaptationLogic::FixedRate:
+        {
+            size_t bps = var_InheritInteger(p_demux, "adaptative-bw") * 8192;
+            return new (std::nothrow) FixedRateAdaptationLogic(bps);
+        }
         case AbstractAdaptationLogic::AlwaysLowest:
             return new (std::nothrow) AlwaysLowestAdaptationLogic();
+        case AbstractAdaptationLogic::AlwaysBest:
+            return new (std::nothrow) AlwaysBestAdaptationLogic();
         case AbstractAdaptationLogic::Default:
         case AbstractAdaptationLogic::RateBased:
         {
-            RateBasedAdaptationLogic *logic = new (std::nothrow) RateBasedAdaptationLogic(0, 0);
+            int width = var_InheritInteger(p_demux, "adaptative-width");
+            int height = var_InheritInteger(p_demux, "adaptative-height");
+            RateBasedAdaptationLogic *logic = new (std::nothrow) RateBasedAdaptationLogic(width, height);
             conn->setDownloadRateObserver(logic);
             return logic;
         }
diff --git a/modules/demux/dash/DASHManager.cpp b/modules/demux/dash/DASHManager.cpp
index 3f59380..0ed13cb 100644
--- a/modules/demux/dash/DASHManager.cpp
+++ b/modules/demux/dash/DASHManager.cpp
@@ -32,7 +32,6 @@
 #include "mpd/MPDFactory.h"
 #include "mpd/ProgramInformation.h"
 #include "xml/DOMParser.h"
-#include "../adaptative/logic/RateBasedAdaptationLogic.h"
 #include "../adaptative/tools/Helper.h"
 #include "../adaptative/http/HTTPConnectionManager.h"
 #include <vlc_stream.h>
@@ -200,27 +199,3 @@ bool DASHManager::isDASH(stream_t *stream)
     }
     return false;
 }
-
-AbstractAdaptationLogic *DASHManager::createLogic(AbstractAdaptationLogic::LogicType type,
-                                                  HTTPConnectionManager *conn)
-{
-    switch(type)
-    {
-        case AbstractAdaptationLogic::FixedRate:
-        {
-            size_t bps = var_InheritInteger(p_demux, "adaptative-bw") * 8192;
-            return new (std::nothrow) FixedRateAdaptationLogic(bps);
-        }
-        case AbstractAdaptationLogic::Default:
-        case AbstractAdaptationLogic::RateBased:
-        {
-            int width = var_InheritInteger(p_demux, "adaptative-width");
-            int height = var_InheritInteger(p_demux, "adaptative-height");
-            RateBasedAdaptationLogic *logic = new (std::nothrow) RateBasedAdaptationLogic(width, height);
-            conn->setDownloadRateObserver(logic);
-            return logic;
-        }
-        default:
-            return PlaylistManager::createLogic(type, conn);
-    }
-}
diff --git a/modules/demux/dash/DASHManager.h b/modules/demux/dash/DASHManager.h
index a0716d7..da0b99e 100644
--- a/modules/demux/dash/DASHManager.h
+++ b/modules/demux/dash/DASHManager.h
@@ -42,9 +42,6 @@ namespace dash
             virtual ~DASHManager    ();
 
             virtual bool updatePlaylist(); //reimpl
-            virtual AbstractAdaptationLogic *createLogic(AbstractAdaptationLogic::LogicType,
-                                                         HTTPConnectionManager *); //reimpl
-
             static bool isDASH(stream_t *);
 
         protected:
diff --git a/modules/demux/hls/HLSManager.cpp b/modules/demux/hls/HLSManager.cpp
index 5bb2375..3802b46 100644
--- a/modules/demux/hls/HLSManager.cpp
+++ b/modules/demux/hls/HLSManager.cpp
@@ -23,7 +23,6 @@
 #endif
 
 #include "HLSManager.hpp"
-#include "../adaptative/logic/RateBasedAdaptationLogic.h"
 #include "../adaptative/tools/Retrieve.hpp"
 #include "../adaptative/http/HTTPConnectionManager.h"
 #include "playlist/Parser.hpp"
@@ -103,26 +102,3 @@ bool HLSManager::isHTTPLiveStreaming(stream_t *s)
     return false;
 }
 
-AbstractAdaptationLogic *HLSManager::createLogic(AbstractAdaptationLogic::LogicType type,
-                                                 HTTPConnectionManager *conn)
-{
-    switch(type)
-    {
-        case AbstractAdaptationLogic::FixedRate:
-        {
-            size_t bps = var_InheritInteger(p_demux, "adaptative-bw") * 8192;
-            return new (std::nothrow) FixedRateAdaptationLogic(bps);
-        }
-        case AbstractAdaptationLogic::Default:
-        case AbstractAdaptationLogic::RateBased:
-        {
-            int width = var_InheritInteger(p_demux, "adaptative-width");
-            int height = var_InheritInteger(p_demux, "adaptative-height");
-            RateBasedAdaptationLogic *logic = new (std::nothrow) RateBasedAdaptationLogic(width, height);
-            conn->setDownloadRateObserver(logic);
-            return logic;
-        }
-        default:
-            return PlaylistManager::createLogic(type, conn);
-    }
-}
diff --git a/modules/demux/hls/HLSManager.hpp b/modules/demux/hls/HLSManager.hpp
index af8f179..cec3dde 100644
--- a/modules/demux/hls/HLSManager.hpp
+++ b/modules/demux/hls/HLSManager.hpp
@@ -35,9 +35,6 @@ namespace hls
                         AbstractStreamFactory *,
                         logic::AbstractAdaptationLogic::LogicType type );
             virtual ~HLSManager();
-            virtual AbstractAdaptationLogic *createLogic(AbstractAdaptationLogic::LogicType,
-                                                         HTTPConnectionManager *);
-
             static bool isHTTPLiveStreaming(stream_t *);
     };
 
diff --git a/modules/demux/smooth/SmoothManager.cpp b/modules/demux/smooth/SmoothManager.cpp
index 6520aad..78e51be 100644
--- a/modules/demux/smooth/SmoothManager.cpp
+++ b/modules/demux/smooth/SmoothManager.cpp
@@ -23,7 +23,6 @@
 # include "config.h"
 #endif
 
-#include "../adaptative/logic/RateBasedAdaptationLogic.h"
 #include "../adaptative/tools/Retrieve.hpp"
 #include "playlist/Parser.hpp"
 #include "../adaptative/xml/DOMParser.h"
@@ -185,25 +184,3 @@ bool SmoothManager::isSmoothStreaming(stream_t *stream)
     free( str );
     return ret;
 }
-
-AbstractAdaptationLogic *SmoothManager::createLogic(AbstractAdaptationLogic::LogicType type,
-                                                    HTTPConnectionManager *conn)
-{
-    switch(type)
-    {
-        case AbstractAdaptationLogic::FixedRate:
-        {
-            size_t bps = var_InheritInteger(p_demux, "adaptative-bw") * 8192;
-            return new (std::nothrow) FixedRateAdaptationLogic(bps);
-        }
-        case AbstractAdaptationLogic::Default:
-        case AbstractAdaptationLogic::RateBased:
-        {
-            int width = var_InheritInteger(p_demux, "adaptative-width");
-            int height = var_InheritInteger(p_demux, "adaptative-height");
-            return new (std::nothrow) RateBasedAdaptationLogic(width, height);
-        }
-        default:
-            return PlaylistManager::createLogic(type, conn);
-    }
-}
diff --git a/modules/demux/smooth/SmoothManager.hpp b/modules/demux/smooth/SmoothManager.hpp
index e383467..7593905 100644
--- a/modules/demux/smooth/SmoothManager.hpp
+++ b/modules/demux/smooth/SmoothManager.hpp
@@ -37,9 +37,6 @@ namespace smooth
             virtual ~SmoothManager();
 
             virtual bool updatePlaylist(); //reimpl
-            virtual AbstractAdaptationLogic *createLogic(AbstractAdaptationLogic::LogicType,
-                                                         HTTPConnectionManager *);
-
             static bool isSmoothStreaming(stream_t *);
 
         private:



More information about the vlc-commits mailing list