Commit 8f4cf91d authored by François Cartegnie's avatar François Cartegnie 🤞

demux: adaptive: allow regular http access

parent c1161676
......@@ -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 ()
......
......@@ -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);
......
......@@ -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 &);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment