From 0c2ac1f4e52b564f2296ba29982f3bd92dcc8acf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96man?= Date: Sat, 17 May 2008 09:30:41 +0000 Subject: [PATCH] Add ability to force start of an DVB transport, needed for probing --- avgen.c | 5 +++-- dvb_dvr.c | 5 +++-- dvb_dvr.h | 3 ++- file_input.c | 5 +++-- iptv_input.c | 4 ++-- serviceprobe.c | 2 +- transports.c | 8 ++++---- transports.h | 2 +- tvhead.h | 2 +- v4l.c | 6 ++++-- 10 files changed, 24 insertions(+), 18 deletions(-) diff --git a/avgen.c b/avgen.c index d82f222c..d579eb97 100644 --- a/avgen.c +++ b/avgen.c @@ -76,7 +76,7 @@ static void avgen_deliver(th_transport_t *t, avgen_t *avg, int64_t clk); static void avgen_stop_feed(th_transport_t *t); static int avgen_start_feed(th_transport_t *t, unsigned int weight, - int status); + int status, int force_start); static void update_video(avgen_t *avg, int vframe, int framerate); static void update_audio(avgen_t *avg, int vframe, int framerate); @@ -174,7 +174,8 @@ rgb2yuv(uint8_t yuv[3], const uint8_t rgb[3]) * */ static int -avgen_start_feed(th_transport_t *t, unsigned int weight, int status) +avgen_start_feed(th_transport_t *t, unsigned int weight, int status, + int force_start) { avgen_t *avg; AVCodecContext *avctx; diff --git a/dvb_dvr.c b/dvb_dvr.c index 88b8198c..42b7b8c2 100644 --- a/dvb_dvr.c +++ b/dvb_dvr.c @@ -137,7 +137,8 @@ dvb_stop_feed(th_transport_t *t) * transports that is subscribing to the adapter */ int -dvb_start_feed(th_transport_t *t, unsigned int weight, int status) +dvb_start_feed(th_transport_t *t, unsigned int weight, int status, + int force_start) { struct dmx_pes_filter_params dmx_param; th_stream_t *st; @@ -150,7 +151,7 @@ dvb_start_feed(th_transport_t *t, unsigned int weight, int status) /* Check if adapter is idle, or already tuned */ - if(tdmi != NULL && tdmi != t->tht_dvb_mux_instance) { + if(tdmi != NULL && tdmi != t->tht_dvb_mux_instance && !force_start) { /* Nope .. */ diff --git a/dvb_dvr.h b/dvb_dvr.h index ec005264..8ff3eea2 100644 --- a/dvb_dvr.h +++ b/dvb_dvr.h @@ -21,7 +21,8 @@ int dvb_dvr_init(th_dvb_adapter_t *tda); -int dvb_start_feed(struct th_transport *t, unsigned int weight, int status); +int dvb_start_feed(struct th_transport *t, unsigned int weight, int status, + int force_start); void dvb_stop_feed(th_transport_t *t); diff --git a/file_input.c b/file_input.c index 28cf6a48..98befac9 100644 --- a/file_input.c +++ b/file_input.c @@ -61,7 +61,7 @@ typedef struct file_input { static void file_input_stop_feed(th_transport_t *t); static int file_input_start_feed(th_transport_t *t, unsigned int weight, - int status); + int status, int force_start); static void fi_deliver(void *aux, int64_t now); @@ -191,7 +191,8 @@ file_input_reset(th_transport_t *t, file_input_t *fi) * */ static int -file_input_start_feed(th_transport_t *t, unsigned int weight, int status) +file_input_start_feed(th_transport_t *t, unsigned int weight, int status, + int force_start) { file_input_t *fi = t->tht_file_input; diff --git a/iptv_input.c b/iptv_input.c index 209dab7c..2858668a 100644 --- a/iptv_input.c +++ b/iptv_input.c @@ -68,7 +68,7 @@ iptv_fd_callback(int events, void *opaque, int fd) } static int -iptv_start_feed(th_transport_t *t, unsigned int weight, int status) +iptv_start_feed(th_transport_t *t, unsigned int weight, int status, int force) { int fd; struct ip_mreqn m; @@ -253,7 +253,7 @@ static void iptv_probe_transport(th_transport_t *t) { syslog(LOG_INFO, "iptv: Probing transport %s", t->tht_name); - iptv_start_feed(t, 1, TRANSPORT_PROBING); + iptv_start_feed(t, 1, TRANSPORT_PROBING, 1); } diff --git a/serviceprobe.c b/serviceprobe.c index fcb6870f..37572abb 100644 --- a/serviceprobe.c +++ b/serviceprobe.c @@ -184,7 +184,7 @@ serviceprobe_start(void *aux, int64_t now) if(t->tht_runstatus != TRANSPORT_RUNNING) - transport_start(t, INT32_MAX); + transport_start(t, INT32_MAX, 1); s->ths_transport = t; LIST_INSERT_HEAD(&t->tht_subscriptions, s, ths_transport_link); diff --git a/transports.c b/transports.c index f2dc3e62..f71ae584 100644 --- a/transports.c +++ b/transports.c @@ -157,7 +157,7 @@ transport_stop(th_transport_t *t, int flush_subscriptions) * */ int -transport_start(th_transport_t *t, unsigned int weight) +transport_start(th_transport_t *t, unsigned int weight, int force_start) { th_stream_t *st; AVCodec *c; @@ -165,7 +165,7 @@ transport_start(th_transport_t *t, unsigned int weight) assert(t->tht_runstatus != TRANSPORT_RUNNING); - if(t->tht_start_feed(t, weight, TRANSPORT_RUNNING)) + if(t->tht_start_feed(t, weight, TRANSPORT_RUNNING, force_start)) return -1; t->tht_monitor_suspend = 10; @@ -313,7 +313,7 @@ transport_find(channel_t *ch, unsigned int weight) if(t->tht_runstatus == TRANSPORT_RUNNING) return t; - if(!transport_start(t, 0)) + if(!transport_start(t, 0, 0)) return t; } @@ -322,7 +322,7 @@ transport_find(channel_t *ch, unsigned int weight) for(i = 0; i < cnt; i++) { t = vec[i]; - if(!transport_start(t, weight)) + if(!transport_start(t, weight, 0)) return t; } return NULL; diff --git a/transports.h b/transports.h index 64229114..807e840d 100644 --- a/transports.h +++ b/transports.h @@ -23,7 +23,7 @@ unsigned int transport_compute_weight(struct th_transport_list *head); -int transport_start(th_transport_t *t, unsigned int weight); +int transport_start(th_transport_t *t, unsigned int weight, int force_start); void transport_stop(th_transport_t *t, int flush_subscriptions); diff --git a/tvhead.h b/tvhead.h index f41639c9..4045dfa2 100644 --- a/tvhead.h +++ b/tvhead.h @@ -436,7 +436,7 @@ typedef struct th_transport { LIST_HEAD(, th_subscription) tht_subscriptions; int (*tht_start_feed)(struct th_transport *t, unsigned int weight, - int status); + int status, int force_start); void (*tht_stop_feed)(struct th_transport *t); diff --git a/v4l.c b/v4l.c index 78f4de18..76e9b32a 100644 --- a/v4l.c +++ b/v4l.c @@ -53,7 +53,8 @@ static void v4l_add_adapter(const char *path); static void v4l_stop_feed(th_transport_t *t); -static int v4l_start_feed(th_transport_t *t, unsigned int weight, int status); +static int v4l_start_feed(th_transport_t *t, unsigned int weight, int status, + int force_start); /* * @@ -232,7 +233,8 @@ v4l_adapter_clean(th_v4l_adapter_t *tva) * */ static int -v4l_start_feed(th_transport_t *t, unsigned int weight, int status) +v4l_start_feed(th_transport_t *t, unsigned int weight, int status, + int force_start) { th_v4l_adapter_t *tva, *cand = NULL; int w, fd;