Mercurial > mplayer.hg
changeset 11352:d8b1f7509df2
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
author | attila |
---|---|
date | Sat, 01 Nov 2003 15:17:01 +0000 |
parents | dce7219bed77 |
children | d405317808ac |
files | libmenu/menu_dvbin.c libmpdemux/dvb_tune.c libmpdemux/dvbin.c mplayer.c |
diffstat | 4 files changed, 35 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/libmenu/menu_dvbin.c Sat Nov 01 14:57:40 2003 +0000 +++ b/libmenu/menu_dvbin.c Sat Nov 01 15:17:01 2003 +0000 @@ -112,6 +112,8 @@ elem->p.txt = name; elem->num = n; + if(n == 0) + elem->p.prev = NULL; menu_list_add_entry(menu, elem); }
--- a/libmpdemux/dvb_tune.c Sat Nov 01 14:57:40 2003 +0000 +++ b/libmpdemux/dvb_tune.c Sat Nov 01 15:17:01 2003 +0000 @@ -65,7 +65,7 @@ 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 @@ 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 @@ 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 @@ 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) {
--- a/libmpdemux/dvbin.c Sat Nov 01 14:57:40 2003 +0000 +++ b/libmpdemux/dvbin.c Sat Nov 01 15:17:01 2003 +0000 @@ -127,7 +127,7 @@ 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 @@ 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 @@ 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 @@ } 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 @@ 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 @@ } } + 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 @@ { 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 @@ 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)
--- a/mplayer.c Sat Nov 01 14:57:40 2003 +0000 +++ b/mplayer.c Sat Nov 01 15:17:01 2003 +0000 @@ -1372,6 +1372,7 @@ #endif // CACHE2: initial prefill: 20% later: 5% (should be set by -cacheopts) +goto_enable_cache: if(stream_cache_size>0){ current_module="enable_cache"; if(!stream_enable_cache(stream,stream_cache_size*1024,stream_cache_size*1024/5,stream_cache_size*1024/20)) @@ -1379,9 +1380,6 @@ } //============ Open DEMUXERS --- DETECT file type ======================= -#ifdef HAS_DVBIN_SUPPORT -goto_open_demuxer: -#endif current_module="demux_open"; demuxer=demux_open(stream,file_format,audio_id,video_id,dvdsub_id,filename); @@ -1568,7 +1566,8 @@ if(dvb_step_channel(priv, dir)) { uninit_player(INITED_ALL-(INITED_STREAM|INITED_INPUT)); - goto goto_open_demuxer; + cache_uninit(stream); + goto goto_enable_cache; } } } @@ -2933,8 +2932,8 @@ if(dvb_step_channel(priv, dir)) { uninit_player(INITED_ALL-(INITED_STREAM|INITED_INPUT)); - printf("UNINIT COMPLETE\n"); - goto goto_open_demuxer; + cache_uninit(stream); + goto goto_enable_cache; } } } @@ -2967,7 +2966,8 @@ if(dvb_set_channel(priv, cmd->args[0].v.i)) { uninit_player(INITED_ALL-(INITED_STREAM|INITED_INPUT)); - goto goto_open_demuxer; + cache_uninit(stream); + goto goto_enable_cache; } } }