linuxdvb: fix configuration processing

This commit is contained in:
Adam Sutton 2013-10-27 21:29:05 +00:00
parent a622f4fffa
commit dded4e1b9d
3 changed files with 16 additions and 17 deletions

View file

@ -185,7 +185,7 @@ linuxdvb_frontend_dvbs_class_satconf_set ( void *self, const void *str )
if (lfe->lfe_satconf && !strcmp(str ?: "", lfe->lfe_satconf->ls_type))
return 0;
linuxdvb_satconf_destroy(lfe->lfe_satconf);
lfe->lfe_satconf = linuxdvb_satconf_create(lfe, str);
lfe->lfe_satconf = linuxdvb_satconf_create(lfe, str, NULL, NULL);
return 1;
}
@ -816,6 +816,8 @@ linuxdvb_frontend_create0
const char *str;
const idclass_t *idc;
pthread_t tid;
const char *scuuid = NULL, *sctype = NULL;
htsmsg_t *scconf = NULL;
/* Get type */
if (conf) {
@ -860,9 +862,17 @@ linuxdvb_frontend_create0
/* Start table thread */
tvhthread_create(&tid, NULL, mpegts_input_table_thread, lfe, 1);
/* Satconf */
if (conf) {
if ((scconf = htsmsg_get_map(conf, "satconf"))) {
sctype = htsmsg_get_str(scconf, "type");
scuuid = htsmsg_get_str(scconf, "uuid");
}
}
/* Create satconf */
if (type == FE_QPSK && !lfe->lfe_satconf)
lfe->lfe_satconf = linuxdvb_satconf_create(lfe, "");
lfe->lfe_satconf = linuxdvb_satconf_create(lfe, sctype, scuuid, scconf);
/* No conf */
if (!conf)
@ -925,14 +935,12 @@ linuxdvb_frontend_save ( linuxdvb_frontend_t *lfe, htsmsg_t *m )
{
mpegts_input_save((mpegts_input_t*)lfe, m);
htsmsg_add_str(m, "type", dvb_type2str(lfe->lfe_info.type));
htsmsg_print(m);
if (lfe->lfe_satconf) {
htsmsg_t *s = htsmsg_create_map();
linuxdvb_satconf_save(lfe->lfe_satconf, s);
htsmsg_add_str(s, "uuid", idnode_uuid_as_str(&lfe->lfe_satconf->ls_id));
htsmsg_add_msg(m, "satconf", s);
}
htsmsg_print(m);
}
/******************************************************************************

View file

@ -346,17 +346,13 @@ void linuxdvb_satconf_ele_destroy ( linuxdvb_satconf_ele_t *ls );
htsmsg_t *linuxdvb_satconf_type_list ( void *o );
linuxdvb_satconf_t *linuxdvb_satconf_create0(const char *uuid, htsmsg_t *conf);
linuxdvb_satconf_t *linuxdvb_satconf_create
( linuxdvb_frontend_t *lfe, const char *type );
( linuxdvb_frontend_t *lfe,
const char *type, const char *uuid, htsmsg_t *conf );
void linuxdvb_satconf_delete ( linuxdvb_satconf_t *ls );
void linuxdvb_satconf_destroy ( linuxdvb_satconf_t *ls );
linuxdvb_satconf_t *linuxdvb_satconf_create
( linuxdvb_frontend_t *lfe, const char *type );
void linuxdvb_satconf_destroy ( linuxdvb_satconf_t *ls );
#endif /* __TVH_LINUXDVB_PRIVATE_H__ */

View file

@ -77,13 +77,10 @@ linuxdvb_satconf_class_network_set
{
int i = 0;
linuxdvb_satconf_ele_t *lse;
printf("SET NETWORK %p %d = %s\n", ls, idx, uuid);
LIST_FOREACH(lse, &ls->ls_elements, ls_link) {
printf("element\n");
if (i == idx) break;
i++;
}
printf("lse = %p\n", lse);
if (lse)
return linuxdvb_satconf_ele_class_network_set(lse, uuid);
return 0;
@ -369,14 +366,13 @@ linuxdvb_satconf_destroy ( linuxdvb_satconf_t *ls )
linuxdvb_satconf_t *
linuxdvb_satconf_create
( linuxdvb_frontend_t *lfe, const char *type )
( linuxdvb_frontend_t *lfe, const char *type, const char *uuid,
htsmsg_t *conf )
{
int i;
linuxdvb_satconf_ele_t *lse;
struct linuxdvb_satconf_type *lst
= linuxdvb_satconf_type_find(type);
const char *uuid = NULL;//"TODO";
htsmsg_t *conf = NULL;
assert(lst);
linuxdvb_satconf_t *ls = calloc(1, sizeof(linuxdvb_satconf_t));
@ -446,7 +442,6 @@ linuxdvb_satconf_ele_class_network_set(void *o, const void *v)
mpegts_input_t *mi = o;
mpegts_network_t *mn = mi->mi_network;
const char *s = v;
printf("SET NETWORK %s\n", (const char*)v);
if (mi->mi_network && !strcmp(idnode_uuid_as_str(&mn->mn_id), s ?: ""))
return 0;