diff --git a/avgen.c b/avgen.c index f13e6ed8..a271f930 100644 --- a/avgen.c +++ b/avgen.c @@ -118,7 +118,7 @@ avgen_init(void) t->tht_uniquename = strdup("TEST1"); - transport_link(t, ch); + transport_link(t, ch, THT_OTHER); } diff --git a/channels.c b/channels.c index 8d16bef6..318a7d28 100644 --- a/channels.c +++ b/channels.c @@ -239,18 +239,6 @@ service_load(struct config_head *head) free(t); } -/** - * - */ -void -transport_link(th_transport_t *t, th_channel_t *ch) -{ - transport_set_channel(t, ch); - transport_monitor_init(t); - LIST_INSERT_HEAD(&all_transports, t, tht_global_link); -} - - /** * */ diff --git a/dvb.c b/dvb.c index 97518379..762ce959 100644 --- a/dvb.c +++ b/dvb.c @@ -168,7 +168,7 @@ dvb_find_transport(th_dvb_mux_instance_t *tdmi, uint16_t tid, return NULL; t = calloc(1, sizeof(th_transport_t)); - transport_monitor_init(t); + transport_init(t, THT_MPEG_TS); t->tht_dvb_transport_id = tid; t->tht_dvb_service_id = sid; diff --git a/dvb_muxconfig.c b/dvb_muxconfig.c index 6c397054..49743763 100644 --- a/dvb_muxconfig.c +++ b/dvb_muxconfig.c @@ -338,7 +338,7 @@ dvb_configure_transport(th_transport_t *t, const char *muxname, t->tht_dvb_mux = tdm; t->tht_name = strdup(tdm->tdm_title); - transport_link(t, channel_find(channel_name, 1, NULL)); + transport_link(t, channel_find(channel_name, 1, NULL), THT_MPEG_TS); return 0; } diff --git a/iptv_input.c b/iptv_input.c index 80e0a712..c0711f1b 100644 --- a/iptv_input.c +++ b/iptv_input.c @@ -286,7 +286,7 @@ iptv_probe_done(th_transport_t *t, int timeout) iptv_stop_feed(t); if(!timeout) - transport_link(t, t->tht_channel); + transport_link(t, t->tht_channel, THT_MPEG_TS); else LIST_INSERT_HEAD(&iptv_stale_transports, t, tht_adapter_link); diff --git a/transports.c b/transports.c index a7262739..fbb7823c 100644 --- a/transports.c +++ b/transports.c @@ -329,9 +329,14 @@ transport_monitor(void *aux, int64_t now) } +/** + * + */ void -transport_monitor_init(th_transport_t *t) +transport_init(th_transport_t *t, int source_type) { + t->tht_source_type = source_type; + avgstat_init(&t->tht_cc_errors, 3600); avgstat_init(&t->tht_rate, 10); @@ -339,6 +344,19 @@ transport_monitor_init(th_transport_t *t) } +/** + * + */ +void +transport_link(th_transport_t *t, th_channel_t *ch, int source_type) +{ + transport_set_channel(t, ch); + transport_init(t, source_type); + LIST_INSERT_HEAD(&all_transports, t, tht_global_link); +} + + + th_stream_t * transport_add_stream(th_transport_t *t, int pid, tv_streamtype_t type) { diff --git a/transports.h b/transports.h index 246bd31b..ae5c5ecd 100644 --- a/transports.h +++ b/transports.h @@ -25,11 +25,11 @@ unsigned int transport_compute_weight(struct th_transport_list *head); void transport_stop(th_transport_t *t, int flush_subscriptions); -void transport_monitor_init(th_transport_t *t); +void transport_init(th_transport_t *t, int source_type); -int transport_set_channel(th_transport_t *th, th_channel_t *ch); +void transport_link(th_transport_t *t, th_channel_t *ch, int source_type); -void transport_link(th_transport_t *t, th_channel_t *ch); +int transport_set_channel(th_transport_t *t, th_channel_t *ch); th_transport_t *transport_find(th_channel_t *ch, unsigned int weight); diff --git a/tvhead.h b/tvhead.h index ffa5cf9c..3611b2c1 100644 --- a/tvhead.h +++ b/tvhead.h @@ -442,6 +442,11 @@ typedef struct th_transport { const char *tht_uniquename; const char *tht_network; + enum { + THT_MPEG_TS, + THT_OTHER, + } tht_source_type; + } th_transport_t; diff --git a/v4l.c b/v4l.c index 730e9f88..b28e34bd 100644 --- a/v4l.c +++ b/v4l.c @@ -101,7 +101,7 @@ v4l_configure_transport(th_transport_t *t, const char *muxname, snprintf(buf, sizeof(buf), "ANALOG:%u", t->tht_v4l_frequency); t->tht_uniquename = strdup(buf); - transport_link(t, channel_find(channel_name, 1, NULL)); + transport_link(t, channel_find(channel_name, 1, NULL), THT_OTHER); return 0; }