SAT>IP server: fix the tuner configuration

This commit is contained in:
Jaroslav Kysela 2015-03-10 14:37:46 +01:00
parent a4c2cc2a0f
commit 6753203c65
7 changed files with 22 additions and 12 deletions

View file

@ -1360,13 +1360,14 @@ config_check ( void )
* Initialisation / Shutdown / Saving
* *************************************************************************/
static int config_newcfg = 0;
void
config_init ( const char *path, int backup )
config_boot ( const char *path )
{
struct stat st;
char buf[1024];
const char *homedir = getenv("HOME");
int new = 0;
/* Generate default */
if (!path) {
@ -1376,7 +1377,7 @@ config_init ( const char *path, int backup )
/* Ensure directory exists */
if (stat(path, &st)) {
new = 1;
config_newcfg = 1;
if (makedirs(path, 0700)) {
tvhwarn("START", "failed to create settings directory %s,"
" settings will not be saved", path);
@ -1407,9 +1408,13 @@ config_init ( const char *path, int backup )
tvhlog(LOG_DEBUG, "config", "no configuration, loading defaults");
config = htsmsg_create_map();
}
}
void
config_init ( int backup )
{
/* Store version number */
if (new) {
if (config_newcfg) {
htsmsg_set_u32(config, "version", ARRAY_SIZE(config_migrate_table));
htsmsg_set_str(config, "fullversion", tvheadend_version);
config_save();
@ -1419,6 +1424,7 @@ config_init ( const char *path, int backup )
if (config_migrate(backup))
config_check();
}
tvhinfo("config", "loaded");
}
void config_done ( void )

View file

@ -23,7 +23,8 @@
#include "htsmsg.h"
void config_init ( const char *path, int backup );
void config_boot ( const char *path );
void config_init ( int backup );
void config_done ( void );
void config_save ( void );

View file

@ -709,6 +709,7 @@ main(int argc, char **argv)
signal(SIGILL, handle_sigill); // see handler..
uuid_init();
config_boot(opt_config);
tcp_server_preinit(opt_ipv6);
http_server_init(opt_bindaddr); // bind to ports only
htsp_init(opt_bindaddr); // bind to ports only
@ -817,7 +818,7 @@ main(int argc, char **argv)
/* Initialise configuration */
idnode_init();
spawn_init();
config_init(opt_config, opt_nobackup == 0);
config_init(opt_nobackup == 0);
/**
* Initialize subsystems

View file

@ -1029,12 +1029,14 @@ void satip_server_rtsp_init(const char *bindaddr, int port)
rtsp_close_sessions();
pthread_mutex_unlock(&rtsp_lock);
tcp_server_delete(rtsp_server);
rtsp_server = NULL;
reg = 1;
}
free(rtsp_ip);
rtsp_ip = strdup(bindaddr);
rtsp_port = port;
rtsp_server = tcp_server_create(bindaddr, port, &ops, NULL);
if (!rtsp_server)
rtsp_server = tcp_server_create(bindaddr, port, &ops, NULL);
if (reg)
tcp_server_register(rtsp_server);
}

View file

@ -695,7 +695,7 @@ tcp_server_create
if(x != 0)
{
tvhlog(LOG_ERR, "tcp", "bind: %s: %s", bindaddr != NULL ? bindaddr : "*", strerror(errno));
tvhlog(LOG_ERR, "tcp", "bind: %s:%i: %s", bindaddr != NULL ? bindaddr : "*", port, strerror(errno));
close(fd);
return NULL;
}

View file

@ -532,9 +532,9 @@ extjs_config(http_connection_t *hc, const char *remain, void *opaque)
if ((str = http_arg_get(&hc->hc_req_args, "satip_dvbt")))
ssave |= config_set_int("satip_dvbt", atoi(str));
if ((str = http_arg_get(&hc->hc_req_args, "satip_dvbs")))
ssave |= config_set_int("satip_dvbt", atoi(str));
ssave |= config_set_int("satip_dvbs", atoi(str));
if ((str = http_arg_get(&hc->hc_req_args, "satip_dvbc")))
ssave |= config_set_int("satip_dvbt", atoi(str));
ssave |= config_set_int("satip_dvbc", atoi(str));
if (save | ssave)
config_save();
if (ssave)

View file

@ -234,11 +234,11 @@ tvheadend.miscconf = function(panel, index) {
fieldLabel: 'Exported DVB-T Tuners'
});
var dvbs = new Ext.form.NumberField({
name: 'satip_dvbt',
name: 'satip_dvbs',
fieldLabel: 'Exported DVB-S2 Tuners'
});
var dvbc = new Ext.form.NumberField({
name: 'satip_dvbt',
name: 'satip_dvbc',
fieldLabel: 'Exported DVB-C Tuners'
});
satipPanel = new Ext.form.FieldSet({