From 2a5fe021498ff3b126625cd8f5a0a50409433efd Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 27 Jan 2015 21:18:45 +0100 Subject: [PATCH] zapit, GUI: allow building with older DVB API version the new API features are not yet used, so allow building with older API version e.g. on stlinux where the kernel is too old --- src/gui/scan_setup.cpp | 34 +++++++++++++++++++++++- src/zapit/include/zapit/frontend_types.h | 17 ++++++++++-- src/zapit/src/frontend.cpp | 24 +++++++++++++---- 3 files changed, 67 insertions(+), 8 deletions(-) diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index 669973216..7d8d38d80 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -9,7 +9,7 @@ Copyright (C) 2011 T. Graf 'dbt' Homepage: http://www.dbox2-tuning.net/ - Copyright (C) 2011-2012 Stefan Seyfried + Copyright (C) 2011-2015 Stefan Seyfried Copyright (C) 2011-2014 CoolStream International Ltd License: GPL @@ -160,7 +160,11 @@ const CMenuOptionChooser::keyval CABLESETUP_SCANTP_FEC[CABLESETUP_SCANTP_FEC_COU }; #endif +#if _HAVE_DVB57 #define TERRSETUP_SCANTP_FEC_COUNT 9 +#else +#define TERRSETUP_SCANTP_FEC_COUNT 8 +#endif const CMenuOptionChooser::keyval TERRSETUP_SCANTP_FEC[TERRSETUP_SCANTP_FEC_COUNT] = { // DVB-T @@ -171,37 +175,51 @@ const CMenuOptionChooser::keyval TERRSETUP_SCANTP_FEC[TERRSETUP_SCANTP_FEC_COUNT { FEC_7_8, LOCALE_EXTRA_FEC_7_8 }, { FEC_AUTO, LOCALE_EXTRA_FEC_AUTO }, // DTMB ie +#if _HAVE_DVB57 { FEC_2_5, LOCALE_EXTRA_FEC_2_5 }, +#endif { FEC_3_5, LOCALE_EXTRA_FEC_3_5 }, { FEC_4_5, LOCALE_EXTRA_FEC_4_5 }, }; +#if _HAVE_DVB57 #define TERRSETUP_SCANTP_BW_COUNT 7 +#else +#define TERRSETUP_SCANTP_BW_COUNT 4 +#endif const CMenuOptionChooser::keyval TERRSETUP_SCANTP_BW[TERRSETUP_SCANTP_BW_COUNT] = { { BANDWIDTH_8_MHZ, LOCALE_EXTRA_TP_BANDWIDTH_8MHZ }, { BANDWIDTH_7_MHZ, LOCALE_EXTRA_TP_BANDWIDTH_7MHZ }, { BANDWIDTH_6_MHZ, LOCALE_EXTRA_TP_BANDWIDTH_6MHZ }, +#if _HAVE_DVB57 { BANDWIDTH_5_MHZ, LOCALE_EXTRA_TP_BANDWIDTH_5MHZ }, { BANDWIDTH_10_MHZ, LOCALE_EXTRA_TP_BANDWIDTH_10MHZ }, { BANDWIDTH_1_712_MHZ, LOCALE_EXTRA_TP_BANDWIDTH_1_712MHZ }, +#endif { BANDWIDTH_AUTO, LOCALE_EXTRA_TP_BANDWIDTH_AUTO } }; +#if _HAVE_DVB57 #define TERRSETUP_SCANTP_GI_COUNT 11 +#else +#define TERRSETUP_SCANTP_GI_COUNT 5 +#endif const CMenuOptionChooser::keyval TERRSETUP_SCANTP_GI[TERRSETUP_SCANTP_GI_COUNT] = { { GUARD_INTERVAL_1_4, LOCALE_EXTRA_TP_GI_1_4 }, { GUARD_INTERVAL_1_8, LOCALE_EXTRA_TP_GI_1_8 }, { GUARD_INTERVAL_1_16, LOCALE_EXTRA_TP_GI_1_16 }, { GUARD_INTERVAL_1_32, LOCALE_EXTRA_TP_GI_1_32 }, +#if _HAVE_DVB57 { GUARD_INTERVAL_1_128, LOCALE_EXTRA_TP_GI_1_128 }, { GUARD_INTERVAL_19_128, LOCALE_EXTRA_TP_GI_19_128 }, { GUARD_INTERVAL_19_256, LOCALE_EXTRA_TP_GI_19_256 }, { GUARD_INTERVAL_PN420, LOCALE_EXTRA_TP_GI_PN420 }, { GUARD_INTERVAL_PN595, LOCALE_EXTRA_TP_GI_PN595 }, { GUARD_INTERVAL_PN945, LOCALE_EXTRA_TP_GI_PN945 }, +#endif { GUARD_INTERVAL_AUTO, LOCALE_EXTRA_TP_GI_AUTO } }; @@ -215,17 +233,25 @@ const CMenuOptionChooser::keyval TERRSETUP_SCANTP_HIERARCHY[TERRSETUP_SCANTP_HIE { HIERARCHY_AUTO, LOCALE_EXTRA_TP_HIERARCHY_AUTO } }; +#if _HAVE_DVB57 #define TERRSETUP_SCANTP_TRANSMIT_MODE_COUNT 9 +#else +#define TERRSETUP_SCANTP_TRANSMIT_MODE_COUNT 4 +#endif const CMenuOptionChooser::keyval TERRSETUP_SCANTP_TRANSMIT_MODE[TERRSETUP_SCANTP_TRANSMIT_MODE_COUNT] = { +#if _HAVE_DVB57 { TRANSMISSION_MODE_1K, LOCALE_EXTRA_TP_TRANSMIT_MODE_1K }, +#endif { TRANSMISSION_MODE_2K, LOCALE_EXTRA_TP_TRANSMIT_MODE_2K }, { TRANSMISSION_MODE_4K, LOCALE_EXTRA_TP_TRANSMIT_MODE_4K }, { TRANSMISSION_MODE_8K, LOCALE_EXTRA_TP_TRANSMIT_MODE_8K }, +#if _HAVE_DVB57 { TRANSMISSION_MODE_16K, LOCALE_EXTRA_TP_TRANSMIT_MODE_16K }, { TRANSMISSION_MODE_32K, LOCALE_EXTRA_TP_TRANSMIT_MODE_32K }, { TRANSMISSION_MODE_C1, LOCALE_EXTRA_TP_TRANSMIT_MODE_C1 }, { TRANSMISSION_MODE_C3780, LOCALE_EXTRA_TP_TRANSMIT_MODE_C3780 }, +#endif { TRANSMISSION_MODE_AUTO, LOCALE_EXTRA_TP_TRANSMIT_MODE_AUTO } }; @@ -248,14 +274,20 @@ const CMenuOptionChooser::keyval CABLESETUP_SCANTP_MOD[CABLESETUP_SCANTP_MOD_COU { QAM_AUTO, LOCALE_EXTRA_TP_MOD_AUTO } }; +#if _HAVE_DVB57 #define TERRSETUP_SCANTP_MOD_COUNT 6 +#else +#define TERRSETUP_SCANTP_MOD_COUNT 5 +#endif const CMenuOptionChooser::keyval TERRSETUP_SCANTP_MOD[TERRSETUP_SCANTP_MOD_COUNT] = { { QPSK, LOCALE_EXTRA_TP_MOD_4 }, { QAM_16, LOCALE_EXTRA_TP_MOD_16 }, { QAM_32, LOCALE_EXTRA_TP_MOD_32 }, { QAM_64, LOCALE_EXTRA_TP_MOD_64 }, +#if _HAVE_DVB57 { QAM_4_NR, LOCALE_EXTRA_TP_MOD_4_NR }, +#endif { QAM_AUTO, LOCALE_EXTRA_TP_MOD_AUTO } }; diff --git a/src/zapit/include/zapit/frontend_types.h b/src/zapit/include/zapit/frontend_types.h index 98a2f456a..7c9d4551f 100644 --- a/src/zapit/include/zapit/frontend_types.h +++ b/src/zapit/include/zapit/frontend_types.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2012 CoolStream International Ltd + * Copyright (C) 2013,2015 Stefan Seyfried * * License: GPLv2 * @@ -58,6 +59,18 @@ #define ZAPIT_DS_IS_TERR(ds) (((ds) & ZAPIT_DM_TERR) != 0) #define ZAPIT_DS_IS_CABLE(ds) (((ds) & ZAPIT_DM_CABLE) != 0) #define ZAPIT_DS_BIT_MASK(ds) ((1 << (ds)) & ZAPIT_DS_MASK) + +/* compat stuff for building with older DVB-API versions */ +/* actually, DVB-T2 is available from API 5.3, and SYS_TURBO is available from 5.4, + * but all this is pretty much unused anyway, so we can stick it under one #define */ +#if ((DVB_API_VERSION > 5) || (DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR > 6)) +#define _HAVE_DVB57 1 +#else +#warning DVB_API < 5.7 -- no DVB-T2/DTMB support. +/* this is actually needed before 5.5, not 5.7, but this works for now */ +#define SYS_DVBC_ANNEX_A SYS_DVBC_ANNEX_AC +#endif + /* dvb transmission types */ typedef enum { UNKNOWN_DS = ZAPIT_DS_UNKNOWN, @@ -103,9 +116,9 @@ typedef struct { zapit_pilot_t pilot; fe_rolloff_t rolloff; - +#if _HAVE_DVB57 enum fe_interleaving interleaving; - +#endif uint8_t polarization; } FrontendParameters; diff --git a/src/zapit/src/frontend.cpp b/src/zapit/src/frontend.cpp index 4babbc02c..37abe13bf 100644 --- a/src/zapit/src/frontend.cpp +++ b/src/zapit/src/frontend.cpp @@ -3,7 +3,7 @@ * * (C) 2002-2003 Andreas Oberritter * - * (C) 2007-2013 Stefan Seyfried + * (C) 2007-2013,2015 Stefan Seyfried * Copyright (C) 2011 CoolStream International Ltd * * This program is free software; you can redistribute it and/or modify @@ -552,8 +552,10 @@ fe_bandwidth_t CFrontend::getBandwidth(const uint8_t bandwidth) return BANDWIDTH_7_MHZ; case 0x02: return BANDWIDTH_6_MHZ; +#if _HAVE_DVB57 case 0x03: return BANDWIDTH_5_MHZ; +#endif default: return BANDWIDTH_AUTO; // AUTO } @@ -868,9 +870,11 @@ void CFrontend::getDelSys(delivery_system_t delsys, int f, int m, char *&fec, ch case QAM_256: mod = (char *)"QAM_256"; break; +#if _HAVE_DVB57 case QAM_4_NR: mod = (char *)"QAM_4_NR"; break; +#endif case QPSK: if (delsys == DVB_T || delsys == DVB_T2 || delsys == DTMB) { mod = (char *)"QPSK"; // AKA QAM_4 @@ -921,9 +925,11 @@ void CFrontend::getDelSys(delivery_system_t delsys, int f, int m, char *&fec, ch case FEC_9_10: fec = (char *)"9/10"; break; +#if _HAVE_DVB57 case FEC_2_5: - fec = (char *)"2/3"; + fec = (char *)"2/5"; break; +#endif default: INFO("unknown FEC: %d!", f); case FEC_AUTO: @@ -946,9 +952,11 @@ fe_delivery_system_t CFrontend::getFEDeliverySystem(delivery_system_t Delsys) case DVB_T: delsys = SYS_DVBT; break; +#if _HAVE_DVB57 case DVB_T2: delsys = SYS_DVBT2; break; +#endif case DVB_C: delsys = SYS_DVBC_ANNEX_A; break; @@ -964,15 +972,17 @@ fe_delivery_system_t CFrontend::getFEDeliverySystem(delivery_system_t Delsys) case ISDBS: delsys = SYS_ISDBS; break; - case DTMB: - delsys = SYS_DTMB; - break; case DSS: delsys = SYS_DSS; break; +#if _HAVE_DVB57 + case DTMB: + delsys = SYS_DTMB; + break; case TURBO: delsys = SYS_TURBO; break; +#endif default: delsys = SYS_UNDEFINED; break; @@ -1052,9 +1062,11 @@ uint32_t CFrontend::getFEBandwidth(fe_bandwidth_t bandwidth) case BANDWIDTH_6_MHZ: bandwidth_hz = 6000000; break; +#if HAVE_DVBT2 case BANDWIDTH_5_MHZ: bandwidth_hz = 5000000; break; +#endif } return bandwidth_hz; @@ -1107,9 +1119,11 @@ bool CFrontend::buildProperties(const FrontendParameters *feparams, struct dtv_p case FEC_9_10: fec = FEC_9_10; break; +#if HAVE_DTMB case FEC_2_5: fec = FEC_2_5; break; +#endif default: INFO("[fe%d] unknown FEC: %d", fenumber, fec_inner); case FEC_AUTO: