diff --git a/src/gui/motorcontrol.cpp b/src/gui/motorcontrol.cpp index 6334a1946..c36e16096 100644 --- a/src/gui/motorcontrol.cpp +++ b/src/gui/motorcontrol.cpp @@ -162,9 +162,9 @@ int CMotorControl::exec(CMenuTarget* parent, const std::string &) g_Zapit->setScanSatelliteList( satList); CZapit::getInstance()->SetLiveFrontend(frontend); - TP.feparams.frequency = atoi(scansettings.TP_freq); - TP.feparams.u.qpsk.symbol_rate = atoi(scansettings.TP_rate); - TP.feparams.u.qpsk.fec_inner = (fe_code_rate_t)scansettings.TP_fec; + TP.feparams.dvb_feparams.frequency = atoi(scansettings.TP_freq); + TP.feparams.dvb_feparams.u.qpsk.symbol_rate = atoi(scansettings.TP_rate); + TP.feparams.dvb_feparams.u.qpsk.fec_inner = (fe_code_rate_t)scansettings.TP_fec; TP.polarization = scansettings.TP_pol; g_Zapit->tune_TP(TP); diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index f3255966b..87fd2009c 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -97,14 +97,14 @@ void CScanTs::prev_next_TP( bool up) /* FIXME transponders with duplicate frequency skipped */ if(up) { for (tI = select_transponders.begin(); tI != select_transponders.end(); ++tI) { - if(tI->second.feparams.frequency > TP.feparams.frequency){ + if(tI->second.feparams.dvb_feparams.frequency > TP.feparams.dvb_feparams.frequency){ next_tp = true; break; } } } else { for ( tI=select_transponders.end() ; tI != select_transponders.begin(); --tI ) { - if(tI->second.feparams.frequency < TP.feparams.frequency) { + if(tI->second.feparams.dvb_feparams.frequency < TP.feparams.dvb_feparams.frequency) { next_tp = true; break; } @@ -112,15 +112,15 @@ void CScanTs::prev_next_TP( bool up) } if(next_tp) { - TP.feparams.frequency = tI->second.feparams.frequency; + TP.feparams.dvb_feparams.frequency = tI->second.feparams.dvb_feparams.frequency; if(g_info.delivery_system == DVB_S) { - TP.feparams.u.qpsk.symbol_rate = tI->second.feparams.u.qpsk.symbol_rate; - TP.feparams.u.qpsk.fec_inner = tI->second.feparams.u.qpsk.fec_inner; + TP.feparams.dvb_feparams.u.qpsk.symbol_rate = tI->second.feparams.dvb_feparams.u.qpsk.symbol_rate; + TP.feparams.dvb_feparams.u.qpsk.fec_inner = tI->second.feparams.dvb_feparams.u.qpsk.fec_inner; TP.polarization = tI->second.polarization; } else { - TP.feparams.u.qam.symbol_rate = tI->second.feparams.u.qam.symbol_rate; - TP.feparams.u.qam.fec_inner = tI->second.feparams.u.qam.fec_inner; - TP.feparams.u.qam.modulation = tI->second.feparams.u.qam.modulation; + TP.feparams.dvb_feparams.u.qam.symbol_rate = tI->second.feparams.dvb_feparams.u.qam.symbol_rate; + TP.feparams.dvb_feparams.u.qam.fec_inner = tI->second.feparams.dvb_feparams.u.qam.fec_inner; + TP.feparams.dvb_feparams.u.qam.modulation = tI->second.feparams.dvb_feparams.u.qam.modulation; } testFunc(); } @@ -134,8 +134,8 @@ void CScanTs::testFunc() CFrontend * frontend = CServiceScan::getInstance()->GetFrontend(); if(frontend->getInfo()->type == FE_QPSK) { - frontend->getDelSys(TP.feparams.u.qpsk.fec_inner, dvbs_get_modulation((fe_code_rate_t)TP.feparams.u.qpsk.fec_inner), f, s, m); - snprintf(buffer,sizeof(buffer), "%u %c %d %s %s %s", TP.feparams.frequency/1000, transponder::pol(TP.polarization), TP.feparams.u.qpsk.symbol_rate/1000, f, s, m); + frontend->getDelSys(TP.feparams.dvb_feparams.u.qpsk.fec_inner, dvbs_get_modulation((fe_code_rate_t)TP.feparams.dvb_feparams.u.qpsk.fec_inner), f, s, m); + snprintf(buffer,sizeof(buffer), "%u %c %d %s %s %s", TP.feparams.dvb_feparams.frequency/1000, transponder::pol(TP.polarization), TP.feparams.dvb_feparams.u.qpsk.symbol_rate/1000, f, s, m); } else if(frontend->getInfo()->type == FE_QAM) { frontend->getDelSys(scansettings.TP_fec, scansettings.TP_mod, f, s, m); snprintf(buffer,sizeof(buffer), "%u %d %s %s %s", atoi(scansettings.TP_freq)/1000, atoi(scansettings.TP_rate)/1000, f, s, m); @@ -205,17 +205,17 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) if(scansettings.scan_nit_manual) scan_flags |= CServiceScan::SCAN_NIT; TP.scan_mode = scan_flags; - TP.feparams.frequency = atoi(scansettings.TP_freq); + TP.feparams.dvb_feparams.frequency = atoi(scansettings.TP_freq); if(g_info.delivery_system == DVB_S) { - TP.feparams.u.qpsk.symbol_rate = atoi(scansettings.TP_rate); - TP.feparams.u.qpsk.fec_inner = (fe_code_rate_t) scansettings.TP_fec; + TP.feparams.dvb_feparams.u.qpsk.symbol_rate = atoi(scansettings.TP_rate); + TP.feparams.dvb_feparams.u.qpsk.fec_inner = (fe_code_rate_t) scansettings.TP_fec; TP.polarization = scansettings.TP_pol; } else { - TP.feparams.u.qam.symbol_rate = atoi(scansettings.TP_rate); - TP.feparams.u.qam.fec_inner = (fe_code_rate_t)scansettings.TP_fec; - TP.feparams.u.qam.modulation = (fe_modulation_t) scansettings.TP_mod; + TP.feparams.dvb_feparams.u.qam.symbol_rate = atoi(scansettings.TP_rate); + TP.feparams.dvb_feparams.u.qam.fec_inner = (fe_code_rate_t)scansettings.TP_fec; + TP.feparams.dvb_feparams.u.qam.modulation = (fe_modulation_t) scansettings.TP_mod; } - //printf("[neutrino] freq %d rate %d fec %d pol %d\n", TP.feparams.frequency, TP.feparams.u.qpsk.symbol_rate, TP.feparams.u.qpsk.fec_inner, TP.polarization); + //printf("[neutrino] freq %d rate %d fec %d pol %d\n", TP.feparams.dvb_feparams.frequency, TP.feparams.dvb_feparams.u.qpsk.symbol_rate, TP.feparams.dvb_feparams.u.qpsk.fec_inner, TP.polarization); } else { if(scansettings.scan_nit) scan_flags |= CServiceScan::SCAN_NIT; diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index 146c22cbb..abab6ee2f 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -983,18 +983,18 @@ void CScanSetup::updateManualSettings() transponder_list_t::iterator tI; tI = transponders.find(channel->getTransponderId()); if(tI != transponders.end()) { - sprintf(scansettings.TP_freq, "%d", tI->second.feparams.frequency); + sprintf(scansettings.TP_freq, "%d", tI->second.feparams.dvb_feparams.frequency); CFrontend * frontend = CFEManager::getInstance()->getLiveFE(); switch (frontend->getInfo()->type) { case FE_QPSK: - sprintf(scansettings.TP_rate, "%d", tI->second.feparams.u.qpsk.symbol_rate); - scansettings.TP_fec = tI->second.feparams.u.qpsk.fec_inner; + sprintf(scansettings.TP_rate, "%d", tI->second.feparams.dvb_feparams.u.qpsk.symbol_rate); + scansettings.TP_fec = tI->second.feparams.dvb_feparams.u.qpsk.fec_inner; scansettings.TP_pol = tI->second.polarization; break; case FE_QAM: - sprintf(scansettings.TP_rate, "%d", tI->second.feparams.u.qam.symbol_rate); - scansettings.TP_fec = tI->second.feparams.u.qam.fec_inner; - scansettings.TP_mod = tI->second.feparams.u.qam.modulation; + sprintf(scansettings.TP_rate, "%d", tI->second.feparams.dvb_feparams.u.qam.symbol_rate); + scansettings.TP_fec = tI->second.feparams.dvb_feparams.u.qam.fec_inner; + scansettings.TP_mod = tI->second.feparams.dvb_feparams.u.qam.modulation; break; case FE_OFDM: case FE_ATSC: @@ -1070,21 +1070,21 @@ int CTPSelectHandler::exec(CMenuTarget* parent, const std::string &/*actionkey*/ tmpI = tmplist.find(select); - printf("CTPSelectHandler::exec: selected TP: freq %d pol %d SR %d\n", tmpI->second.feparams.frequency, - tmpI->second.polarization, tmpI->second.feparams.u.qpsk.symbol_rate); + printf("CTPSelectHandler::exec: selected TP: freq %d pol %d SR %d\n", tmpI->second.feparams.dvb_feparams.frequency, + tmpI->second.polarization, tmpI->second.feparams.dvb_feparams.u.qpsk.symbol_rate); - sprintf(scansettings.TP_freq, "%d", tmpI->second.feparams.frequency); + sprintf(scansettings.TP_freq, "%d", tmpI->second.feparams.dvb_feparams.frequency); switch (frontend->getInfo()->type) { case FE_QPSK: - sprintf(scansettings.TP_rate, "%d", tmpI->second.feparams.u.qpsk.symbol_rate); - scansettings.TP_fec = tmpI->second.feparams.u.qpsk.fec_inner; + sprintf(scansettings.TP_rate, "%d", tmpI->second.feparams.dvb_feparams.u.qpsk.symbol_rate); + scansettings.TP_fec = tmpI->second.feparams.dvb_feparams.u.qpsk.fec_inner; scansettings.TP_pol = tmpI->second.polarization; break; case FE_QAM: - sprintf(scansettings.TP_rate, "%d", tmpI->second.feparams.u.qam.symbol_rate); - scansettings.TP_fec = tmpI->second.feparams.u.qam.fec_inner; - scansettings.TP_mod = tmpI->second.feparams.u.qam.modulation; + sprintf(scansettings.TP_rate, "%d", tmpI->second.feparams.dvb_feparams.u.qam.symbol_rate); + scansettings.TP_fec = tmpI->second.feparams.dvb_feparams.u.qam.fec_inner; + scansettings.TP_mod = tmpI->second.feparams.dvb_feparams.u.qam.modulation; break; case FE_OFDM: case FE_ATSC: diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index 30a407b36..ea7cbbc77 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -583,7 +583,7 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) ypos += iheight; scaling = 27000; - if (t.type == FE_QPSK && t.feparams.u.qpsk.fec_inner < FEC_S2_QPSK_1_2) + if (t.type == FE_QPSK && t.feparams.dvb_feparams.u.qpsk.fec_inner < FEC_S2_QPSK_1_2) scaling = 15000; sprintf (buf, "%s",g_Locale->getText (LOCALE_SCANTS_FREQDATA)); diff --git a/src/zapit/include/zapit/client/zapittypes.h b/src/zapit/include/zapit/client/zapittypes.h index 86073bedf..50d7a0859 100644 --- a/src/zapit/include/zapit/client/zapittypes.h +++ b/src/zapit/include/zapit/client/zapittypes.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include /* diseqc types */ typedef enum { @@ -91,7 +91,7 @@ typedef struct TP_parameter uint8_t polarization; uint8_t diseqc; int scan_mode; - struct dvb_frontend_parameters feparams; + FrontendParameters feparams; } TP_params; #endif /* __zapittypes_h__ */ diff --git a/src/zapit/include/zapit/frontend_c.h b/src/zapit/include/zapit/frontend_c.h index ec89fb384..492028124 100644 --- a/src/zapit/include/zapit/frontend_c.h +++ b/src/zapit/include/zapit/frontend_c.h @@ -28,28 +28,31 @@ #include #include #include +#include #include -#define FEC_S2_QPSK_1_2 (fe_code_rate_t)(FEC_AUTO+1) //10 -#define FEC_S2_QPSK_2_3 (fe_code_rate_t)(FEC_S2_QPSK_1_2+1) //11 -#define FEC_S2_QPSK_3_4 (fe_code_rate_t)(FEC_S2_QPSK_2_3+1) //12 -#define FEC_S2_QPSK_5_6 (fe_code_rate_t)(FEC_S2_QPSK_3_4+1) //13 -#define FEC_S2_QPSK_7_8 (fe_code_rate_t)(FEC_S2_QPSK_5_6+1) //14 -#define FEC_S2_QPSK_8_9 (fe_code_rate_t)(FEC_S2_QPSK_7_8+1) //15 -#define FEC_S2_QPSK_3_5 (fe_code_rate_t)(FEC_S2_QPSK_8_9+1) //16 -#define FEC_S2_QPSK_4_5 (fe_code_rate_t)(FEC_S2_QPSK_3_5+1) //17 -#define FEC_S2_QPSK_9_10 (fe_code_rate_t)(FEC_S2_QPSK_4_5+1) //18 +#define FEC_S2_QPSK_BASE (fe_code_rate_t)(FEC_AUTO+1) +#define FEC_S2_QPSK_1_2 (fe_code_rate_t)(FEC_S2_QPSK_BASE+0) //10 +#define FEC_S2_QPSK_2_3 (fe_code_rate_t)(FEC_S2_QPSK_BASE+1) //11 +#define FEC_S2_QPSK_3_4 (fe_code_rate_t)(FEC_S2_QPSK_BASE+2) //12 +#define FEC_S2_QPSK_5_6 (fe_code_rate_t)(FEC_S2_QPSK_BASE+3) //13 +#define FEC_S2_QPSK_7_8 (fe_code_rate_t)(FEC_S2_QPSK_BASE+4) //14 +#define FEC_S2_QPSK_8_9 (fe_code_rate_t)(FEC_S2_QPSK_BASE+5) //15 +#define FEC_S2_QPSK_3_5 (fe_code_rate_t)(FEC_S2_QPSK_BASE+6) //16 +#define FEC_S2_QPSK_4_5 (fe_code_rate_t)(FEC_S2_QPSK_BASE+7) //17 +#define FEC_S2_QPSK_9_10 (fe_code_rate_t)(FEC_S2_QPSK_BASE+8) //18 -#define FEC_S2_8PSK_1_2 (fe_code_rate_t)(FEC_S2_QPSK_9_10+1) //19 -#define FEC_S2_8PSK_2_3 (fe_code_rate_t)(FEC_S2_8PSK_1_2+1) //20 -#define FEC_S2_8PSK_3_4 (fe_code_rate_t)(FEC_S2_8PSK_2_3+1) //21 -#define FEC_S2_8PSK_5_6 (fe_code_rate_t)(FEC_S2_8PSK_3_4+1) //22 -#define FEC_S2_8PSK_7_8 (fe_code_rate_t)(FEC_S2_8PSK_5_6+1) //23 -#define FEC_S2_8PSK_8_9 (fe_code_rate_t)(FEC_S2_8PSK_7_8+1) //24 -#define FEC_S2_8PSK_3_5 (fe_code_rate_t)(FEC_S2_8PSK_8_9+1) //25 -#define FEC_S2_8PSK_4_5 (fe_code_rate_t)(FEC_S2_8PSK_3_5+1) //26 -#define FEC_S2_8PSK_9_10 (fe_code_rate_t)(FEC_S2_8PSK_4_5+1) //27 -#define FEC_S2_AUTO (fe_code_rate_t)(FEC_S2_8PSK_9_10+1) //28 +#define FEC_S2_8PSK_BASE (fe_code_rate_t)(FEC_S2_QPSK_9_10+1) +#define FEC_S2_8PSK_1_2 (fe_code_rate_t)(FEC_S2_8PSK_BASE+0) //19 +#define FEC_S2_8PSK_2_3 (fe_code_rate_t)(FEC_S2_8PSK_BASE+1) //20 +#define FEC_S2_8PSK_3_4 (fe_code_rate_t)(FEC_S2_8PSK_BASE+2) //21 +#define FEC_S2_8PSK_5_6 (fe_code_rate_t)(FEC_S2_8PSK_BASE+3) //22 +#define FEC_S2_8PSK_7_8 (fe_code_rate_t)(FEC_S2_8PSK_BASE+4) //23 +#define FEC_S2_8PSK_8_9 (fe_code_rate_t)(FEC_S2_8PSK_BASE+5) //24 +#define FEC_S2_8PSK_3_5 (fe_code_rate_t)(FEC_S2_8PSK_BASE+6) //25 +#define FEC_S2_8PSK_4_5 (fe_code_rate_t)(FEC_S2_8PSK_BASE+7) //26 +#define FEC_S2_8PSK_9_10 (fe_code_rate_t)(FEC_S2_8PSK_BASE+8) //27 +#define FEC_S2_AUTO (fe_code_rate_t)(FEC_S2_8PSK_BASE+9) //28 static inline fe_modulation_t dvbs_get_modulation(fe_code_rate_t fec) { @@ -75,21 +78,10 @@ static inline fe_rolloff_t dvbs_get_rolloff(fe_delivery_system_t delsys) return ROLLOFF_35; } -typedef struct dvb_frontend_parameters FrontendParameters; - #define MAX_LNBS 64 /* due to Diseqc 1.1 (2003-01-10 rasc) */ class CFEManager; -typedef struct frontend_config { - int diseqcRepeats; - int diseqcType; - int uni_scr; - int uni_qrg; - int motorRotationSpeed; - int highVoltage; -} frontend_config_t; - class CFrontend { private: @@ -133,14 +125,14 @@ class CFrontend int32_t lnbSwitch; /* current Transponderdata */ TP_params currentTransponder; - struct dvb_frontend_parameters curfe; + FrontendParameters curfe; bool slave; int fenumber; bool standby; - bool buildProperties(const dvb_frontend_parameters*, struct dtv_properties &); + bool buildProperties(const FrontendParameters*, struct dtv_properties &); uint32_t getDiseqcReply(const int timeout_ms) const; - struct dvb_frontend_parameters getFrontend(void) const; + FrontendParameters getFrontend(void) const; void secResetOverload(void); void secSetTone(const fe_sec_tone_mode_t mode, const uint32_t ms); void secSetVoltage(const fe_sec_voltage_t voltage, const uint32_t ms); @@ -152,7 +144,7 @@ class CFrontend void sendDiseqcStandby(void); void sendDiseqcZeroByteCommand(const uint8_t frm, const uint8_t addr, const uint8_t cmd); void sendToneBurst(const fe_sec_mini_cmd_t burst, const uint32_t ms); - int setFrontend(const struct dvb_frontend_parameters *feparams, bool nowait = false); + int setFrontend(const FrontendParameters *feparams, bool nowait = false); void setSec(const uint8_t sat_no, const uint8_t pol, const bool high_band); void set12V(bool enable); void reset(void); @@ -168,7 +160,7 @@ class CFrontend uint8_t getDiseqcPosition(void) const { return currentTransponder.diseqc; } uint8_t getDiseqcRepeats(void) const { return config.diseqcRepeats; } diseqc_t getDiseqcType(void) const { return (diseqc_t) config.diseqcType; } - uint32_t getFrequency(void) const { return curfe.frequency; } + uint32_t getFrequency(void) const { return curfe.dvb_feparams.frequency; } bool getHighBand() { return (int) getFrequency() >= lnbSwitch; } static fe_modulation_t getModulation(const uint8_t modulation); uint8_t getPolarization(void) const; @@ -203,7 +195,7 @@ class CFrontend void setConfig(frontend_config_t cfg) { setDiseqcType((diseqc_t) cfg.diseqcType); config = cfg; }; int setParameters(TP_params *TP, bool nowait = 0); - int tuneFrequency (struct dvb_frontend_parameters * feparams, uint8_t polarization, bool nowait = false); + int tuneFrequency (FrontendParameters * feparams, uint8_t polarization, bool nowait = false); const TP_params* getParameters(void) const { return ¤tTransponder; }; struct dvb_frontend_event* setParametersResponse(TP_params *TP); void setCurrentSatellitePosition(int32_t satellitePosition) {currentSatellitePosition = satellitePosition; } diff --git a/src/zapit/include/zapit/transponder.h b/src/zapit/include/zapit/transponder.h index 34c6b77c7..298d3fe52 100644 --- a/src/zapit/include/zapit/transponder.h +++ b/src/zapit/include/zapit/transponder.h @@ -21,8 +21,8 @@ #ifndef _TRANSPONDER_H_ #define _TRANSPONDER_H_ -#include #include +#include #include #include @@ -35,11 +35,11 @@ public: t_satellite_position satellitePosition; uint8_t type; - struct dvb_frontend_parameters feparams; + FrontendParameters feparams; unsigned char polarization; bool updated; - transponder(fe_type_t fType, const transponder_id_t t_id, const struct dvb_frontend_parameters p_feparams, const uint8_t p_polarization = 0); + transponder(fe_type_t fType, const transponder_id_t t_id, const FrontendParameters p_feparams, const uint8_t p_polarization = 0); transponder(); bool operator==(const transponder& t) const; diff --git a/src/zapit/lib/zapitclient.cpp b/src/zapit/lib/zapitclient.cpp index 7fd705509..bdf1e2a2c 100644 --- a/src/zapit/lib/zapitclient.cpp +++ b/src/zapit/lib/zapitclient.cpp @@ -30,7 +30,7 @@ /* libevent */ #include - +#include #include #include #include diff --git a/src/zapit/src/fastscan.cpp b/src/zapit/src/fastscan.cpp index 6a1983ed7..0e9e8c7b4 100644 --- a/src/zapit/src/fastscan.cpp +++ b/src/zapit/src/fastscan.cpp @@ -110,9 +110,9 @@ bool CServiceScan::ScanFast() printf("[fast scan] scaning operator %d for %s channels\n", op->id, type == FAST_SCAN_SD ? "SD" : type == FAST_SCAN_HD ? "HD" : "All"); - feparams.frequency = 12515000; - feparams.u.qpsk.symbol_rate = 22000000; - feparams.u.qpsk.fec_inner = FEC_5_6; + feparams.dvb_feparams.frequency = 12515000; + feparams.dvb_feparams.u.qpsk.symbol_rate = 22000000; + feparams.dvb_feparams.u.qpsk.fec_inner = FEC_5_6; polarization = 0; CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_SATELLITE, op->name, strlen(op->name)+1); @@ -477,7 +477,7 @@ bool CServiceScan::ParseFnt(unsigned short pid, unsigned short operator_id) stiterator stI; process_satellite_delivery_system_descriptor(buffer + pos2, &feparams, &polarization, &satellitePosition); - freq = feparams.frequency / 1000; + freq = feparams.dvb_feparams.frequency / 1000; TsidOnid = CREATE_TRANSPONDER_ID64(freq, satellitePosition, original_network_id, transport_stream_id); stI = transponders.find(TsidOnid); if(stI == transponders.end()) { @@ -557,7 +557,7 @@ void CServiceScan::process_satellite_delivery_system_descriptor(const unsigned c stiterator tI; int modulationSystem, modulationType, /*rollOff,*/ fec_inner; - feparams->frequency = ( + feparams->dvb_feparams.frequency = ( ((buffer[2] >> 4) * 100000000) + ((buffer[2] & 0x0F) * 10000000) + ((buffer[3] >> 4) * 1000000) + @@ -574,13 +574,13 @@ void CServiceScan::process_satellite_delivery_system_descriptor(const unsigned c ((buffer[7] >> 4) * 10) + ((buffer[7] & 0x0F) * 1) ); - feparams->inversion = INVERSION_AUTO; + feparams->dvb_feparams.inversion = INVERSION_AUTO; //rollOff = (buffer[8] >> 4) & 0x03; //alpha_0_35, alpha_0_25, alpha_0_20, alpha_auto modulationSystem = (buffer[8] >> 2) & 0x01; // 1= DVB_S2 modulationType = (buffer[8]) & 0x03; // 1=QPSK, 2=M8PSK - feparams->u.qpsk.symbol_rate = ( + feparams->dvb_feparams.u.qpsk.symbol_rate = ( ((buffer[9] >> 4) * 100000000) + ((buffer[9] & 0x0F) * 10000000) + ((buffer[10] >> 4) * 1000000) + @@ -594,19 +594,19 @@ void CServiceScan::process_satellite_delivery_system_descriptor(const unsigned c if(modulationType == 2) fec_inner += 9; - feparams->u.qpsk.fec_inner = (fe_code_rate_t) fec_inner; + feparams->dvb_feparams.u.qpsk.fec_inner = (fe_code_rate_t) fec_inner; * polarization = (buffer[8] >> 5) & 0x03; /* workarounds for braindead broadcasters (e.g. on Telstar 12 at 15.0W) */ - if (feparams->frequency >= 100000000) - feparams->frequency /= 10; - if (feparams->u.qpsk.symbol_rate >= 50000000) - feparams->u.qpsk.symbol_rate /= 10; + if (feparams->dvb_feparams.frequency >= 100000000) + feparams->dvb_feparams.frequency /= 10; + if (feparams->dvb_feparams.u.qpsk.symbol_rate >= 50000000) + feparams->dvb_feparams.u.qpsk.symbol_rate /= 10; - feparams->frequency = (int) 1000 * (int) round ((double) feparams->frequency / (double) 1000); + feparams->dvb_feparams.frequency = (int) 1000 * (int) round ((double) feparams->dvb_feparams.frequency / (double) 1000); #ifdef SCAN_DEBUG - printf("[FNT] new TP: sat %d freq %d SR %d fec %d pol %d\n", *satellitePosition, feparams->frequency, feparams->u.qpsk.symbol_rate, fec_inner, * polarization); + printf("[FNT] new TP: sat %d freq %d SR %d fec %d pol %d\n", *satellitePosition, feparams->dvb_feparams.frequency, feparams->dvb_feparams.u.qpsk.symbol_rate, fec_inner, * polarization); #endif } diff --git a/src/zapit/src/frontend.cpp b/src/zapit/src/frontend.cpp index 42d8fb60c..e71764a47 100644 --- a/src/zapit/src/frontend.cpp +++ b/src/zapit/src/frontend.cpp @@ -163,15 +163,15 @@ CFrontend::CFrontend(int Number, int Adapter) memset(&curfe, 0, sizeof(curfe)); - curfe.u.qpsk.fec_inner = FEC_3_4; - curfe.u.qam.fec_inner = FEC_3_4; - curfe.u.qam.modulation = QAM_64; + curfe.dvb_feparams.u.qpsk.fec_inner = FEC_3_4; + curfe.dvb_feparams.u.qam.fec_inner = FEC_3_4; + curfe.dvb_feparams.u.qam.modulation = QAM_64; tuned = false; uncommitedInput = 255; diseqc = 255; currentTransponder.polarization = 1; - currentTransponder.feparams.frequency = 0; + currentTransponder.feparams.dvb_feparams.frequency = 0; currentTransponder.TP_id = 0; currentTransponder.diseqc = 255; @@ -294,9 +294,9 @@ void CFrontend::Unlock() fe_code_rate_t CFrontend::getCFEC() { if (info.type == FE_QPSK) { - return curfe.u.qpsk.fec_inner; + return curfe.dvb_feparams.u.qpsk.fec_inner; } else { - return curfe.u.qam.fec_inner; + return curfe.dvb_feparams.u.qam.fec_inner; } } @@ -381,9 +381,9 @@ uint8_t CFrontend::getPolarization(void) const uint32_t CFrontend::getRate() { if (info.type == FE_QPSK) { - return curfe.u.qpsk.symbol_rate; + return curfe.dvb_feparams.u.qpsk.symbol_rate; } else { - return curfe.u.qam.symbol_rate; + return curfe.dvb_feparams.u.qam.symbol_rate; } } @@ -400,7 +400,7 @@ fe_status_t CFrontend::getStatus(void) const #endif } -struct dvb_frontend_parameters CFrontend::getFrontend(void) const +FrontendParameters CFrontend::getFrontend(void) const { return currentTransponder.feparams; } @@ -607,7 +607,7 @@ void CFrontend::getDelSys(uint8_t type, int f, int m, char *&fec, char *&sys, ch } } -bool CFrontend::buildProperties(const struct dvb_frontend_parameters *feparams, struct dtv_properties& cmdseq) +bool CFrontend::buildProperties(const FrontendParameters *feparams, struct dtv_properties& cmdseq) { fe_delivery_system delsys = SYS_DVBS; fe_modulation_t modulation = QPSK; @@ -619,14 +619,14 @@ bool CFrontend::buildProperties(const struct dvb_frontend_parameters *feparams, /* Decode the needed settings */ switch (info.type) { case FE_QPSK: - fec_inner = feparams->u.qpsk.fec_inner; + fec_inner = feparams->dvb_feparams.u.qpsk.fec_inner; delsys = dvbs_get_delsys(fec_inner); modulation = dvbs_get_modulation(fec_inner); rolloff = dvbs_get_rolloff(delsys); break; case FE_QAM: - fec_inner = feparams->u.qam.fec_inner; - modulation = feparams->u.qam.modulation; + fec_inner = feparams->dvb_feparams.u.qam.fec_inner; + modulation = feparams->dvb_feparams.u.qam.modulation; delsys = SYS_DVBC_ANNEX_AC; break; default: @@ -715,15 +715,15 @@ bool CFrontend::buildProperties(const struct dvb_frontend_parameters *feparams, memcpy(cmdseq.props, dvbs_cmdargs, sizeof(dvbs_cmdargs)); nrOfProps = FE_DVBS_PROPS; } - cmdseq.props[FREQUENCY].u.data = feparams->frequency; - cmdseq.props[SYMBOL_RATE].u.data= feparams->u.qpsk.symbol_rate; + cmdseq.props[FREQUENCY].u.data = feparams->dvb_feparams.frequency; + cmdseq.props[SYMBOL_RATE].u.data= feparams->dvb_feparams.u.qpsk.symbol_rate; cmdseq.props[INNER_FEC].u.data = fec; /*_inner*/ ; break; case FE_QAM: memcpy(cmdseq.props, dvbc_cmdargs, sizeof(dvbc_cmdargs)); - cmdseq.props[FREQUENCY].u.data = feparams->frequency; + cmdseq.props[FREQUENCY].u.data = feparams->dvb_feparams.frequency; cmdseq.props[MODULATION].u.data = modulation; - cmdseq.props[SYMBOL_RATE].u.data= feparams->u.qam.symbol_rate; + cmdseq.props[SYMBOL_RATE].u.data= feparams->dvb_feparams.u.qam.symbol_rate; cmdseq.props[INNER_FEC].u.data = fec_inner; nrOfProps = FE_DVBC_PROPS; break; @@ -734,7 +734,7 @@ bool CFrontend::buildProperties(const struct dvb_frontend_parameters *feparams, if (config.uni_scr >= 0) - cmdseq.props[FREQUENCY].u.data = sendEN50494TuningCommand(feparams->frequency, + cmdseq.props[FREQUENCY].u.data = sendEN50494TuningCommand(feparams->dvb_feparams.frequency, currentToneMode == SEC_TONE_ON, currentVoltage == SEC_VOLTAGE_18, 0); /* bank 0/1, like mini-diseqc a/b, not impl.*/ @@ -744,7 +744,7 @@ bool CFrontend::buildProperties(const struct dvb_frontend_parameters *feparams, return true; } -int CFrontend::setFrontend(const struct dvb_frontend_parameters *feparams, bool /*nowait*/) +int CFrontend::setFrontend(const FrontendParameters *feparams, bool /*nowait*/) { struct dtv_property cmdargs[FE_COMMON_PROPS + FE_DVBS2_PROPS]; // WARNING: increase when needed more space struct dtv_properties cmdseq; @@ -1020,7 +1020,7 @@ bool CFrontend::setInput(CZapitChannel * channel, bool nvod) currentTransponder.TP_id = tpI->first; currentSatellitePosition = channel->getSatellitePosition(); - setInput(channel->getSatellitePosition(), tpI->second.feparams.frequency, tpI->second.polarization); + setInput(channel->getSatellitePosition(), tpI->second.feparams.dvb_feparams.frequency, tpI->second.polarization); return true; } @@ -1111,7 +1111,7 @@ bool CFrontend::retuneChannel(void) int CFrontend::tuneFrequency(FrontendParameters * feparams, uint8_t polarization, bool nowait) { TP_params TP; - //printf("[fe%d] tune to frequency %d pol %s srate %d\n", fenumber, feparams->frequency, polarization ? "Vertical/Right" : "Horizontal/Left", feparams->u.qpsk.symbol_rate); + //printf("[fe%d] tune to frequency %d pol %s srate %d\n", fenumber, feparams->dvb_feparams.frequency, polarization ? "Vertical/Right" : "Horizontal/Left", feparams->dvb_feparams.u.qpsk.symbol_rate); memmove(&curfe, feparams, sizeof(struct dvb_frontend_parameters)); memmove(&TP.feparams, feparams, sizeof(struct dvb_frontend_parameters)); @@ -1129,7 +1129,7 @@ int CFrontend::setParameters(TP_params *TP, bool /*nowait*/) /* Copy the data for local use */ currTP = *TP; feparams = &currTP.feparams; - freq = (int) feparams->frequency; + freq = (int) feparams->dvb_feparams.frequency; char * f, *s, *m; if (info.type == FE_QPSK) { @@ -1143,35 +1143,35 @@ int CFrontend::setParameters(TP_params *TP, bool /*nowait*/) freq_offset = lnbOffsetHigh; } - feparams->frequency = abs(freq - freq_offset); + feparams->dvb_feparams.frequency = abs(freq - freq_offset); setSec(TP->diseqc, TP->polarization, high_band); - getDelSys(feparams->u.qpsk.fec_inner, dvbs_get_modulation(feparams->u.qpsk.fec_inner), f, s, m); + getDelSys(feparams->dvb_feparams.u.qpsk.fec_inner, dvbs_get_modulation(feparams->dvb_feparams.u.qpsk.fec_inner), f, s, m); } else if (info.type == FE_QAM) { if (freq < 1000*1000) - feparams->frequency = freq * 1000; - getDelSys(feparams->u.qam.fec_inner,feparams->u.qam.modulation, f, s, m); + feparams->dvb_feparams.frequency = freq * 1000; + getDelSys(feparams->dvb_feparams.u.qam.fec_inner,feparams->dvb_feparams.u.qam.modulation, f, s, m); #if 0 - switch (TP->feparams.inversion) { + switch (TP->feparams.dvb_feparams.inversion) { case INVERSION_OFF: - TP->feparams.inversion = INVERSION_ON; + TP->feparams.dvb_feparams.inversion = INVERSION_ON; break; case INVERSION_ON: default: - TP->feparams.inversion = INVERSION_OFF; + TP->feparams.dvb_feparams.inversion = INVERSION_OFF; break; } #endif } - //printf("[fe%d] tuner to frequency %d (offset %d timeout %d)\n", fenumber, feparams->frequency, freq_offset, TIMEOUT_MAX_MS); - //printf("[fe%d] tune to frequency %d (tuner %d offset %d timeout %d)\n", fenumber, freq, feparams->frequency, freq_offset, TIMEOUT_MAX_MS); + //printf("[fe%d] tuner to frequency %d (offset %d timeout %d)\n", fenumber, feparams->dvb_feparams.frequency, freq_offset, TIMEOUT_MAX_MS); + //printf("[fe%d] tune to frequency %d (tuner %d offset %d timeout %d)\n", fenumber, freq, feparams->dvb_feparams.frequency, freq_offset, TIMEOUT_MAX_MS); printf("[fe%d] tune to %d %s %s %s %s srate %d (tuner %d offset %d timeout %d)\n", fenumber, freq, s, m, f, - TP->polarization ? "V/R" : "H/L", feparams->u.qpsk.symbol_rate, feparams->frequency, freq_offset, TIMEOUT_MAX_MS); + TP->polarization ? "V/R" : "H/L", feparams->dvb_feparams.u.qpsk.symbol_rate, feparams->dvb_feparams.frequency, freq_offset, TIMEOUT_MAX_MS); setFrontend(feparams); #if 0 if (tuned) { - ret = diff(event.parameters.frequency, TP->feparams.frequency); + ret = diff(event.parameters.frequency, TP->feparams.dvb_feparams.frequency); /* if everything went ok, then it is a good idea to copy the real * frontend parameters, so we can update the service list, if it differs. * TODO: set a flag to indicate a change in the service list */ @@ -1184,7 +1184,7 @@ int CFrontend::setParameters(TP_params *TP, bool /*nowait*/) * because they are used for the channel list and were given * to this method as a pointer */ if (info.type == FE_QPSK) - TP->feparams.frequency += freq_offset; + TP->feparams.dvb_feparams.frequency += freq_offset; #endif return tuned; diff --git a/src/zapit/src/getservices.cpp b/src/zapit/src/getservices.cpp index 96e8f2c20..141b6cca6 100644 --- a/src/zapit/src/getservices.cpp +++ b/src/zapit/src/getservices.cpp @@ -298,31 +298,31 @@ void CServiceManager::ParseTransponders(xmlNodePtr node, t_satellite_position sa t_transport_stream_id transport_stream_id = xmlGetNumericAttribute(node, "id", 16); t_original_network_id original_network_id = xmlGetNumericAttribute(node, "on", 16); - feparams.frequency = xmlGetNumericAttribute(node, "frq", 0); - feparams.inversion = (fe_spectral_inversion) xmlGetNumericAttribute(node, "inv", 0); + feparams.dvb_feparams.frequency = xmlGetNumericAttribute(node, "frq", 0); + feparams.dvb_feparams.inversion = (fe_spectral_inversion) xmlGetNumericAttribute(node, "inv", 0); if(cable) { - feparams.u.qam.symbol_rate = xmlGetNumericAttribute(node, "sr", 0); - feparams.u.qam.fec_inner = (fe_code_rate_t) xmlGetNumericAttribute(node, "fec", 0); - feparams.u.qam.modulation = (fe_modulation_t) xmlGetNumericAttribute(node, "mod", 0); + feparams.dvb_feparams.u.qam.symbol_rate = xmlGetNumericAttribute(node, "sr", 0); + feparams.dvb_feparams.u.qam.fec_inner = (fe_code_rate_t) xmlGetNumericAttribute(node, "fec", 0); + feparams.dvb_feparams.u.qam.modulation = (fe_modulation_t) xmlGetNumericAttribute(node, "mod", 0); - if (feparams.frequency > 1000*1000) - feparams.frequency = feparams.frequency/1000; //transponderlist was read from tuxbox + if (feparams.dvb_feparams.frequency > 1000*1000) + feparams.dvb_feparams.frequency = feparams.dvb_feparams.frequency/1000; //transponderlist was read from tuxbox } else { - feparams.u.qpsk.fec_inner = (fe_code_rate_t) xmlGetNumericAttribute(node, "fec", 0); - feparams.u.qpsk.symbol_rate = xmlGetNumericAttribute(node, "sr", 0); + feparams.dvb_feparams.u.qpsk.fec_inner = (fe_code_rate_t) xmlGetNumericAttribute(node, "fec", 0); + feparams.dvb_feparams.u.qpsk.symbol_rate = xmlGetNumericAttribute(node, "sr", 0); polarization = xmlGetNumericAttribute(node, "pol", 0); - if(feparams.u.qpsk.symbol_rate < 50000) - feparams.u.qpsk.symbol_rate = feparams.u.qpsk.symbol_rate * 1000; + if(feparams.dvb_feparams.u.qpsk.symbol_rate < 50000) + feparams.dvb_feparams.u.qpsk.symbol_rate = feparams.dvb_feparams.u.qpsk.symbol_rate * 1000; - if(feparams.frequency < 20000) - feparams.frequency = feparams.frequency*1000; + if(feparams.dvb_feparams.frequency < 20000) + feparams.dvb_feparams.frequency = feparams.dvb_feparams.frequency*1000; else - feparams.frequency = (int) 1000 * (int) round ((double) feparams.frequency / (double) 1000); + feparams.dvb_feparams.frequency = (int) 1000 * (int) round ((double) feparams.dvb_feparams.frequency / (double) 1000); } - freq_id_t freq = CREATE_FREQ_ID(feparams.frequency, cable); + freq_id_t freq = CREATE_FREQ_ID(feparams.dvb_feparams.frequency, cable); transponder_id_t tid = CREATE_TRANSPONDER_ID64(freq, satellitePosition,original_network_id,transport_stream_id); transponder t(frontendType, tid, feparams, polarization); @@ -465,18 +465,18 @@ void CServiceManager::ParseSatTransponders(fe_type_t fType, xmlNodePtr search, t while ((tps = xmlGetNextOccurence(tps, "transponder")) != NULL) { memset(&feparams, 0x00, sizeof(FrontendParameters)); - feparams.frequency = xmlGetNumericAttribute(tps, "frequency", 0); - feparams.inversion = INVERSION_AUTO; + feparams.dvb_feparams.frequency = xmlGetNumericAttribute(tps, "frequency", 0); + feparams.dvb_feparams.inversion = INVERSION_AUTO; if (fType == FE_QAM) { - feparams.u.qam.symbol_rate = xmlGetNumericAttribute(tps, "symbol_rate", 0); - feparams.u.qam.fec_inner = (fe_code_rate_t) xmlGetNumericAttribute(tps, "fec_inner", 0); - feparams.u.qam.modulation = (fe_modulation_t) xmlGetNumericAttribute(tps, "modulation", 0); - if (feparams.frequency > 1000*1000) - feparams.frequency=feparams.frequency/1000; //transponderlist was read from tuxbox + feparams.dvb_feparams.u.qam.symbol_rate = xmlGetNumericAttribute(tps, "symbol_rate", 0); + feparams.dvb_feparams.u.qam.fec_inner = (fe_code_rate_t) xmlGetNumericAttribute(tps, "fec_inner", 0); + feparams.dvb_feparams.u.qam.modulation = (fe_modulation_t) xmlGetNumericAttribute(tps, "modulation", 0); + if (feparams.dvb_feparams.frequency > 1000*1000) + feparams.dvb_feparams.frequency=feparams.dvb_feparams.frequency/1000; //transponderlist was read from tuxbox } else if (fType == FE_QPSK) { - feparams.u.qpsk.symbol_rate = xmlGetNumericAttribute(tps, "symbol_rate", 0); + feparams.dvb_feparams.u.qpsk.symbol_rate = xmlGetNumericAttribute(tps, "symbol_rate", 0); polarization = xmlGetNumericAttribute(tps, "polarization", 0); uint8_t system = xmlGetNumericAttribute(tps, "system", 0); uint8_t modulation = xmlGetNumericAttribute(tps, "modulation", 0); @@ -484,10 +484,10 @@ void CServiceManager::ParseSatTransponders(fe_type_t fType, xmlNodePtr search, t xml_fec = CFrontend::getCodeRate(xml_fec, system); if(modulation == 2 && ((fe_code_rate_t) xml_fec != FEC_AUTO)) xml_fec += 9; - feparams.u.qpsk.fec_inner = (fe_code_rate_t) xml_fec; - feparams.frequency = (int) 1000 * (int) round ((double) feparams.frequency / (double) 1000); + feparams.dvb_feparams.u.qpsk.fec_inner = (fe_code_rate_t) xml_fec; + feparams.dvb_feparams.frequency = (int) 1000 * (int) round ((double) feparams.dvb_feparams.frequency / (double) 1000); } - freq_id_t freq = CREATE_FREQ_ID(feparams.frequency, fType == FE_QAM); + freq_id_t freq = CREATE_FREQ_ID(feparams.dvb_feparams.frequency, fType == FE_QAM); polarization &= 7; transponder_id_t tid = CREATE_TRANSPONDER_ID64(freq, satellitePosition, fake_nid, fake_tid); diff --git a/src/zapit/src/scan.cpp b/src/zapit/src/scan.cpp index b91871e8c..9d26a3757 100644 --- a/src/zapit/src/scan.cpp +++ b/src/zapit/src/scan.cpp @@ -132,7 +132,7 @@ void CServiceScan::CleanAllMaps() bool CServiceScan::tuneFrequency(FrontendParameters *feparams, uint8_t polarization, t_satellite_position satellitePosition) { - frontend->setInput(satellitePosition, feparams->frequency, polarization); + frontend->setInput(satellitePosition, feparams->dvb_feparams.frequency, polarization); int ret = frontend->driveToSatellitePosition(satellitePosition, false); //true); if(ret > 0) { printf("[scan] waiting %d seconds for motor to turn satellite dish.\n", ret); @@ -268,7 +268,7 @@ _repeat: } } - freq_id_t freq = CREATE_FREQ_ID(tI->second.feparams.frequency, cable); + freq_id_t freq = CREATE_FREQ_ID(tI->second.feparams.dvb_feparams.frequency, cable); CNit nit(satellitePosition, freq, cable_nid); if(flags & SCAN_NIT) @@ -581,13 +581,13 @@ bool CServiceScan::ScanTransponder() printf("[scan] scanning sat %s position %d\n", providerName.c_str(), satellitePosition); CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_SATELLITE, providerName.c_str(), providerName.size()+1); - TP->feparams.inversion = INVERSION_AUTO; + TP->feparams.dvb_feparams.inversion = INVERSION_AUTO; flags = TP->scan_mode; printf("[scan] NIT %s, fta only: %s, satellites %s\n", flags & SCAN_NIT ? "yes" : "no", flags & SCAN_FTA ? "yes" : "no", scanProviders.size() == 1 ? "single" : "multi"); - freq_id_t freq = CREATE_FREQ_ID(TP->feparams.frequency, cable); + freq_id_t freq = CREATE_FREQ_ID(TP->feparams.dvb_feparams.frequency, cable); fake_tid++; fake_nid++; transponder_id_t tid = CREATE_TRANSPONDER_ID64(freq, satellitePosition, fake_nid, fake_tid); @@ -629,7 +629,7 @@ bool CServiceScan::ReplaceTransponderParams(freq_id_t freq, t_satellite_position bool ret = false; for (transponder_list_t::iterator tI = transponders.begin(); tI != transponders.end(); ++tI) { if (tI->second.satellitePosition == satellitePosition) { - freq_id_t newfreq = CREATE_FREQ_ID(tI->second.feparams.frequency, cable); + freq_id_t newfreq = CREATE_FREQ_ID(tI->second.feparams.dvb_feparams.frequency, cable); if (freq == newfreq) { memcpy(&tI->second.feparams, feparams, sizeof(struct dvb_frontend_parameters)); tI->second.polarization = polarization; @@ -644,7 +644,7 @@ bool CServiceScan::ReplaceTransponderParams(freq_id_t freq, t_satellite_position void CServiceScan::SendTransponderInfo(transponder &t) { - uint32_t actual_freq = t.feparams.frequency; + uint32_t actual_freq = t.feparams.dvb_feparams.frequency; if (!cable) actual_freq /= 1000; CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_REPORT_FREQUENCY, &actual_freq,sizeof(actual_freq)); @@ -654,7 +654,7 @@ void CServiceScan::SendTransponderInfo(transponder &t) CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_SERVICENAME, (void *) " ", 2); if (!cable) { - uint32_t actual_polarisation = ((t.feparams.u.qpsk.symbol_rate/1000) << 16) | (t.feparams.u.qpsk.fec_inner << 8) | (uint)t.polarization; + uint32_t actual_polarisation = ((t.feparams.dvb_feparams.u.qpsk.symbol_rate/1000) << 16) | (t.feparams.dvb_feparams.u.qpsk.fec_inner << 8) | (uint)t.polarization; CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_REPORT_FREQUENCYP, &actual_polarisation,sizeof(actual_polarisation)); } } diff --git a/src/zapit/src/scannit.cpp b/src/zapit/src/scannit.cpp index 6cd1986fa..762960867 100644 --- a/src/zapit/src/scannit.cpp +++ b/src/zapit/src/scannit.cpp @@ -303,21 +303,59 @@ bool CNit::ParseSatelliteDescriptor(SatelliteDeliverySystemDescriptor * sd, Tran } uint8_t polarization = sd->getPolarization(); + uint8_t modulation = sd->getModulation(); + uint8_t modulation_system = sd->getModulationSystem(); FrontendParameters feparams; - feparams.inversion = INVERSION_AUTO; - feparams.frequency = sd->getFrequency() * 10; - feparams.u.qpsk.symbol_rate = sd->getSymbolRate() * 100; + switch (modulation_system) { + case 0: // DVB-S + feparams.delsys = SYS_DVBS; + // Hack for APSTAR 138E, 8PSK signalled but delsys set to DVB-S + if (modulation == 2) + feparams.delsys = SYS_DVBS2; + break; + case 1: // DVB-S2 + feparams.delsys = SYS_DVBS2; + break; + default: +#ifdef DEBUG_NIT + printf("NIT: undefined modulation system %08x\n", modulation_system; +#endif + feparams.delsys = SYS_UNDEFINED; + break; + } + + feparams.dvb_feparams.inversion = INVERSION_AUTO; + feparams.dvb_feparams.frequency = sd->getFrequency() * 10; + feparams.dvb_feparams.u.qpsk.symbol_rate = sd->getSymbolRate() * 100; int fec_inner = CFrontend::getCodeRate(sd->getFecInner(), sd->getModulationSystem()); - if(sd->getModulation() == 2 && ((fe_code_rate_t) fec_inner != FEC_AUTO)) - fec_inner += 9; + if(sd->getModulation() == 2 && ((fe_code_rate_t) fec_inner != FEC_AUTO)) { + if (sd->getModulationSystem() != 1) + fec_inner = (fec_inner - 1) + FEC_S2_8PSK_BASE; + else + fec_inner += 9; + } - feparams.u.qpsk.fec_inner = (fe_code_rate_t) fec_inner; - feparams.frequency = (int) 1000 * (int) round ((double) feparams.frequency / (double) 1000); + // Set the roll-off + switch (sd->getRollOff()) { + case 0: + default: + feparams.rolloff = ROLLOFF_35; + break; + case 1: + feparams.rolloff = ROLLOFF_25; + break; + case 2: + feparams.rolloff = ROLLOFF_20; + break; + } - freq_id_t freq = CREATE_FREQ_ID(feparams.frequency, false); + feparams.dvb_feparams.u.qpsk.fec_inner = (fe_code_rate_t) fec_inner; + feparams.dvb_feparams.frequency = (int) 1000 * (int) round ((double) feparams.dvb_feparams.frequency / (double) 1000); + + freq_id_t freq = CREATE_FREQ_ID(feparams.dvb_feparams.frequency, false); transponder_id_t TsidOnid = CREATE_TRANSPONDER_ID64( freq, satellitePosition, tsinfo->getOriginalNetworkId(), tsinfo->getTransportStreamId()); @@ -333,16 +371,16 @@ bool CNit::ParseCableDescriptor(CableDeliverySystemDescriptor * sd, TransportStr FrontendParameters feparams; - feparams.inversion = INVERSION_AUTO; - feparams.frequency = sd->getFrequency() * 100; - feparams.u.qam.symbol_rate = sd->getSymbolRate() * 100; - feparams.u.qam.fec_inner = CFrontend::getCodeRate(sd->getFecInner()); - feparams.u.qam.modulation = CFrontend::getModulation(sd->getModulation()); + feparams.dvb_feparams.inversion = INVERSION_AUTO; + feparams.dvb_feparams.frequency = sd->getFrequency() * 100; + feparams.dvb_feparams.u.qam.symbol_rate = sd->getSymbolRate() * 100; + feparams.dvb_feparams.u.qam.fec_inner = CFrontend::getCodeRate(sd->getFecInner()); + feparams.dvb_feparams.u.qam.modulation = CFrontend::getModulation(sd->getModulation()); - if(feparams.frequency > 1000*1000) - feparams.frequency /= 1000; + if(feparams.dvb_feparams.frequency > 1000*1000) + feparams.dvb_feparams.frequency /= 1000; - freq_id_t freq = CREATE_FREQ_ID(feparams.frequency, true); + freq_id_t freq = CREATE_FREQ_ID(feparams.dvb_feparams.frequency, true); transponder_id_t TsidOnid = CREATE_TRANSPONDER_ID64( freq, satellitePosition, tsinfo->getOriginalNetworkId(), tsinfo->getTransportStreamId()); diff --git a/src/zapit/src/transponder.cpp b/src/zapit/src/transponder.cpp index 0e6f54869..0db0d34bb 100644 --- a/src/zapit/src/transponder.cpp +++ b/src/zapit/src/transponder.cpp @@ -23,7 +23,7 @@ #include #include -transponder::transponder(fe_type_t fType, const transponder_id_t t_id, const struct dvb_frontend_parameters p_feparams, const uint8_t p_polarization) +transponder::transponder(fe_type_t fType, const transponder_id_t t_id, const FrontendParameters p_feparams, const uint8_t p_polarization) { transponder_id = t_id; transport_stream_id = GET_TRANSPORT_STREAM_ID_FROM_TRANSPONDER_ID(t_id); @@ -41,7 +41,7 @@ transponder::transponder(fe_type_t fType, const transponder_id_t t_id, const str transponder::transponder() { - memset(&feparams, 0, sizeof(struct dvb_frontend_parameters)); + memset(&feparams, 0, sizeof(FrontendParameters)); transponder_id = 0; transport_stream_id = 0; original_network_id = 0; @@ -57,28 +57,31 @@ bool transponder::operator==(const transponder& t) const //(transport_stream_id == t.transport_stream_id) && //(original_network_id == t.original_network_id) && ((polarization & 1) == (t.polarization & 1)) && - (abs((int) feparams.frequency - (int)t.feparams.frequency) <= 3000) + (abs((int) feparams.dvb_feparams.frequency - (int)t.feparams.dvb_feparams.frequency) <= 3000) ); } bool transponder::compare(const transponder& t) const { bool ret = false; + const struct dvb_frontend_parameters *dvb_feparams1 = &feparams.dvb_feparams; + const struct dvb_frontend_parameters *dvb_feparams2 = &t.feparams.dvb_feparams; + if (type == FE_QAM) { ret = ( (t == (*this)) && - (feparams.u.qam.symbol_rate == t.feparams.u.qam.symbol_rate) && - (feparams.u.qam.fec_inner == t.feparams.u.qam.fec_inner || - feparams.u.qam.fec_inner == FEC_AUTO || t.feparams.u.qam.fec_inner == FEC_AUTO) && - (feparams.u.qam.modulation == t.feparams.u.qam.modulation || - feparams.u.qam.modulation == QAM_AUTO || t.feparams.u.qam.modulation == QAM_AUTO) + (dvb_feparams1->u.qam.symbol_rate == dvb_feparams2->u.qam.symbol_rate) && + (dvb_feparams1->u.qam.fec_inner == dvb_feparams2->u.qam.fec_inner || + dvb_feparams1->u.qam.fec_inner == FEC_AUTO || dvb_feparams2->u.qam.fec_inner == FEC_AUTO) && + (dvb_feparams1->u.qam.modulation == dvb_feparams2->u.qam.modulation || + dvb_feparams1->u.qam.modulation == QAM_AUTO || dvb_feparams2->u.qam.modulation == QAM_AUTO) ); } else { ret = ( (t == (*this)) && - (feparams.u.qpsk.symbol_rate == t.feparams.u.qpsk.symbol_rate) && - (feparams.u.qpsk.fec_inner == t.feparams.u.qpsk.fec_inner || - feparams.u.qpsk.fec_inner == FEC_AUTO || t.feparams.u.qpsk.fec_inner == FEC_AUTO) + (dvb_feparams1->u.qpsk.symbol_rate == dvb_feparams2->u.qpsk.symbol_rate) && + (dvb_feparams1->u.qpsk.fec_inner == dvb_feparams2->u.qpsk.fec_inner || + dvb_feparams1->u.qpsk.fec_inner == FEC_AUTO || dvb_feparams2->u.qpsk.fec_inner == FEC_AUTO) ); } return ret; @@ -86,32 +89,36 @@ bool transponder::compare(const transponder& t) const void transponder::dumpServiceXml(FILE * fd) { + struct dvb_frontend_parameters *dvb_feparams = &feparams.dvb_feparams; + if (type == FE_QAM) { fprintf(fd, "\t\t\n", transport_stream_id, original_network_id, - feparams.frequency, feparams.inversion, - feparams.u.qam.symbol_rate, feparams.u.qam.fec_inner, - feparams.u.qam.modulation); + dvb_feparams->frequency, dvb_feparams->inversion, + dvb_feparams->u.qam.symbol_rate, dvb_feparams->u.qam.fec_inner, + dvb_feparams->u.qam.modulation); } else { fprintf(fd, "\t\t\n", transport_stream_id, original_network_id, - feparams.frequency, feparams.inversion, - feparams.u.qpsk.symbol_rate, feparams.u.qpsk.fec_inner, + dvb_feparams->frequency, dvb_feparams->inversion, + dvb_feparams->u.qpsk.symbol_rate, dvb_feparams->u.qpsk.fec_inner, polarization); } } void transponder::dump(std::string label) { + struct dvb_frontend_parameters *dvb_feparams = &feparams.dvb_feparams; + if (type == FE_QAM) printf("%s tp-id %016llx freq %d rate %d fec %d mod %d\n", label.c_str(), - transponder_id, feparams.frequency, feparams.u.qam.symbol_rate, - feparams.u.qam.fec_inner, feparams.u.qam.modulation); + transponder_id, dvb_feparams->frequency, dvb_feparams->u.qam.symbol_rate, + dvb_feparams->u.qam.fec_inner, dvb_feparams->u.qam.modulation); else printf("%s tp-id %016llx freq %d rate %d fec %d pol %d\n", label.c_str(), - transponder_id, feparams.frequency, feparams.u.qpsk.symbol_rate, - feparams.u.qpsk.fec_inner, polarization); + transponder_id, dvb_feparams->frequency, dvb_feparams->u.qpsk.symbol_rate, + dvb_feparams->u.qpsk.fec_inner, polarization); } void transponder::ddump(std::string label) @@ -136,14 +143,16 @@ std::string transponder::description() { char buf[128] = {0}; char * f, *s, *m; + struct dvb_frontend_parameters *dvb_feparams = &feparams.dvb_feparams; + switch(type) { case FE_QPSK: - CFrontend::getDelSys(type, feparams.u.qpsk.fec_inner, dvbs_get_modulation(feparams.u.qpsk.fec_inner), f, s, m); - snprintf(buf, sizeof(buf), "%d %c %d %s %s %s ", feparams.frequency/1000, pol(polarization), feparams.u.qpsk.symbol_rate/1000, f, s, m); + CFrontend::getDelSys(type, dvb_feparams->u.qpsk.fec_inner, dvbs_get_modulation(dvb_feparams->u.qpsk.fec_inner), f, s, m); + snprintf(buf, sizeof(buf), "%d %c %d %s %s %s ", dvb_feparams->frequency/1000, pol(polarization), dvb_feparams->u.qpsk.symbol_rate/1000, f, s, m); break; case FE_QAM: - CFrontend::getDelSys(type, feparams.u.qam.fec_inner, feparams.u.qam.modulation, f, s, m); - snprintf(buf, sizeof(buf), "%d %d %s %s %s ", feparams.frequency/1000, feparams.u.qam.symbol_rate/1000, f, s, m); + CFrontend::getDelSys(type, dvb_feparams->u.qam.fec_inner, dvb_feparams->u.qam.modulation, f, s, m); + snprintf(buf, sizeof(buf), "%d %d %s %s %s ", dvb_feparams->frequency/1000, dvb_feparams->u.qam.symbol_rate/1000, f, s, m); break; case FE_OFDM: case FE_ATSC: diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index 1940ade59..646515a06 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -1028,7 +1028,7 @@ bool CZapit::ParseCommand(CBasicMessage::Header &rmsg, int connfd) case CZapitMessages::CMD_TUNE_TP: { CBasicServer::receive_data(connfd, &TP, sizeof(TP)); sig_delay = 0; - TP.feparams.inversion = INVERSION_AUTO; + TP.feparams.dvb_feparams.inversion = INVERSION_AUTO; const char *name = scanProviders.empty() ? "unknown" : scanProviders.begin()->second.c_str(); switch (live_fe->getInfo()->type) { @@ -1036,13 +1036,13 @@ bool CZapit::ParseCommand(CBasicMessage::Header &rmsg, int connfd) case FE_OFDM: { //FIXME check scanProviders.size() ! t_satellite_position satellitePosition = scanProviders.begin()->first; - printf("[zapit] tune to sat %s freq %d rate %d fec %d pol %d\n", name, TP.feparams.frequency, TP.feparams.u.qpsk.symbol_rate, TP.feparams.u.qpsk.fec_inner, TP.polarization); - live_fe->setInput(satellitePosition, TP.feparams.frequency, TP.polarization); + printf("[zapit] tune to sat %s freq %d rate %d fec %d pol %d\n", name, TP.feparams.dvb_feparams.frequency, TP.feparams.dvb_feparams.u.qpsk.symbol_rate, TP.feparams.dvb_feparams.u.qpsk.fec_inner, TP.polarization); + live_fe->setInput(satellitePosition, TP.feparams.dvb_feparams.frequency, TP.polarization); live_fe->driveToSatellitePosition(satellitePosition); break; } case FE_QAM: - printf("[zapit] tune to cable %s freq %d rate %d fec %d\n", name, TP.feparams.frequency, TP.feparams.u.qam.symbol_rate, TP.feparams.u.qam.fec_inner); + printf("[zapit] tune to cable %s freq %d rate %d fec %d\n", name, TP.feparams.dvb_feparams.frequency, TP.feparams.dvb_feparams.u.qam.symbol_rate, TP.feparams.dvb_feparams.u.qam.fec_inner); break; default: WARN("Unknown type %d", live_fe->getInfo()->type);