int mpegts_input_class_network_set ( void *o, const void *p );
htsmsg_t *mpegts_input_class_network_enum ( void *o, const char *lang );
char *mpegts_input_class_network_rend ( void *o, const char *lang );
+const void *mpegts_input_class_active_get ( void *o );
int mpegts_mps_weight(elementary_stream_t *st);
return la->la_name ?: la->la_rootpath;
}
+static const void *
+linuxdvb_adapter_class_active_get ( void *obj )
+{
+ static int active;
+#if ENABLE_LINUXDVB_CA
+ linuxdvb_ca_t *lca;
+#endif
+ linuxdvb_adapter_t *la = (linuxdvb_adapter_t*)obj;
+ active = la->la_is_enabled(la);
+#if ENABLE_LINUXDVB_CA
+ if (!active) {
+ LIST_FOREACH(lca, &la->la_ca_devices, lca_link)
+ if (lca->lca_enabled) {
+ active = 1;
+ break;
+ }
+ }
+#endif
+ return &active;
+}
+
const idclass_t linuxdvb_adapter_class =
{
.ic_class = "linuxdvb_adapter",
.ic_get_childs = linuxdvb_adapter_class_get_childs,
.ic_get_title = linuxdvb_adapter_class_get_title,
.ic_properties = (const property_t[]){
+ {
+ .type = PT_BOOL,
+ .id = "active",
+ .name = N_("Active"),
+ .opts = PO_RDONLY | PO_NOSAVE | PO_NOUI,
+ .get = linuxdvb_adapter_class_active_get,
+ },
{
.type = PT_STR,
.id = "rootpath",
return buf;
}
+static const void *
+linuxdvb_ca_class_active_get ( void *obj )
+{
+ static int active;
+ linuxdvb_ca_t *lca = (linuxdvb_ca_t*)obj;
+ active = !!lca->lca_enabled;
+ return &active;
+}
+
const idclass_t linuxdvb_ca_class =
{
.ic_class = "linuxdvb_ca",
.ic_changed = linuxdvb_ca_class_changed,
.ic_get_title = linuxdvb_ca_class_get_title,
.ic_properties = (const property_t[]) {
+ {
+ .type = PT_BOOL,
+ .id = "active",
+ .name = N_("Active"),
+ .opts = PO_RDONLY | PO_NOSAVE | PO_NOUI,
+ .get = linuxdvb_ca_class_active_get,
+ },
{
.type = PT_BOOL,
.id = "enabled",
linuxdvb_adapter_changed(la);
}
+const void *
+linuxdvb_frontend_class_active_get ( void *obj )
+{
+ int *active;
+ linuxdvb_frontend_t *lfe = (linuxdvb_frontend_t*)obj;
+ active = (int *)mpegts_input_class_active_get(obj);
+ if (!(*active) && lfe->lfe_adapter->la_exclusive)
+ *active = lfe->lfe_adapter->la_is_enabled(lfe->lfe_adapter);
+ return active;
+}
+
CLASS_DOC(linuxdvb_frontend)
CLASS_DOC(linuxdvb_frontend_dvbs)
CLASS_DOC(linuxdvb_frontend_dvbt)
.ic_doc = tvh_doc_linuxdvb_frontend_class,
.ic_changed = linuxdvb_frontend_class_changed,
.ic_properties = (const property_t[]) {
+ {
+ .type = PT_BOOL,
+ .id = "active",
+ .name = N_("Active"),
+ .opts = PO_RDONLY | PO_NOSAVE | PO_NOUI,
+ .get = linuxdvb_frontend_class_active_get,
+ },
{
.type = PT_STR,
.id = "fe_path",
if (lfe->lfe_fe_path == NULL)
return MI_IS_ENABLED_NEVER;
- if (!mpegts_input_is_enabled(mi, mm, flags, weight))
- return MI_IS_ENABLED_NEVER;
+ w = mpegts_input_is_enabled(mi, mm, flags, weight);
+ if (w != MI_IS_ENABLED_OK)
+ return w;
if (access(lfe->lfe_fe_path, R_OK | W_OK))
return MI_IS_ENABLED_NEVER;
+ if (mm == NULL)
+ return MI_IS_ENABLED_OK;
if (lfe->lfe_in_setup)
return MI_IS_ENABLED_RETRY;
if (lfe->lfe_type != DVB_TYPE_S)
.ic_class = "linuxdvb_lnb_basic",
.ic_caption = N_("LNB"),
.ic_get_title = linuxdvb_lnb_class_get_title,
+ .ic_properties = (const property_t[]) {
+ {
+ .type = PT_INT,
+ .id = "lfo",
+ .name = N_("Low frequency offset"),
+ .opts = PO_RDONLY | PO_NOSAVE,
+ .off = offsetof(linuxdvb_lnb_conf_t, lnb_low),
+ },
+ {
+ .type = PT_INT,
+ .id = "hfo",
+ .name = N_("High frequency offset"),
+ .opts = PO_RDONLY | PO_NOSAVE,
+ .off = offsetof(linuxdvb_lnb_conf_t, lnb_high),
+ },
+ {
+ .type = PT_INT,
+ .id = "sfo",
+ .name = N_("Switch frequency offset"),
+ .opts = PO_RDONLY | PO_NOSAVE,
+ .off = offsetof(linuxdvb_lnb_conf_t, lnb_switch),
+ },
+ {}
+ }
};
/* **************************************************************************
* Static list
* *************************************************************************/
-struct linuxdvb_lnb_conf linuxdvb_lnb_all[] = {
+linuxdvb_lnb_conf_t linuxdvb_lnb_all[] = {
{
{ {
.ld_type = "Universal",
linuxdvb_lnb_create0
( const char *name, htsmsg_t *conf, linuxdvb_satconf_ele_t *ls )
{
+ linuxdvb_lnb_conf_t *lsc = &linuxdvb_lnb_all[0], *lsc2;
int i;
- /* Setup static entries */
- for (i = 0; i < ARRAY_SIZE(linuxdvb_lnb_all); i++)
- if (!linuxdvb_lnb_all[i].ld_id.in_class)
- idnode_insert(&linuxdvb_lnb_all[i].ld_id, NULL, &linuxdvb_lnb_class, 0);
-
/* Find */
if (name) {
- for (i = 0; i < ARRAY_SIZE(linuxdvb_lnb_all); i++) {
- if (!strcmp(linuxdvb_lnb_all[i].ld_type, name))
- return (linuxdvb_lnb_t*)&linuxdvb_lnb_all[i];
- }
+ for (i = 0; i < ARRAY_SIZE(linuxdvb_lnb_all); i++)
+ if (!strcmp(linuxdvb_lnb_all[i].ld_type, name)) {
+ lsc = &linuxdvb_lnb_all[i];
+ break;
+ }
}
- return (linuxdvb_lnb_t*)linuxdvb_lnb_all; // Universal
+
+ lsc2 = malloc(sizeof(linuxdvb_lnb_conf_t));
+ *lsc2 = *lsc;
+ return linuxdvb_diseqc_create0(lsc2, NULL, &linuxdvb_lnb_class, conf, lsc->ld_type, ls);
}
void
-linuxdvb_lnb_destroy ( linuxdvb_lnb_t *lnb )
+linuxdvb_lnb_destroy ( linuxdvb_diseqc_t *ld )
{
+ linuxdvb_diseqc_destroy(ld);
+ free(ld);
}
/******************************************************************************
int linuxdvb_adapter_current_weight ( linuxdvb_adapter_t *la );
+const void *linuxdvb_frontend_class_active_get ( void *obj );
+
linuxdvb_frontend_t *
linuxdvb_frontend_create
( htsmsg_t *conf, linuxdvb_adapter_t *la, int number,
linuxdvb_diseqc_t *linuxdvb_en50494_create0
( const char *name, htsmsg_t *conf, linuxdvb_satconf_ele_t *ls, int port );
-void linuxdvb_lnb_destroy ( linuxdvb_lnb_t *lnb );
+void linuxdvb_lnb_destroy ( linuxdvb_diseqc_t *ld );
void linuxdvb_switch_destroy ( linuxdvb_diseqc_t *ld );
void linuxdvb_rotor_destroy ( linuxdvb_diseqc_t *ld );
void linuxdvb_en50494_destroy ( linuxdvb_diseqc_t *ld );
void linuxdvb_en50494_init (void);
-int linuxdvb_diseqc_raw_send (int fd, uint8_t len, ...);
+int linuxdvb_diseqc_raw_send (int fd, int len, ...);
int
linuxdvb_diseqc_send
- (int fd, uint8_t framing, uint8_t addr, uint8_t cmd, uint8_t len, ...);
+ (int fd, uint8_t framing, uint8_t addr, uint8_t cmd, int len, ...);
int linuxdvb_diseqc_set_volt ( linuxdvb_satconf_t *ls, int volt );
/*
linuxdvb_satconf_type_find ( const char *type );
struct linuxdvb_satconf_type {
+ int enable;
int ports;
const char *type;
const char *name;
* Types
* *************************************************************************/
+static const void *
+linuxdvb_satconf_class_active_get ( void *obj )
+{
+ static int active;
+ linuxdvb_satconf_t *ls = obj;
+ linuxdvb_satconf_ele_t *lse;
+ active = 0;
+ if (linuxdvb_frontend_class_active_get(ls->ls_frontend)) {
+ TAILQ_FOREACH(lse, &ls->ls_elements, lse_link) {
+ if (lse->lse_enabled) {
+ active = 1;
+ break;
+ }
+ }
+ }
+ return &active;
+}
+
static linuxdvb_satconf_ele_t *
linuxdvb_satconf_class_find_ele( linuxdvb_satconf_t *ls, int idx )
{
.ic_doc = tvh_doc_linuxdvb_satconf_class,
.ic_changed = linuxdvb_satconf_class_changed,
.ic_properties = (const property_t[]) {
+ {
+ .type = PT_BOOL,
+ .id = "active",
+ .name = N_("Active"),
+ .opts = PO_RDONLY | PO_NOSAVE | PO_NOUI,
+ .get = linuxdvb_satconf_class_active_get,
+ },
{
.type = PT_BOOL,
.id = "early_tune",
/* Types/classes */
static struct linuxdvb_satconf_type linuxdvb_satconf_types[] = {
{
- .type = "simple",
- .name = N_("Universal LNB only"),
- .idc = &linuxdvb_satconf_lnbonly_class,
- .ports = 1,
+ .type = "simple",
+ .name = N_("Universal LNB only"),
+ .idc = &linuxdvb_satconf_lnbonly_class,
+ .ports = 1,
+ .enable = 1,
},
{
- .type = "2port",
- .name = N_("2-Port switch (universal LNB)"),
- .idc = &linuxdvb_satconf_2port_class,
- .ports = 2,
+ .type = "2port",
+ .name = N_("2-Port switch (universal LNB)"),
+ .idc = &linuxdvb_satconf_2port_class,
+ .ports = 2,
+ .enable = 1,
},
{
- .type = "4port",
- .name = N_("4-Port switch (universal LNB)"),
- .idc = &linuxdvb_satconf_4port_class,
- .ports = 4,
+ .type = "4port",
+ .name = N_("4-Port switch (universal LNB)"),
+ .idc = &linuxdvb_satconf_4port_class,
+ .ports = 4,
+ .enable = 1,
},
{
- .type = "en50494",
- .name = N_("Unicable I switch (universal LNB)"),
- .idc = &linuxdvb_satconf_en50494_class,
- .ports = 2,
+ .type = "en50494",
+ .name = N_("Unicable I switch (universal LNB)"),
+ .idc = &linuxdvb_satconf_en50494_class,
+ .ports = 2,
+ .enable = 1,
},
{
- .type = "en50607",
- .name = N_("Unicable II switch (universal LNB)"),
- .idc = &linuxdvb_satconf_en50607_class,
- .ports = 4,
+ .type = "en50607",
+ .name = N_("Unicable II switch (universal LNB)"),
+ .idc = &linuxdvb_satconf_en50607_class,
+ .ports = 4,
+ .enable = 1,
},
{
- .type = "advanced",
- .name = N_("Advanced (non-universal LNBs, rotors, etc.)"),
- .idc = &linuxdvb_satconf_advanced_class,
- .ports = 0,
+ .type = "advanced",
+ .name = N_("Advanced (non-universal LNBs, rotors, etc.)"),
+ .idc = &linuxdvb_satconf_advanced_class,
+ .ports = 0,
+ .enable = 0,
},
};
htsmsg_add_str(l, NULL, str);
htsmsg_add_msg(e, "networks", l);
}
- (void)linuxdvb_satconf_ele_create0(htsmsg_get_str(e, "uuid"), e, ls);
+ lse = linuxdvb_satconf_ele_create0(htsmsg_get_str(e, "uuid"), e, ls);
+ if (lst->enable)
+ lse->lse_enabled = 1;
}
}
}
/* Create elements */
- i = 0;
lse = TAILQ_FIRST(&ls->ls_elements);
- while (i < lst->ports) {
+ for (i = 0; i < lst->ports; i++) {
if (!lse)
lse = linuxdvb_satconf_ele_create0(NULL, NULL, ls);
+ if (lst->enable)
+ lse->lse_enabled = 1;
if (!lse->lse_lnb)
lse->lse_lnb = linuxdvb_lnb_create0(NULL, NULL, lse);
if (lst->ports > 1) {
}
}
lse = TAILQ_NEXT(lse, lse_link);
- i++;
}
return ls;
linuxdvb_satconf_t *sc = ls->lse_parent;
linuxdvb_satconf_ele_t *lse;
TAILQ_FOREACH(lse, &sc->ls_elements, lse_link) {
- for (i = 0; i < lse->lse_networks->is_count; i++)
+ for (i = 0; i < lse->lse_networks->is_count; i++) {
+ if (!lse->lse_enabled) continue;
htsmsg_add_str(l, NULL,
idnode_uuid_as_str(lse->lse_networks->is_array[i], ubuf));
+ }
}
mpegts_input_class_network_set(ls->lse_parent->ls_frontend, l);
htsmsg_destroy(l);
linuxdvb_satconf_class_changed(&lse->lse_parent->ls_id);
}
+static const void *
+linuxdvb_satconf_ele_class_active_get ( void *obj )
+{
+ static int active;
+ linuxdvb_satconf_ele_t *lse = obj;
+ active = 0;
+ if (*(int *)linuxdvb_frontend_class_active_get(lse->lse_parent->ls_frontend))
+ active = lse->lse_enabled;
+ return &active;
+}
+
const idclass_t linuxdvb_satconf_ele_class =
{
.ic_class = "linuxdvb_satconf_ele",
.ic_get_childs = linuxdvb_satconf_ele_class_get_childs,
.ic_changed = linuxdvb_satconf_ele_class_changed,
.ic_properties = (const property_t[]) {
+ {
+ .type = PT_BOOL,
+ .id = "active",
+ .name = N_("Active"),
+ .opts = PO_RDONLY | PO_NOSAVE | PO_NOUI,
+ .get = linuxdvb_satconf_ele_class_active_get,
+ },
{
.type = PT_BOOL,
.id = "enabled",
linuxdvb_satconf_ele_class_changed(&ld->ld_satconf->lse_id);
}
+static const void *
+linuxdvb_diseqc_class_active_get ( void *obj )
+{
+ static int active;
+ linuxdvb_diseqc_t *ld = obj;
+ if (ld->ld_satconf)
+ return linuxdvb_satconf_ele_class_active_get(ld->ld_satconf);
+ active = 1;
+ return &active;
+}
+
const idclass_t linuxdvb_diseqc_class =
{
.ic_class = "linuxdvb_diseqc",
.ic_event = "linuxdvb_diseqc",
.ic_get_title = linuxdvb_diseqc_class_get_title,
.ic_changed = linuxdvb_diseqc_class_changed,
+ .ic_properties = (const property_t[]) {
+ {
+ .type = PT_BOOL,
+ .id = "active",
+ .name = N_("Active"),
+ .opts = PO_RDONLY | PO_NOSAVE | PO_NOUI,
+ .get = linuxdvb_diseqc_class_active_get,
+ },
+ {}
+ }
};
linuxdvb_diseqc_t *
int
linuxdvb_diseqc_raw_send
- (int fd, uint8_t len, ...)
+ (int fd, int len, ...)
{
int i;
va_list ap;
int
linuxdvb_diseqc_send
- (int fd, uint8_t framing, uint8_t addr, uint8_t cmd, uint8_t len, ...)
+ (int fd, uint8_t framing, uint8_t addr, uint8_t cmd, int len, ...)
{
int i;
va_list ap;
return buf;
}
+const void *
+mpegts_input_class_active_get ( void *obj )
+{
+ static int active;
+ mpegts_input_t *mi = obj;
+ active = mi->mi_is_enabled((mpegts_input_t*)mi, NULL, 0, -1) != MI_IS_ENABLED_NEVER;
+ return &active;
+}
+
const void *
mpegts_input_class_network_get ( void *obj )
{
.ic_perm_def = ACCESS_ADMIN,
.ic_get_title = mpegts_input_class_get_title,
.ic_properties = (const property_t[]){
+ {
+ .type = PT_BOOL,
+ .id = "active",
+ .name = N_("Active"),
+ .opts = PO_RDONLY | PO_NOSAVE | PO_NOUI,
+ .get = mpegts_input_class_active_get,
+ },
{
.type = PT_BOOL,
.id = "enabled",
return m;
}
+static const void *
+satip_device_class_active_get ( void * obj )
+{
+ static int active;
+ satip_device_t *sd = (satip_device_t *)obj;
+ satip_frontend_t *lfe;
+ active = 0;
+ TAILQ_FOREACH(lfe, &sd->sd_frontends, sf_link)
+ if (*(int *)mpegts_input_class_active_get(lfe)) {
+ active = 1;
+ break;
+ }
+ return &active;
+}
+
static idnode_set_t *
satip_device_class_get_childs ( idnode_t *in )
{
.ic_get_childs = satip_device_class_get_childs,
.ic_get_title = satip_device_class_get_title,
.ic_properties = (const property_t[]){
+ {
+ .type = PT_BOOL,
+ .id = "active",
+ .name = N_("Active"),
+ .opts = PO_RDONLY | PO_NOSAVE | PO_NOUI,
+ .get = satip_device_class_active_get,
+ },
{
.type = PT_STR,
.id = "tunercfgu",
satip_frontend_t *lfe = (satip_frontend_t*)mi;
satip_frontend_t *lfe2;
satip_satconf_t *sfc;
+ int r;
lock_assert(&global_lock);
- if (!mpegts_input_is_enabled(mi, mm, flags, weight))
- return MI_IS_ENABLED_NEVER;
+ r = mpegts_input_is_enabled(mi, mm, flags, weight);
+ if (r != MI_IS_ENABLED_OK)
+ return r;
if (lfe->sf_device->sd_dbus_allow <= 0)
return MI_IS_ENABLED_NEVER;
+ if (mm == NULL)
+ return MI_IS_ENABLED_OK;
if (lfe->sf_type != DVB_TYPE_S)
return MI_IS_ENABLED_OK;
/* check if the position is enabled */
* Frontend callbacks
* *************************************************************************/
+static const void *
+satip_satconf_class_active_get ( void *obj )
+{
+ static int active;
+ satip_satconf_t *sfc = obj;
+ active = 0;
+ if (*(int *)mpegts_input_class_active_get(sfc->sfc_lfe))
+ active = sfc->sfc_enabled;
+ return &active;
+}
+
static satip_satconf_t *
satip_satconf_find_ele( satip_frontend_t *lfe, mpegts_mux_t *mux )
{
.ic_get_title = satip_satconf_class_get_title,
.ic_changed = satip_satconf_class_changed,
.ic_properties = (const property_t[]) {
+ {
+ .type = PT_BOOL,
+ .id = "active",
+ .name = N_("Active"),
+ .opts = PO_RDONLY | PO_NOSAVE | PO_NOUI,
+ .get = satip_satconf_class_active_get,
+ },
{
.type = PT_BOOL,
.id = "enabled",
return prop_sbuf;
}
+static const void *
+tvhdhomerun_device_class_active_get ( void * obj )
+{
+ static int active;
+ tvhdhomerun_device_t *hd = (tvhdhomerun_device_t *)obj;
+ tvhdhomerun_frontend_t *lfe;
+ active = 0;
+ TAILQ_FOREACH(lfe, &hd->hd_frontends, hf_link)
+ if (*(int *)mpegts_input_class_active_get(lfe)) {
+ active = 1;
+ break;
+ }
+ return &active;
+}
+
static htsmsg_t *
tvhdhomerun_device_class_override_enum( void * p, const char *lang )
{
.ic_get_childs = tvhdhomerun_device_class_get_childs,
.ic_get_title = tvhdhomerun_device_class_get_title,
.ic_properties = (const property_t[]){
+ {
+ .type = PT_BOOL,
+ .id = "active",
+ .name = N_("Active"),
+ .opts = PO_RDONLY | PO_NOSAVE | PO_NOUI,
+ .get = tvhdhomerun_device_class_active_get,
+ },
{
.type = PT_STR,
.id = "networkType",
var p = n.attributes.params;
if (!p) return;
for (var i = 0; i < p.length; i++)
- if (p[i].id == "enabled" && p[i].value) {
+ if (p[i].id == "active" && p[i].value) {
n.ui.addClass('x-tree-node-on');
break;
}