[vlc-commits] demux: adaptive: allow regular http access

Francois Cartegnie git at videolan.org
Thu Feb 25 23:00:46 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Feb 25 22:59:03 2016 +0100| [8f4cf91d8e4d9bc93910519aa90ac74cce94d696] | committer: Francois Cartegnie

demux: adaptive: allow regular http access

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

 modules/demux/adaptive/adaptive.cpp                   |    4 ++++
 modules/demux/adaptive/http/HTTPConnectionManager.cpp |   13 +++++++++----
 modules/demux/adaptive/http/HTTPConnectionManager.h   |    4 ++--
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/modules/demux/adaptive/adaptive.cpp b/modules/demux/adaptive/adaptive.cpp
index bbeb16e..1d18dd4 100644
--- a/modules/demux/adaptive/adaptive.cpp
+++ b/modules/demux/adaptive/adaptive.cpp
@@ -72,6 +72,9 @@ static void Close   (vlc_object_t *);
 
 #define ADAPT_LOGIC_TEXT N_("Adaptation Logic")
 
+#define ADAPT_ACCESS_TEXT N_("Use regular HTTP modules")
+#define ADAPT_ACCESS_LONGTEXT N_("Connect using http access instead of custom http code")
+
 static const int pi_logics[] = {AbstractAdaptationLogic::RateBased,
                                 AbstractAdaptationLogic::FixedRate,
                                 AbstractAdaptationLogic::AlwaysLowest,
@@ -94,6 +97,7 @@ vlc_module_begin ()
         add_integer( "adaptive-width",  480, ADAPT_WIDTH_TEXT,  ADAPT_WIDTH_TEXT,  true )
         add_integer( "adaptive-height", 360, ADAPT_HEIGHT_TEXT, ADAPT_HEIGHT_TEXT, true )
         add_integer( "adaptive-bw",     250, ADAPT_BW_TEXT,     ADAPT_BW_LONGTEXT,     false )
+        add_bool   ( "adaptive-use-access", false, ADAPT_ACCESS_TEXT, ADAPT_ACCESS_LONGTEXT, true );
         set_callbacks( Open, Close )
 vlc_module_end ()
 
diff --git a/modules/demux/adaptive/http/HTTPConnectionManager.cpp b/modules/demux/adaptive/http/HTTPConnectionManager.cpp
index 371756b..969fd10 100644
--- a/modules/demux/adaptive/http/HTTPConnectionManager.cpp
+++ b/modules/demux/adaptive/http/HTTPConnectionManager.cpp
@@ -34,15 +34,20 @@
 
 using namespace adaptive::http;
 
-HTTPConnectionManager::HTTPConnectionManager    (vlc_object_t *stream, ConnectionFactory *factory_) :
-                       stream                   (stream),
+HTTPConnectionManager::HTTPConnectionManager    (vlc_object_t *p_object_, ConnectionFactory *factory_) :
+                       p_object                 (p_object_),
                        rateObserver             (NULL)
 {
     vlc_mutex_init(&lock);
     downloader = new (std::nothrow) Downloader();
     downloader->start();
     if(!factory_)
-        factory = new (std::nothrow) ConnectionFactory();
+    {
+        if(var_InheritBool(p_object, "adaptive-use-access"))
+            factory = new (std::nothrow) StreamUrlConnectionFactory();
+        else
+            factory = new (std::nothrow) ConnectionFactory();
+    }
     else
         factory = factory_;
 }
@@ -90,7 +95,7 @@ AbstractConnection * HTTPConnectionManager::getConnection(ConnectionParams &para
     AbstractConnection *conn = reuseConnection(params);
     if(!conn)
     {
-        conn = factory->createConnection(stream, params);
+        conn = factory->createConnection(p_object, params);
 
         connectionPool.push_back(conn);
 
diff --git a/modules/demux/adaptive/http/HTTPConnectionManager.h b/modules/demux/adaptive/http/HTTPConnectionManager.h
index 638bc55..755df86 100644
--- a/modules/demux/adaptive/http/HTTPConnectionManager.h
+++ b/modules/demux/adaptive/http/HTTPConnectionManager.h
@@ -47,7 +47,7 @@ namespace adaptive
         class HTTPConnectionManager : public IDownloadRateObserver
         {
             public:
-                HTTPConnectionManager           (vlc_object_t *stream, ConnectionFactory * = NULL);
+                HTTPConnectionManager           (vlc_object_t *p_object, ConnectionFactory * = NULL);
                 virtual ~HTTPConnectionManager  ();
 
                 void    closeAllConnections ();
@@ -61,7 +61,7 @@ namespace adaptive
                 void    releaseAllConnections ();
                 vlc_mutex_t                                         lock;
                 std::vector<AbstractConnection *>                   connectionPool;
-                vlc_object_t                                       *stream;
+                vlc_object_t                                       *p_object;
                 IDownloadRateObserver                              *rateObserver;
                 ConnectionFactory                                  *factory;
                 AbstractConnection * reuseConnection(ConnectionParams &);



More information about the vlc-commits mailing list