Mercurial > mplayer.hg
changeset 12108:06c4780332bc
disallow non-sense type parameter; added support for absolute file path; prefer channels.conf.{sat,ter,cbl} over channels.conf if the file is available
author | nicodvb |
---|---|
date | Sat, 03 Apr 2004 10:30:46 +0000 |
parents | bc89ddda34b8 |
children | b888e3fd8cc8 |
files | libmpdemux/dvbin.c |
diffstat | 1 files changed, 32 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/dvbin.c Fri Apr 02 23:36:06 2004 +0000 +++ b/libmpdemux/dvbin.c Sat Apr 03 10:30:46 2004 +0000 @@ -64,7 +64,7 @@ } stream_defaults = { - "", 1, "", 0, 0, "channels.conf" + "", 1, "", 0, 0, NULL }; #define ST_OFF(f) M_ST_OFF(struct stream_priv_s, f) @@ -95,7 +95,7 @@ m_option_t dvbin_opts_conf[] = { {"prog", &stream_defaults.prog, CONF_TYPE_STRING, 0, 0 ,0, NULL}, {"card", &stream_defaults.card, CONF_TYPE_INT, M_OPT_RANGE, 1, 4, NULL}, - {"type", &stream_defaults.type, CONF_TYPE_STRING, 0, 0 ,0, NULL}, + {"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}, {"file", &stream_defaults.file, CONF_TYPE_STRING, 0, 0 ,0, NULL}, @@ -664,27 +664,7 @@ return STREAM_ERROR; } - if(!strncmp(p->type, "CBL", 3)) - { - tuner_type = TUNER_CBL; - } - else if(!strncmp(p->type, "TER", 3)) - { - tuner_type = TUNER_TER; - } - else if(!strncmp(p->type, "SAT", 3)) - { - tuner_type = TUNER_SAT; - } - else - { - int t = dvb_get_tuner_type(priv); - - if((t==TUNER_SAT) || (t==TUNER_TER) || (t==TUNER_CBL)) - { - tuner_type = t; - } - } + tuner_type = dvb_get_tuner_type(priv); if(tuner_type == 0) { @@ -695,12 +675,38 @@ 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", - p->prog, priv->card+1, priv->tuner_type, p->vid, p->aid, p->file); + mp_msg(MSGT_DEMUX, MSGL_V, "OPEN_DVB: prog=%s, card=%d, type=%d, vid=%d, aid=%d\n", + p->prog, priv->card+1, priv->tuner_type, p->vid, p->aid); if(dvb_list_ptr == NULL) { - filename = get_path(p->file); + if(p->file != NULL) + { + if(p->file[0] == '/') + filename = p->file; + else + filename = get_path(p->file); + } + else + { + switch(priv->tuner_type) + { + case TUNER_TER: + filename = get_path("channels.conf.ter"); + break; + case TUNER_CBL: + filename = get_path("channels.conf.cbl"); + break; + case TUNER_SAT: + filename = get_path("channels.conf.sat"); + break; + } + } + + if((filename == NULL) || (access(filename, F_OK | R_OK) != 0)) + filename = get_path("channels.conf"); + + if(filename) { if((dvb_list_ptr = dvb_get_channels(filename, tuner_type)) == NULL)