Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
bouquet: do not map disabled services, fixes #2525
  • Loading branch information
perexg committed Dec 4, 2014
1 parent 64eec14 commit 4fcc326
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/bouquet.c
Expand Up @@ -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 &&
Expand Down Expand Up @@ -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);
}
}

/*
*
*/
Expand Down
2 changes: 2 additions & 0 deletions src/bouquet.h
Expand Up @@ -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); }
Expand Down
7 changes: 7 additions & 0 deletions src/service.c
Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 4fcc326

Please sign in to comment.