Added some new transport/multiplex search routines and used them in epg modules.
This commit is contained in:
parent
753f762de4
commit
4b5ee3585c
5 changed files with 71 additions and 29 deletions
|
@ -399,6 +399,10 @@ int dvb_mux_copy(th_dvb_adapter_t *dst, th_dvb_mux_instance_t *tdmi_src,
|
|||
|
||||
void dvb_mux_add_to_scan_queue (th_dvb_mux_instance_t *tdmi);
|
||||
|
||||
th_dvb_mux_instance_t *dvb_mux_find
|
||||
(th_dvb_adapter_t *tda, const char *netname, uint16_t onid, uint16_t tsid,
|
||||
int enabled );
|
||||
|
||||
/**
|
||||
* DVB Transport (aka DVB service)
|
||||
*/
|
||||
|
@ -412,6 +416,11 @@ struct service *dvb_transport_find2(th_dvb_mux_instance_t *tdmi,
|
|||
uint16_t sid, int pmt_pid,
|
||||
const char *identifier, int *save);
|
||||
|
||||
struct service *dvb_transport_find3
|
||||
(th_dvb_adapter_t *tda, th_dvb_mux_instance_t *tdmi,
|
||||
const char *netname, uint16_t onid, uint16_t tsid, uint16_t sid,
|
||||
int enabled, int epgprimary);
|
||||
|
||||
void dvb_transport_notify(struct service *t);
|
||||
|
||||
void dvb_transport_notify_by_adapter(th_dvb_adapter_t *tda);
|
||||
|
|
|
@ -1262,3 +1262,24 @@ void dvb_mux_add_to_scan_queue ( th_dvb_mux_instance_t *tdmi )
|
|||
tdmi->tdmi_scan_queue = &tda->tda_scan_queues[ti];
|
||||
TAILQ_INSERT_TAIL(tdmi->tdmi_scan_queue, tdmi, tdmi_scan_link);
|
||||
}
|
||||
|
||||
th_dvb_mux_instance_t *dvb_mux_find
|
||||
( th_dvb_adapter_t *tda, const char *netname, uint16_t onid, uint16_t tsid,
|
||||
int enabled )
|
||||
{
|
||||
th_dvb_mux_instance_t *tdmi;
|
||||
if (tda) {
|
||||
LIST_FOREACH(tdmi, &tda->tda_muxes, tdmi_adapter_link) {
|
||||
if (enabled && !tdmi->tdmi_enabled) continue;
|
||||
if (onid && onid != tdmi->tdmi_network_id) continue;
|
||||
if (tsid && tsid != tdmi->tdmi_transport_stream_id) continue;
|
||||
if (netname && strcmp(netname, tdmi->tdmi_network ?: "")) continue;
|
||||
return tdmi;
|
||||
}
|
||||
} else {
|
||||
TAILQ_FOREACH(tda, &dvb_adapters, tda_global_link)
|
||||
if ((tdmi = dvb_mux_find(tda, netname, onid, tsid, enabled)))
|
||||
return tdmi;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -383,6 +383,41 @@ dvb_grace_period(service_t *t)
|
|||
return 10;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find transport based on the DVB identification
|
||||
*/
|
||||
service_t *
|
||||
dvb_transport_find3
|
||||
(th_dvb_adapter_t *tda, th_dvb_mux_instance_t *tdmi,
|
||||
const char *netname, uint16_t onid, uint16_t tsid, uint16_t sid,
|
||||
int enabled, int epgprimary)
|
||||
{
|
||||
service_t *svc;
|
||||
if (tdmi) {
|
||||
LIST_FOREACH(svc, &tdmi->tdmi_transports, s_group_link) {
|
||||
if (enabled && !svc->s_enabled) continue;
|
||||
if (epgprimary && !service_is_primary_epg(svc)) continue;
|
||||
if (sid == svc->s_dvb_service_id) return svc;
|
||||
}
|
||||
} else if (tda) {
|
||||
LIST_FOREACH(tdmi, &tda->tda_muxes, tdmi_adapter_link) {
|
||||
if (enabled && !tdmi->tdmi_enabled) continue;
|
||||
if (onid && onid != tdmi->tdmi_network_id) continue;
|
||||
if (tsid && tsid != tdmi->tdmi_transport_stream_id) continue;
|
||||
if (netname && strcmp(netname, tdmi->tdmi_network ?: "")) continue;
|
||||
if ((svc = dvb_transport_find3(tda, tdmi, NULL, 0, 0, sid,
|
||||
enabled, epgprimary)))
|
||||
return svc;
|
||||
}
|
||||
} else {
|
||||
TAILQ_FOREACH(tda, &dvb_adapters, tda_global_link)
|
||||
if ((svc = dvb_transport_find3(tda, NULL, netname, onid, tsid,
|
||||
sid, enabled, epgprimary)))
|
||||
return svc;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find a transport based on 'serviceid' on the given mux
|
||||
|
|
|
@ -713,11 +713,8 @@ static int _eit_callback
|
|||
// Note: tableid=0x4f,0x60-0x6f is other TS
|
||||
// so must find the tdmi
|
||||
if(tableid == 0x4f || tableid >= 0x60) {
|
||||
tda = tdmi->tdmi_adapter;
|
||||
LIST_FOREACH(tdmi, &tda->tda_muxes, tdmi_adapter_link)
|
||||
if(tdmi->tdmi_transport_stream_id == tsid &&
|
||||
tdmi->tdmi_network_id == onid)
|
||||
break;
|
||||
tda = tdmi->tdmi_adapter;
|
||||
tdmi = dvb_mux_find(tda, NULL, onid, tsid, 1);
|
||||
} else {
|
||||
if (tdmi->tdmi_transport_stream_id != tsid ||
|
||||
tdmi->tdmi_network_id != onid) {
|
||||
|
@ -733,11 +730,8 @@ static int _eit_callback
|
|||
if(!tdmi) goto done;
|
||||
|
||||
/* Get service */
|
||||
svc = dvb_transport_find(tdmi, sid, 0, NULL);
|
||||
if (!svc || !svc->s_enabled || !svc->s_ch) goto done;
|
||||
|
||||
/* Ignore (not primary EPG service) */
|
||||
if (!service_is_primary_epg(svc)) goto done;
|
||||
svc = dvb_transport_find3(NULL, tdmi, NULL, 0, 0, sid, 1, 1);
|
||||
if (!svc || !svc->s_ch) goto done;
|
||||
|
||||
/* Register as interesting */
|
||||
if (tableid < 0x50)
|
||||
|
|
|
@ -189,23 +189,6 @@ static epggrab_channel_t *_opentv_find_epggrab_channel
|
|||
(epggrab_module_t*)mod);
|
||||
}
|
||||
|
||||
static service_t *_opentv_find_service ( int onid, int tsid, int sid )
|
||||
{
|
||||
th_dvb_adapter_t *tda;
|
||||
th_dvb_mux_instance_t *tdmi;
|
||||
service_t *t = NULL;
|
||||
TAILQ_FOREACH(tda, &dvb_adapters, tda_global_link) {
|
||||
LIST_FOREACH(tdmi, &tda->tda_muxes, tdmi_adapter_link) {
|
||||
if (tdmi->tdmi_transport_stream_id != tsid) continue;
|
||||
if (tdmi->tdmi_network_id != onid) continue;
|
||||
LIST_FOREACH(t, &tdmi->tdmi_transports, s_group_link) {
|
||||
if (t->s_dvb_service_id == sid) return t;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* ************************************************************************
|
||||
* OpenTV event processing
|
||||
* ***********************************************************************/
|
||||
|
@ -442,8 +425,8 @@ static void _opentv_parse_channels
|
|||
cnum = ((int)buf[i+5] << 8) | buf[i+6];
|
||||
|
||||
/* Find the service */
|
||||
svc = _opentv_find_service(onid, tsid, sid);
|
||||
if (svc && svc->s_ch && service_is_primary_epg(svc)) {
|
||||
svc = dvb_transport_find3(NULL, NULL, NULL, onid, tsid, sid, 1, 1);
|
||||
if (svc && svc->s_ch) {
|
||||
ec =_opentv_find_epggrab_channel(mod, cid, 1, &save);
|
||||
ecl = LIST_FIRST(&ec->channels);
|
||||
if (!ecl) {
|
||||
|
|
Loading…
Add table
Reference in a new issue