Merge branch 'master' into epg-rewrite
This commit is contained in:
commit
ee1f454cf0
8 changed files with 66 additions and 10 deletions
|
@ -205,6 +205,8 @@ typedef struct th_dvb_adapter {
|
|||
int tda_unc_is_delta; /* 1 if we believe FE_READ_UNCORRECTED_BLOCKS
|
||||
* return dela values */
|
||||
|
||||
uint32_t tda_extrapriority; // extra priority for choosing the best adapter/service
|
||||
|
||||
} th_dvb_adapter_t;
|
||||
|
||||
/**
|
||||
|
@ -287,6 +289,8 @@ htsmsg_t *dvb_adapter_build_msg(th_dvb_adapter_t *tda);
|
|||
|
||||
htsmsg_t *dvb_fe_opts(th_dvb_adapter_t *tda, const char *which);
|
||||
|
||||
void dvb_adapter_set_extrapriority(th_dvb_adapter_t *tda, int extrapriority);
|
||||
|
||||
/**
|
||||
* DVB Multiplex
|
||||
*/
|
||||
|
|
|
@ -86,6 +86,7 @@ tda_save(th_dvb_adapter_t *tda)
|
|||
htsmsg_add_u32(m, "dump_muxes", tda->tda_dump_muxes);
|
||||
htsmsg_add_u32(m, "nitoid", tda->tda_nitoid);
|
||||
htsmsg_add_u32(m, "diseqc_version", tda->tda_diseqc_version);
|
||||
htsmsg_add_u32(m, "extrapriority", tda->tda_extrapriority);
|
||||
hts_settings_save(m, "dvbadapters/%s", tda->tda_identifier);
|
||||
htsmsg_destroy(m);
|
||||
}
|
||||
|
@ -232,6 +233,23 @@ dvb_adapter_set_diseqc_version(th_dvb_adapter_t *tda, unsigned int v)
|
|||
tda_save(tda);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void
|
||||
dvb_adapter_set_extrapriority(th_dvb_adapter_t *tda, int extrapriority)
|
||||
{
|
||||
lock_assert(&global_lock);
|
||||
|
||||
if(tda->tda_extrapriority == extrapriority)
|
||||
return;
|
||||
|
||||
tvhlog(LOG_NOTICE, "dvb", "Adapter \"%s\" extra priority \"%d\" changed to \"%d\"",
|
||||
tda->tda_displayname, tda->tda_extrapriority, extrapriority);
|
||||
|
||||
tda->tda_extrapriority = extrapriority;
|
||||
tda_save(tda);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -383,6 +401,7 @@ dvb_adapter_init(uint32_t adapter_mask)
|
|||
htsmsg_get_u32(c, "dump_muxes", &tda->tda_dump_muxes);
|
||||
htsmsg_get_u32(c, "nitoid", &tda->tda_nitoid);
|
||||
htsmsg_get_u32(c, "diseqc_version", &tda->tda_diseqc_version);
|
||||
htsmsg_get_u32(c, "extrapriority", &tda->tda_extrapriority);
|
||||
}
|
||||
htsmsg_destroy(l);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,9 @@ dvb_mux_preconf_add(th_dvb_adapter_t *tda, const struct mux *m, int num,
|
|||
break;
|
||||
|
||||
case FE_QPSK:
|
||||
#if DVB_API_VERSION > 5
|
||||
dmc.dmc_fe_delsys = SYS_DVBS;
|
||||
#endif
|
||||
dmc.dmc_fe_params.u.qpsk.symbol_rate = m->symrate;
|
||||
dmc.dmc_fe_params.u.qpsk.fec_inner = m->fec;
|
||||
|
||||
|
|
|
@ -164,7 +164,11 @@ htsmsg_json_parse_string(const char *s, const char **endp)
|
|||
|
||||
if(*s == '\\') {
|
||||
esc = 1;
|
||||
} else if(*s == '"' && (s[-1] != '\\' || s[-2] == '\\')) {
|
||||
/* skip the escape */
|
||||
s++;
|
||||
if (*s == 'u') s += 4;
|
||||
// Note: we could detect the lack of support here!
|
||||
} else if(*s == '"') {
|
||||
|
||||
*endp = s + 1;
|
||||
|
||||
|
@ -184,7 +188,7 @@ htsmsg_json_parse_string(const char *s, const char **endp)
|
|||
a++;
|
||||
if(*a == 'b')
|
||||
*b++ = '\b';
|
||||
else if (*a == '\\')
|
||||
else if(*a == '\\')
|
||||
*b++ = '\\';
|
||||
else if(*a == 'f')
|
||||
*b++ = '\f';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Functions converting HTSMSGs to/from XML
|
||||
* Copyright (C) 2008 Andreas Öman
|
||||
* Copyright (C) 2008 Andreas <EFBFBD>man
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -693,7 +693,7 @@ htsmsg_xml_parse_cd(xmlparser_t *xp, htsmsg_t *parent, char *src)
|
|||
}
|
||||
}
|
||||
|
||||
if(y == 1 && c >= 1) {
|
||||
if(y == 1 && c > 0) {
|
||||
/* One segment UTF-8 (or 7bit ASCII),
|
||||
use data directly from source */
|
||||
|
||||
|
@ -707,7 +707,7 @@ htsmsg_xml_parse_cd(xmlparser_t *xp, htsmsg_t *parent, char *src)
|
|||
*cc->cc_end = 0;
|
||||
free(cc);
|
||||
|
||||
} else if(c >= 1) {
|
||||
} else if(c > 0) {
|
||||
body = malloc(c + 1);
|
||||
c = 0;
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ service_start(service_t *t, unsigned int weight, int force_start)
|
|||
static int
|
||||
dvb_extra_prio(th_dvb_adapter_t *tda)
|
||||
{
|
||||
return tda->tda_hostconnection * 10;
|
||||
return tda->tda_extrapriority + tda->tda_hostconnection * 10;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -285,10 +285,19 @@ servicecmp(const void *A, const void *B)
|
|||
service_t *a = *(service_t **)A;
|
||||
service_t *b = *(service_t **)B;
|
||||
|
||||
int q = service_get_quality(a) - service_get_quality(b);
|
||||
/* only check quality if both adapters have the same prio
|
||||
*
|
||||
* there needs to be a much more sophisticated algorithm to take priority and quality into account
|
||||
* additional, it may be problematic, since a higher priority value lowers the ranking
|
||||
*
|
||||
*/
|
||||
if (dvb_extra_prio(a->s_dvb_mux_instance->tdmi_adapter) == dvb_extra_prio(b->s_dvb_mux_instance->tdmi_adapter)) {
|
||||
|
||||
if(q != 0)
|
||||
return q; /* Quality precedes priority */
|
||||
int q = service_get_quality(a) - service_get_quality(b);
|
||||
|
||||
if(q != 0)
|
||||
return q; /* Quality precedes priority */
|
||||
}
|
||||
|
||||
return service_get_prio(a) - service_get_prio(b);
|
||||
}
|
||||
|
@ -335,6 +344,9 @@ service_find(channel_t *ch, unsigned int weight, const char *loginfo,
|
|||
continue;
|
||||
}
|
||||
vec[cnt++] = t;
|
||||
tvhlog(LOG_DEBUG, "Service",
|
||||
"%s: Adding adapter \"%s\" for service \"%s\"",
|
||||
loginfo, t->s_dvb_mux_instance->tdmi_identifier, service_nicename(t));
|
||||
}
|
||||
|
||||
/* Sort services, lower priority should come come earlier in the vector
|
||||
|
@ -358,6 +370,9 @@ service_find(channel_t *ch, unsigned int weight, const char *loginfo,
|
|||
/* First, try all services without stealing */
|
||||
for(i = off; i < cnt; i++) {
|
||||
t = vec[i];
|
||||
tvhlog(LOG_DEBUG, "Service", "%s: Probing adapter \"%s\" without stealing for service \"%s\"",
|
||||
loginfo, t->s_dvb_mux_instance->tdmi_identifier, service_nicename(t));
|
||||
|
||||
if(t->s_status == SERVICE_RUNNING)
|
||||
return t;
|
||||
if((r = service_start(t, 0, 0)) == 0)
|
||||
|
@ -372,6 +387,9 @@ service_find(channel_t *ch, unsigned int weight, const char *loginfo,
|
|||
|
||||
for(i = off; i < cnt; i++) {
|
||||
t = vec[i];
|
||||
tvhlog(LOG_DEBUG, "Service", "%s: Probing adapter \"%s\" with weight %d for service \"%s\"",
|
||||
loginfo, t->s_dvb_mux_instance->tdmi_identifier, weight, service_nicename(t));
|
||||
|
||||
if((r = service_start(t, weight, 0)) == 0)
|
||||
return t;
|
||||
*errorp = r;
|
||||
|
|
|
@ -156,6 +156,7 @@ extjs_dvbadapter(http_connection_t *hc, const char *remain, void *opaque)
|
|||
((const char *[]){"DiSEqC 1.0 / 2.0",
|
||||
"DiSEqC 1.1 / 2.1"})
|
||||
[tda->tda_diseqc_version % 2]);
|
||||
htsmsg_add_u32(r, "extrapriority", tda->tda_extrapriority);
|
||||
|
||||
out = json_single_record(r, "dvbadapters");
|
||||
} else if(!strcmp(op, "save")) {
|
||||
|
@ -185,6 +186,9 @@ extjs_dvbadapter(http_connection_t *hc, const char *remain, void *opaque)
|
|||
dvb_adapter_set_diseqc_version(tda, 1);
|
||||
}
|
||||
|
||||
if((s = http_arg_get(&hc->hc_req_args, "extrapriority")) != NULL)
|
||||
dvb_adapter_set_extrapriority(tda, atoi(s));
|
||||
|
||||
out = htsmsg_create_map();
|
||||
htsmsg_add_u32(out, "success", 1);
|
||||
} else if(!strcmp(op, "addnetwork")) {
|
||||
|
|
|
@ -1106,7 +1106,7 @@ tvheadend.dvb_adapter_general = function(adapterData, satConfStore) {
|
|||
var confreader = new Ext.data.JsonReader({
|
||||
root: 'dvbadapters'
|
||||
}, ['name', 'automux', 'idlescan', 'diseqcversion', 'qmon',
|
||||
'dumpmux', 'nitoid']);
|
||||
'dumpmux', 'nitoid','extrapriority']);
|
||||
|
||||
|
||||
function saveConfForm () {
|
||||
|
@ -1150,6 +1150,11 @@ tvheadend.dvb_adapter_general = function(adapterData, satConfStore) {
|
|||
fieldLabel: 'NIT-o Network ID',
|
||||
name: 'nitoid',
|
||||
width: 50
|
||||
},
|
||||
{
|
||||
fieldLabel: 'Extra priority',
|
||||
name: 'extrapriority',
|
||||
width: 50
|
||||
}
|
||||
];
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue