satip: fix the addr blocking through dbus

This commit is contained in:
Jaroslav Kysela 2014-08-09 18:17:46 +02:00
parent 2e4c99b678
commit eb46c63532
3 changed files with 8 additions and 6 deletions

View file

@ -62,20 +62,21 @@ satip_device_block( const char *addr, int block )
tvh_hardware_t *th;
satip_device_t *sd;
satip_frontend_t *lfe;
int val = block < 0 ? 0 : block;
pthread_mutex_lock(&global_lock);
TVH_HARDWARE_FOREACH(th) {
if (!idnode_is_instance(&th->th_id, &satip_device_class))
continue;
sd = (satip_device_t *)th;
if (strcmp(sd->sd_info.addr, addr) == 0) {
tvhinfo("satip", "address %s is %s", addr,
block < 0 ? "stopped" : (block > 0 ? "allowed" : "disabled"));
sd->sd_dbus_block = block < 0 ? 0 : block;
if (strcmp(sd->sd_info.addr, addr) == 0 && val != sd->sd_dbus_allow) {
sd->sd_dbus_allow = val;
if (block < 0) {
TAILQ_FOREACH(lfe, &sd->sd_frontends, sf_link)
mpegts_input_stop_all((mpegts_input_t *)lfe);
}
tvhinfo("satip", "address %s is %s", addr,
block < 0 ? "stopped" : (block > 0 ? "allowed" : "disabled"));
}
}
pthread_mutex_unlock(&global_lock);
@ -380,6 +381,7 @@ satip_device_create( satip_device_info_t *info )
sd->sd_pids_max = 32;
sd->sd_pids_deladd = 1;
sd->sd_sig_scale = 240;
sd->sd_dbus_allow = 1;
if (!tvh_hardware_create0((tvh_hardware_t*)sd, &satip_device_class,
uuid.hex, conf)) {

View file

@ -376,7 +376,7 @@ satip_frontend_is_enabled ( mpegts_input_t *mi, mpegts_mux_t *mm,
lock_assert(&global_lock);
if (!mpegts_input_is_enabled(mi, mm, reason)) return 0;
if (lfe->sf_device->sd_dbus_block) return 0;
if (lfe->sf_device->sd_dbus_allow <= 0) return 0;
if (lfe->sf_type != DVB_TYPE_S) return 1;
/* check if the position is enabled */
position = satip_satconf_get_position(lfe, mm);

View file

@ -81,7 +81,7 @@ struct satip_device
int sd_sig_scale;
int sd_pids0;
int sd_pilot_on;
int sd_dbus_block;
int sd_dbus_allow;
pthread_mutex_t sd_tune_mutex;
};