diff --git a/channels.c b/channels.c
index 318a7d28..1aae6760 100644
--- a/channels.c
+++ b/channels.c
@@ -222,10 +222,6 @@ service_load(struct config_head *head)
t->tht_prio = atoi(config_get_str_sub(head, "prio", ""));
if(0) {
-#ifdef ENABLE_INPUT_DVB
- } else if((v = config_get_str_sub(head, "dvbmux", NULL)) != NULL) {
- r = dvb_configure_transport(t, v, name);
-#endif
#ifdef ENABLE_INPUT_IPTV
} else if((v = config_get_str_sub(head, "iptv", NULL)) != NULL) {
r = iptv_configure_transport(t, v, head, name);
diff --git a/dvb.c b/dvb.c
index 762ce959..19f0bfa9 100644
--- a/dvb.c
+++ b/dvb.c
@@ -75,7 +75,7 @@ dvb_add_adapter(const char *path)
return;
}
tda = calloc(1, sizeof(th_dvb_adapter_t));
- tda->tda_path = strdup(path);
+ tda->tda_rootpath = strdup(path);
tda->tda_demux_path = malloc(256);
snprintf(tda->tda_demux_path, 256, "%s/demux0", path);
tda->tda_dvr_path = malloc(256);
@@ -137,7 +137,7 @@ dvb_init(void)
if(tdmi == NULL) {
syslog(LOG_WARNING,
"No muxes configured on \"%s\" DVB adapter unused",
- tda->tda_path);
+ tda->tda_rootpath);
startupcounter--;
} else {
dvb_start_initial_scan(tdmi);
@@ -148,18 +148,23 @@ dvb_init(void)
/**
- * Based on the gived transport id and service id, try to locate the transport
+ * Based on the gived transport id and service id on the given mux
+ * try to locate the transport.
+ *
+ * If it cannot be found we create it
*/
th_transport_t *
dvb_find_transport(th_dvb_mux_instance_t *tdmi, uint16_t tid,
uint16_t sid, int pmt_pid)
{
th_transport_t *t;
- th_dvb_mux_t *tdm = tdmi->tdmi_mux;
char tmp[100];
+ /* XXX: Minimize this search */
+
LIST_FOREACH(t, &all_transports, tht_global_link) {
- if(t->tht_dvb_transport_id == tid &&
+ if(t->tht_dvb_mux_instance == tdmi &&
+ t->tht_dvb_transport_id == tid &&
t->tht_dvb_service_id == sid)
return t;
}
@@ -176,13 +181,13 @@ dvb_find_transport(th_dvb_mux_instance_t *tdmi, uint16_t tid,
t->tht_type = TRANSPORT_DVB;
t->tht_start_feed = dvb_start_feed;
t->tht_stop_feed = dvb_stop_feed;
- t->tht_dvb_mux = tdm;
+ t->tht_dvb_mux_instance = tdmi;
- snprintf(tmp, sizeof(tmp), "%s:%04x:%04x", tdm->tdm_name, tid, sid);
+ snprintf(tmp, sizeof(tmp), "%s/%04x", tdmi->tdmi_uniquename, sid);
free((void *)t->tht_uniquename);
t->tht_uniquename = strdup(tmp);
- t->tht_name = strdup(tdm->tdm_title);
+ t->tht_name = strdup(tmp);
LIST_INSERT_HEAD(&all_transports, t, tht_global_link);
dvb_table_add_transport(tdmi, t, pmt_pid);
@@ -213,7 +218,7 @@ tdmi_activate(th_dvb_mux_instance_t *tdmi)
startupcounter--;
syslog(LOG_INFO,
"\"%s\" Initial scan completed, adapter available",
- tda->tda_path);
+ tda->tda_rootpath);
/* no more muxes to probe, link adapter to the world */
LIST_REMOVE(tda, tda_link);
LIST_INSERT_HEAD(&dvb_adapters_running, tda, tda_link);
@@ -231,7 +236,6 @@ static void
tdmi_initial_scan_timeout(void *aux, int64_t now)
{
th_dvb_mux_instance_t *tdmi = aux;
- th_dvb_adapter_t *tda = tdmi->tdmi_adapter;
const char *err;
#if 0
th_dvb_table_t *tdt;
@@ -246,8 +250,8 @@ tdmi_initial_scan_timeout(void *aux, int64_t now)
else
err = "Missing PSI tables, scan will continue";
- syslog(LOG_DEBUG, "\"%s\" mux \"%s\" Initial scan timed out -- %s",
- tda->tda_path, tdmi->tdmi_mux->tdm_name, err);
+ syslog(LOG_DEBUG, "\"%s\" Initial scan timed out -- %s",
+ tdmi->tdmi_uniquename, err);
tdmi_activate(tdmi);
}
@@ -260,11 +264,9 @@ void
tdmi_check_scan_status(th_dvb_mux_instance_t *tdmi)
{
th_dvb_table_t *tdt;
- th_dvb_adapter_t *tda = tdmi->tdmi_adapter;
if(tdmi->tdmi_state >= TDMI_IDLE)
return;
-
LIST_FOREACH(tdt, &tdmi->tdmi_tables, tdt_link)
if(tdt->tdt_count == 0)
@@ -272,8 +274,8 @@ tdmi_check_scan_status(th_dvb_mux_instance_t *tdmi)
/* All tables seen at least once */
- syslog(LOG_DEBUG, "\"%s\" on \"%s\" Initial scan completed",
- tda->tda_path, tdmi->tdmi_mux->tdm_name);
+ syslog(LOG_DEBUG, "\"%s\" Initial scan completed",
+ tdmi->tdmi_uniquename);
tdmi_activate(tdmi);
}
@@ -292,17 +294,6 @@ dvb_start_initial_scan(th_dvb_mux_instance_t *tdmi)
}
-
-/**
- *
- */
-static int
-mux_sort_quality(th_dvb_mux_instance_t *a, th_dvb_mux_instance_t *b)
-{
- return a->tdmi_fec_err_per_sec - b->tdmi_fec_err_per_sec;
-}
-
-
/**
*
*/
@@ -311,7 +302,6 @@ dvb_fec_monitor(void *aux, int64_t now)
{
th_dvb_adapter_t *tda = aux;
th_dvb_mux_instance_t *tdmi;
- th_dvb_mux_t *tdm;
dtimer_arm(&tda->tda_fec_monitor_timer, dvb_fec_monitor, tda, 1);
@@ -322,18 +312,12 @@ dvb_fec_monitor(void *aux, int64_t now)
if(tdmi->tdmi_fec_err_per_sec > DVB_FEC_ERROR_LIMIT) {
if(LIST_FIRST(&tda->tda_transports) != NULL) {
- syslog(LOG_ERR, "%s: on %s: Too many FEC errors (%d / s), "
+ syslog(LOG_ERR, "\"%s\": Too many FEC errors (%d / s), "
"flushing subscribers\n",
- tdmi->tdmi_mux->tdm_name, tda->tda_path,
- tdmi->tdmi_fec_err_per_sec);
+ tdmi->tdmi_uniquename, tdmi->tdmi_fec_err_per_sec);
dvb_adapter_clean(tdmi->tdmi_adapter);
}
}
-
- tdm = tdmi->tdmi_mux;
- LIST_REMOVE(tdmi, tdmi_mux_link);
- LIST_INSERT_SORTED(&tdm->tdm_instances, tdmi, tdmi_mux_link,
- mux_sort_quality);
}
}
diff --git a/dvb.h b/dvb.h
index 4ebdf856..4468dbf0 100644
--- a/dvb.h
+++ b/dvb.h
@@ -27,9 +27,6 @@ extern struct th_dvb_mux_list dvb_muxes;
void dvb_init(void);
-int dvb_configure_transport(th_transport_t *t, const char *muxname,
- const char *channel_name);
-
void dvb_tune_tdmi(th_dvb_mux_instance_t *tdmi, int maylog,
tdmi_state_t state);
diff --git a/dvb_dvr.c b/dvb_dvr.c
index 7114651e..6b5b4d1d 100644
--- a/dvb_dvr.c
+++ b/dvb_dvr.c
@@ -122,7 +122,6 @@ dvb_stop_feed(th_transport_t *t)
{
th_stream_t *st;
- t->tht_dvb_adapter = NULL;
LIST_REMOVE(t, tht_adapter_link);
LIST_FOREACH(st, &t->tht_streams, st_link) {
close(st->st_demuxer_fd);
@@ -133,45 +132,41 @@ dvb_stop_feed(th_transport_t *t)
/*
+ * Switch the adapter (which is implicitly tied to our transport)
+ * to receive the given transport.
*
+ * But we only do this if 'weight' is higher than all of the current
+ * transports that is subscribing to the adapter
*/
int
dvb_start_feed(th_transport_t *t, unsigned int weight, int status)
{
- th_dvb_adapter_t *tda;
struct dmx_pes_filter_params dmx_param;
th_stream_t *st;
int w, fd, pid;
+ th_dvb_adapter_t *tda = t->tht_dvb_mux_instance->tdmi_adapter;
+ th_dvb_mux_instance_t *tdmi = tda->tda_mux_current;
- th_dvb_mux_instance_t *tdmi, *cand = NULL;
- th_dvb_mux_t *mux = t->tht_dvb_mux;
+ /* Check if adapter is idle, or already tuned */
- LIST_FOREACH(tdmi, &mux->tdm_instances, tdmi_mux_link) {
+ if(tdmi != NULL && tdmi == t->tht_dvb_mux_instance) {
- if(tdmi->tdmi_state == TDMI_RUNNING)
- goto gotmux;
+ /* Nope .. */
if(tdmi->tdmi_status != NULL)
- continue; /* no lock */
+ return 1; /* no lock on adapter, cant use it */
if(tdmi->tdmi_fec_err_per_sec > DVB_FEC_ERROR_LIMIT / 3)
- continue; /* too much errors to even consider */
+ return 1; /* too many errors for using it */
w = transport_compute_weight(&tdmi->tdmi_adapter->tda_transports);
- if(w < weight && cand == NULL)
- cand = tdmi;
+ if(w >= weight)
+ return 1; /* We are outranked by weight, cant use it */
+
+ tdmi = t->tht_dvb_mux_instance;
+ dvb_adapter_clean(tda);
}
- if(cand == NULL)
- return 1;
-
- tdmi = cand;
-
- dvb_adapter_clean(tdmi->tdmi_adapter);
-
- gotmux:
- tda = tdmi->tdmi_adapter;
-
LIST_FOREACH(st, &t->tht_streams, st_link) {
fd = open(tda->tda_demux_path, O_RDWR);
@@ -206,8 +201,7 @@ dvb_start_feed(th_transport_t *t, unsigned int weight, int status)
}
LIST_INSERT_HEAD(&tda->tda_transports, t, tht_adapter_link);
- t->tht_dvb_adapter = tda;
- t->tht_status = TRANSPORT_RUNNING;
+ t->tht_status = status;
dvb_tune_tdmi(tdmi, 1, TDMI_RUNNING);
return 0;
diff --git a/dvb_fe.c b/dvb_fe.c
index 83503568..7f1f0f18 100644
--- a/dvb_fe.c
+++ b/dvb_fe.c
@@ -81,13 +81,12 @@ dvb_fe_manager(void *aux)
tdmi = c->tdmi;
- i = ioctl(tda->tda_fe_fd, FE_SET_FRONTEND,
- tdmi->tdmi_mux->tdm_fe_params);
+ i = ioctl(tda->tda_fe_fd, FE_SET_FRONTEND, tdmi->tdmi_fe_params);
if(i != 0) {
syslog(LOG_ERR, "\"%s\" tuning to %dHz"
" -- Front configuration failed -- %s",
- tda->tda_path, tdmi->tdmi_mux->tdm_fe_params->frequency,
+ tda->tda_rootpath, tdmi->tdmi_fe_params->frequency,
strerror(errno));
}
free(c);
@@ -195,7 +194,7 @@ dvb_tune_tdmi(th_dvb_mux_instance_t *tdmi, int maylog, tdmi_state_t state)
if(maylog)
syslog(LOG_DEBUG, "\"%s\" tuning to mux \"%s\"",
- tda->tda_path, tdmi->tdmi_mux->tdm_title);
+ tda->tda_rootpath, tdmi->tdmi_shortname);
/* Add tables which will be activated once the tuning is completed */
diff --git a/dvb_muxconfig.c b/dvb_muxconfig.c
index 65778162..5193e773 100644
--- a/dvb_muxconfig.c
+++ b/dvb_muxconfig.c
@@ -33,34 +33,16 @@
#include "transports.h"
-static void
-dvb_add_mux_instance(th_dvb_adapter_t *tda, th_dvb_mux_t *tdm)
-{
- th_dvb_mux_instance_t *tdmi;
-
- tdmi = calloc(1, sizeof(th_dvb_mux_instance_t));
-
- pthread_mutex_init(&tdmi->tdmi_table_lock, NULL);
-
- tdmi->tdmi_status = TDMI_CONFIGURED;
-
- tdmi->tdmi_mux = tdm;
- tdmi->tdmi_adapter = tda;
-
- LIST_INSERT_HEAD(&tda->tda_muxes_configured, tdmi, tdmi_adapter_link);
- LIST_INSERT_HEAD(&tdm->tdm_instances, tdmi, tdmi_mux_link);
-}
-
static void
-dvb_add_mux(struct dvb_frontend_parameters *fe_param, const char *name,
- fe_type_t type)
+dvb_add_mux(struct dvb_frontend_parameters *fe_param, fe_type_t type)
{
- th_dvb_mux_t *tdm;
th_dvb_adapter_t *tda;
char buf[100];
char *typetxt;
+ th_dvb_mux_instance_t *tdmi;
+
switch(type) {
case FE_QPSK:
typetxt = "DVB-S";
@@ -78,37 +60,39 @@ dvb_add_mux(struct dvb_frontend_parameters *fe_param, const char *name,
return;
}
- tdm = calloc(1, sizeof(th_dvb_mux_t));
- tdm->tdm_type = type;
-
- tdm->tdm_fe_params = malloc(sizeof(struct dvb_frontend_parameters));
-
- memcpy(tdm->tdm_fe_params, fe_param,
- sizeof(struct dvb_frontend_parameters));
-
- if(name == NULL) {
- snprintf(buf, sizeof(buf), "%s-%d", typetxt, fe_param->frequency);
-
- tdm->tdm_name = strdup(buf);
-
- snprintf(buf, sizeof(buf), "%s: %.1f MHz", typetxt,
- (float)fe_param->frequency / 1000000.0f);
- } else {
- tdm->tdm_name = strdup(name);
- snprintf(buf, sizeof(buf), "%s: %.1f MHz (%s)", typetxt,
- (float)fe_param->frequency / 1000000.0f, name);
- }
-
- tdm->tdm_title = strdup(buf);
-
- LIST_INSERT_HEAD(&dvb_muxes, tdm, tdm_global_link);
-
LIST_FOREACH(tda, &dvb_adapters_probing, tda_link) {
- if(tda->tda_fe_info->type == type)
- dvb_add_mux_instance(tda, tdm);
+ if(tda->tda_fe_info->type != type)
+ continue; /* Does not match frontend */
+
+ tdmi = calloc(1, sizeof(th_dvb_mux_instance_t));
+ pthread_mutex_init(&tdmi->tdmi_table_lock, NULL);
+
+ tdmi->tdmi_status = TDMI_CONFIGURED;
+ tdmi->tdmi_adapter = tda;
+ LIST_INSERT_HEAD(&tda->tda_muxes_configured, tdmi, tdmi_adapter_link);
+
+ tdmi->tdmi_type = type;
+
+ tdmi->tdmi_fe_params = malloc(sizeof(struct dvb_frontend_parameters));
+
+ memcpy(tdmi->tdmi_fe_params, fe_param,
+ sizeof(struct dvb_frontend_parameters));
+
+ /* Generate names */
+
+ snprintf(buf, sizeof(buf), "%s/%s/%.1fMHz",
+ tda->tda_rootpath, typetxt,
+ (float)fe_param->frequency / 1000000.0f);
+ tdmi->tdmi_uniquename = strdup(buf);
+
+ snprintf(buf, sizeof(buf), "%s/%.1fMHz",
+ typetxt, (float)fe_param->frequency / 1000000.0f);
+ tdmi->tdmi_shortname = strdup(buf);
}
}
+
+
static struct strtab fectab[] = {
{ "NONE", FEC_NONE },
{ "1/2", FEC_1_2 },
@@ -196,7 +180,7 @@ dvb_t_config(const char *l)
r = str2val(fec2, fectab);
f.u.ofdm.code_rate_LP = r == FEC_NONE ? FEC_AUTO : r;
- dvb_add_mux(&f, NULL, FE_OFDM);
+ dvb_add_mux(&f, FE_OFDM);
}
@@ -223,7 +207,7 @@ dvb_c_config(const char *l)
f.u.qam.fec_inner = str2val(fec, fectab);
f.u.qam.modulation = str2val(qam, qamtab);
- dvb_add_mux(&f, NULL, FE_QAM);
+ dvb_add_mux(&f, FE_QAM);
}
@@ -280,34 +264,3 @@ dvb_mux_setup(void)
dvb_muxfile_add(ce->ce_value);
}
-
-
-/*
- *
- */
-
-int
-dvb_configure_transport(th_transport_t *t, const char *muxname,
- const char *channel_name)
-{
- th_dvb_mux_t *tdm;
-
- LIST_FOREACH(tdm, &dvb_muxes, tdm_global_link)
- if(!strcmp(tdm->tdm_name, muxname))
- break;
-
- if(tdm == NULL)
- return -1;
-
- t->tht_type = TRANSPORT_DVB;
- t->tht_start_feed = dvb_start_feed;
- t->tht_stop_feed = dvb_stop_feed;
- t->tht_dvb_mux = tdm;
- t->tht_name = strdup(tdm->tdm_title);
-
- transport_link(t, channel_find(channel_name, 1, NULL), THT_MPEG_TS);
- return 0;
-}
-
-
-
diff --git a/dvb_tables.c b/dvb_tables.c
index c6dd41d9..3b149e44 100644
--- a/dvb_tables.c
+++ b/dvb_tables.c
@@ -310,7 +310,6 @@ static int
dvb_sdt_callback(th_dvb_mux_instance_t *tdmi, uint8_t *ptr, int len,
uint8_t tableid, void *opaque)
{
- th_dvb_mux_t *tdm = tdmi->tdmi_mux;
th_transport_t *t;
int version;
int current_next_indicator;
@@ -330,7 +329,7 @@ dvb_sdt_callback(th_dvb_mux_instance_t *tdmi, uint8_t *ptr, int len,
uint8_t stype;
int ret = 0, l;
- if(tdm->tdm_network == NULL)
+ if(tdmi->tdmi_network == NULL)
return -1;
if(len < 8)
@@ -419,7 +418,7 @@ dvb_sdt_callback(th_dvb_mux_instance_t *tdmi, uint8_t *ptr, int len,
t->tht_provider = strdup(provider);
free((void *)t->tht_network);
- t->tht_network = strdup(tdm->tdm_network);
+ t->tht_network = strdup(tdmi->tdmi_network);
if(t->tht_channel == NULL) {
/* Not yet mapped to a channel */
@@ -521,8 +520,6 @@ dvb_nit_callback(th_dvb_mux_instance_t *tdmi, uint8_t *ptr, int len,
uint8_t tag, tlen;
int ntl;
char networkname[256];
- th_dvb_mux_t *tdm = tdmi->tdmi_mux;
-
ptr += 5;
len -= 5;
@@ -547,19 +544,8 @@ dvb_nit_callback(th_dvb_mux_instance_t *tdmi, uint8_t *ptr, int len,
if(dvb_get_string(networkname, sizeof(networkname), ptr, tlen, "UTF8"))
return 0;
- if(tdm->tdm_network != NULL) {
- if(strcmp(tdm->tdm_network, networkname)) {
- syslog(LOG_ALERT,
- "DVB Mux conflict \"%s\" on \"%s\" says it's \"%s\", "
- "but is has alrady been reported as \"%s\"",
- tdm->tdm_name,
- tdmi->tdmi_adapter->tda_path,
- networkname,
- tdm->tdm_network);
- }
- } else {
- tdm->tdm_network = strdup(networkname);
- }
+ free((void *)tdmi->tdmi_network);
+ tdmi->tdmi_network = strdup(networkname);
break;
}
diff --git a/htmlui.c b/htmlui.c
index 835fe7ee..9aabc455 100644
--- a/htmlui.c
+++ b/htmlui.c
@@ -949,7 +949,7 @@ page_status(http_connection_t *hc, const char *remain, void *opaque)
} else {
LIST_FOREACH(tda, &dvb_adapters_running, tda_link) {
tcp_qprintf(&tq, "
%s
%s
",
- tda->tda_path, tda->tda_info);
+ tda->tda_rootpath, tda->tda_info);
LIST_FOREACH(tdmi, &tda->tda_muxes_active, tdmi_adapter_link) {
tcp_qprintf(&tq,
@@ -957,7 +957,7 @@ page_status(http_connection_t *hc, const char *remain, void *opaque)
"width: 160px; float: left\">"
"%s"
"",
- tdmi->tdmi_mux->tdm_title);
+ tdmi->tdmi_shortname);
txt = tdmi->tdmi_status ?: "Ok";
if(tdmi->tdmi_fec_err_per_sec > DVB_FEC_ERROR_LIMIT)
@@ -1110,8 +1110,8 @@ page_status(http_connection_t *hc, const char *remain, void *opaque)
break;
case TRANSPORT_DVB:
- t1 = t->tht_dvb_mux->tdm_name;
- t2 = t->tht_dvb_adapter->tda_path;
+ t1 = t->tht_dvb_mux_instance->tdmi_shortname;
+ t2 = t->tht_dvb_mux_instance->tdmi_adapter->tda_rootpath;
break;
case TRANSPORT_AVGEN:
diff --git a/htsclient.c b/htsclient.c
index aec800ce..046981d3 100644
--- a/htsclient.c
+++ b/htsclient.c
@@ -194,7 +194,6 @@ cr_show(client_t *c, char **argv, int argc)
th_transport_t *t;
th_channel_t *ch;
th_dvb_adapter_t *tda;
- th_dvb_mux_t *tdm;
th_dvb_mux_instance_t *tdmi;
event_t *e;
char *tmp;
@@ -305,26 +304,10 @@ cr_show(client_t *c, char **argv, int argc)
return 0;
}
- if(!strcasecmp(subcmd, "dvbmuxes")) {
- LIST_FOREACH(tdm, &dvb_muxes, tdm_global_link) {
-
- cprintf(c, "\"%s\"\n", tdm->tdm_title);
-
- LIST_FOREACH(tdmi, &tdm->tdm_instances, tdmi_mux_link) {
- cprintf(c, "%20s: ", tdmi->tdmi_adapter->tda_path);
-
- print_tdmi(c, tdmi);
-
-
- }
- }
- return 0;
- }
-
if(!strcasecmp(subcmd, "dvbadapters")) {
LIST_FOREACH(tda, &dvb_adapters_running, tda_link) {
- cprintf(c, "%20s: ", tda->tda_path);
+ cprintf(c, "%20s: ", tda->tda_rootpath);
tdmi = tda->tda_mux_current;
@@ -333,7 +316,7 @@ cr_show(client_t *c, char **argv, int argc)
continue;
}
- cprintf(c, "Tuned to \"%s\"\n", tdmi->tdmi_mux->tdm_title);
+ cprintf(c, "Tuned to \"%s\"\n", tdmi->tdmi_shortname);
cprintf(c, "\t\t ");
print_tdmi(c, tda->tda_mux_current);
@@ -870,12 +853,8 @@ client_status_update(void *aux, int64_t now)
{
client_t *c = aux;
th_channel_t *ch;
- th_dvb_adapter_t *tda;
- th_v4l_adapter_t *v4l;
- th_dvb_mux_instance_t *tdmi;
th_subscription_t *s;
th_transport_t *t;
- int ccerr, rate;
dtimer_arm(&c->c_status_timer, client_status_update, c, 1);
@@ -891,93 +870,8 @@ client_status_update(void *aux, int64_t now)
continue;
}
- ccerr = avgstat_read(&t->tht_cc_errors, 60, dispatch_clock);
- rate = avgstat_read_and_expire(&t->tht_rate, dispatch_clock);
- rate = rate * 8 / 1000 / 10; /* convert to kbit / s */
-
- switch(t->tht_type) {
- default:
- break;
-
- case TRANSPORT_DVB:
- if((tda = t->tht_dvb_adapter) == NULL) {
- csprintf(c, ch,
- "status = 0\n"
- "info = No adapter available"
- "transport = %s\n",
- t->tht_name);
- break;
- }
- if((tdmi = tda->tda_mux_current) == NULL) {
- csprintf(c, ch,
- "status = 0\n"
- "info = No mux available"
- "transport = %s\n",
- t->tht_name);
- break;
- }
-
- if(tdmi->tdmi_status == NULL) {
- csprintf(c, ch,
- "status = 1\n"
- "info = Signal ok\n"
- "adapter = %s\n"
- "transport = %s\n"
- "uncorrected-blocks = %d\n"
- "rate = %d\n"
- "cc-errors = %d\n",
- tda->tda_path,
- t->tht_name,
- tdmi->tdmi_uncorrected_blocks,
- rate, ccerr);
-
-
- } else {
- csprintf(c, ch,
- "status = 0"
- "info = %s"
- "adapter = %s\n"
- "transport = %s\n",
- tdmi->tdmi_status,
- tda->tda_path,
- t->tht_name);
- }
- break;
-
- case TRANSPORT_IPTV:
- csprintf(c, ch,
- "status = 1\n"
- "info = Signal ok\n"
- "transport = %s\n"
- "rate = %d\n"
- "cc-errors = %d\n",
- t->tht_name,
- rate, ccerr);
- break;
-
- case TRANSPORT_V4L:
- v4l = t->tht_v4l_adapter;
- if(v4l == NULL) {
- csprintf(c, ch,
- "status = 0\n"
- "info = No adapter available"
- "transport = %s\n",
- t->tht_name);
- continue;
- }
-
- csprintf(c, ch,
- "status = 1\n"
- "info = Signal ok\n"
- "adapter = %s\n"
- "transport = %s\n"
- "rate = %d\n"
- "cc-errors = %d\n",
- v4l->tva_name,
- t->tht_name,
- rate, ccerr);
- break;
-
- }
+ csprintf(c, ch,
+ "status = 0\n"
+ "info = Running");
}
}
diff --git a/tvhead.h b/tvhead.h
index 44d366af..8d826bae 100644
--- a/tvhead.h
+++ b/tvhead.h
@@ -145,10 +145,8 @@ typedef enum {
* DVB Mux instance
*/
typedef struct th_dvb_mux_instance {
- LIST_ENTRY(th_dvb_mux_instance) tdmi_mux_link;
LIST_ENTRY(th_dvb_mux_instance) tdmi_adapter_link;
- struct th_dvb_mux *tdmi_mux;
struct th_dvb_adapter *tdmi_adapter;
uint16_t tdmi_snr, tdmi_signal;
@@ -169,8 +167,16 @@ typedef struct th_dvb_mux_instance {
time_t tdmi_got_adapter;
time_t tdmi_lost_adapter;
+ int tdmi_type; /* really fe_type_t */
+ struct dvb_frontend_parameters *tdmi_fe_params;
+
+ const char *tdmi_shortname; /* Only unique for the specific adapter */
+ const char *tdmi_uniquename; /* Globally unique */
+ const char *tdmi_network; /* Name of network, from NIT table */
} th_dvb_mux_instance_t;
+
+
/*
*
*/
@@ -189,27 +195,6 @@ typedef struct th_dvb_table {
} th_dvb_table_t;
-/*
- * DVB Mux (more or less the DVB frontend configuration on)
- */
-typedef struct th_dvb_mux {
- LIST_ENTRY(th_dvb_mux) tdm_global_link;
-
- struct th_dvb_mux_instance_list tdm_instances;
-
- struct dvb_frontend_parameters *tdm_fe_params;
-
- /* XXX: One of these shoud go, there has to be limits */
-
- const char *tdm_name;
- const char *tdm_title;
- const char *tdm_network;
-
- int tdm_type; /* really fe_type_t */
-
-} th_dvb_mux_t;
-
-
/*
* DVB Adapter (one of these per physical adapter)
*/
@@ -222,7 +207,7 @@ typedef struct th_dvb_adapter {
struct th_dvb_mux_instance_list tda_muxes_active;
th_dvb_mux_instance_t *tda_mux_current;
- const char *tda_path;
+ const char *tda_rootpath;
const char *tda_info;
LIST_ENTRY(th_dvb_adapter) tda_link;
@@ -408,8 +393,7 @@ typedef struct th_transport {
union {
struct {
- struct th_dvb_mux *mux;
- struct th_dvb_adapter *adapter;
+ struct th_dvb_mux_instance *mux_instance;
} dvb;
struct {
@@ -459,8 +443,7 @@ typedef struct th_transport {
#define tht_v4l_frequency u.v4l.frequency
#define tht_v4l_adapter u.v4l.adapter
-#define tht_dvb_mux u.dvb.mux
-#define tht_dvb_adapter u.dvb.adapter
+#define tht_dvb_mux_instance u.dvb.mux_instance
#define tht_iptv_group_addr u.iptv.group_addr
#define tht_iptv_interface_addr u.iptv.interface_addr