Add support for the DVB terrestrial delivery descriptor (i.e. auto-detection of DVB-T muxes). Note that DVB-T2 is a different descriptor and not included in this commit.
This commit is contained in:
parent
93fe784960
commit
c9088eb739
2 changed files with 71 additions and 0 deletions
|
@ -47,6 +47,7 @@
|
|||
#define DVB_DESC_PARENTAL_RAT 0x55
|
||||
#define DVB_DESC_TELETEXT 0x56
|
||||
#define DVB_DESC_SUBTITLE 0x59
|
||||
#define DVB_DESC_TERR 0x5a
|
||||
#define DVB_DESC_AC3 0x6a
|
||||
#define DVB_DESC_DEF_AUTHORITY 0x73
|
||||
#define DVB_DESC_CRID 0x76
|
||||
|
|
|
@ -612,6 +612,32 @@ static const fe_modulation_t qam_tab [6] = {
|
|||
QAM_AUTO, QAM_16, QAM_32, QAM_64, QAM_128, QAM_256
|
||||
};
|
||||
|
||||
static const fe_bandwidth_t bandwidth_tab [8] = {
|
||||
BANDWIDTH_8_MHZ, BANDWIDTH_7_MHZ, BANDWIDTH_6_MHZ, BANDWIDTH_AUTO,
|
||||
BANDWIDTH_AUTO, BANDWIDTH_AUTO, BANDWIDTH_AUTO, BANDWIDTH_AUTO
|
||||
};
|
||||
|
||||
static const fe_modulation_t constellation_tab [4] = {
|
||||
QPSK, QAM_16, QAM_64, QAM_AUTO
|
||||
};
|
||||
|
||||
static const fe_code_rate_t code_rate_tab [8] = {
|
||||
FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8, FEC_AUTO, FEC_AUTO, FEC_AUTO
|
||||
};
|
||||
|
||||
static const fe_guard_interval_t guard_interval_tab [4] = {
|
||||
GUARD_INTERVAL_1_32, GUARD_INTERVAL_1_16, GUARD_INTERVAL_1_8, GUARD_INTERVAL_1_4
|
||||
};
|
||||
|
||||
static const fe_transmit_mode_t transmission_mode_tab [4] = {
|
||||
TRANSMISSION_MODE_2K, TRANSMISSION_MODE_8K, TRANSMISSION_MODE_4K, TRANSMISSION_MODE_AUTO
|
||||
};
|
||||
|
||||
static const fe_hierarchy_t hierarchy_info_tab [8] = {
|
||||
HIERARCHY_NONE, HIERARCHY_1, HIERARCHY_2, HIERARCHY_4,
|
||||
HIERARCHY_NONE, HIERARCHY_1, HIERARCHY_2, HIERARCHY_4
|
||||
};
|
||||
|
||||
/**
|
||||
* Cable delivery descriptor
|
||||
*/
|
||||
|
@ -746,6 +772,46 @@ dvb_table_sat_delivery(th_dvb_mux_instance_t *tdmi, uint8_t *ptr, int len,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Terrestrial delivery descriptor
|
||||
*/
|
||||
static int
|
||||
dvb_table_terr_delivery(th_dvb_mux_instance_t *tdmi, uint8_t *ptr, int len,
|
||||
uint16_t tsid, uint16_t onid)
|
||||
{
|
||||
struct dvb_mux_conf dmc;
|
||||
int freq;
|
||||
|
||||
if(!tdmi->tdmi_adapter->tda_autodiscovery)
|
||||
return -1;
|
||||
|
||||
if(len < 11)
|
||||
return -1;
|
||||
|
||||
memset(&dmc, 0, sizeof(dmc));
|
||||
dmc.dmc_fe_params.inversion = INVERSION_AUTO;
|
||||
|
||||
freq = ((ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | ptr[3]) * 10;
|
||||
|
||||
if(!freq)
|
||||
return -1;
|
||||
|
||||
dmc.dmc_fe_params.frequency = freq;
|
||||
dmc.dmc_fe_params.u.ofdm.bandwidth = bandwidth_tab[(ptr[4] & 0xe0) >> 5];
|
||||
dmc.dmc_fe_params.u.ofdm.constellation=constellation_tab[(ptr[5] & 0xc0) >> 6];
|
||||
dmc.dmc_fe_params.u.ofdm.hierarchy_information=hierarchy_info_tab[(ptr[5] & 0x38) >> 3];
|
||||
dmc.dmc_fe_params.u.ofdm.code_rate_HP=code_rate_tab[ptr[5] & 0x3];
|
||||
dmc.dmc_fe_params.u.ofdm.code_rate_LP=code_rate_tab[(ptr[6] & 0xe0) >> 5];
|
||||
dmc.dmc_fe_params.u.ofdm.guard_interval=guard_interval_tab[(ptr[6] & 0x18) >> 3];
|
||||
dmc.dmc_fe_params.u.ofdm.transmission_mode=transmission_mode_tab[(ptr[6] & 0x06) >> 1];
|
||||
|
||||
dvb_mux_create(tdmi->tdmi_adapter, &dmc, onid, tsid, NULL,
|
||||
"automatic mux discovery", 1, 1, NULL, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -881,6 +947,10 @@ dvb_nit_callback(th_dvb_mux_instance_t *tdmi, uint8_t *ptr, int len,
|
|||
if(tdmi->tdmi_adapter->tda_type == FE_QAM)
|
||||
dvb_table_cable_delivery(tdmi, ptr, tlen, tsid, onid);
|
||||
break;
|
||||
case DVB_DESC_TERR:
|
||||
if(tdmi->tdmi_adapter->tda_type == FE_OFDM)
|
||||
dvb_table_terr_delivery(tdmi, ptr, tlen, tsid, onid);
|
||||
break;
|
||||
case DVB_DESC_LOCAL_CHAN:
|
||||
dvb_table_local_channel(tdmi, ptr, tlen, tsid, onid);
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue