epg: do not subscribe to muxes without any active (assigned) channels

This commit is contained in:
Jaroslav Kysela 2014-06-27 23:40:40 +02:00
parent 9e69054a04
commit fd0d9931dd
3 changed files with 19 additions and 3 deletions

View file

@ -124,9 +124,8 @@ epggrab_ota_done ( epggrab_ota_mux_t *ota, int timeout )
epggrab_ota_pending_timer_cb(NULL);
/* Remove from active */
if (!timeout) {
if (!timeout)
epggrab_ota_active_timer_cb(NULL);
}
}
static void
@ -339,7 +338,8 @@ next_one:
}
/* Subscribe to the mux */
if (mpegts_mux_subscribe(mm, "epggrab", SUBSCRIPTION_PRIO_EPG)) {
if (mm->mm_is_epg(mm) <= 0 ||
mpegts_mux_subscribe(mm, "epggrab", SUBSCRIPTION_PRIO_EPG)) {
om->om_active = 0;
om->om_when = dispatch_clock + epggrab_ota_period(om, 4) + extra;
LIST_INSERT_SORTED(&epggrab_ota_pending, om, om_q_link, om_time_cmp);

View file

@ -377,6 +377,7 @@ struct mpegts_mux
void (*mm_open_table) (mpegts_mux_t*,mpegts_table_t*,int subscribe);
void (*mm_close_table) (mpegts_mux_t*,mpegts_table_t*);
void (*mm_create_instances) (mpegts_mux_t*);
int (*mm_is_epg) (mpegts_mux_t*);
/*
* Configuration

View file

@ -439,6 +439,20 @@ mpegts_mux_is_enabled ( mpegts_mux_t *mm )
return mm->mm_enabled;
}
static int
mpegts_mux_is_epg ( mpegts_mux_t *mm )
{
mpegts_service_t *s;
lock_assert(&global_lock);
LIST_FOREACH(s, &mm->mm_services, s_dvb_mux_link)
if (LIST_FIRST(&s->s_channels))
break;
return s ? 1 : 0;
}
static void
mpegts_mux_create_instances ( mpegts_mux_t *mm )
{
@ -833,6 +847,7 @@ mpegts_mux_create0
mm->mm_display_name = mpegts_mux_display_name;
mm->mm_config_save = mpegts_mux_config_save;
mm->mm_is_enabled = mpegts_mux_is_enabled;
mm->mm_is_epg = mpegts_mux_is_epg;
/* Start/stop */
mm->mm_start = mpegts_mux_start;