Add ability to force start of an DVB transport, needed for probing

This commit is contained in:
Andreas Öman 2008-05-17 09:30:41 +00:00
parent 70a03bb900
commit 0c2ac1f4e5
10 changed files with 24 additions and 18 deletions

View file

@ -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;

View file

@ -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 .. */

View file

@ -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);

View file

@ -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;

View file

@ -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);
}

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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);

6
v4l.c
View file

@ -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;