linuxdvb: fix some mistake in previous commits and reduce level of config saving
There was excessive saving as a result of some mistakes in the MPEGTS/DVB code.
This commit is contained in:
parent
95a9c3bbf1
commit
4b3c1dc30f
6 changed files with 62 additions and 16 deletions
|
@ -836,8 +836,8 @@ dvb_nit_callback
|
|||
else
|
||||
mux = dvb_desc_terr_del(mm, onid, tsid, dptr, dlen);
|
||||
if (mux) {
|
||||
mpegts_mux_set_onid(mux, onid);
|
||||
mpegts_mux_set_tsid(mux, tsid);
|
||||
mpegts_mux_set_tsid(mux, onid);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -951,6 +951,7 @@ dvb_sdt_callback
|
|||
int r;
|
||||
s->s_dvb_servicetype = stype;
|
||||
save = 1;
|
||||
tvhtrace("sdt", " type changed");
|
||||
|
||||
/* Set tvh service type */
|
||||
if ((r = dvb_servicetype_lookup(stype)) != -1)
|
||||
|
@ -960,7 +961,7 @@ dvb_sdt_callback
|
|||
/* Update scrambled state */
|
||||
if (s->s_scrambled != free_ca_mode) {
|
||||
s->s_scrambled = free_ca_mode;
|
||||
save = 1;
|
||||
tvhtrace("sdt", " scrambled changed");
|
||||
}
|
||||
|
||||
/* Check if this is master
|
||||
|
@ -973,6 +974,7 @@ dvb_sdt_callback
|
|||
if (*sauth && strcmp(s->s_dvb_cridauth ?: "", sauth)) {
|
||||
tvh_str_update(&s->s_dvb_cridauth, sauth);
|
||||
save = 1;
|
||||
tvhtrace("sdt", " cridauth changed");
|
||||
}
|
||||
|
||||
/* Update name */
|
||||
|
@ -980,6 +982,7 @@ dvb_sdt_callback
|
|||
if (!s->s_dvb_svcname || master) {
|
||||
tvh_str_update(&s->s_dvb_svcname, sname);
|
||||
save2 = 1;
|
||||
tvhtrace("sdt", " name changed");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -988,6 +991,7 @@ dvb_sdt_callback
|
|||
if (!s->s_dvb_provider || master) {
|
||||
tvh_str_update(&s->s_dvb_provider, sprov);
|
||||
save2 = 1;
|
||||
tvhtrace("sdt", " provider changed");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -198,10 +198,10 @@ linuxdvb_adapter_find_by_number ( int adapter )
|
|||
/*
|
||||
* Load an adapter
|
||||
*/
|
||||
linuxdvb_adapter_t *
|
||||
void
|
||||
linuxdvb_adapter_added ( int adapter )
|
||||
{
|
||||
int i, r, fd;
|
||||
int i, r, fd, save = 0;
|
||||
char fe_path[512], dmx_path[512], dvr_path[512];
|
||||
linuxdvb_adapter_t *la = NULL;
|
||||
struct dvb_frontend_info dfi;
|
||||
|
@ -243,7 +243,7 @@ linuxdvb_adapter_added ( int adapter )
|
|||
if (!la) {
|
||||
if (!(la = linuxdvb_adapter_find_by_number(adapter))) {
|
||||
tvhlog(LOG_ERR, "linuxdvb", "failed to find/create adapter%d", adapter);
|
||||
return NULL;
|
||||
return;
|
||||
}
|
||||
la->la_dvb_number = adapter;
|
||||
if (!la->la_name) {
|
||||
|
@ -256,11 +256,9 @@ linuxdvb_adapter_added ( int adapter )
|
|||
/* Create frontend */
|
||||
tvhlog(LOG_DEBUG, "linuxdvb", "fe_create(%p, %s, %s, %s)",
|
||||
la, fe_path, dmx_path, dvr_path);
|
||||
linuxdvb_frontend_added(la, i, fe_path, dmx_path, dvr_path, &dfi);
|
||||
save |= linuxdvb_frontend_added(la, i, fe_path, dmx_path, dvr_path, &dfi);
|
||||
}
|
||||
|
||||
if (la)
|
||||
if (save)
|
||||
linuxdvb_device_save(la->la_device);
|
||||
|
||||
return la;
|
||||
}
|
||||
|
|
|
@ -879,7 +879,7 @@ linuxdvb_frontend_create0
|
|||
return lfe;
|
||||
}
|
||||
|
||||
linuxdvb_frontend_t *
|
||||
int
|
||||
linuxdvb_frontend_added
|
||||
( linuxdvb_adapter_t *la, int fe_num,
|
||||
const char *fe_path,
|
||||
|
@ -887,6 +887,7 @@ linuxdvb_frontend_added
|
|||
const char *dvr_path,
|
||||
const struct dvb_frontend_info *fe_info )
|
||||
{
|
||||
int save = 0;
|
||||
linuxdvb_frontend_t *lfe = NULL;
|
||||
|
||||
/* Find existing */
|
||||
|
@ -895,7 +896,7 @@ linuxdvb_frontend_added
|
|||
if (lfe->lfe_info.type != fe_info->type) {
|
||||
tvhlog(LOG_ERR, "linuxdvb", "detected incorrect fe_type %s != %s",
|
||||
dvb_type2str(lfe->lfe_info.type), dvb_type2str(fe_info->type));
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -905,8 +906,9 @@ linuxdvb_frontend_added
|
|||
if (!lfe) {
|
||||
if (!(lfe = linuxdvb_frontend_create0(la, NULL, NULL, fe_info->type))) {
|
||||
tvhlog(LOG_ERR, "linuxdvb", "failed to create frontend");
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
save = 1;
|
||||
}
|
||||
|
||||
/* Defaults */
|
||||
|
@ -925,7 +927,7 @@ linuxdvb_frontend_added
|
|||
lfe->lfe_dmx_path = strdup(dmx_path);
|
||||
lfe->lfe_dvr_path = strdup(dvr_path);
|
||||
|
||||
return lfe;
|
||||
return save;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <math.h>
|
||||
|
||||
/* **************************************************************************
|
||||
* Class definition
|
||||
|
@ -407,6 +408,38 @@ linuxdvb_mux_dvbs_class_delsys_enum (void *o)
|
|||
return list;
|
||||
}
|
||||
|
||||
static const void *
|
||||
linuxdvb_mux_dvbs_class_orbital_get ( void *o )
|
||||
{
|
||||
static char buf[256], *s = buf;
|
||||
linuxdvb_mux_t *lm = o;
|
||||
snprintf(buf, sizeof(buf), "%0.1f%c",
|
||||
lm->lm_tuning.dmc_fe_orbital_pos / 10.0,
|
||||
lm->lm_tuning.dmc_fe_orbital_dir);
|
||||
return &s;
|
||||
}
|
||||
|
||||
static int
|
||||
linuxdvb_mux_dvbs_class_orbital_set ( void *o, const void *s )
|
||||
{
|
||||
int pos, save = 0;
|
||||
char dir;
|
||||
char *tmp = strdupa(s);
|
||||
linuxdvb_mux_t *lm = o;
|
||||
|
||||
dir = tmp[strlen(tmp)-1];
|
||||
tmp[strlen(tmp)-1] = '\0';
|
||||
pos = (int)floorf(atof(tmp) * 10.0);
|
||||
|
||||
if (pos != lm->lm_tuning.dmc_fe_orbital_pos ||
|
||||
dir != lm->lm_tuning.dmc_fe_orbital_dir) {
|
||||
lm->lm_tuning.dmc_fe_orbital_pos = pos;
|
||||
lm->lm_tuning.dmc_fe_orbital_dir = dir;
|
||||
save = 1;
|
||||
}
|
||||
return save;
|
||||
}
|
||||
|
||||
const idclass_t linuxdvb_mux_dvbs_class =
|
||||
{
|
||||
.ic_super = &linuxdvb_mux_class,
|
||||
|
@ -465,6 +498,14 @@ const idclass_t linuxdvb_mux_dvbs_class =
|
|||
.list = linuxdvb_mux_dvbs_class_pilot_list,
|
||||
},
|
||||
#endif
|
||||
{
|
||||
.type = PT_STR,
|
||||
.id = "orbital",
|
||||
.name = "Orbital Pos.",
|
||||
.set = linuxdvb_mux_dvbs_class_orbital_set,
|
||||
.get = linuxdvb_mux_dvbs_class_orbital_get,
|
||||
.opts = PO_ADVANCED | PO_RDONLY
|
||||
},
|
||||
{}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -238,7 +238,7 @@ void linuxdvb_adapter_save ( linuxdvb_adapter_t *la, htsmsg_t *m );
|
|||
linuxdvb_adapter_t *linuxdvb_adapter_create0
|
||||
( linuxdvb_device_t *ld, const char *uuid, htsmsg_t *conf );
|
||||
|
||||
linuxdvb_adapter_t *linuxdvb_adapter_added (int a);
|
||||
void linuxdvb_adapter_added (int a);
|
||||
|
||||
int linuxdvb_adapter_is_free ( linuxdvb_adapter_t *la );
|
||||
int linuxdvb_adapter_current_weight ( linuxdvb_adapter_t *la );
|
||||
|
@ -252,8 +252,7 @@ linuxdvb_frontend_create0
|
|||
|
||||
void linuxdvb_frontend_save ( linuxdvb_frontend_t *lfe, htsmsg_t *m );
|
||||
|
||||
linuxdvb_frontend_t *
|
||||
linuxdvb_frontend_added
|
||||
int linuxdvb_frontend_added
|
||||
( linuxdvb_adapter_t *la, int fe_num,
|
||||
const char *fe_path, const char *dmx_path, const char *dvr_path,
|
||||
const struct dvb_frontend_info *fe_info );
|
||||
|
|
|
@ -157,6 +157,8 @@ hts_settings_save(htsmsg_t *record, const char *pathfmt, ...)
|
|||
/* Create directories */
|
||||
if (hts_settings_makedirs(path)) return;
|
||||
|
||||
tvhdebug("settings", "saving to %s", path);
|
||||
|
||||
/* Create tmp file */
|
||||
snprintf(tmppath, sizeof(tmppath), "%s.tmp", path);
|
||||
if((fd = tvh_open(tmppath, O_CREAT | O_TRUNC | O_RDWR, 0700)) < 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue