diff options
author | sfan5 <sfan5@live.de> | 2023-01-10 16:28:31 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2023-01-12 22:02:07 +0100 |
commit | b6b83805183618f3a46f2cc77d85dcff72ef6396 (patch) | |
tree | 4762507be5d1d63820ee3821e2578e6e09a14299 /stream | |
parent | 1e00e3119fb5da8f02fe1a5deaa5edce219a7175 (diff) | |
download | mpv-b6b83805183618f3a46f2cc77d85dcff72ef6396.tar.bz2 mpv-b6b83805183618f3a46f2cc77d85dcff72ef6396.tar.xz |
stream/dvb: drop support for DVB API before 5.8
There is really no reason to keep the #ifdef mess around given
that version is available since December 2012 (Linux 3.7).
Diffstat (limited to 'stream')
-rw-r--r-- | stream/dvb_tune.c | 160 | ||||
-rw-r--r-- | stream/dvbin.h | 53 | ||||
-rw-r--r-- | stream/stream_dvb.c | 9 |
3 files changed, 14 insertions, 208 deletions
diff --git a/stream/dvb_tune.c b/stream/dvb_tune.c index d9b350f876..2a33525a17 100644 --- a/stream/dvb_tune.c +++ b/stream/dvb_tune.c @@ -79,21 +79,18 @@ unsigned int dvb_get_tuner_delsys_mask(int fe_fd, struct mp_log *log) struct dtv_properties cmdseq = {.num = 1, .props = prop}; struct dvb_frontend_info fe_info; -#ifdef DVB_USE_S2API - /* S2API is the DVB API new since 2.6.28. - It allows to query frontends with multiple delivery systems. */ mp_verbose(log, "Querying tuner frontend type via DVBv5 API for frontend FD %d\n", fe_fd); prop[0].cmd = DTV_ENUM_DELSYS; if (ioctl(fe_fd, FE_GET_PROPERTY, &cmdseq) < 0) { mp_err(log, "DVBv5: FE_GET_PROPERTY(DTV_ENUM_DELSYS) error: %d, FD: %d\n\n", errno, fe_fd); - goto old_api; + return ret_mask; } unsigned int i, delsys_count = prop[0].u.buffer.len; mp_verbose(log, "DVBv5: Number of supported delivery systems: %d\n", delsys_count); if (delsys_count == 0) { mp_err(log, "DVBv5: Frontend FD %d returned no delivery systems!\n", fe_fd); - goto old_api; + return ret_mask; } for (i = 0; i < delsys_count; i++) { delsys = (unsigned int)prop[0].u.buffer.data[i]; @@ -102,73 +99,6 @@ unsigned int dvb_get_tuner_delsys_mask(int fe_fd, struct mp_log *log) } return ret_mask; - -old_api: -#endif - mp_verbose(log, "Querying tuner frontend type via pre-DVBv5 API for frontend FD %d\n", - fe_fd); - - memset(&fe_info, 0x00, sizeof(struct dvb_frontend_info)); - if (ioctl(fe_fd, FE_GET_INFO, &fe_info) < 0) { - mp_err(log, "DVBv3: FE_GET_INFO error: %d, FD: %d\n\n", errno, fe_fd); - return ret_mask; - } - /* Try to get kernel DVB API version. */ - prop[0].cmd = DTV_API_VERSION; - if (ioctl(fe_fd, FE_GET_PROPERTY, &cmdseq) < 0) { - prop[0].u.data = 0x0300; /* Fail, assume 3.0 */ - } - - mp_verbose(log, "DVBv3: Queried tuner frontend type of device named '%s', FD: %d\n", - fe_info.name, fe_fd); - switch (fe_info.type) { - case FE_OFDM: - DELSYS_SET(ret_mask, SYS_DVBT); - if (prop[0].u.data < 0x0500) - break; - if (FE_CAN_2G_MODULATION & fe_info.caps) { - DELSYS_SET(ret_mask, SYS_DVBT2); - } - break; - case FE_QPSK: - DELSYS_SET(ret_mask, SYS_DVBS); - if (prop[0].u.data < 0x0500) - break; - if (FE_CAN_2G_MODULATION & fe_info.caps) { - DELSYS_SET(ret_mask, SYS_DVBS2); - } -#if 0 /* Not used now. */ - if (FE_CAN_TURBO_FEC & fe_info.caps) { - DELSYS_SET(ret_mask, SYS_TURBO); - } -#endif - break; - case FE_QAM: - DELSYS_SET(ret_mask, SYS_DVBC_ANNEX_A); - DELSYS_SET(ret_mask, SYS_DVBC_ANNEX_C); - break; -#ifdef DVB_ATSC - case FE_ATSC: - if ((FE_CAN_8VSB | FE_CAN_16VSB) & fe_info.caps) { - DELSYS_SET(ret_mask, SYS_ATSC); - } - if ((FE_CAN_QAM_64 | FE_CAN_QAM_256 | FE_CAN_QAM_AUTO) & fe_info.caps) { - DELSYS_SET(ret_mask, SYS_DVBC_ANNEX_B); - } - break; -#endif - default: - mp_err(log, "DVBv3: Unknown tuner frontend type: %d\n", fe_info.type); - return ret_mask; - } - - for (delsys = 0; delsys < SYS_DVB__COUNT__; delsys ++) { - if (!DELSYS_IS_SET(ret_mask, delsys)) - continue; /* Skip unsupported. */ - mp_verbose(log, "DVBv3: Tuner frontend type seems to be %s\n", get_dvb_delsys(delsys)); - } - - return ret_mask; } int dvb_open_devices(dvb_priv_t *priv, unsigned int adapter, @@ -463,7 +393,6 @@ static int do_diseqc(int secfd, int sat_no, int polv, int hi_lo) ((sat_no / 4) % 2) ? SEC_MINI_B : SEC_MINI_A); } -#ifdef DVB_USE_S2API static int dvbv5_tune(dvb_priv_t *priv, int fd_frontend, unsigned int delsys, struct dtv_properties* cmdseq) { @@ -481,7 +410,6 @@ static int dvbv5_tune(dvb_priv_t *priv, int fd_frontend, } return 0; } -#endif static int tune_it(dvb_priv_t *priv, int fd_frontend, unsigned int delsys, unsigned int freq, unsigned int srate, char pol, @@ -522,11 +450,6 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend, unsigned int delsys, /* Prepare params, be verbose. */ switch (delsys) { case SYS_DVBT2: -#ifndef DVB_USE_S2API - MP_ERR(priv, "ERROR: Can not tune to T2 channel, S2-API not " - "available, will tune to DVB-T!\n"); -#endif - /* PASSTROUTH. */ case SYS_DVBT: if (freq < 1000000) freq *= 1000UL; @@ -562,11 +485,6 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend, unsigned int delsys, get_dvb_delsys(delsys), freq, bandwidth_hz); break; case SYS_DVBS2: -#ifndef DVB_USE_S2API - MP_ERR(priv, "ERROR: Can not tune to S2 channel, S2-API not " - "available, will tune to DVB-S!\n"); -#endif - /* PASSTROUTH. */ case SYS_DVBS: if (freq > 2200000) { // this must be an absolute frequency @@ -595,19 +513,16 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend, unsigned int delsys, MP_VERBOSE(priv, "tuning %s to %d, srate=%d\n", get_dvb_delsys(delsys), freq, srate); break; -#ifdef DVB_ATSC case SYS_ATSC: case SYS_DVBC_ANNEX_B: MP_VERBOSE(priv, "tuning %s to %d, modulation=%d\n", get_dvb_delsys(delsys), freq, modulation); break; -#endif default: MP_VERBOSE(priv, "Unknown FE type. Aborting\n"); return 0; } -#ifdef DVB_USE_S2API /* S2API is the DVB API new since 2.6.28. * It is needed to tune to new delivery systems, e.g. DVB-S2. * It takes a struct with a list of pairs of command + parameter. @@ -646,7 +561,7 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend, unsigned int delsys, .props = p }; if (dvbv5_tune(priv, fd_frontend, delsys, &cmdseq) != 0) { - goto old_api; + goto error_tune; } } break; @@ -673,7 +588,7 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend, unsigned int delsys, .props = p }; if (dvbv5_tune(priv, fd_frontend, delsys, &cmdseq) != 0) { - goto old_api; + goto error_tune; } } break; @@ -694,11 +609,10 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend, unsigned int delsys, .props = p }; if (dvbv5_tune(priv, fd_frontend, delsys, &cmdseq) != 0) { - goto old_api; + goto error_tune; } } break; -#ifdef DVB_ATSC case SYS_ATSC: case SYS_DVBC_ANNEX_B: { @@ -714,73 +628,21 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend, unsigned int delsys, .props = p }; if (dvbv5_tune(priv, fd_frontend, delsys, &cmdseq) != 0) { - goto old_api; + goto error_tune; } } break; -#endif } int tune_status = check_status(priv, fd_frontend, timeout); if (tune_status != 0) { - MP_ERR(priv, "ERROR locking to channel when tuning with S2API, clearing and falling back to DVBv3-tuning.\n"); - if (ioctl(fd_frontend, FE_SET_PROPERTY, &cmdseq_clear) < 0) { - MP_ERR(priv, "FE_SET_PROPERTY DTV_CLEAR failed\n"); - } - goto old_api; - } else { - return tune_status; - } - -old_api: -#endif - - MP_VERBOSE(priv, "Tuning via DVB-API version 3.\n"); - - if (stream_id != NO_STREAM_ID_FILTER && stream_id != 0) { - MP_ERR(priv, "DVB-API version 3 does not support stream_id (PLP).\n"); - return -1; - } - memset(&feparams, 0x00, sizeof(feparams)); - feparams.frequency = freq; - feparams.inversion = specInv; - - switch (delsys) { - case SYS_DVBT: - case SYS_DVBT2: - feparams.u.ofdm.bandwidth = bandwidth; - feparams.u.ofdm.code_rate_HP = HP_CodeRate; - feparams.u.ofdm.code_rate_LP = LP_CodeRate; - feparams.u.ofdm.constellation = modulation; - feparams.u.ofdm.transmission_mode = TransmissionMode; - feparams.u.ofdm.guard_interval = guardInterval; - feparams.u.ofdm.hierarchy_information = hier; - break; - case SYS_DVBS: - case SYS_DVBS2: - feparams.u.qpsk.symbol_rate = srate; - feparams.u.qpsk.fec_inner = HP_CodeRate; - break; - case SYS_DVBC_ANNEX_A: - case SYS_DVBC_ANNEX_C: - feparams.u.qam.symbol_rate = srate; - feparams.u.qam.fec_inner = HP_CodeRate; - feparams.u.qam.modulation = modulation; - break; -#ifdef DVB_ATSC - case SYS_ATSC: - case SYS_DVBC_ANNEX_B: - feparams.u.vsb.modulation = modulation; - break; -#endif - } - - if (ioctl(fd_frontend, FE_SET_FRONTEND, &feparams) < 0) { - MP_ERR(priv, "ERROR tuning channel\n"); - return -1; + MP_ERR(priv, "ERROR locking to channel\n"); } + return tune_status; - return check_status(priv, fd_frontend, timeout); +error_tune: + MP_ERR(priv, "ERROR tuning channel\n"); + return -1; } int dvb_tune(dvb_priv_t *priv, unsigned int delsys, diff --git a/stream/dvbin.h b/stream/dvbin.h index 1c314bda82..2bb494d3d9 100644 --- a/stream/dvbin.h +++ b/stream/dvbin.h @@ -27,35 +27,8 @@ #define MAX_ADAPTERS 16 #define MAX_FRONTENDS 8 -#undef DVB_ATSC -#if defined(DVB_API_VERSION_MINOR) - -/* kernel headers >=2.6.28 have version 5. - * - * Version 5 is also called S2API, it adds support for tuning to S2 channels - * and is extensible for future delivery systems. Old API is deprecated. - * StreamID-implementation only supported since API >=5.2. - * At least DTV_ENUM_DELSYS requires 5.5. - */ - -#if (DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR >= 5) -#define DVB_USE_S2API 1 - -// This had a different name until API 5.8. -#ifndef DTV_STREAM_ID -#define DTV_STREAM_ID DTV_ISDBS_TS_ID -#endif -#endif - -// This is only defined, for convenience, since API 5.8. -#ifndef NO_STREAM_ID_FILTER -#define NO_STREAM_ID_FILTER (~0U) -#endif - -#if (DVB_API_VERSION == 3 && DVB_API_VERSION_MINOR >= 1) || DVB_API_VERSION == 5 -#define DVB_ATSC 1 -#endif - +#if DVB_API_VERSION < 5 || DVB_API_VERSION_MINOR < 8 +#error DVB support requires a non-ancient kernel #endif #define DVB_CHANNEL_LOWER -1 @@ -136,16 +109,6 @@ typedef struct { /* Keep in sync with enum fe_delivery_system. */ -#ifndef DVB_USE_S2API -# define SYS_DVBC_ANNEX_A 1 -# define SYS_DVBC_ANNEX_B 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) @@ -158,7 +121,6 @@ typedef struct { (0 != ((__mask) & DELSYS_BIT((__bit)))) -#ifdef DVB_ATSC #define DELSYS_SUPP_MASK \ ( \ DELSYS_BIT(SYS_DVBC_ANNEX_A) | \ @@ -170,17 +132,6 @@ typedef struct { 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 void dvb_update_config(stream_t *); int dvb_parse_path(stream_t *); diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c index a9fb12cb5e..22a2d300b1 100644 --- a/stream/stream_dvb.c +++ b/stream/stream_dvb.c @@ -276,9 +276,7 @@ static dvb_channels_list_t *dvb_get_channels(struct mp_log *log, const char *sat_conf = "%d:%c:%d:%d:%255[^:]:%255[^:]\n"; const char *ter_conf = "%d:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]\n"; -#ifdef DVB_ATSC const char *atsc_conf = "%d:%255[^:]:%255[^:]:%255[^:]\n"; -#endif const char *vdr_conf = "%d:%255[^:]:%255[^:]:%d:%255[^:]:%255[^:]:%255[^:]:%*255[^:]:%d:%*d:%*d:%*d\n%n"; @@ -458,7 +456,6 @@ static dvb_channels_list_t *dvb_get_channels(struct mp_log *log, list->NUM_CHANNELS, fields, ptr->name, ptr->freq, ptr->srate); break; -#ifdef DVB_ATSC case SYS_ATSC: case SYS_DVBC_ANNEX_B: fields = sscanf(&line[k], atsc_conf, @@ -467,7 +464,6 @@ static dvb_channels_list_t *dvb_get_channels(struct mp_log *log, get_dvb_delsys(delsys), list->NUM_CHANNELS, fields, ptr->name, ptr->freq); break; -#endif case SYS_DVBS: case SYS_DVBS2: fields = sscanf(&line[k], sat_conf, @@ -605,15 +601,13 @@ static dvb_channels_list_t *dvb_get_channels(struct mp_log *log, ptr->mod = QAM_32; } else if (!strcmp(mod, "QAM_16")) { ptr->mod = QAM_16; -#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; -#endif } } -#ifdef DVB_ATSC + /* Modulation defines real delsys for ATSC: Terrestrial (VSB) is SYS_ATSC, Cable (QAM) is SYS_DVBC_ANNEX_B. */ if (delsys == SYS_ATSC || delsys == SYS_DVBC_ANNEX_B) { @@ -627,7 +621,6 @@ static dvb_channels_list_t *dvb_get_channels(struct mp_log *log, mp_verbose(log, "Switched to delivery system for ATSC: %s (guessed from modulation).\n", get_dvb_delsys(delsys)); } -#endif switch (delsys) { case SYS_DVBT: |