mirror of https://github.com/mpv-player/mpv
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
This commit is contained in:
parent
6ce8b10dd2
commit
4b1211d2d0
|
@ -112,6 +112,8 @@ static int fill_menu(menu_t* menu)
|
|||
elem->p.txt = name;
|
||||
elem->num = n;
|
||||
|
||||
if(n == 0)
|
||||
elem->p.prev = NULL;
|
||||
|
||||
menu_list_add_entry(menu, elem);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
14
mplayer.c
14
mplayer.c
|
@ -1372,6 +1372,7 @@ if(stream->type==STREAMTYPE_DVD){
|
|||
#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 @@ if(stream_cache_size>0){
|
|||
}
|
||||
|
||||
//============ 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(!sh_video && !sh_audio){
|
|||
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 (stream->type==STREAMTYPE_DVDNAV && dvd_nav_still)
|
|||
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 (stream->type==STREAMTYPE_DVDNAV && dvd_nav_still)
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue