diff --git a/libmpdemux/dvb_defaults.h b/libmpdemux/dvb_defaults.h index 0f56c1e8e5..43f29b2718 100644 --- a/libmpdemux/dvb_defaults.h +++ b/libmpdemux/dvb_defaults.h @@ -66,9 +66,7 @@ #ifndef DVB_T_LOCATION #ifndef UK - #warning No DVB-T country defined in dvb_defaults.h - #warning defaulting to UK - #warning Ignore this if using Satellite or Cable + #warning No DVB-T country defined in dvb_defaults.h, defaulting to UK. Ignore this if using Satellite or Cable. #endif /* UNITED KINGDOM settings */ diff --git a/libmpdemux/dvb_tune.c b/libmpdemux/dvb_tune.c index fb1cf45b10..cf6e6af219 100644 --- a/libmpdemux/dvb_tune.c +++ b/libmpdemux/dvb_tune.c @@ -52,7 +52,7 @@ -int dvb_get_tuner_type(dvb_priv_t *priv) +int dvb_get_tuner_type(int fe_fd) { #ifdef HAVE_DVB_HEAD struct dvb_frontend_info fe_info; @@ -60,9 +60,7 @@ int dvb_get_tuner_type(dvb_priv_t *priv) FrontendInfo fe_info; #endif - int res, fe_fd; - - fe_fd = priv->fe_fd; + int res; res = ioctl(fe_fd, FE_GET_INFO, &fe_info); if(res < 0) @@ -74,15 +72,15 @@ int dvb_get_tuner_type(dvb_priv_t *priv) switch(fe_info.type) { case FE_OFDM: - mp_msg(MSGT_DEMUX, MSGL_INFO, "TUNER TYPE SEEMS TO BE DVB-T\n"); + mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-T\n"); return TUNER_TER; case FE_QPSK: - mp_msg(MSGT_DEMUX, MSGL_INFO, "TUNER TYPE SEEMS TO BE DVB-S\n"); + mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-S\n"); return TUNER_SAT; case FE_QAM: - mp_msg(MSGT_DEMUX, MSGL_INFO, "TUNER TYPE SEEMS TO BE DVB-C\n"); + mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-C\n"); return TUNER_CBL; default: @@ -92,26 +90,46 @@ int dvb_get_tuner_type(dvb_priv_t *priv) } - -int dvb_open_fe(dvb_priv_t *priv) +int dvb_open_devices(dvb_priv_t *priv, int n) { - priv->fe_fd = open(dvb_frontenddev[priv->card], O_RDWR | O_NONBLOCK); + priv->fe_fd = open(dvb_frontenddev[n], O_RDWR | O_NONBLOCK); if(priv->fe_fd < 0) { - mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR IN OPENING FRONTEND DEVICE %s: ERRNO %d\n", dvb_frontenddev[priv->card], errno); + mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING FRONTEND DEVICE %s: ERRNO %d\n", dvb_frontenddev[n], errno); return 0; } #ifdef HAVE_DVB_HEAD priv->sec_fd=0; #else - priv->sec_fd = open(dvb_secdev[priv->card], O_RDWR); + priv->sec_fd = open(dvb_secdev[n], O_RDWR); if(priv->sec_fd < 0) { - mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR IN OPENING SEC DEVICE %s: ERRNO %d\n", dvb_secdev[priv->card], errno); + mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING SEC DEVICE %s: ERRNO %d\n", dvb_secdev[n], errno); close(priv->fe_fd); return 0; } #endif + priv->demux_fd[0] = open(dvb_demuxdev[n], O_RDWR); + if(priv->demux_fd[0] < 0) + { + mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DEMUX 0: %d\n", errno); + return 0; + } + + priv->demux_fd[1] = open(dvb_demuxdev[n], O_RDWR); + if(priv->demux_fd[1] < 0) + { + mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DEMUX 1: %d\n", errno); + return 0; + } + + + priv->dvr_fd = open(dvb_dvrdev[n], O_RDONLY| O_NONBLOCK); + if(priv->dvr_fd < 0) + { + mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DVR DEVICE %s: %d\n", dvb_dvrdev[n], errno); + return 0; + } return 1; } @@ -172,7 +190,7 @@ static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int fe_transmit_mode_t TransmissionMode, fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth); -dvb_tune(dvb_priv_t *priv, int freq, char pol, int srate, int diseqc, int tone, +int dvb_tune(dvb_priv_t *priv, int freq, char pol, int srate, int diseqc, int tone, fe_spectral_inversion_t specInv, fe_modulation_t modulation, fe_guard_interval_t guardInterval, fe_transmit_mode_t TransmissionMode, fe_bandwidth_t bandWidth, fe_code_rate_t HP_CodeRate) { @@ -270,7 +288,6 @@ static void print_status(fe_status_t festatus) #ifdef HAVE_DVB_HEAD static int check_status(int fd_frontend,struct dvb_frontend_parameters* feparams, int tuner_type, uint32_t base) { - int res; int32_t strength; fe_status_t festatus; struct dvb_frontend_event event; diff --git a/libmpdemux/dvbin.h b/libmpdemux/dvbin.h index 63cad2a152..1f6c4f5ee0 100644 --- a/libmpdemux/dvbin.h +++ b/libmpdemux/dvbin.h @@ -32,10 +32,6 @@ #include "inttypes.h" -typedef struct -{ - int next, prev; -} dvb_history_t; typedef struct { char *name; @@ -54,9 +50,21 @@ typedef struct { typedef struct { uint16_t NUM_CHANNELS; uint16_t current; - dvb_channel_t channels[512]; + dvb_channel_t *channels; } dvb_channels_list; +typedef struct { + int type; + dvb_channels_list *list; + char *name; + int devno; +} dvb_card_config_t; + +typedef struct { + int count; + dvb_card_config_t *cards; + void *priv; +} dvb_config_t; typedef struct { @@ -66,6 +74,7 @@ typedef struct { int demux_fd[3]; int dvr_fd; + dvb_config_t *config; dvb_channels_list *list; int tuner_type; int is_on; @@ -80,10 +89,7 @@ typedef struct { #define TUNER_CBL 3 extern int dvb_step_channel(dvb_priv_t *, int); -extern int dvb_set_channel(dvb_priv_t *, int); -extern int dvb_open_fe(dvb_priv_t *priv); - -extern dvb_history_t dvb_prev_next; - +extern int dvb_set_channel(dvb_priv_t *, int, int); +extern dvb_config_t *dvb_get_config(); #endif