From df91e492fd3365cf7db9c6ba4a721f8fcce0521c Mon Sep 17 00:00:00 2001 From: ivan-83 Date: Mon, 13 Feb 2017 04:55:35 +0300 Subject: dvb: add support for DVB-T2 Probably does much more: + add support DVB-T2 * DVB params set to AUTO by default * MAX_CARDS: 4 -> 16 * DMX_SET_BUFFER_SIZE: 64kb -> 256kb + add DTV_CLEAR call before tune + add logic from https://github.com/olifre/mpv/commits/dvb-mixed-api-scan * rename type to delsys * single playlist per adapter * card -> adapter * fix channels order in playlist * update internal api * auto fallback to old DVB API on tune * fix DELSYS_SUPP_MASK value * remove tone - unused * add channel mem zeroize in config parser + add code from libdvbv5 for detect delivery systems * SYS_DVBC_ANNEX_AC replaced to SYS_DVBC_ANNEX_A + SYS_DVBC_ANNEX_C Signed-off-by: wm4 --- stream/dvbin.h | 90 ++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 65 insertions(+), 25 deletions(-) (limited to 'stream/dvbin.h') diff --git a/stream/dvbin.h b/stream/dvbin.h index e461364c48..02b6a72968 100644 --- a/stream/dvbin.h +++ b/stream/dvbin.h @@ -62,12 +62,13 @@ typedef struct { char *name; - int freq, srate, diseqc, tone; + unsigned int freq, srate, diseqc; char pol; - int tpid, dpid1, dpid2, progid, ca, pids[DMX_FILTER_SIZE], pids_cnt; - bool is_dvb_s2; - int stream_id; - int service_id; + unsigned int tpid, dpid1, dpid2, progid, ca, pids[DMX_FILTER_SIZE], pids_cnt; + bool is_dvb_x2; + unsigned int delsys; + unsigned int stream_id; + unsigned int service_id; fe_spectral_inversion_t inv; fe_modulation_t mod; fe_transmit_mode_t trans; @@ -78,57 +79,96 @@ typedef struct { } dvb_channel_t; typedef struct { - uint16_t NUM_CHANNELS; - uint16_t current; + unsigned int NUM_CHANNELS; + unsigned int current; dvb_channel_t *channels; -} dvb_channels_list; +} dvb_channels_list_t; typedef struct { - int type; - dvb_channels_list *list; - char *name; int devno; -} dvb_card_config_t; + unsigned int delsys_mask; + dvb_channels_list_t *list; +} dvb_adapter_config_t; typedef struct { - int count; - dvb_card_config_t *cards; + unsigned int adapters_count; + dvb_adapter_config_t *adapters; + unsigned int cur_adapter; - int card; int fe_fd; int dvr_fd; int demux_fd[3], demux_fds[DMX_FILTER_SIZE], demux_fds_cnt; - dvb_channels_list *list; - int tuner_type; int is_on; int retry; int timeout; - int last_freq; + unsigned int last_freq; bool switching_channel; bool stream_used; } dvb_state_t; -typedef struct dvb_params { +typedef struct { struct mp_log *log; dvb_state_t *state; char *cfg_prog; - int cfg_card; + int cfg_devno; int cfg_timeout; char *cfg_file; int cfg_full_transponder; } dvb_priv_t; -#define TUNER_SAT 1 -#define TUNER_TER 2 -#define TUNER_CBL 3 -#define TUNER_ATSC 4 + +/* Keep in sync with enum fe_delivery_system. */ +#ifndef DVB_USE_S2API +# define SYS_DVBC_ANNEX_A 1 +# define SYS_DVBT 3 +# define SYS_DVBS 5 +# define SYS_DVBS2 6 +# define SYS_ATSC 11 +# define SYS_DVBT2 16 +# define SYS_DVBC_ANNEX_C 18 +#endif +#define SYS_DVB__COUNT__ (SYS_DVBC_ANNEX_C + 1) + + +#define DELSYS_BIT(__bit) (((unsigned int)1) << (__bit)) + +#define DELSYS_SET(__mask, __bit) \ + (__mask) |= DELSYS_BIT((__bit)) + +#define DELSYS_IS_SET(__mask, __bit) \ + (0 != ((__mask) & DELSYS_BIT((__bit)))) + + +#ifdef DVB_ATSC +#define DELSYS_SUPP_MASK \ + ( \ + DELSYS_BIT(SYS_DVBC_ANNEX_A) | \ + DELSYS_BIT(SYS_DVBT) | \ + DELSYS_BIT(SYS_DVBS) | \ + DELSYS_BIT(SYS_DVBS2) | \ + DELSYS_BIT(SYS_ATSC) | \ + DELSYS_BIT(SYS_DVBT2) | \ + DELSYS_BIT(SYS_DVBC_ANNEX_C) \ + ) +#else +#define DELSYS_SUPP_MASK \ + ( \ + DELSYS_BIT(SYS_DVBC_ANNEX_A) | \ + DELSYS_BIT(SYS_DVBT) | \ + DELSYS_BIT(SYS_DVBS) | \ + DELSYS_BIT(SYS_DVBS2) | \ + DELSYS_BIT(SYS_DVBT2) | \ + DELSYS_BIT(SYS_DVBC_ANNEX_C) \ + ) +#endif + int dvb_step_channel(stream_t *, int); -int dvb_set_channel(stream_t *, int, int); +int dvb_set_channel(stream_t *, unsigned int, unsigned int); dvb_state_t *dvb_get_state(stream_t *); void dvb_free_state(dvb_state_t *); -- cgit v1.2.3