capmt linuxdvb: some minor tweaks to ensure only necessary are enabled
Only adapters that have active frontends will be enabled in capmt. In addition to this I've also fixed code so it will actually honour the port configuration (which was being ignored in OSCAM mode).
This commit is contained in:
parent
9749c294e7
commit
9de5cc4c98
3 changed files with 29 additions and 10 deletions
|
@ -576,25 +576,24 @@ capmt_thread(void *aux)
|
|||
|
||||
/* open connection to emulated ca0 device */
|
||||
if (!capmt->capmt_oscam) {
|
||||
bind_ok = capmt_create_udp_socket(&capmt->capmt_sock_ca0[0], capmt->capmt_port);
|
||||
bind_ok = capmt_create_udp_socket(&capmt->capmt_sock_ca0[0],
|
||||
capmt->capmt_port);
|
||||
} else {
|
||||
int i;
|
||||
int i, n;
|
||||
extern const idclass_t linuxdvb_adapter_class;
|
||||
linuxdvb_adapter_t *la;
|
||||
idnode_set_t *is = idnode_find_all(&linuxdvb_adapter_class);
|
||||
for (i = 0; i < is->is_count; i++) {
|
||||
la = (linuxdvb_adapter_t*)is->is_array[i];
|
||||
#if TODO_FIXME
|
||||
if (!la || !la->mi_is_enabled) continue;
|
||||
if (!la->mi_is_enabled((mpegts_input_t*)la)) continue;
|
||||
#endif
|
||||
if (la->la_dvb_number > MAX_CA) {
|
||||
if (!la || !la->la_is_enabled(la)) continue;
|
||||
n = la->la_dvb_number;
|
||||
if (n < 0 || n > MAX_CA) {
|
||||
tvhlog(LOG_ERR, "capmt", "adapter number > MAX_CA");
|
||||
continue;
|
||||
}
|
||||
tvhlog(LOG_INFO, "capmt", "Creating capmt UDP socket for adapter %d",
|
||||
la->la_dvb_number);
|
||||
bind_ok = capmt_create_udp_socket(&capmt->capmt_sock_ca0[la->la_dvb_number], 9000 + la->la_dvb_number);
|
||||
tvhlog(LOG_INFO, "capmt", "created UDP socket %d", n);
|
||||
bind_ok = capmt_create_udp_socket(&capmt->capmt_sock_ca0[n],
|
||||
capmt->capmt_port + n);
|
||||
}
|
||||
}
|
||||
if (bind_ok)
|
||||
|
|
|
@ -103,6 +103,20 @@ linuxdvb_adapter_save ( linuxdvb_adapter_t *la, htsmsg_t *m )
|
|||
htsmsg_add_msg(m, "frontends", l);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if enabled
|
||||
*/
|
||||
static int
|
||||
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))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create
|
||||
*/
|
||||
|
@ -124,6 +138,7 @@ linuxdvb_adapter_create0
|
|||
LIST_INSERT_HEAD(&ld->ld_adapters, la, la_link);
|
||||
la->la_device = ld;
|
||||
la->la_dvb_number = -1;
|
||||
la->la_is_enabled = linuxdvb_adapter_is_enabled;
|
||||
|
||||
/* No conf */
|
||||
if (!conf)
|
||||
|
|
|
@ -92,6 +92,11 @@ struct linuxdvb_adapter
|
|||
* Frontends
|
||||
*/
|
||||
LIST_HEAD(,linuxdvb_frontend) la_frontends;
|
||||
|
||||
/*
|
||||
* Functions
|
||||
*/
|
||||
int (*la_is_enabled) ( linuxdvb_adapter_t *la );
|
||||
};
|
||||
|
||||
struct linuxdvb_frontend
|
||||
|
|
Loading…
Add table
Reference in a new issue