void (*ti_get_streams) (tvh_input_t *, tvh_input_stream_list_t*);
void (*ti_clear_stats) (tvh_input_t *);
struct htsmsg *(*ti_wizard_get) (tvh_input_t *, const char *);
- void (*ti_wizard_set) (tvh_input_t *, struct htsmsg *);
+ void (*ti_wizard_set) (tvh_input_t *, struct htsmsg *, const char *);
};
/*
void mpegts_network_unregister_builder
( const idclass_t *idc );
+mpegts_network_builder_t *mpegts_network_builder_find ( const char *clazz );
+
mpegts_network_t *mpegts_network_build
( const char *clazz, htsmsg_t *conf );
void mpegts_network_scan ( mpegts_network_t *mn );
void mpegts_network_get_type_str( mpegts_network_t *mn, char *buf, size_t buflen );
+htsmsg_t * mpegts_network_wizard_get ( mpegts_input_t *mi, const idclass_t *idc,
+ mpegts_network_t *mn, const char *lang );
+void mpegts_network_wizard_create ( const char *clazz, htsmsg_t **nlist, const char *lang );
+
mpegts_mux_t *mpegts_mux_create0
( mpegts_mux_t *mm, const idclass_t *class, const char *uuid,
mpegts_network_t *mn, uint16_t onid, uint16_t tsid,
htsmsg_destroy(c);
}
+static mpegts_network_t *
+iptv_input_wizard_network ( iptv_input_t *lfe )
+{
+ return (mpegts_network_t *)LIST_FIRST(&lfe->mi_networks);
+}
+
+static htsmsg_t *
+iptv_input_wizard_get( tvh_input_t *ti, const char *lang )
+{
+ iptv_input_t *mi = (iptv_input_t*)ti;
+ mpegts_network_t *mn;
+ const idclass_t *idc;
+
+ mn = iptv_input_wizard_network(mi);
+ if (mn == NULL || (mn && mn->mn_wizard))
+ idc = &iptv_auto_network_class;
+ return mpegts_network_wizard_get((mpegts_input_t *)mi, idc, mn, lang);
+}
+
+static void
+iptv_input_wizard_set( tvh_input_t *ti, htsmsg_t *conf, const char *lang )
+{
+ iptv_input_t *mi = (iptv_input_t*)ti;
+ const char *ntype = htsmsg_get_str(conf, "mpegts_network_type");
+ mpegts_network_t *mn;
+
+ mn = iptv_input_wizard_network(mi);
+ if ((mn == NULL || mn->mn_wizard))
+ mpegts_network_wizard_create(ntype, NULL, lang);
+}
+
void iptv_init ( void )
{
/* Register handlers */
/* Init Input */
mpegts_input_create0((mpegts_input_t*)iptv_input,
&iptv_input_class, NULL, NULL);
+ iptv_input->ti_wizard_get = iptv_input_wizard_get;
+ iptv_input->ti_wizard_set = iptv_input_wizard_set;
iptv_input->mi_warm_mux = iptv_input_warm_mux;
iptv_input->mi_start_mux = iptv_input_start_mux;
iptv_input->mi_stop_mux = iptv_input_stop_mux;
* Creation/Config
* *************************************************************************/
+static mpegts_network_t *
+linuxdvb_frontend_wizard_network ( linuxdvb_frontend_t *lfe )
+{
+ linuxdvb_satconf_ele_t *ele = NULL;
+
+ if (lfe->lfe_satconf) {
+ ele = TAILQ_FIRST(&lfe->lfe_satconf->ls_elements);
+ if (ele && ele->lse_networks && ele->lse_networks->is_count > 0)
+ return (mpegts_network_t *)ele->lse_networks->is_array[0];
+ }
+ return (mpegts_network_t *)LIST_FIRST(&lfe->mi_networks);
+}
+
+static htsmsg_t *
+linuxdvb_frontend_wizard_get( tvh_input_t *ti, const char *lang )
+{
+ linuxdvb_frontend_t *lfe = (linuxdvb_frontend_t*)ti;
+ mpegts_network_t *mn;
+ const idclass_t *idc = NULL;
+
+ mn = linuxdvb_frontend_wizard_network(lfe);
+ if ((lfe->lfe_master == 0 && mn == NULL) || (mn && mn->mn_wizard))
+ idc = dvb_network_class_by_fe_type(lfe->lfe_type);
+ return mpegts_network_wizard_get((mpegts_input_t *)lfe, idc, mn, lang);
+}
+
+static void
+linuxdvb_frontend_wizard_set( tvh_input_t *ti, htsmsg_t *conf, const char *lang )
+{
+ linuxdvb_frontend_t *lfe = (linuxdvb_frontend_t*)ti;
+ const char *ntype = htsmsg_get_str(conf, "mpegts_network_type");
+ mpegts_network_t *mn;
+
+ mn = linuxdvb_frontend_wizard_network(lfe);
+ if (ntype && (mn == NULL || mn->mn_wizard)) {
+ htsmsg_t *nlist;
+ mpegts_network_wizard_create(ntype, &nlist, lang);
+ if (lfe->lfe_satconf) {
+ htsmsg_t *conf = htsmsg_create_map();
+ htsmsg_add_msg(conf, "networks", nlist);
+ linuxdvb_satconf_create(lfe, NULL, NULL, conf);
+ mn = linuxdvb_frontend_wizard_network(lfe);
+ htsmsg_destroy(conf);
+ } else {
+ mpegts_input_set_networks((mpegts_input_t *)lfe, nlist);
+ htsmsg_destroy(nlist);
+ }
+ if (mn) {
+ mn->mn_wizard = 1;
+ mn->mn_config_save(mn);
+ }
+ }
+}
+
linuxdvb_frontend_t *
linuxdvb_frontend_create
( htsmsg_t *conf, linuxdvb_adapter_t *la, int number,
lfe->lfe_dvr_path = strdup(dvr_path);
/* Input callbacks */
+ lfe->ti_wizard_get = linuxdvb_frontend_wizard_get;
+ lfe->ti_wizard_set = linuxdvb_frontend_wizard_set;
lfe->mi_is_enabled = linuxdvb_frontend_is_enabled;
lfe->mi_start_mux = linuxdvb_frontend_start_mux;
lfe->mi_stop_mux = linuxdvb_frontend_stop_mux;
snprintf(buf, buflen, "%s", s);
}
+/******************************************************************************
+ * Wizard
+ *****************************************************************************/
+
+htsmsg_t *
+mpegts_network_wizard_get
+ ( mpegts_input_t *mi, const idclass_t *idc,
+ mpegts_network_t *mn, const char *lang )
+{
+ htsmsg_t *m = htsmsg_create_map(), *l, *e;
+ char ubuf[UUID_HEX_SIZE], buf[256];
+
+ if (mi && idc) {
+ mi->mi_display_name(mi, buf, sizeof(buf));
+ htsmsg_add_str(m, "input_name", buf);
+ l = htsmsg_create_list();
+ e = htsmsg_create_map();
+ htsmsg_add_str(e, "key", idc->ic_class);
+ htsmsg_add_str(e, "val", idclass_get_caption(idc, lang));
+ htsmsg_add_msg(l, NULL, e);
+ htsmsg_add_msg(m, "mpegts_network_types", l);
+ if (mn)
+ htsmsg_add_str(m, "mpegts_network", idnode_uuid_as_str(&mn->mn_id, ubuf));
+ }
+ return m;
+}
+
+void
+mpegts_network_wizard_create
+ ( const char *clazz, htsmsg_t **nlist, const char *lang )
+{
+ char buf[256];
+ mpegts_network_t *mn;
+ mpegts_network_builder_t *mnb;
+ htsmsg_t *conf;
+
+ if (nlist)
+ *nlist = NULL;
+ mnb = mpegts_network_builder_find(clazz);
+ if (mnb == NULL)
+ return;
+
+ conf = htsmsg_create_map();
+ htsmsg_add_str(conf, "networkname", idclass_get_caption(mnb->idc, lang));
+ htsmsg_add_bool(conf, "wizard", 1);
+ mn = mnb->build(mnb->idc, conf);
+ htsmsg_destroy(conf);
+ if (mn && nlist) {
+ *nlist = htsmsg_create_list();
+ htsmsg_add_str(*nlist, NULL, idnode_uuid_as_str(&mn->mn_id, buf));
+ }
+}
+
/******************************************************************************
* Network classes/creation
*****************************************************************************/
}
}
-mpegts_network_t *
-mpegts_network_build
- ( const char *clazz, htsmsg_t *conf )
+mpegts_network_builder_t *
+mpegts_network_builder_find
+ ( const char *clazz )
{
mpegts_network_builder_t *mnb;
LIST_FOREACH(mnb, &mpegts_network_builders, link) {
if (!strcmp(mnb->idc->ic_class, clazz))
- return mnb->build(mnb->idc, conf);
+ return mnb;
}
return NULL;
}
+mpegts_network_t *
+mpegts_network_build
+ ( const char *clazz, htsmsg_t *conf )
+{
+ mpegts_network_builder_t *mnb;
+ mnb = mpegts_network_builder_find(clazz);
+ if (mnb)
+ return mnb->build(mnb->idc, conf);
+ return NULL;
+}
+
/******************************************************************************
* Search
*****************************************************************************/
return sd->sd_info.srcs;
}
+static mpegts_network_t *
+satip_frontend_wizard_network ( satip_frontend_t *lfe )
+{
+ satip_satconf_t *sfc;
+
+ sfc = TAILQ_FIRST(&lfe->sf_satconf);
+ if (sfc && sfc->sfc_networks)
+ if (sfc->sfc_networks->is_count > 0)
+ return (mpegts_network_t *)sfc->sfc_networks->is_array[0];
+ return NULL;
+}
+
static htsmsg_t *
satip_frontend_wizard_get( tvh_input_t *ti, const char *lang )
{
satip_frontend_t *lfe = (satip_frontend_t*)ti;
- htsmsg_t *m = htsmsg_create_map(), *l, *e;
- satip_satconf_t *sfc;
- const idclass_t *idc;
- char ubuf[UUID_HEX_SIZE], buf[256];
+ mpegts_network_t *mn;
+ const idclass_t *idc = NULL;
- sfc = TAILQ_FIRST(&lfe->sf_satconf);
- if (sfc == NULL || (sfc && sfc->sfc_wizard)) {
- lfe->mi_display_name((mpegts_input_t*)lfe, buf, sizeof(buf));
- htsmsg_add_str(m, "input_name", buf);
+ mn = satip_frontend_wizard_network(lfe);
+ if (lfe->sf_master == 0 && (mn == NULL || (mn && mn->mn_wizard)))
idc = dvb_network_class_by_fe_type(lfe->sf_type);
- if (idc) {
- l = htsmsg_create_list();
- e = htsmsg_create_map();
- htsmsg_add_str(e, "key", idc->ic_class);
- htsmsg_add_str(e, "val", idclass_get_caption(idc, lang));
- htsmsg_add_msg(l, NULL, e);
- htsmsg_add_msg(m, "mpegts_network_types", l);
- }
- if (sfc && sfc->sfc_wizard) {
- lfe->mi_display_name((mpegts_input_t*)lfe, buf, sizeof(buf));
- htsmsg_add_str(m, "input_name", buf);
- htsmsg_add_str(m, "mpegts_network",
- idnode_uuid_as_str(sfc->sfc_networks->is_array[0], ubuf));
- }
- }
- return m;
+ return mpegts_network_wizard_get((mpegts_input_t *)lfe, idc, mn, lang);
}
static void
-satip_frontend_wizard_set( tvh_input_t *ti, htsmsg_t *conf )
+satip_frontend_wizard_set( tvh_input_t *ti, htsmsg_t *conf, const char *lang )
{
satip_frontend_t *lfe = (satip_frontend_t*)ti;
- const char *uuid = htsmsg_get_str(conf, "mpegts_network_type");
- satip_satconf_t *sfc;
+ const char *ntype = htsmsg_get_str(conf, "mpegts_network_type");
+ mpegts_network_t *mn;
- sfc = TAILQ_FIRST(&lfe->sf_satconf);
- if (uuid && (sfc == NULL || sfc->sfc_wizard)) {
+ mn = satip_frontend_wizard_network(lfe);
+ if (ntype && lfe->sf_master == 0 && (mn == NULL || mn->mn_wizard)) {
htsmsg_t *conf = htsmsg_create_map();
- htsmsg_t *nlist = htsmsg_create_list();
- htsmsg_add_str(nlist, NULL, uuid);
+ htsmsg_t *nlist;
+ mpegts_network_wizard_create(ntype, &nlist, lang);
htsmsg_add_msg(conf, "networks", nlist);
- htsmsg_add_bool(conf, "wizard", 1);
satip_satconf_create(lfe, conf, satip_frontend_default_positions(lfe));
htsmsg_destroy(conf);
}
/*
* Config
*/
- int sfc_wizard;
int sfc_enabled;
int sfc_position;
int sfc_priority;
.ic_get_title = satip_satconf_class_get_title,
.ic_save = satip_satconf_class_save,
.ic_properties = (const property_t[]) {
- {
- .type = PT_BOOL,
- .id = "wizard",
- .name = N_("Wizard"),
- .off = offsetof(satip_satconf_t, sfc_wizard),
- .opts = PO_NOUI,
- },
{
.type = PT_BOOL,
.id = "enabled",
}
};
+static mpegts_network_t *
+tvhdhomerun_frontend_wizard_network ( tvhdhomerun_frontend_t *hfe )
+{
+ return (mpegts_network_t *)LIST_FIRST(&hfe->mi_networks);
+}
+
+static htsmsg_t *
+tvhdhomerun_frontend_wizard_get( tvh_input_t *ti, const char *lang )
+{
+ tvhdhomerun_frontend_t *hfe = (tvhdhomerun_frontend_t*)ti;
+ mpegts_network_t *mn;
+ const idclass_t *idc = NULL;
+
+ mn = tvhdhomerun_frontend_wizard_network(hfe);
+ if (mn == NULL || (mn && mn->mn_wizard))
+ idc = dvb_network_class_by_fe_type(hfe->hf_type);
+ return mpegts_network_wizard_get((mpegts_input_t *)hfe, idc, mn, lang);
+}
+
+static void
+tvhdhomerun_frontend_wizard_set( tvh_input_t *ti, htsmsg_t *conf, const char *lang )
+{
+ tvhdhomerun_frontend_t *hfe = (tvhdhomerun_frontend_t*)ti;
+ const char *ntype = htsmsg_get_str(conf, "mpegts_network_type");
+ mpegts_network_t *mn;
+
+ mn = tvhdhomerun_frontend_wizard_network(hfe);
+ if (ntype && (mn == NULL || mn->mn_wizard)) {
+ htsmsg_t *nlist = htsmsg_create_list();
+ mpegts_network_wizard_create(ntype, &nlist, lang);
+ htsmsg_add_str(nlist, NULL, ntype);
+ mpegts_input_set_networks((mpegts_input_t *)hfe, nlist);
+ htsmsg_destroy(nlist);
+ }
+}
+
void
tvhdhomerun_frontend_delete ( tvhdhomerun_frontend_t *hfe )
{
}
/* Input callbacks */
+ hfe->ti_wizard_get = tvhdhomerun_frontend_wizard_get;
+ hfe->ti_wizard_set = tvhdhomerun_frontend_wizard_set;
hfe->mi_is_enabled = tvhdhomerun_frontend_is_enabled;
hfe->mi_start_mux = tvhdhomerun_frontend_start_mux;
hfe->mi_stop_mux = tvhdhomerun_frontend_stop_mux;
#define WIZARD_NETWORKS 6
typedef struct wizard_network {
+ char lang [64];
property_t props [WIZARD_NETWORKS * 3 + 10];
char tuner [WIZARD_NETWORKS][64];
char tunerid [WIZARD_NETWORKS][UUID_HEX_SIZE];
continue;
m = htsmsg_create_map();
htsmsg_add_str(m, "mpegts_network_type", w->network_type[idx]);
- ti->ti_wizard_set(ti, m);
+ ti->ti_wizard_set(ti, m, w->lang[0] ? w->lang : NULL);
htsmsg_destroy(m);
}
for (mn = LIST_FIRST(&mpegts_network_all); mn != NULL; mn = mn_next) {
ic->ic_properties = w->props;
ic->ic_save = network_save;
page->free = network_free;
+ snprintf(w->lang, sizeof(w->lang), "%s", lang ?: "");
for (idx = 0; idx < ARRAY_SIZE(props); idx++)
w->props[idx] = props[idx];