bouquet: do not map disabled services, fixes #2525

This commit is contained in:
Jaroslav Kysela 2014-12-04 13:53:43 +01:00
parent 64eec14399
commit 4fcc326b98
3 changed files with 30 additions and 0 deletions

View 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);
}
}
/*
*
*/

View 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); }

View 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,