]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
bouquet: do not map disabled services, fixes #2525
authorJaroslav Kysela <perex@perex.cz>
Thu, 4 Dec 2014 12:53:43 +0000 (13:53 +0100)
committerJaroslav Kysela <perex@perex.cz>
Thu, 4 Dec 2014 13:11:23 +0000 (14:11 +0100)
src/bouquet.c
src/bouquet.h
src/service.c

index 872008470fe5157474336e24c020763e9fac7904..2ff6157acd540548eb86b9bf736410158bdef548 100644 (file)
@@ -225,6 +225,8 @@ bouquet_map_channel(bouquet_t *bq, service_t *t)
   channel_t *ch = NULL;
   channel_service_mapping_t *csm;
 
+  if (!t->s_enabled)
+    return;
   if (!bq->bq_mapradio && service_is_radio(t))
     return;
   if (!bq->bq_mapnolcn &&
@@ -319,6 +321,25 @@ bouquet_unmap_channel(bouquet_t *bq, service_t *t)
   }
 }
 
+/**
+ *
+ */
+void
+bouquet_notify_service_enabled(service_t *t)
+{
+  bouquet_t *bq;
+
+  lock_assert(&global_lock);
+
+  RB_FOREACH(bq, &bouquets, bq_link)
+    if (idnode_set_exists(bq->bq_services, &t->s_id)) {
+      if (!t->s_enabled)
+        bouquet_unmap_channel(bq, t);
+      else if (bq->bq_enabled && bq->bq_maptoch)
+        bouquet_map_channel(bq, t);
+    }
+}
+
 /*
  *
  */
index 5c1713b943e238e36d185fe81a6e2573ae011f48..3c5b98c49f988975151b58de1ca7434d3382d03a 100644 (file)
@@ -73,6 +73,8 @@ bouquet_t * bouquet_create(const char *uuid, htsmsg_t *conf,
 void bouquet_destroy_by_service(service_t *t);
 void bouquet_destroy_by_channel_tag(channel_tag_t *ct);
 
+void bouquet_notify_service_enabled(service_t *t);
+
 static inline bouquet_t *
 bouquet_find_by_uuid(const char *uuid)
   { return (bouquet_t *)idnode_find(uuid, &bouquet_class, NULL); }
index 3d61043b53d1f8e3593059d8af45760c3fc14697..12e57815a6c408f9e6b98b309929b41ce37f52f1 100644 (file)
@@ -54,6 +54,12 @@ static void service_class_save(struct idnode *self);
 
 struct service_queue service_all;
 
+static void
+service_class_notify_enabled ( void *obj )
+{
+  bouquet_notify_service_enabled((service_t *)obj);
+}
+
 static const void *
 service_class_channel_get ( void *obj )
 {
@@ -182,6 +188,7 @@ const idclass_t service_class = {
       .id       = "enabled",
       .name     = "Enabled",
       .off      = offsetof(service_t, s_enabled),
+      .notify   = service_class_notify_enabled,
     },
     {
       .type     = PT_STR,