summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authornicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-06-04 23:04:42 +0000
committernicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-06-04 23:04:42 +0000
commit5bc7c258978efa8726d0fdb2f522900763215285 (patch)
treeca671ab2f1154430e6d2ff4ae13a4bacb0924304 /libmpdemux
parentcf601586ab8344d4d795edbc21437c1a41267f13 (diff)
downloadmpv-5bc7c258978efa8726d0fdb2f522900763215285.tar.bz2
mpv-5bc7c258978efa8726d0fdb2f522900763215285.tar.xz
configurable tuning timeout
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18562 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/dvb_tune.c22
-rw-r--r--libmpdemux/dvbin.c10
-rw-r--r--libmpdemux/dvbin.h1
3 files changed, 19 insertions, 14 deletions
diff --git a/libmpdemux/dvb_tune.c b/libmpdemux/dvb_tune.c
index 75f16d04bf..81ceda108a 100644
--- a/libmpdemux/dvb_tune.c
+++ b/libmpdemux/dvb_tune.c
@@ -238,19 +238,19 @@ int dvb_demux_start(int fd)
static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int srate, char pol, int tone,
fe_spectral_inversion_t specInv, unsigned int diseqc, fe_modulation_t modulation, fe_code_rate_t HP_CodeRate,
fe_transmit_mode_t TransmissionMode, fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth,
- fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier);
+ fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int tmout);
int dvb_tune(dvb_priv_t *priv, int freq, char pol, int srate, int diseqc, int tone,
fe_spectral_inversion_t specInv, fe_modulation_t modulation, fe_guard_interval_t guardInterval,
fe_transmit_mode_t TransmissionMode, fe_bandwidth_t bandWidth, fe_code_rate_t HP_CodeRate,
- fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier)
+ fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int timeout)
{
int ris;
mp_msg(MSGT_DEMUX, MSGL_INFO, "dvb_tune Freq: %lu\n", (long unsigned int) freq);
- ris = tune_it(priv->fe_fd, priv->sec_fd, freq, srate, pol, tone, specInv, diseqc, modulation, HP_CodeRate, TransmissionMode, guardInterval, bandWidth, LP_CodeRate, hier);
+ ris = tune_it(priv->fe_fd, priv->sec_fd, freq, srate, pol, tone, specInv, diseqc, modulation, HP_CodeRate, TransmissionMode, guardInterval, bandWidth, LP_CodeRate, hier, timeout);
if(ris != 0)
mp_msg(MSGT_DEMUX, MSGL_INFO, "dvb_tune, TUNING FAILED\n");
@@ -338,7 +338,7 @@ static void print_status(fe_status_t festatus)
#ifdef HAVE_DVB_HEAD
-static int check_status(int fd_frontend,struct dvb_frontend_parameters* feparams, int tuner_type, uint32_t base)
+static int check_status(int fd_frontend,struct dvb_frontend_parameters* feparams, int tuner_type, uint32_t base, int tmout)
{
int32_t strength;
fe_status_t festatus;
@@ -360,7 +360,7 @@ static int check_status(int fd_frontend,struct dvb_frontend_parameters* feparams
while(!ok)
{
festatus = 0;
- if(poll(pfd,1,3000) > 0)
+ if(poll(pfd,1,tmout*1000) > 0)
{
if (pfd[0].revents & POLLPRI)
{
@@ -371,7 +371,7 @@ static int check_status(int fd_frontend,struct dvb_frontend_parameters* feparams
}
usleep(10000);
tm2 = time((time_t*) NULL);
- if((festatus & FE_TIMEDOUT) || (locks >= 2) || (tm2 - tm1 >= 3))
+ if((festatus & FE_TIMEDOUT) || (locks >= 2) || (tm2 - tm1 >= tmout))
ok = 1;
}
@@ -426,7 +426,7 @@ static int check_status(int fd_frontend,struct dvb_frontend_parameters* feparams
}
else
{
- mp_msg(MSGT_DEMUX, MSGL_ERR, "Not able to lock to the signal on the given frequency\n");
+ mp_msg(MSGT_DEMUX, MSGL_ERR, "Not able to lock to the signal on the given frequency, timeout: %d\n", tmout);
return -1;
}
return 0;
@@ -434,7 +434,7 @@ static int check_status(int fd_frontend,struct dvb_frontend_parameters* feparams
#else
-static int check_status(int fd_frontend,FrontendParameters* feparams,int tuner_type,uint32_t base)
+static int check_status(int fd_frontend,FrontendParameters* feparams,int tuner_type,uint32_t base, int tmout)
{
int i,res;
int32_t strength;
@@ -461,7 +461,7 @@ static int check_status(int fd_frontend,FrontendParameters* feparams,int tuner_t
pfd[0].fd = fd_frontend;
pfd[0].events = POLLIN | POLLPRI;
- if(poll(pfd,1,10000) > 0)
+ if(poll(pfd,1,tmout*1000) > 0)
{
if (pfd[0].revents & POLLPRI)
{
@@ -643,7 +643,7 @@ static int do_diseqc(int secfd, int sat_no, int polv, int hi_lo)
static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int srate, char pol, int tone,
fe_spectral_inversion_t specInv, unsigned int diseqc, fe_modulation_t modulation, fe_code_rate_t HP_CodeRate,
fe_transmit_mode_t TransmissionMode, fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth,
- fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier)
+ fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int timeout)
{
int res, hi_lo, dfd;
#ifdef HAVE_DVB_HEAD
@@ -787,5 +787,5 @@ static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int
if (fd_sec) SecGetStatus(fd_sec, &sec_state);
#endif
- return(check_status(fd_frontend,&feparams,fe_info.type, (hi_lo ? LOF2 : LOF1)));
+ return(check_status(fd_frontend,&feparams,fe_info.type, (hi_lo ? LOF2 : LOF1), timeout));
}
diff --git a/libmpdemux/dvbin.c b/libmpdemux/dvbin.c
index e0815b04c2..d04f302b12 100644
--- a/libmpdemux/dvbin.c
+++ b/libmpdemux/dvbin.c
@@ -64,11 +64,12 @@ static struct stream_priv_s
int card;
char *type;
int vid, aid;
+ int timeout;
char *file;
}
stream_defaults =
{
- "", 1, "", 0, 0, NULL
+ "", 1, "", 0, 0, 3, NULL
};
#define ST_OFF(f) M_ST_OFF(struct stream_priv_s, f)
@@ -80,6 +81,7 @@ static m_option_t stream_params[] = {
{"type", ST_OFF(type), CONF_TYPE_STRING, 0, 0 ,0, NULL},
{"vid", ST_OFF(vid), CONF_TYPE_INT, 0, 0 ,0, NULL},
{"aid", ST_OFF(aid), CONF_TYPE_INT, 0, 0 ,0, NULL},
+ {"timeout",ST_OFF(timeout), CONF_TYPE_INT, M_OPT_RANGE, 1, 30, NULL},
{"file", ST_OFF(file), CONF_TYPE_STRING, 0, 0 ,0, NULL},
{"hostname", ST_OFF(prog), CONF_TYPE_STRING, 0, 0, 0, NULL },
@@ -102,6 +104,7 @@ m_option_t dvbin_opts_conf[] = {
{"type", "DVB card type is autodetected and can't be overridden\n", CONF_TYPE_PRINT, CONF_NOCFG, 0 ,0, NULL},
{"vid", &stream_defaults.vid, CONF_TYPE_INT, 0, 0 ,0, NULL},
{"aid", &stream_defaults.aid, CONF_TYPE_INT, 0, 0 ,0, NULL},
+ {"timeout", &stream_defaults.timeout, CONF_TYPE_INT, M_OPT_RANGE, 1, 30, NULL},
{"file", &stream_defaults.file, CONF_TYPE_STRING, 0, 0 ,0, NULL},
{NULL, NULL, 0, 0, 0, 0, NULL}
@@ -119,7 +122,7 @@ int dvb_fix_demuxes(dvb_priv_t *priv, int cnt, int *pids);
extern int dvb_tune(dvb_priv_t *priv, int freq, char pol, int srate, int diseqc, int tone,
fe_spectral_inversion_t specInv, fe_modulation_t modulation, fe_guard_interval_t guardInterval,
fe_transmit_mode_t TransmissionMode, fe_bandwidth_t bandWidth, fe_code_rate_t HP_CodeRate,
- fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier);
+ fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int timeout);
extern char *dvb_dvrdev[4], *dvb_demuxdev[4], *dvb_frontenddev[4];
static dvb_config_t *dvb_config = NULL;
@@ -560,7 +563,7 @@ int dvb_set_channel(dvb_priv_t *priv, int card, int n)
if(do_tuning)
if (! dvb_tune(priv, channel->freq, channel->pol, channel->srate, channel->diseqc, channel->tone,
- channel->inv, channel->mod, channel->gi, channel->trans, channel->bw, channel->cr, channel->cr_lp, channel->hier))
+ channel->inv, channel->mod, channel->gi, channel->trans, channel->bw, channel->cr, channel->cr_lp, channel->hier, priv->timeout))
return 0;
@@ -733,6 +736,7 @@ static int dvb_open(stream_t *stream, int mode, void *opts, int *file_format)
return STREAM_ERROR;
}
priv->card = p->card - 1;
+ priv->timeout = p->timeout;
tuner_type = priv->config->cards[priv->card].type;
diff --git a/libmpdemux/dvbin.h b/libmpdemux/dvbin.h
index 02c75b67d4..369fd86f03 100644
--- a/libmpdemux/dvbin.h
+++ b/libmpdemux/dvbin.h
@@ -99,6 +99,7 @@ typedef struct {
stream_t *stream;
char new_tuning[256], prev_tuning[256];
int retry;
+ int timeout;
} dvb_priv_t;