Browse Source

demux: adaptative: remove duplicated logic creation

pull/35/head
Francois Cartegnie 11 years ago
parent
commit
877863da9f
  1. 12
      modules/demux/adaptative/PlaylistManager.cpp
  2. 25
      modules/demux/dash/DASHManager.cpp
  3. 3
      modules/demux/dash/DASHManager.h
  4. 24
      modules/demux/hls/HLSManager.cpp
  5. 3
      modules/demux/hls/HLSManager.hpp
  6. 23
      modules/demux/smooth/SmoothManager.cpp
  7. 3
      modules/demux/smooth/SmoothManager.hpp

12
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;
}

25
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);
}
}

3
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:

24
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);
}
}

3
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 *);
};

23
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);
}
}

3
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:

Loading…
Cancel
Save