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
This commit is contained in:
Stefan Seyfried
2015-01-27 21:18:45 +01:00
parent 0bff1ff02d
commit 2a5fe02149
3 changed files with 67 additions and 8 deletions

View File

@@ -9,7 +9,7 @@
Copyright (C) 2011 T. Graf 'dbt' Copyright (C) 2011 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/ 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 Copyright (C) 2011-2014 CoolStream International Ltd
License: GPL License: GPL
@@ -160,7 +160,11 @@ const CMenuOptionChooser::keyval CABLESETUP_SCANTP_FEC[CABLESETUP_SCANTP_FEC_COU
}; };
#endif #endif
#if _HAVE_DVB57
#define TERRSETUP_SCANTP_FEC_COUNT 9 #define TERRSETUP_SCANTP_FEC_COUNT 9
#else
#define TERRSETUP_SCANTP_FEC_COUNT 8
#endif
const CMenuOptionChooser::keyval TERRSETUP_SCANTP_FEC[TERRSETUP_SCANTP_FEC_COUNT] = const CMenuOptionChooser::keyval TERRSETUP_SCANTP_FEC[TERRSETUP_SCANTP_FEC_COUNT] =
{ {
// DVB-T // 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_7_8, LOCALE_EXTRA_FEC_7_8 },
{ FEC_AUTO, LOCALE_EXTRA_FEC_AUTO }, { FEC_AUTO, LOCALE_EXTRA_FEC_AUTO },
// DTMB ie // DTMB ie
#if _HAVE_DVB57
{ FEC_2_5, LOCALE_EXTRA_FEC_2_5 }, { FEC_2_5, LOCALE_EXTRA_FEC_2_5 },
#endif
{ FEC_3_5, LOCALE_EXTRA_FEC_3_5 }, { FEC_3_5, LOCALE_EXTRA_FEC_3_5 },
{ FEC_4_5, LOCALE_EXTRA_FEC_4_5 }, { FEC_4_5, LOCALE_EXTRA_FEC_4_5 },
}; };
#if _HAVE_DVB57
#define TERRSETUP_SCANTP_BW_COUNT 7 #define TERRSETUP_SCANTP_BW_COUNT 7
#else
#define TERRSETUP_SCANTP_BW_COUNT 4
#endif
const CMenuOptionChooser::keyval TERRSETUP_SCANTP_BW[TERRSETUP_SCANTP_BW_COUNT] = const CMenuOptionChooser::keyval TERRSETUP_SCANTP_BW[TERRSETUP_SCANTP_BW_COUNT] =
{ {
{ BANDWIDTH_8_MHZ, LOCALE_EXTRA_TP_BANDWIDTH_8MHZ }, { BANDWIDTH_8_MHZ, LOCALE_EXTRA_TP_BANDWIDTH_8MHZ },
{ BANDWIDTH_7_MHZ, LOCALE_EXTRA_TP_BANDWIDTH_7MHZ }, { BANDWIDTH_7_MHZ, LOCALE_EXTRA_TP_BANDWIDTH_7MHZ },
{ BANDWIDTH_6_MHZ, LOCALE_EXTRA_TP_BANDWIDTH_6MHZ }, { BANDWIDTH_6_MHZ, LOCALE_EXTRA_TP_BANDWIDTH_6MHZ },
#if _HAVE_DVB57
{ BANDWIDTH_5_MHZ, LOCALE_EXTRA_TP_BANDWIDTH_5MHZ }, { BANDWIDTH_5_MHZ, LOCALE_EXTRA_TP_BANDWIDTH_5MHZ },
{ BANDWIDTH_10_MHZ, LOCALE_EXTRA_TP_BANDWIDTH_10MHZ }, { BANDWIDTH_10_MHZ, LOCALE_EXTRA_TP_BANDWIDTH_10MHZ },
{ BANDWIDTH_1_712_MHZ, LOCALE_EXTRA_TP_BANDWIDTH_1_712MHZ }, { BANDWIDTH_1_712_MHZ, LOCALE_EXTRA_TP_BANDWIDTH_1_712MHZ },
#endif
{ BANDWIDTH_AUTO, LOCALE_EXTRA_TP_BANDWIDTH_AUTO } { BANDWIDTH_AUTO, LOCALE_EXTRA_TP_BANDWIDTH_AUTO }
}; };
#if _HAVE_DVB57
#define TERRSETUP_SCANTP_GI_COUNT 11 #define TERRSETUP_SCANTP_GI_COUNT 11
#else
#define TERRSETUP_SCANTP_GI_COUNT 5
#endif
const CMenuOptionChooser::keyval TERRSETUP_SCANTP_GI[TERRSETUP_SCANTP_GI_COUNT] = const CMenuOptionChooser::keyval TERRSETUP_SCANTP_GI[TERRSETUP_SCANTP_GI_COUNT] =
{ {
{ GUARD_INTERVAL_1_4, LOCALE_EXTRA_TP_GI_1_4 }, { GUARD_INTERVAL_1_4, LOCALE_EXTRA_TP_GI_1_4 },
{ GUARD_INTERVAL_1_8, LOCALE_EXTRA_TP_GI_1_8 }, { GUARD_INTERVAL_1_8, LOCALE_EXTRA_TP_GI_1_8 },
{ GUARD_INTERVAL_1_16, LOCALE_EXTRA_TP_GI_1_16 }, { GUARD_INTERVAL_1_16, LOCALE_EXTRA_TP_GI_1_16 },
{ GUARD_INTERVAL_1_32, LOCALE_EXTRA_TP_GI_1_32 }, { 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_1_128, LOCALE_EXTRA_TP_GI_1_128 },
{ GUARD_INTERVAL_19_128, LOCALE_EXTRA_TP_GI_19_128 }, { GUARD_INTERVAL_19_128, LOCALE_EXTRA_TP_GI_19_128 },
{ GUARD_INTERVAL_19_256, LOCALE_EXTRA_TP_GI_19_256 }, { GUARD_INTERVAL_19_256, LOCALE_EXTRA_TP_GI_19_256 },
{ GUARD_INTERVAL_PN420, LOCALE_EXTRA_TP_GI_PN420 }, { GUARD_INTERVAL_PN420, LOCALE_EXTRA_TP_GI_PN420 },
{ GUARD_INTERVAL_PN595, LOCALE_EXTRA_TP_GI_PN595 }, { GUARD_INTERVAL_PN595, LOCALE_EXTRA_TP_GI_PN595 },
{ GUARD_INTERVAL_PN945, LOCALE_EXTRA_TP_GI_PN945 }, { GUARD_INTERVAL_PN945, LOCALE_EXTRA_TP_GI_PN945 },
#endif
{ GUARD_INTERVAL_AUTO, LOCALE_EXTRA_TP_GI_AUTO } { 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 } { HIERARCHY_AUTO, LOCALE_EXTRA_TP_HIERARCHY_AUTO }
}; };
#if _HAVE_DVB57
#define TERRSETUP_SCANTP_TRANSMIT_MODE_COUNT 9 #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] = const CMenuOptionChooser::keyval TERRSETUP_SCANTP_TRANSMIT_MODE[TERRSETUP_SCANTP_TRANSMIT_MODE_COUNT] =
{ {
#if _HAVE_DVB57
{ TRANSMISSION_MODE_1K, LOCALE_EXTRA_TP_TRANSMIT_MODE_1K }, { TRANSMISSION_MODE_1K, LOCALE_EXTRA_TP_TRANSMIT_MODE_1K },
#endif
{ TRANSMISSION_MODE_2K, LOCALE_EXTRA_TP_TRANSMIT_MODE_2K }, { TRANSMISSION_MODE_2K, LOCALE_EXTRA_TP_TRANSMIT_MODE_2K },
{ TRANSMISSION_MODE_4K, LOCALE_EXTRA_TP_TRANSMIT_MODE_4K }, { TRANSMISSION_MODE_4K, LOCALE_EXTRA_TP_TRANSMIT_MODE_4K },
{ TRANSMISSION_MODE_8K, LOCALE_EXTRA_TP_TRANSMIT_MODE_8K }, { TRANSMISSION_MODE_8K, LOCALE_EXTRA_TP_TRANSMIT_MODE_8K },
#if _HAVE_DVB57
{ TRANSMISSION_MODE_16K, LOCALE_EXTRA_TP_TRANSMIT_MODE_16K }, { TRANSMISSION_MODE_16K, LOCALE_EXTRA_TP_TRANSMIT_MODE_16K },
{ TRANSMISSION_MODE_32K, LOCALE_EXTRA_TP_TRANSMIT_MODE_32K }, { TRANSMISSION_MODE_32K, LOCALE_EXTRA_TP_TRANSMIT_MODE_32K },
{ TRANSMISSION_MODE_C1, LOCALE_EXTRA_TP_TRANSMIT_MODE_C1 }, { TRANSMISSION_MODE_C1, LOCALE_EXTRA_TP_TRANSMIT_MODE_C1 },
{ TRANSMISSION_MODE_C3780, LOCALE_EXTRA_TP_TRANSMIT_MODE_C3780 }, { TRANSMISSION_MODE_C3780, LOCALE_EXTRA_TP_TRANSMIT_MODE_C3780 },
#endif
{ TRANSMISSION_MODE_AUTO, LOCALE_EXTRA_TP_TRANSMIT_MODE_AUTO } { 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 } { QAM_AUTO, LOCALE_EXTRA_TP_MOD_AUTO }
}; };
#if _HAVE_DVB57
#define TERRSETUP_SCANTP_MOD_COUNT 6 #define TERRSETUP_SCANTP_MOD_COUNT 6
#else
#define TERRSETUP_SCANTP_MOD_COUNT 5
#endif
const CMenuOptionChooser::keyval TERRSETUP_SCANTP_MOD[TERRSETUP_SCANTP_MOD_COUNT] = const CMenuOptionChooser::keyval TERRSETUP_SCANTP_MOD[TERRSETUP_SCANTP_MOD_COUNT] =
{ {
{ QPSK, LOCALE_EXTRA_TP_MOD_4 }, { QPSK, LOCALE_EXTRA_TP_MOD_4 },
{ QAM_16, LOCALE_EXTRA_TP_MOD_16 }, { QAM_16, LOCALE_EXTRA_TP_MOD_16 },
{ QAM_32, LOCALE_EXTRA_TP_MOD_32 }, { QAM_32, LOCALE_EXTRA_TP_MOD_32 },
{ QAM_64, LOCALE_EXTRA_TP_MOD_64 }, { QAM_64, LOCALE_EXTRA_TP_MOD_64 },
#if _HAVE_DVB57
{ QAM_4_NR, LOCALE_EXTRA_TP_MOD_4_NR }, { QAM_4_NR, LOCALE_EXTRA_TP_MOD_4_NR },
#endif
{ QAM_AUTO, LOCALE_EXTRA_TP_MOD_AUTO } { QAM_AUTO, LOCALE_EXTRA_TP_MOD_AUTO }
}; };

View File

@@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2012 CoolStream International Ltd * Copyright (C) 2012 CoolStream International Ltd
* Copyright (C) 2013,2015 Stefan Seyfried
* *
* License: GPLv2 * License: GPLv2
* *
@@ -58,6 +59,18 @@
#define ZAPIT_DS_IS_TERR(ds) (((ds) & ZAPIT_DM_TERR) != 0) #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_IS_CABLE(ds) (((ds) & ZAPIT_DM_CABLE) != 0)
#define ZAPIT_DS_BIT_MASK(ds) ((1 << (ds)) & ZAPIT_DS_MASK) #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 */ /* dvb transmission types */
typedef enum { typedef enum {
UNKNOWN_DS = ZAPIT_DS_UNKNOWN, UNKNOWN_DS = ZAPIT_DS_UNKNOWN,
@@ -103,9 +116,9 @@ typedef struct {
zapit_pilot_t pilot; zapit_pilot_t pilot;
fe_rolloff_t rolloff; fe_rolloff_t rolloff;
#if _HAVE_DVB57
enum fe_interleaving interleaving; enum fe_interleaving interleaving;
#endif
uint8_t polarization; uint8_t polarization;
} FrontendParameters; } FrontendParameters;

View File

@@ -3,7 +3,7 @@
* *
* (C) 2002-2003 Andreas Oberritter <obi@tuxbox.org> * (C) 2002-2003 Andreas Oberritter <obi@tuxbox.org>
* *
* (C) 2007-2013 Stefan Seyfried * (C) 2007-2013,2015 Stefan Seyfried
* Copyright (C) 2011 CoolStream International Ltd * Copyright (C) 2011 CoolStream International Ltd
* *
* This program is free software; you can redistribute it and/or modify * 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; return BANDWIDTH_7_MHZ;
case 0x02: case 0x02:
return BANDWIDTH_6_MHZ; return BANDWIDTH_6_MHZ;
#if _HAVE_DVB57
case 0x03: case 0x03:
return BANDWIDTH_5_MHZ; return BANDWIDTH_5_MHZ;
#endif
default: default:
return BANDWIDTH_AUTO; // AUTO 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: case QAM_256:
mod = (char *)"QAM_256"; mod = (char *)"QAM_256";
break; break;
#if _HAVE_DVB57
case QAM_4_NR: case QAM_4_NR:
mod = (char *)"QAM_4_NR"; mod = (char *)"QAM_4_NR";
break; break;
#endif
case QPSK: case QPSK:
if (delsys == DVB_T || delsys == DVB_T2 || delsys == DTMB) { if (delsys == DVB_T || delsys == DVB_T2 || delsys == DTMB) {
mod = (char *)"QPSK"; // AKA QAM_4 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: case FEC_9_10:
fec = (char *)"9/10"; fec = (char *)"9/10";
break; break;
#if _HAVE_DVB57
case FEC_2_5: case FEC_2_5:
fec = (char *)"2/3"; fec = (char *)"2/5";
break; break;
#endif
default: default:
INFO("unknown FEC: %d!", f); INFO("unknown FEC: %d!", f);
case FEC_AUTO: case FEC_AUTO:
@@ -946,9 +952,11 @@ fe_delivery_system_t CFrontend::getFEDeliverySystem(delivery_system_t Delsys)
case DVB_T: case DVB_T:
delsys = SYS_DVBT; delsys = SYS_DVBT;
break; break;
#if _HAVE_DVB57
case DVB_T2: case DVB_T2:
delsys = SYS_DVBT2; delsys = SYS_DVBT2;
break; break;
#endif
case DVB_C: case DVB_C:
delsys = SYS_DVBC_ANNEX_A; delsys = SYS_DVBC_ANNEX_A;
break; break;
@@ -964,15 +972,17 @@ fe_delivery_system_t CFrontend::getFEDeliverySystem(delivery_system_t Delsys)
case ISDBS: case ISDBS:
delsys = SYS_ISDBS; delsys = SYS_ISDBS;
break; break;
case DTMB:
delsys = SYS_DTMB;
break;
case DSS: case DSS:
delsys = SYS_DSS; delsys = SYS_DSS;
break; break;
#if _HAVE_DVB57
case DTMB:
delsys = SYS_DTMB;
break;
case TURBO: case TURBO:
delsys = SYS_TURBO; delsys = SYS_TURBO;
break; break;
#endif
default: default:
delsys = SYS_UNDEFINED; delsys = SYS_UNDEFINED;
break; break;
@@ -1052,9 +1062,11 @@ uint32_t CFrontend::getFEBandwidth(fe_bandwidth_t bandwidth)
case BANDWIDTH_6_MHZ: case BANDWIDTH_6_MHZ:
bandwidth_hz = 6000000; bandwidth_hz = 6000000;
break; break;
#if HAVE_DVBT2
case BANDWIDTH_5_MHZ: case BANDWIDTH_5_MHZ:
bandwidth_hz = 5000000; bandwidth_hz = 5000000;
break; break;
#endif
} }
return bandwidth_hz; return bandwidth_hz;
@@ -1107,9 +1119,11 @@ bool CFrontend::buildProperties(const FrontendParameters *feparams, struct dtv_p
case FEC_9_10: case FEC_9_10:
fec = FEC_9_10; fec = FEC_9_10;
break; break;
#if HAVE_DTMB
case FEC_2_5: case FEC_2_5:
fec = FEC_2_5; fec = FEC_2_5;
break; break;
#endif
default: default:
INFO("[fe%d] unknown FEC: %d", fenumber, fec_inner); INFO("[fe%d] unknown FEC: %d", fenumber, fec_inner);
case FEC_AUTO: case FEC_AUTO: