Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
DVB-T autodiscovery: validate more frequency and allow to reset code …
…rate LP
  • Loading branch information
perexg committed Jun 7, 2016
1 parent af333d9 commit 17f2d92
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/input/mpegts/dvb_psi.c
Expand Up @@ -365,8 +365,8 @@ dvb_desc_terr_del

/* Extract data */
frequency = ((ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | ptr[3]);
if (!frequency) {
tvhwarn(mt->mt_name, "dvb-t frequency error");
if (frequency < 1000000 || frequency > 200000000) {
tvhdebug(mt->mt_name, "dvb-t frequency error (%d)", frequency);
return NULL;
}

Expand Down
15 changes: 11 additions & 4 deletions src/input/mpegts/mpegts_network_dvb.c
Expand Up @@ -703,6 +703,13 @@ dvb_network_create_mux
" (%li)", (long)dmc->x, (long)tuning_new.x); \
tuning_new.x = dmc->x; \
} xr ? cbit : 0; })
#define COMPAREN0(x, cbit) ({ \
int xr = dmc->x != 1 && dmc->x != tuning_new.x; \
if (xr) { \
tvhtrace("mpegts", "create mux dmc->" #x " (%li) != lm->lm_tuning." #x \
" (%li)", (long)dmc->x, (long)tuning_new.x); \
tuning_new.x = dmc->x; \
} xr ? cbit : 0; })
tuning_new = tuning_old = lm->lm_tuning;
/* Always save the orbital position */
if (dmc->dmc_fe_type == DVB_TYPE_S) {
Expand All @@ -727,11 +734,11 @@ dvb_network_create_mux
case DVB_TYPE_T:
save |= COMPARE(dmc_fe_stream_id, CBIT_STREAM_ID);
save |= COMPAREN(u.dmc_fe_ofdm.bandwidth, CBIT_BANDWIDTH);
save |= COMPAREN(u.dmc_fe_ofdm.hierarchy_information, CBIT_HIERARCHY);
save |= COMPAREN(u.dmc_fe_ofdm.code_rate_HP, CBIT_RATE_HP);
save |= COMPAREN(u.dmc_fe_ofdm.code_rate_LP, CBIT_RATE_LP);
save |= COMPAREN0(u.dmc_fe_ofdm.code_rate_LP, CBIT_RATE_LP);
save |= COMPAREN(u.dmc_fe_ofdm.transmission_mode, CBIT_TRANS_MODE);
save |= COMPAREN(u.dmc_fe_ofdm.guard_interval, CBIT_GUARD);
save |= COMPAREN(u.dmc_fe_ofdm.hierarchy_information, CBIT_HIERARCHY);
break;
case DVB_TYPE_S:
save |= COMPARE(u.dmc_fe_qpsk.polarisation, CBIT_POLARISATION);
Expand All @@ -757,11 +764,11 @@ dvb_network_create_mux
mpegts_mux_nice_name((mpegts_mux_t *)mm, muxname, sizeof(muxname));
dvb_mux_conf_str(&tuning_old, buf, sizeof(buf));
tvhlog(change ? LOG_WARNING : LOG_NOTICE, "mpegts",
"mux %s%s from %s (%08x)", muxname,
"mux %s%s %s (%08x)", muxname,
change ? " changed from" : " old params", buf, save);
dvb_mux_conf_str(&tuning_new, buf, sizeof(buf));
tvhlog(change ? LOG_WARNING : LOG_NOTICE, "mpegts",
"mux %s%s to %s (%08x)", muxname,
"mux %s%s %s (%08x)", muxname,
change ? " changed to " : " new params", buf, save);
if (!change) save = 0;
}
Expand Down

0 comments on commit 17f2d92

Please sign in to comment.