Commit 92646bf1 authored by François Cartegnie's avatar François Cartegnie 🤞

demux: adaptive: change logic var to string

parent c11670e8
......@@ -75,13 +75,22 @@ static void Close (vlc_object_t *);
#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::Default,
static const AbstractAdaptationLogic::LogicType pi_logics[] = {
AbstractAdaptationLogic::Default,
AbstractAdaptationLogic::Predictive,
AbstractAdaptationLogic::RateBased,
AbstractAdaptationLogic::FixedRate,
AbstractAdaptationLogic::AlwaysLowest,
AbstractAdaptationLogic::AlwaysBest};
static const char *const ppsz_logics_values[] = {
"",
"predictive",
"rate",
"fixedrate",
"lowest",
"highest"};
static const char *const ppsz_logics[] = { N_("Default"),
N_("Predictive"),
N_("Bandwidth Adaptive"),
......@@ -95,9 +104,8 @@ vlc_module_begin ()
set_capability( "demux", 12 )
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_DEMUX )
add_integer( "adaptive-logic", AbstractAdaptationLogic::Default,
ADAPT_LOGIC_TEXT, NULL, false )
change_integer_list( pi_logics, ppsz_logics )
add_string( "adaptive-logic", "", ADAPT_LOGIC_TEXT, NULL, false )
change_string_list( ppsz_logics_values, ppsz_logics )
add_integer( "adaptive-width", 0, ADAPT_WIDTH_TEXT, ADAPT_WIDTH_TEXT, true )
add_integer( "adaptive-height", 0, ADAPT_HEIGHT_TEXT, ADAPT_HEIGHT_TEXT, true )
add_integer( "adaptive-bw", 250, ADAPT_BW_TEXT, ADAPT_BW_LONGTEXT, false )
......@@ -130,8 +138,21 @@ static int Open(vlc_object_t *p_obj)
}
PlaylistManager *p_manager = NULL;
AbstractAdaptationLogic::LogicType logic =
static_cast<AbstractAdaptationLogic::LogicType>(var_InheritInteger(p_obj, "adaptive-logic"));
char *psz_logic = var_InheritString(p_obj, "adaptive-logic");
AbstractAdaptationLogic::LogicType logic = AbstractAdaptationLogic::Default;
if( psz_logic )
{
for(size_t i=0;i<ARRAY_SIZE(pi_logics); i++)
{
if(!strcmp(psz_logic, ppsz_logics_values[i]))
{
logic = pi_logics[i];
break;
}
}
free( psz_logic );
}
std::string playlisturl(p_demux->s->psz_url);
......
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