linuxdvb: old code would update tuning params even without auto-discovery

This is important for correcting mistakes in the pre-defined configuration
files, and also picking up potential changes (not sure that will quite work).

The one thing that is left untouched is the frequency, a) to not confuse people
and b) I've seen 2 transponders sending slightly diff freq and this can cause
the config to be constantly updated.

The one thing this will also do, for better or worse, is remove an AUTO
settings. Cons are it could be less flexible an tuners may automatically deal
with small changes in settings, Pro's are if you have some tuners that accept
AUTO and some that don't, once its scanned on something that does it will get
updated. Plus its probably better, where possible, to have the full settings.
This commit is contained in:
Adam Sutton 2013-11-18 09:21:35 +00:00
parent 974d5f4cb0
commit 95a9c3bbf1
2 changed files with 18 additions and 4 deletions

View file

@ -213,7 +213,6 @@ static mpegts_mux_t *
linuxdvb_network_find_mux
( linuxdvb_network_t *ln, dvb_mux_conf_t *dmc )
{
#define LINUXDVB_FREQ_TOL 2000 // TODO: fix this!
mpegts_mux_t *mm;
LIST_FOREACH(mm, &ln->mn_muxes, mm_network_link) {
linuxdvb_mux_t *lm = (linuxdvb_mux_t*)mm;
@ -240,13 +239,25 @@ static mpegts_mux_t *
linuxdvb_network_create_mux
( mpegts_mux_t *mm, uint16_t onid, uint16_t tsid, dvb_mux_conf_t *dmc )
{
int save = 0;
linuxdvb_network_t *ln = (linuxdvb_network_t*)mm->mm_network;
mm = linuxdvb_network_find_mux(ln, dmc);
if (!mm && ln->mn_autodiscovery) {
mm = (mpegts_mux_t*)linuxdvb_mux_create0(ln, onid, tsid, dmc, NULL, NULL);
if (mm)
mm->mm_config_save(mm);
mm = (mpegts_mux_t*)linuxdvb_mux_create0(ln, onid, tsid, dmc, NULL, NULL);
save = 1;
} else if (mm) {
linuxdvb_mux_t *lm = (linuxdvb_mux_t*)mm;
dmc->dmc_fe_params.frequency = lm->lm_tuning.dmc_fe_params.frequency;
// Note: keep original freq, else it can bounce around if diff transponders
// report it slightly differently.
// TODO: Note: should we also leave AUTO settings as is?
if (memcmp(&lm->lm_tuning, dmc, sizeof(lm->lm_tuning))) {
memcpy(&lm->lm_tuning, dmc, sizeof(lm->lm_tuning));
save = 1;
}
}
if (save)
mm->mm_config_save(mm);
return mm;
}

View file

@ -22,6 +22,9 @@
#include "input/mpegts.h"
/* Max allowed frequency variation for something to be considered the same */
#define LINUXDVB_FREQ_TOL 2000
typedef struct linuxdvb_hardware linuxdvb_hardware_t;
typedef struct linuxdvb_device linuxdvb_device_t;
typedef struct linuxdvb_adapter linuxdvb_adapter_t;