mpegts input: add OTA EPG checkbox per input device

This commit is contained in:
Jaroslav Kysela 2014-07-03 18:41:55 +02:00
parent 98350cac5d
commit 3812a8ec67
9 changed files with 33 additions and 11 deletions

View file

@ -19,6 +19,9 @@
<dt>Name</dt>
<dd>The name of this tuner.</dd>
<dt>OTA EPG</dt>
<dd>Allow OTA EPG (epggrab) scan on this input device</dd>
<dt>Priority</dt>
<dd>The tuner priority value (higher value = higher priority to use this
tuner).</dd>

View file

@ -511,6 +511,8 @@ struct mpegts_input
int mi_priority;
int mi_ota_epg;
LIST_ENTRY(mpegts_input) mi_global_link;
mpegts_network_link_list_t mi_networks;
@ -554,7 +556,7 @@ struct mpegts_input
/*
* Functions
*/
int (*mi_is_enabled) (mpegts_input_t*, mpegts_mux_t *mm);
int (*mi_is_enabled) (mpegts_input_t*, mpegts_mux_t *mm, const char *reason);
void (*mi_enabled_updated)(mpegts_input_t*);
void (*mi_display_name) (mpegts_input_t*, char *buf, size_t len);
int (*mi_is_free) (mpegts_input_t*);
@ -624,6 +626,8 @@ void mpegts_input_status_timer ( void *p );
int mpegts_input_grace ( mpegts_input_t * mi, mpegts_mux_t * mm );
int mpegts_input_is_enabled ( mpegts_input_t * mi, mpegts_mux_t *mm, const char *reason );
/* TODO: exposing these class methods here is a bit of a hack */
const void *mpegts_input_class_network_get ( void *o );
int mpegts_input_class_network_set ( void *o, const void *p );

View file

@ -119,7 +119,7 @@ linuxdvb_adapter_is_enabled ( linuxdvb_adapter_t *la )
{
linuxdvb_frontend_t *lfe;
LIST_FOREACH(lfe, &la->la_frontends, lfe_link) {
if (lfe->mi_is_enabled((mpegts_input_t*)lfe, NULL))
if (lfe->mi_is_enabled((mpegts_input_t*)lfe, NULL, "adapter"))
return 1;
}
return 0;

View file

@ -254,11 +254,12 @@ linuxdvb_frontend_get_grace ( mpegts_input_t *mi, mpegts_mux_t *mm )
}
static int
linuxdvb_frontend_is_enabled ( mpegts_input_t *mi, mpegts_mux_t *mm )
linuxdvb_frontend_is_enabled ( mpegts_input_t *mi, mpegts_mux_t *mm,
const char *reason )
{
linuxdvb_frontend_t *lfe = (linuxdvb_frontend_t*)mi;
if (lfe->lfe_fe_path == NULL) return 0;
if (!lfe->mi_enabled) return 0;
if (!mpegts_input_is_enabled(mi, mm, reason)) return 0;
if (access(lfe->lfe_fe_path, R_OK | W_OK)) return 0;
return 1;
}

View file

@ -143,6 +143,13 @@ const idclass_t mpegts_input_class =
.off = offsetof(mpegts_input_t, mi_name),
.notify = idnode_notify_title_changed,
},
{
.type = PT_BOOL,
.id = "ota_epg",
.name = "Over-the-air EPG",
.off = offsetof(mpegts_input_t, mi_ota_epg),
.def.i = 1,
},
{
.type = PT_STR,
.id = "networks",
@ -161,9 +168,12 @@ const idclass_t mpegts_input_class =
* Class methods
* *************************************************************************/
static int
mpegts_input_is_enabled ( mpegts_input_t *mi, mpegts_mux_t *mm )
int
mpegts_input_is_enabled ( mpegts_input_t *mi, mpegts_mux_t *mm,
const char *reason )
{
if (!strcmp(reason, "epggrab") && !mi->mi_ota_epg)
return 0;
return mi->mi_enabled;
}
@ -958,6 +968,9 @@ mpegts_input_create0
pthread_cond_init(&mi->mi_table_cond, NULL);
TAILQ_INIT(&mi->mi_table_queue);
/* Defaults */
mi->mi_ota_epg = 1;
/* Add to global list */
LIST_INSERT_HEAD(&mpegts_input_all, mi, mi_global_link);

View file

@ -532,7 +532,7 @@ mpegts_mux_start
/* Calculate priority+weight and sort */
count = 0;
LIST_FOREACH(mmi, &mm->mm_instances, mmi_mux_link) {
int e = mmi->mmi_input->mi_is_enabled(mmi->mmi_input, mm);
int e = mmi->mmi_input->mi_is_enabled(mmi->mmi_input, mm, reason);
tvhtrace("mpegts", "%s - mmi %p enabled %d", buf, mmi, e);
if (!e) continue;
enabled = 1;

View file

@ -598,7 +598,7 @@ dvb_mux_create_instances ( mpegts_mux_t *mm )
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))
if (mi->mi_is_enabled(mi, mm, "service"))
mi->mi_create_mux_instance(mi, mm);
}
}

View file

@ -189,7 +189,7 @@ mpegts_service_enlist(service_t *t, struct service_instance_list *sil)
if (mmi->mmi_tune_failed)
continue;
if (!mmi->mmi_input->mi_is_enabled(mmi->mmi_input, mmi->mmi_mux)) continue;
if (!mmi->mmi_input->mi_is_enabled(mmi->mmi_input, mmi->mmi_mux, "service")) continue;
/* Set weight to -1 (forced) for already active mux */
if (mmi->mmi_mux->mm_active == mmi) {

View file

@ -361,7 +361,8 @@ satip_frontend_match_satcfg ( satip_frontend_t *lfe2, mpegts_mux_t *mm2 )
}
static int
satip_frontend_is_enabled ( mpegts_input_t *mi, mpegts_mux_t *mm )
satip_frontend_is_enabled ( mpegts_input_t *mi, mpegts_mux_t *mm,
const char *reason )
{
satip_frontend_t *lfe = (satip_frontend_t*)mi;
satip_frontend_t *lfe2;
@ -369,7 +370,7 @@ satip_frontend_is_enabled ( mpegts_input_t *mi, mpegts_mux_t *mm )
lock_assert(&global_lock);
if (!lfe->mi_enabled) return 0;
if (!mpegts_input_is_enabled(mi, mm, reason)) return 0;
if (lfe->sf_type != DVB_TYPE_S) return 1;
/* check if the position is enabled */
position = satip_satconf_get_position(lfe, mm);