Commit 9537fc5c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Linux DVB: support for multi-standard frontends with API v5.5

parent fd122ba2
...@@ -434,6 +434,59 @@ void dvb_remove_pid (dvb_device_t *d, uint16_t pid) ...@@ -434,6 +434,59 @@ void dvb_remove_pid (dvb_device_t *d, uint16_t pid)
/** Enumerates the systems supported by one frontend */ /** Enumerates the systems supported by one frontend */
static unsigned dvb_probe_frontend (dvb_device_t *d, int fd) static unsigned dvb_probe_frontend (dvb_device_t *d, int fd)
{ {
#if DVBv5(5)
struct dtv_property prop = {
.cmd = DTV_ENUM_DELSYS
};
struct dtv_properties props = {
.num = 1,
.props = &prop
};
if (ioctl (fd, FE_GET_PROPERTY, &props) < 0)
{
msg_Err (d->obj, "cannot enumerate frontend systems: %m");
return 0;
}
static const unsigned systab[] = {
[SYS_UNDEFINED] = 0,
[SYS_DVBC_ANNEX_A] = DVB_C,
[SYS_DVBC_ANNEX_B] = CQAM,
[SYS_DVBT] = DVB_T,
//[SYS_DSS]
[SYS_DVBS] = DVB_S,
[SYS_DVBS2] = DVB_S2,
//[SYS_DVBH]
[SYS_ISDBT] = ISDB_T,
[SYS_ISDBS] = ISDB_S,
[SYS_ISDBC] = ISDB_C, // no drivers exist (as of 3.3-rc6)
[SYS_ATSC] = ATSC,
//[SYS_ATSCMH]
//[SYS_DMBTH]
//[SYS_CMMB]
//[SYS_DAB]
[SYS_DVBT2] = DVB_T2,
//[SYS_TURBO]
[SYS_DVBC_ANNEX_C] = ISDB_C, // another name for ISDB-C?
};
unsigned systems = 0;
msg_Dbg (d->obj, "probing frontend");
for (size_t i = 0; i < prop.u.buffer.len; i++)
{
unsigned sys = prop.u.buffer.data[i];
if (sys >= (sizeof (systab) / sizeof (systab[0])) || !systab[sys])
{
msg_Warn (d->obj, "unknown delivery system %u", sys);
continue;
}
msg_Dbg (d->obj, " system %u", sys);
systems |= systab[sys];
}
#else
struct dvb_frontend_info info; struct dvb_frontend_info info;
if (ioctl (fd, FE_GET_INFO, &info) < 0) if (ioctl (fd, FE_GET_INFO, &info) < 0)
...@@ -481,7 +534,7 @@ static unsigned dvb_probe_frontend (dvb_device_t *d, int fd) ...@@ -481,7 +534,7 @@ static unsigned dvb_probe_frontend (dvb_device_t *d, int fd)
/* ISDB (only terrestrial before DVBv5.5) */ /* ISDB (only terrestrial before DVBv5.5) */
if (info.type == FE_OFDM) if (info.type == FE_OFDM)
systems |= ISDB_T; systems |= ISDB_T;
#endif
return systems; return systems;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment