]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
idnode prop: tweak to get config to load in the right order.
authorAdam Sutton <dev@adamsutton.me.uk>
Wed, 7 Aug 2013 15:58:28 +0000 (16:58 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Fri, 9 Aug 2013 21:07:45 +0000 (22:07 +0100)
src/idnode.c
src/input/mpegts/linuxdvb/linuxdvb_frontend.c
src/input/mpegts/mpegts_input.c
src/prop.c

index b0b3ab8ae30b10916b5e27e39b045f47e9b95b64..06e7a14a502862c0d547fdca39e8b3f444c4ba85 100644 (file)
@@ -581,17 +581,24 @@ idnode_set_free ( idnode_set_t *is )
  * Write
  * *************************************************************************/
 
+static int
+idnode_class_write_values
+  ( idnode_t *self, const idclass_t *idc, htsmsg_t *c, int optmask )
+{
+  int save = 0;
+  if (idc->ic_super)
+    save |= idnode_class_write_values(self, idc->ic_super, c, optmask);
+  save |= prop_write_values(self, idc->ic_properties, c, optmask, NULL);
+  return save;
+}
+
 int
 idnode_write0 ( idnode_t *self, htsmsg_t *c, int optmask, int dosave )
 {
   int save = 0;
   void (*savefn)(idnode_t*) = NULL;
   const idclass_t *idc = self->in_class;
-  for (; idc; idc = idc->ic_super) {
-    save |= prop_write_values(self, idc->ic_properties, c, optmask, NULL);
-    if (!savefn && idc->ic_save)
-      savefn = idc->ic_save;
-  }
+  save = idnode_class_write_values(self, idc, c, optmask);
   if (save && dosave) {
     if (savefn) savefn(self);
     idnode_notify(self, NULL, 0, 0);
@@ -731,7 +738,6 @@ idnode_notify_event ( idnode_t *in )
     if (ic->ic_event) {
       htsmsg_t *m = htsmsg_create_map();
       htsmsg_add_str(m, "uuid", uuid);
-      printf("event = %s\n", ic->ic_event);
       notify_by_msg(ic->ic_event, m);
     }
     ic = ic->ic_super;
index 1f9917a46b287423435837401072acebb8b5c753..aff553132962bdf8caef35f53395b06ed28f731a 100644 (file)
@@ -869,20 +869,6 @@ linuxdvb_frontend_create0
   if (!conf)
     return lfe;
 
-  /* TODO: this should be done differently */
-  if ((str = htsmsg_get_str(conf, "network"))) {
-    linuxdvb_network_t *ln = linuxdvb_network_find_by_uuid(str);
-    if (ln) {
-      if (ln->ln_type == lfe->lfe_info.type) {
-        mpegts_input_set_network((mpegts_input_t*)lfe, (mpegts_network_t*)ln);
-      } else
-        tvhlog(LOG_WARNING, "linuxdvb",
-               "attempt to add network %s of wrong type %s to %s (%s)",
-               dvb_type2str(ln->ln_type), ln->mn_network_name,
-               lfe->mi_displayname, dvb_type2str(lfe->lfe_info.type));
-    }
-  }
-
   return lfe;
 }
 
index 736a0f8069f019be32119aeba2e84c1f301c8bdb..7caaa37a5b22575a70320c735bc1fbf20604c738 100644 (file)
@@ -370,8 +370,6 @@ mpegts_input_create0
     htsmsg_t *c )
 {
   idnode_insert(&mi->mi_id, uuid, class);
-  if (c)
-    idnode_load(&mi->mi_id, c);
   
   /* Defaults */
   mi->mi_is_enabled           = mpegts_input_is_enabled;
@@ -388,7 +386,7 @@ mpegts_input_create0
   mi->mi_has_subscription     = mpegts_input_has_subscription;
 
   /* Index */
-  mi->mi_instance       = ++mpegts_input_idx;
+  mi->mi_instance             = ++mpegts_input_idx;
 
   /* Init mutex */
   pthread_mutex_init(&mi->mi_delivery_mutex, NULL);
@@ -403,6 +401,10 @@ mpegts_input_create0
   /* Add to global list */
   LIST_INSERT_HEAD(&mpegts_input_all, mi, mi_global_link);
 
+  /* Load config */
+  if (c)
+    idnode_load(&mi->mi_id, c);
+
   return mi;
 }
 
@@ -418,8 +420,9 @@ mpegts_input_set_network ( mpegts_input_t *mi, mpegts_network_t *mn )
   char buf1[256], buf2[265];
   if (mi->mi_network == mn) return;
   *buf1 = *buf2 = 0;
-  if (mi->mi_display_name)
+  if (mi->mi_display_name) {
     mi->mi_display_name(mi, buf1, sizeof(buf1));
+  }
   if (mi->mi_network) {
     mi->mi_network->mn_display_name(mi->mi_network, buf2, sizeof(buf2));
     LIST_REMOVE(mi, mi_network_link);
index 05465249cad1d2690aba4fb3a400db48ddde0569..704849b226283e8c12220e9a40ba06f522ed37a6 100644 (file)
@@ -84,19 +84,13 @@ prop_write_values
 {
   int save, save2 = 0;
   htsmsg_field_t *f;
+  const property_t *p;
 
   if (!pl) return 0;
 
-  HTSMSG_FOREACH(f, m) {
-    if(f->hmf_name == NULL)
-      continue;
-
-    /* Find Property */
-    const property_t *p = prop_find(pl, f->hmf_name);
-    if(p == NULL) {
-      //tvhwarn("prop", "invalid property %s", f->hmf_name);
-      continue;
-    }
+  for (p = pl; p->id; p++) {
+    f = htsmsg_field_find(m, p->id);
+    if (!f) continue;
 
     /* Ignore */
     if(p->opts & optmask) continue;