diff options
author | attila <attila@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-11-01 15:17:01 +0000 |
---|---|---|
committer | attila <attila@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-11-01 15:17:01 +0000 |
commit | 4b1211d2d0fa3bd4b9ed112acf528299b82ea962 (patch) | |
tree | 976dbcd01a54132ea2efd09c6a0baf6a0297c500 /libmpdemux | |
parent | 6ce8b10dd24d257ad609fff7e9919ff4d8e918e7 (diff) | |
download | mpv-4b1211d2d0fa3bd4b9ed112acf528299b82ea962.tar.bz2 mpv-4b1211d2d0fa3bd4b9ed112acf528299b82ea962.tar.xz |
Patch by Nico <nsabbi@libero.it>
this patch fixes a recently discovered bug for which DVB-C users
couldn't tune
(wrong parsing of the config file and incorrect parameter passing to
tune_it())
and includes the still unapplied patch posted in date 6/9/2003:
- it works correctly with and without caches; in the former case it
doesn't take anymore a lot of time to empty the cache before changing channel;
the uninit_cache() function is called in mplayer.c just after
the new tuning operation
- initialized a variable identifying the tuner type, and exit if it
isn't supported
- doesn't crash anymore when
1) the channels file doesn't exists
2) the tuner is used by another application
3) in the menu, when trying to select a channel before the first
4) some mp_msg() called in case of error
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@11353 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/dvb_tune.c | 8 | ||||
-rw-r--r-- | libmpdemux/dvbin.c | 36 |
2 files changed, 26 insertions, 18 deletions
diff --git a/libmpdemux/dvb_tune.c b/libmpdemux/dvb_tune.c index 83a0378596..e1d7e4b5c2 100644 --- a/libmpdemux/dvb_tune.c +++ b/libmpdemux/dvb_tune.c @@ -65,7 +65,7 @@ int dvb_get_tuner_type(dvb_priv_t *priv) fe_fd = open(dvb_frontenddev[priv->card], O_RDWR); if(fe_fd < 0) { - mp_msg(MSGT_DEMUX, MSGL_ERR, "get_tuner_type(%d, %s), ERROR IN OPENING FRONTEND DEVICE %s: %d\n", priv->card, dvb_frontenddev[priv->card], errno); + mp_msg(MSGT_DEMUX, MSGL_ERR, "get_tuner_type(card %d), ERROR IN OPENING FRONTEND DEVICE %s: ERRNO %d\n", priv->card, dvb_frontenddev[priv->card], errno); return 0; } @@ -104,7 +104,7 @@ static int open_fe(dvb_priv_t *priv) priv->fe_fd = open(dvb_frontenddev[priv->card], O_RDWR); if(priv->fe_fd < 0) { - mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR IN OPENING FRONTEND DEVICE %s: %d\n", dvb_frontenddev[priv->card], errno); + mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR IN OPENING FRONTEND DEVICE %s: ERRNO %d\n", dvb_frontenddev[priv->card], errno); return 0; } #ifdef HAVE_DVB_HEAD @@ -113,7 +113,7 @@ static int open_fe(dvb_priv_t *priv) priv->sec_fd = open(dvb_secdev[priv->card], O_RDWR); if(priv->sec_fd < 0) { - mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR IN OPENING SEC DEVICE %s: %d\n", dvb_secdev[priv->card], errno); + mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR IN OPENING SEC DEVICE %s: ERRNO %d\n", dvb_secdev[priv->card], errno); close(priv->fe_fd); return 0; } @@ -209,7 +209,7 @@ dvb_tune(dvb_priv_t *priv, int freq, char pol, int srate, int diseqc, int tone, if(freq > 100000000) { - tune_it(priv->fe_fd, 0, freq, 0, 0, tone, specInv, diseqc, modulation, HP_CodeRate, TransmissionMode, guardInterval, bandWidth); + tune_it(priv->fe_fd, 0, freq, srate, 0, tone, specInv, diseqc, modulation, HP_CodeRate, TransmissionMode, guardInterval, bandWidth); } else if(freq != 0) { diff --git a/libmpdemux/dvbin.c b/libmpdemux/dvbin.c index c6437c1b1a..2e4903764f 100644 --- a/libmpdemux/dvbin.c +++ b/libmpdemux/dvbin.c @@ -127,7 +127,7 @@ static dvb_channels_list *dvb_get_channels(char *filename, int type) int fields, row_count; dvb_channel_t *ptr; char *tmp_lcr, *tmp_hier, *inv, *bw, *cr, *mod, *transm, *gi; - const char *cbl_conf = "%a[^:]:%d:%c:%d:%a[^:]:%a[^:]:%d:%d\n"; + const char *cbl_conf = "%a[^:]:%d:%a[^:]:%d:%a[^:]:%a[^:]:%d:%d\n"; const char *sat_conf = "%a[^:]:%d:%c:%d:%d:%d:%d:%d:%d:%d\n"; const char *ter_conf = "%a[^:]:%d:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%d:%d\n"; @@ -296,10 +296,8 @@ static int dvb_streaming_read(stream_t *stream, char *buffer, int size) mp_msg(MSGT_DEMUX, MSGL_V, "dvb_streaming_read(%d)\n", size); - if(priv->retry) - tries = 5; - else - tries = 1; + tries = priv->retry + 1; + while(pos < size) { pfds[0].fd = fd; @@ -375,10 +373,10 @@ int dvb_set_channel(dvb_priv_t *priv, int n) dvb_demux_stop(priv->demux_fd[0]); dvb_demux_stop(priv->demux_fd[1]); priv->retry = 0; - while(stream_read(stream, buf, 4096)); //empty both the stream's and driver's buffer + while(dvb_streaming_read(stream, buf, 4096) > 0); //empty both the stream's and driver's buffer } - priv->retry = 1; + priv->retry = 5; mp_msg(MSGT_DEMUX, MSGL_V, "DVB_SET_CHANNEL: channel %d\n", n); list = priv->list; if(list == NULL) @@ -424,7 +422,7 @@ int dvb_set_channel(dvb_priv_t *priv, int n) } else { - mp_msg(MSGT_DEMUX, MSGL_V, "SAME TUNING, NO TUNING\n"); + mp_msg(MSGT_DEMUX, MSGL_V, "SAME TUNING PARAMETERS, NO TUNING\n"); do_tuning = 0; } @@ -638,7 +636,7 @@ static int dvb_open(stream_t *stream, int mode, void *opts, int *file_format) struct stream_priv_s* p = (struct stream_priv_s*)opts; char *name = NULL, *filename; dvb_priv_t *priv; - int tuner_type; + int tuner_type = 0; @@ -684,6 +682,13 @@ static int dvb_open(stream_t *stream, int mode, void *opts, int *file_format) } } + if(tuner_type == 0) + { + mp_msg(MSGT_DEMUX, MSGL_V, "OPEN_DVB: UNKNOWN OR UNDETECTABLE TUNER TYPE, EXIT\n"); + return STREAM_ERROR; + } + + priv->tuner_type = tuner_type; mp_msg(MSGT_DEMUX, MSGL_V, "OPEN_DVB: prog=%s, card=%d, type=%d, vid=%d, aid=%d, file=%s\n", @@ -696,14 +701,11 @@ static int dvb_open(stream_t *stream, int mode, void *opts, int *file_format) { if((dvb_list_ptr = dvb_get_channels(filename, tuner_type)) == NULL) mp_msg(MSGT_DEMUX, MSGL_ERR, "EMPTY CHANNELS LIST FROM FILE %s!\n", filename); - else - { - priv->list = dvb_list_ptr; - } + priv->list = dvb_list_ptr; } else { - dvb_list_ptr = NULL; + priv->list = dvb_list_ptr = NULL; mp_msg(MSGT_DEMUX, MSGL_WARN, "NO CHANNELS FILE FOUND!\n"); } } @@ -711,6 +713,12 @@ static int dvb_open(stream_t *stream, int mode, void *opts, int *file_format) priv->list = dvb_list_ptr; + if(priv->list == NULL) + { + mp_msg(MSGT_DEMUX, MSGL_ERR, "NO CHANNELS AVAILABLE, EXIT!\n"); + return STREAM_ERROR; + } + if(! strcmp(p->prog, "")) { if(dvb_list_ptr != NULL) |