]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
input tree: fix the active node presentation, fixes #4346
authorJaroslav Kysela <perex@perex.cz>
Tue, 9 May 2017 12:20:07 +0000 (14:20 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 12 May 2017 19:44:46 +0000 (21:44 +0200)
13 files changed:
src/input/mpegts.h
src/input/mpegts/linuxdvb/linuxdvb_adapter.c
src/input/mpegts/linuxdvb/linuxdvb_ca.c
src/input/mpegts/linuxdvb/linuxdvb_frontend.c
src/input/mpegts/linuxdvb/linuxdvb_lnb.c
src/input/mpegts/linuxdvb/linuxdvb_private.h
src/input/mpegts/linuxdvb/linuxdvb_satconf.c
src/input/mpegts/mpegts_input.c
src/input/mpegts/satip/satip.c
src/input/mpegts/satip/satip_frontend.c
src/input/mpegts/satip/satip_satconf.c
src/input/mpegts/tvhdhomerun/tvhdhomerun.c
src/webui/static/app/tvadapters.js

index bf34bd19bc0da437b3bff206e297630610c042ad..6d0158510af4880153c611a7b7c68e2ad1c04303 100644 (file)
@@ -821,6 +821,7 @@ const void *mpegts_input_class_network_get  ( void *o );
 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);
 
index 14d3564b26b2f40ec2804ef81191755522062e04..deb4ac73eaf2c1536042e7acd29f87c845561ce6 100644 (file)
@@ -104,6 +104,27 @@ linuxdvb_adapter_class_get_title ( idnode_t *in, const char *lang )
   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",
@@ -113,6 +134,13 @@ const idclass_t linuxdvb_adapter_class =
   .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",
index 519dfb3060cded2e4f6e6c4b17c837c75b225693..c2b19ef308223ddd1f6b54d290248d90b74747b3 100644 (file)
@@ -177,6 +177,15 @@ linuxdvb_ca_class_get_title ( idnode_t *in, const char *lang )
   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",
@@ -184,6 +193,13 @@ const idclass_t linuxdvb_ca_class =
   .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",
index c0bea0939af0dfc7f514abdca7581c3551d02a09..c1a02361f13ffb85634b532b14ec4c63b0cec1b1 100644 (file)
@@ -51,6 +51,17 @@ linuxdvb_frontend_class_changed ( idnode_t *in )
   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) 
@@ -64,6 +75,13 @@ const idclass_t linuxdvb_frontend_class =
   .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",
@@ -541,10 +559,13 @@ linuxdvb_frontend_is_enabled
 
   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)
index e376032bf3e2fa9afe3ab592d242896ba391da9a..af7f509265adea637218c303f53d0928c65c1b16 100644 (file)
@@ -60,6 +60,30 @@ const idclass_t linuxdvb_lnb_class =
   .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),
+    },
+    {}
+  }
 };
 
 /* **************************************************************************
@@ -185,7 +209,7 @@ linuxdvb_lnb_bandstack_pol
  * Static list
  * *************************************************************************/
 
-struct linuxdvb_lnb_conf linuxdvb_lnb_all[] = {
+linuxdvb_lnb_conf_t linuxdvb_lnb_all[] = {
   {
     { {
       .ld_type    = "Universal",
@@ -401,26 +425,28 @@ linuxdvb_lnb_t *
 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);
 }
 
 /******************************************************************************
index 3616a88188f620810f3d71c8937cdd0b9f2cc05d..8b96b99512a1ab3b869683c74f5761895a849c5c 100644 (file)
@@ -397,6 +397,8 @@ static inline void linuxdvb_adapter_changed ( linuxdvb_adapter_t *la )
 
 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,
@@ -459,7 +461,7 @@ linuxdvb_diseqc_t *linuxdvb_rotor_create0
 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 );
@@ -480,10 +482,10 @@ static inline int linuxdvb_unicable_is_en50494( const char *str )
 
 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 );
 
 /*
index bcfd4eadfc787ec96dbf00d1fa3ffb3c66004b35..80e79617d101926695daf2402da790054f387103 100644 (file)
@@ -35,6 +35,7 @@ static struct linuxdvb_satconf_type *
 linuxdvb_satconf_type_find ( const char *type );
 
 struct linuxdvb_satconf_type {
+  int enable;
   int ports;
   const char *type;
   const char *name;
@@ -45,6 +46,24 @@ struct linuxdvb_satconf_type {
  * 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 )
 {
@@ -220,6 +239,13 @@ const idclass_t linuxdvb_satconf_class =
   .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",
@@ -722,40 +748,46 @@ const idclass_t linuxdvb_satconf_advanced_class =
 /* 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,
   },
 };
 
@@ -1153,7 +1185,9 @@ linuxdvb_satconf_create
           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;
       }
     }
     
@@ -1162,11 +1196,12 @@ linuxdvb_satconf_create
   }
   
   /* 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) {
@@ -1182,7 +1217,6 @@ linuxdvb_satconf_create
       }
     }
     lse = TAILQ_NEXT(lse, lse_link);
-    i++;
   }
 
   return ls;
@@ -1274,9 +1308,11 @@ linuxdvb_satconf_ele_class_network_set( void *o, const void *p )
     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);
@@ -1416,6 +1452,17 @@ linuxdvb_satconf_ele_class_changed ( idnode_t *in )
   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",
@@ -1426,6 +1473,13 @@ const idclass_t linuxdvb_satconf_ele_class =
   .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",
@@ -1595,6 +1649,17 @@ linuxdvb_diseqc_class_changed ( idnode_t *o )
     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",
@@ -1602,6 +1667,16 @@ const idclass_t linuxdvb_diseqc_class =
   .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 *
@@ -1636,7 +1711,7 @@ linuxdvb_diseqc_destroy ( linuxdvb_diseqc_t *ld )
 
 int
 linuxdvb_diseqc_raw_send
-  (int fd, uint8_t len, ...)
+  (int fd, int len, ...)
 {
   int i;
   va_list ap;
@@ -1667,7 +1742,7 @@ linuxdvb_diseqc_raw_send
 
 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;
index 4c5e738aa25639ec85ea2a257268676b62f158f0..b8178808eba99d33880df1d30127d551c19acc9f 100644 (file)
@@ -75,6 +75,15 @@ mpegts_input_class_get_title ( idnode_t *in, const char *lang )
   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 )
 {
@@ -225,6 +234,13 @@ const idclass_t mpegts_input_class =
   .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",
index 3b56267b73dcd448a6c25d3af0c4c934d4a6ffae..660ef5b4d9b944e2e84bf27d8fa97692038b0311 100644 (file)
@@ -141,6 +141,21 @@ satip_device_class_save ( idnode_t *in, char *filename, size_t fsize )
   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 )
 {
@@ -218,6 +233,13 @@ const idclass_t satip_device_class =
   .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",
index 5efb19dbf7cf560bff24423fddb3f69f349c873e..54bfc3abff12ad0918acf3319a98ee527730ac65 100644 (file)
@@ -521,13 +521,17 @@ satip_frontend_is_enabled
   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 */
index 350bd65df7a9777fda2e62f48ac32daedee33253..14465cd5b988abc164df50e007c9f39339457144 100644 (file)
  * 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 )
 {
@@ -331,6 +342,13 @@ const idclass_t satip_satconf_class =
   .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",
index 0c5aaee34360dde449af8b781f39dbb6a1a73cf5..47740a4a0d4ffabf009be6b6ce6e721ce73b2719 100644 (file)
@@ -92,6 +92,21 @@ tvhdhomerun_device_class_get_title( idnode_t *in, const char *lang )
   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 )
 {
@@ -166,6 +181,13 @@ const idclass_t tvhdhomerun_device_class =
   .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",
index ecb103f3517c572b0b55dcddf5580b1ae8776b82..2077f408c428756528d0e5cb3f6a6d384f539ead 100644 (file)
@@ -11,7 +11,7 @@ tvheadend.tvadapters = function(panel, index) {
             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;
                 }