int mms_weight;
};
+enum mpegts_input_is_enabled {
+ MI_IS_ENABLED_RETRY = -1,
+ MI_IS_ENABLED_NEVER = 0,
+ MI_IS_ENABLED_OK = 1,
+};
+
/* Input source */
struct mpegts_input
{
iptv_input_is_enabled
( mpegts_input_t *mi, mpegts_mux_t *mm, int flags, int weight )
{
- if (!mpegts_input_is_enabled(mi, mm, flags, weight)) return 0;
- return iptv_input_is_free(mi, mm, 0, weight, NULL) == NULL ? 1 : -1;
+ if (mpegts_input_is_enabled(mi, mm, flags, weight) == MI_IS_ENABLED_NEVER)
+ return MI_IS_ENABLED_NEVER;
+ return iptv_input_is_free(mi, mm, 0, weight, NULL) == NULL ?
+ MI_IS_ENABLED_OK : MI_IS_ENABLED_RETRY;
}
static int
{
linuxdvb_frontend_t *lfe;
LIST_FOREACH(lfe, &la->la_frontends, lfe_link) {
- if (lfe->mi_is_enabled((mpegts_input_t*)lfe, NULL, 0, -1))
+ if (lfe->mi_is_enabled((mpegts_input_t*)lfe, NULL, 0, -1) != MI_IS_ENABLED_NEVER)
return 1;
}
return 0;
tvh_hardware_t *th;
char ubuf[UUID_HEX_SIZE];
- if (lfe->lfe_fe_path == NULL) return 0;
- if (!mpegts_input_is_enabled(mi, mm, flags, weight)) return 0;
- if (access(lfe->lfe_fe_path, R_OK | W_OK)) return 0;
- if (lfe->lfe_in_setup) return 0;
- if (lfe->lfe_type != DVB_TYPE_S) return 1;
+ if (lfe->lfe_fe_path == NULL)
+ return MI_IS_ENABLED_NEVER;
+ if (!mpegts_input_is_enabled(mi, mm, flags, weight))
+ return MI_IS_ENABLED_NEVER;
+ if (access(lfe->lfe_fe_path, R_OK | W_OK))
+ return MI_IS_ENABLED_NEVER;
+ if (lfe->lfe_in_setup)
+ return MI_IS_ENABLED_RETRY;
+ if (lfe->lfe_type != DVB_TYPE_S)
+ return MI_IS_ENABLED_OK;
/* check if any "blocking" tuner is running */
LIST_FOREACH(th, &tvh_hardware, th_link) {
if (lfe2->lfe_type != DVB_TYPE_S) continue;
if (lfe->lfe_master && !strcmp(lfe->lfe_master, idnode_uuid_as_str(&lfe2->ti_id, ubuf))) {
if (lfe2->lfe_satconf == NULL)
- return 0; /* invalid master */
+ return MI_IS_ENABLED_NEVER; /* invalid master */
if (lfe2->lfe_refcount <= 0)
- return 0; /* prefer master */
- return linuxdvb_satconf_match_mux(lfe2->lfe_satconf, mm);
+ return MI_IS_ENABLED_RETRY; /* prefer master */
+ return linuxdvb_satconf_match_mux(lfe2->lfe_satconf, mm) ?
+ MI_IS_ENABLED_OK : MI_IS_ENABLED_RETRY;
}
if (lfe2->lfe_master &&
!strcmp(lfe2->lfe_master, idnode_uuid_as_str(&lfe->ti_id, ubuf)) &&
lfe2->lfe_refcount > 0) {
if (lfe->lfe_satconf == NULL)
- return 0;
- return linuxdvb_satconf_match_mux(lfe->lfe_satconf, mm);
+ return MI_IS_ENABLED_NEVER;
+ return linuxdvb_satconf_match_mux(lfe->lfe_satconf, mm) ?
+ MI_IS_ENABLED_OK : MI_IS_ENABLED_RETRY;
}
}
}
- return 1;
+ return MI_IS_ENABLED_OK;
}
static void
( mpegts_input_t *mi, mpegts_mux_t *mm, int flags, int weight )
{
if ((flags & SUBSCRIPTION_EPG) != 0 && !mi->mi_ota_epg)
- return 0;
+ return MI_IS_ENABLED_NEVER;
if ((flags & SUBSCRIPTION_INITSCAN) != 0 && !mi->mi_initscan)
- return 0;
+ return MI_IS_ENABLED_NEVER;
if ((flags & SUBSCRIPTION_IDLESCAN) != 0 && !mi->mi_idlescan)
- return 0;
- return mi->mi_enabled;
+ return MI_IS_ENABLED_NEVER;
+ return mi->mi_enabled ? MI_IS_ENABLED_OK : MI_IS_ENABLED_NEVER;
}
void
mpegts_network_link_t *mnl;
LIST_FOREACH(mnl, &mm->mm_network->mn_inputs, mnl_mn_link) {
mpegts_input_t *mi = mnl->mnl_input;
- if (mi->mi_is_enabled(mi, mm, 0, -1))
+ if (mi->mi_is_enabled(mi, mm, 0, -1) != MI_IS_ENABLED_NEVER)
mi->mi_create_mux_instance(mi, mm);
}
}
continue;
r = mi->mi_is_enabled(mi, mmi->mmi_mux, flags, weight);
- if (!r)
+ if (r == MI_IS_ENABLED_NEVER)
continue;
- if (r < 0) {
+ if (r == MI_IS_ENABLED_RETRY) {
/* temporary error - retry later */
errcnt++;
continue;
lock_assert(&global_lock);
- if (!mpegts_input_is_enabled(mi, mm, flags, weight)) return 0;
- if (lfe->sf_device->sd_dbus_allow <= 0) return 0;
- if (lfe->sf_type != DVB_TYPE_S) return 1;
+ if (!mpegts_input_is_enabled(mi, mm, flags, weight))
+ return MI_IS_EMABLED_NEVER;
+ if (lfe->sf_device->sd_dbus_allow <= 0)
+ return MI_IS_ENABLED_NEVER;
+ if (lfe->sf_type != DVB_TYPE_S)
+ return MI_IS_ENABLED_OK;
/* check if the position is enabled */
sfc = satip_satconf_get_position(lfe, mm, NULL, 1, flags, weight);
- if (!sfc)
- return 0;
+ if (!sfc) return MI_IS_ENABLED_NEVER;
/* check if any "blocking" tuner is running */
TAILQ_FOREACH(lfe2, &lfe->sf_device->sd_frontends, sf_link) {
if (lfe2 == lfe) continue;
if (lfe2->sf_type != DVB_TYPE_S) continue;
if (lfe->sf_master == lfe2->sf_number) {
if (!lfe2->sf_running)
- return 0; /* master must be running */
- return satip_frontend_match_satcfg(lfe2, mm, flags, weight);
+ return MI_IS_ENABLED_RETRY; /* master must be running */
+ return satip_frontend_match_satcfg(lfe2, mm, flags, weight) ?
+ MI_IS_ENABLED_OK : MI_IS_ENABLED_RETRY;
}
if (lfe2->sf_master == lfe->sf_number) {
if (lfe2->sf_running)
- return satip_frontend_match_satcfg(lfe2, mm, flags, weight);
+ return satip_frontend_match_satcfg(lfe2, mm, flags, weight) ?
+ MI_IS_ENABLED_OK : MI_IS_ENABLED_RETRY;
}
}
- return 1;
+ return MI_IS_ENABLED_OK;
}
static void