Fix various issus when load/storing/cloning DVB mux configuration

This commit is contained in:
Andreas Öman 2008-05-02 18:33:21 +00:00
parent 473c0956e2
commit b9af9a543d
4 changed files with 28 additions and 14 deletions

21
dvb.c
View file

@ -17,6 +17,7 @@
*/
#include <pthread.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -343,8 +344,8 @@ tdmi_inssort(th_dvb_mux_instance_t *a, th_dvb_mux_instance_t *b)
*/
th_dvb_mux_instance_t *
dvb_mux_create(th_dvb_adapter_t *tda, struct dvb_frontend_parameters *fe_param,
int polarisation, int switchport, int save, uint16_t tsid,
const char *network)
int polarisation, int switchport,
uint16_t tsid, const char *network, int flags)
{
th_dvb_mux_instance_t *tdmi;
char buf[200];
@ -391,10 +392,10 @@ dvb_mux_create(th_dvb_adapter_t *tda, struct dvb_frontend_parameters *fe_param,
tdmi->tdmi_identifier = strdup(buf);
if(save) {
if(flags & DVB_MUX_SAVE) {
dvb_tda_save(tda);
notify_tda_change(tda);
} else {
} else if(flags & DVB_MUX_LOAD) {
dvb_tdmi_load(tdmi);
}
@ -426,6 +427,11 @@ dvb_mux_destroy(th_dvb_mux_instance_t *tdmi)
{
th_dvb_adapter_t *tda = tdmi->tdmi_adapter;
th_transport_t *t;
char buf[400];
snprintf(buf, sizeof(buf), "%s/dvbmuxes/%s",
settings_dir, tdmi->tdmi_identifier);
unlink(buf);
while((t = LIST_FIRST(&tdmi->tdmi_transports)) != NULL)
transport_destroy(t);
@ -707,13 +713,16 @@ dvb_tda_clone(th_dvb_adapter_t *dst, th_dvb_adapter_t *src)
dvb_mux_destroy(tdmi_dst);
LIST_FOREACH(tdmi_src, &src->tda_muxes, tdmi_adapter_link) {
tdmi_dst = dvb_mux_create(dst,
tdmi_src->tdmi_fe_params,
tdmi_src->tdmi_polarisation,
tdmi_src->tdmi_switchport,
0,
tdmi_src->tdmi_transport_stream_id,
tdmi_src->tdmi_network);
tdmi_src->tdmi_network,
0);
assert(tdmi_dst != NULL);
LIST_FOREACH(t_src, &tdmi_src->tdmi_transports, tht_mux_link) {
t_dst = dvb_find_transport(tdmi_dst,

7
dvb.h
View file

@ -50,11 +50,14 @@ void tdmi_check_scan_status(th_dvb_mux_instance_t *tdmi);
th_transport_t *dvb_find_transport(th_dvb_mux_instance_t *tdmi,
uint16_t sid, int pmt_pid, int *created);
#define DVB_MUX_SAVE 0x1
#define DVB_MUX_LOAD 0x2
th_dvb_mux_instance_t *dvb_mux_create(th_dvb_adapter_t *tda,
struct dvb_frontend_parameters *fe_param,
int polarisation, int switchport,
int save, uint16_t tsid,
const char *network);
uint16_t tsid, const char *network,
int flags);
void dvb_tdmi_save(th_dvb_mux_instance_t *tdmi);

View file

@ -253,8 +253,8 @@ dvb_mux_create_str(th_dvb_adapter_t *tda,
break;
}
dvb_mux_create(tda, &f, polarisation, switchport, save, atoi(tsidstr),
network);
dvb_mux_create(tda, &f, polarisation, switchport, atoi(tsidstr),
network, save ? DVB_MUX_SAVE : DVB_MUX_LOAD);
return NULL;
}
@ -336,7 +336,8 @@ dvb_mux_preconf_add(th_dvb_adapter_t *tda, unsigned int n)
break;
}
dvb_mux_create(tda, &f, polarisation, switchport, 0, 0xffff, NULL);
dvb_mux_create(tda, &f, polarisation, switchport, 0xffff, NULL,
DVB_MUX_LOAD);
m++;
}
dvb_tda_save(tda);

View file

@ -559,7 +559,8 @@ dvb_table_cable_delivery(th_dvb_mux_instance_t *tdmi, uint8_t *ptr, int len,
fe_param.u.qam.fec_inner = fec_tab[ptr[10] & 0x07];
dvb_mux_create(tdmi->tdmi_adapter, &fe_param, 0, 0, 1, tsid, NULL);
dvb_mux_create(tdmi->tdmi_adapter, &fe_param, 0, 0, tsid, NULL,
DVB_MUX_SAVE);
}
/**
@ -592,8 +593,8 @@ dvb_table_sat_delivery(th_dvb_mux_instance_t *tdmi, uint8_t *ptr, int len,
pol = (ptr[6] >> 5) & 0x03;
dvb_mux_create(tdmi->tdmi_adapter, &fe_param, pol, tdmi->tdmi_switchport, 1,
tsid, NULL);
dvb_mux_create(tdmi->tdmi_adapter, &fe_param, pol, tdmi->tdmi_switchport,
tsid, NULL, DVB_MUX_SAVE);
}