[vlc-commits] demux: adaptive: add abstractconnectionfactory
Francois Cartegnie
git at videolan.org
Mon Jul 30 12:21:03 CEST 2018
vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Jul 27 18:33:01 2018 +0200| [d83aa6d76c3479e678c3a4e1cd0a63d78ffaf7d6] | committer: Francois Cartegnie
demux: adaptive: add abstractconnectionfactory
(cherry picked from commit 2282ae6aeb9bb980c98afab9f8e55a114d5dbc66)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=d83aa6d76c3479e678c3a4e1cd0a63d78ffaf7d6
---
modules/demux/adaptive/http/HTTPConnection.cpp | 9 +++++----
modules/demux/adaptive/http/HTTPConnection.hpp | 17 +++++++++++++----
modules/demux/adaptive/http/HTTPConnectionManager.cpp | 4 ++--
modules/demux/adaptive/http/HTTPConnectionManager.h | 6 +++---
4 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/modules/demux/adaptive/http/HTTPConnection.cpp b/modules/demux/adaptive/http/HTTPConnection.cpp
index fab2924833..54087a17d7 100644
--- a/modules/demux/adaptive/http/HTTPConnection.cpp
+++ b/modules/demux/adaptive/http/HTTPConnection.cpp
@@ -567,16 +567,17 @@ void StreamUrlConnection::setUsed( bool b )
reset();
}
-ConnectionFactory::ConnectionFactory( AuthStorage *auth )
+NativeConnectionFactory::NativeConnectionFactory( AuthStorage *auth )
+ : AbstractConnectionFactory()
{
authStorage = auth;
}
-ConnectionFactory::~ConnectionFactory()
+NativeConnectionFactory::~NativeConnectionFactory()
{
}
-AbstractConnection * ConnectionFactory::createConnection(vlc_object_t *p_object,
+AbstractConnection * NativeConnectionFactory::createConnection(vlc_object_t *p_object,
const ConnectionParams ¶ms)
{
if((params.getScheme() != "http" && params.getScheme() != "https") || params.getHostname().empty())
@@ -612,7 +613,7 @@ AbstractConnection * ConnectionFactory::createConnection(vlc_object_t *p_object,
}
StreamUrlConnectionFactory::StreamUrlConnectionFactory()
- : ConnectionFactory( NULL )
+ : AbstractConnectionFactory()
{
}
diff --git a/modules/demux/adaptive/http/HTTPConnection.hpp b/modules/demux/adaptive/http/HTTPConnection.hpp
index dd8e41a163..19dec29a44 100644
--- a/modules/demux/adaptive/http/HTTPConnection.hpp
+++ b/modules/demux/adaptive/http/HTTPConnection.hpp
@@ -128,20 +128,29 @@ namespace adaptive
stream_t *p_streamurl;
};
- class ConnectionFactory
+ class AbstractConnectionFactory
{
public:
- ConnectionFactory( AuthStorage * );
- virtual ~ConnectionFactory();
+ AbstractConnectionFactory() {}
+ virtual ~AbstractConnectionFactory() {}
+ virtual AbstractConnection * createConnection(vlc_object_t *, const ConnectionParams &) = 0;
+ };
+
+ class NativeConnectionFactory : public AbstractConnectionFactory
+ {
+ public:
+ NativeConnectionFactory( AuthStorage * );
+ virtual ~NativeConnectionFactory();
virtual AbstractConnection * createConnection(vlc_object_t *, const ConnectionParams &);
private:
AuthStorage *authStorage;
};
- class StreamUrlConnectionFactory : public ConnectionFactory
+ class StreamUrlConnectionFactory : public AbstractConnectionFactory
{
public:
StreamUrlConnectionFactory();
+ virtual ~StreamUrlConnectionFactory() {}
virtual AbstractConnection * createConnection(vlc_object_t *, const ConnectionParams &);
};
}
diff --git a/modules/demux/adaptive/http/HTTPConnectionManager.cpp b/modules/demux/adaptive/http/HTTPConnectionManager.cpp
index a6f1baf347..d45ddc1caf 100644
--- a/modules/demux/adaptive/http/HTTPConnectionManager.cpp
+++ b/modules/demux/adaptive/http/HTTPConnectionManager.cpp
@@ -58,7 +58,7 @@ void AbstractConnectionManager::setDownloadRateObserver(IDownloadRateObserver *o
rateObserver = obs;
}
-HTTPConnectionManager::HTTPConnectionManager (vlc_object_t *p_object_, ConnectionFactory *factory_)
+HTTPConnectionManager::HTTPConnectionManager (vlc_object_t *p_object_, AbstractConnectionFactory *factory_)
: AbstractConnectionManager( p_object_ )
{
vlc_mutex_init(&lock);
@@ -76,7 +76,7 @@ HTTPConnectionManager::HTTPConnectionManager (vlc_object_t *p_object_, AuthSt
if(var_InheritBool(p_object, "adaptive-use-access"))
factory = new (std::nothrow) StreamUrlConnectionFactory();
else
- factory = new (std::nothrow) ConnectionFactory( storage );
+ factory = new (std::nothrow) NativeConnectionFactory( storage );
}
HTTPConnectionManager::~HTTPConnectionManager ()
diff --git a/modules/demux/adaptive/http/HTTPConnectionManager.h b/modules/demux/adaptive/http/HTTPConnectionManager.h
index 09e65530a4..dc712a72d2 100644
--- a/modules/demux/adaptive/http/HTTPConnectionManager.h
+++ b/modules/demux/adaptive/http/HTTPConnectionManager.h
@@ -37,7 +37,7 @@ namespace adaptive
namespace http
{
class ConnectionParams;
- class ConnectionFactory;
+ class AbstractConnectionFactory;
class AbstractConnection;
class AuthStorage;
class Downloader;
@@ -66,7 +66,7 @@ namespace adaptive
class HTTPConnectionManager : public AbstractConnectionManager
{
public:
- HTTPConnectionManager (vlc_object_t *p_object, ConnectionFactory *);
+ HTTPConnectionManager (vlc_object_t *p_object, AbstractConnectionFactory *);
HTTPConnectionManager (vlc_object_t *p_object, AuthStorage *);
virtual ~HTTPConnectionManager ();
@@ -81,7 +81,7 @@ namespace adaptive
Downloader *downloader;
vlc_mutex_t lock;
std::vector<AbstractConnection *> connectionPool;
- ConnectionFactory *factory;
+ AbstractConnectionFactory *factory;
AbstractConnection * reuseConnection(ConnectionParams &);
};
}
More information about the vlc-commits
mailing list