0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00

added support for ATSC tuner and conf.file

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14383 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
nicodvb 2005-01-06 09:43:10 +00:00
parent b3e964f2c3
commit befb5ecec6
3 changed files with 58 additions and 3 deletions

View File

@ -84,6 +84,11 @@ int dvb_get_tuner_type(int fe_fd)
mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-C\n");
return TUNER_CBL;
#ifdef DVB_ATSC
case FE_ATSC:
mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-ATSC\n");
return TUNER_ATSC;
#endif
default:
mp_msg(MSGT_DEMUX, MSGL_ERR, "UNKNOWN TUNER TYPE\n");
return 0;
@ -386,6 +391,12 @@ static int check_status(int fd_frontend,struct dvb_frontend_parameters* feparams
mp_msg(MSGT_DEMUX, MSGL_V, " SymbolRate: %d\n",feparams->u.qpsk.symbol_rate);
mp_msg(MSGT_DEMUX, MSGL_V, " FEC_inner: %d\n",feparams->u.qpsk.fec_inner);
break;
#ifdef DVB_ATSC
case FE_ATSC:
mp_msg(MSGT_DEMUX, MSGL_V, "Event: Frequency: %d\n",feparams->frequency);
mp_msg(MSGT_DEMUX, MSGL_V, " Modulation: %d\n",feparams->u.vsb.modulation);
break;
#endif
default:
break;
}
@ -755,6 +766,13 @@ static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int
feparams.u.qam.QAM = modulation;
#endif
break;
#ifdef DVB_ATSC
case FE_ATSC:
mp_msg(MSGT_DEMUX, MSGL_V, "tuning ATSC to %d, modulation=%d\n",freq,modulation);
feparams.frequency=freq;
feparams.u.vsb.modulation = modulation;
break;
#endif
default:
mp_msg(MSGT_DEMUX, MSGL_V, "Unknown FE type. Aborting\n");
return 0;

View File

@ -133,6 +133,7 @@ static dvb_channels_list *dvb_get_channels(char *filename, int type)
const char *cbl_conf = "%a[^:]:%d:%a[^:]:%d:%a[^:]:%a[^:]:%a[^:]:%a[^:]\n";
const char *sat_conf = "%a[^:]:%d:%c:%d:%d:%a[^:]:%a[^:]\n";
const char *ter_conf = "%a[^:]:%d:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]\n";
const char *atsc_conf = "%a[^:]:%d:%a[^:]:%a[^:]:%a[^:]\n";
mp_msg(MSGT_DEMUX, MSGL_V, "CONFIG_READ FILE: %s, type: %d\n", filename, type);
if((f=fopen(filename, "r"))==NULL)
@ -180,6 +181,16 @@ static dvb_channels_list *dvb_get_channels(char *filename, int type)
"CBL, NUM: %d, NUM_FIELDS: %d, NAME: %s, FREQ: %d, SRATE: %d",
list->NUM_CHANNELS, fields, ptr->name, ptr->freq, ptr->srate);
}
#ifdef DVB_ATSC
else if(type == TUNER_ATSC)
{
fields = sscanf(line, atsc_conf,
&ptr->name, &ptr->freq, &mod, &vpid_str, &apid_str);
mp_msg(MSGT_DEMUX, MSGL_V,
"ATSC, NUM: %d, NUM_FIELDS: %d, NAME: %s, FREQ: %d\n",
list->NUM_CHANNELS, fields, ptr->name, ptr->freq);
}
#endif
else //SATELLITE
{
fields = sscanf(line, sat_conf,
@ -264,7 +275,11 @@ static dvb_channels_list *dvb_get_channels(char *filename, int type)
else if(! strcmp(cr, "FEC_NONE"))
ptr->cr =FEC_NONE;
else ptr->cr =FEC_AUTO;
}
if((type == TUNER_TER) || (type == TUNER_CBL) || (type == TUNER_ATSC))
{
if(! strcmp(mod, "QAM_128"))
ptr->mod = QAM_128;
else if(! strcmp(mod, "QAM_256"))
@ -275,9 +290,15 @@ static dvb_channels_list *dvb_get_channels(char *filename, int type)
ptr->mod = QAM_32;
else if(! strcmp(mod, "QAM_16"))
ptr->mod = QAM_16;
//else ptr->mod = QPSK;
}
#ifdef DVB_ATSC
else if(! strcmp(mod, "VSB_8") || ! strcmp(mod, "8VSB"))
ptr->mod = VSB_8;
else if(! strcmp(mod, "VSB_16") || !strcmp(mod, "16VSB"))
ptr->mod = VSB_16;
ptr->inv = INVERSION_AUTO;
#endif
}
if(type == TUNER_TER)
{
@ -487,6 +508,11 @@ int dvb_set_channel(dvb_priv_t *priv, int card, int n)
sprintf(priv->new_tuning, "%d|%09d|%d|%d|%d|%d", priv->card, channel->freq, channel->inv, channel->srate,
channel->cr, channel->mod);
break;
#ifdef DVB_ATSC
case TUNER_ATSC:
sprintf(priv->new_tuning, "%d|%09d|%d", priv->card, channel->freq, channel->mod);
break;
#endif
}
@ -752,7 +778,7 @@ dvb_config_t *dvb_get_config()
type = dvb_get_tuner_type(fd);
close(fd);
if(type != TUNER_SAT && type != TUNER_TER && type != TUNER_CBL)
if(type != TUNER_SAT && type != TUNER_TER && type != TUNER_CBL && type != TUNER_ATSC)
{
mp_msg(MSGT_DEMUX, MSGL_V, "DVB_CONFIG, can't detect tuner type of card %d, skipping\n", i);
continue;
@ -769,6 +795,9 @@ dvb_config_t *dvb_get_config()
case TUNER_SAT:
conf_file = get_path("channels.conf.sat");
break;
case TUNER_ATSC:
conf_file = get_path("channels.conf.atsc");
break;
}
if((access(conf_file, F_OK | R_OK) != 0))

View File

@ -8,6 +8,7 @@
#ifdef HAVE_DVB_HEAD
#include <linux/dvb/dmx.h>
#include <linux/dvb/frontend.h>
#include <linux/dvb/version.h>
#else
#include <ost/dmx.h>
#include <ost/sec.h>
@ -26,6 +27,12 @@
#define dmx_pes_type_t dmxPesType_t
#endif
#undef DVB_ATSC
#if defined(DVB_API_VERSION_MINOR)
#if DVB_API_VERSION == 3 && DVB_API_VERSION_MINOR >= 1
#define DVB_ATSC 1
#endif
#endif
#define DVB_CHANNEL_LOWER -1
@ -92,6 +99,7 @@ typedef struct {
#define TUNER_SAT 1
#define TUNER_TER 2
#define TUNER_CBL 3
#define TUNER_ATSC 4
extern int dvb_step_channel(dvb_priv_t *, int);
extern int dvb_set_channel(dvb_priv_t *, int, int);