diff -Naur vdr-1.5.8.org/channels.c vdr-1.5.8/channels.c --- vdr-1.5.8.org/channels.c 2009-01-09 19:24:14.388629230 -0500 +++ vdr-1.5.8/channels.c 2009-01-09 19:25:33.634745427 -0500 @@ -50,12 +50,21 @@ }; const tChannelParameterMap ModulationValues[] = { + { 0, MOD_QPSK }, { 0, QPSK }, + { 8, MOD_8PSK }, + { 16, MOD_QAM_16 }, { 16, QAM_16 }, + { 32, MOD_QAM_32 }, { 32, QAM_32 }, + { 64, MOD_QAM_64 }, { 64, QAM_64 }, + { 128, MOD_QAM_128 }, { 128, QAM_128 }, + { 256, MOD_QAM_256 }, { 256, QAM_256 }, + { 512, MOD_BPSK }, + { 999, MOD_QAM_AUTO }, { 999, QAM_AUTO }, { -1 } }; @@ -281,7 +290,7 @@ } } -bool cChannel::SetSatTransponderData(int Source, int Frequency, char Polarization, int Srate, int CoderateH) +bool cChannel::SetSatTransponderData(int Source, int Frequency, char Polarization, int Srate, int CoderateH, int Modulation) { // Workarounds for broadcaster stupidity: // Some providers broadcast the transponder frequency of their channels with two different @@ -295,7 +304,7 @@ if (abs(srate - Srate) <= 1) Srate = srate; - if (source != Source || frequency != Frequency || polarization != Polarization || srate != Srate || coderateH != CoderateH) { + if (source != Source || frequency != Frequency || polarization != Polarization || srate != Srate || coderateH != CoderateH || modulation != Modulation) { if (Number()) { dsyslog("changing transponder data of channel %d from %s:%d:%c:%d:%d to %s:%d:%c:%d:%d", Number(), *cSource::ToString(source), frequency, polarization, srate, coderateH, *cSource::ToString(Source), Frequency, Polarization, Srate, CoderateH); modification |= CHANNELMOD_TRANSP; @@ -306,7 +315,7 @@ polarization = Polarization; srate = Srate; coderateH = CoderateH; - modulation = QPSK; + modulation = Modulation; schedule = NULL; } return true; @@ -614,7 +623,7 @@ ST("CST") q += PrintParameter(q, 'I', MapToUser(inversion, InversionValues)); ST("CST") q += PrintParameter(q, 'C', MapToUser(coderateH, CoderateValues)); ST(" T") q += PrintParameter(q, 'D', MapToUser(coderateL, CoderateValues)); - ST("C T") q += PrintParameter(q, 'M', MapToUser(modulation, ModulationValues)); + ST("CST") q += PrintParameter(q, 'M', MapToUser(modulation, ModulationValues)); ST(" T") q += PrintParameter(q, 'B', MapToUser(bandwidth, BandwidthValues)); ST(" T") q += PrintParameter(q, 'T', MapToUser(transmission, TransmissionValues)); ST(" T") q += PrintParameter(q, 'G', MapToUser(guard, GuardValues)); diff -Naur vdr-1.5.8.org/channels.h vdr-1.5.8/channels.h --- vdr-1.5.8.org/channels.h 2009-01-09 19:24:14.388629230 -0500 +++ vdr-1.5.8/channels.h 2009-01-09 19:25:33.634745427 -0500 @@ -220,7 +220,7 @@ bool HasTimer(void) const; int Modification(int Mask = CHANNELMOD_ALL); void CopyTransponderData(const cChannel *Channel); - bool SetSatTransponderData(int Source, int Frequency, char Polarization, int Srate, int CoderateH); + bool SetSatTransponderData(int Source, int Frequency, char Polarization, int Srate, int CoderateH, int Modulation); bool SetCableTransponderData(int Source, int Frequency, int Modulation, int Srate, int CoderateH); bool SetTerrTransponderData(int Source, int Frequency, int Bandwidth, int Modulation, int Hierarchy, int CodeRateH, int CodeRateL, int Guard, int Transmission); void SetId(int Nid, int Tid, int Sid, int Rid = 0); diff -Naur vdr-1.5.8.org/dvbdevice.c vdr-1.5.8/dvbdevice.c --- vdr-1.5.8.org/dvbdevice.c 2009-01-09 19:24:58.374000506 -0500 +++ vdr-1.5.8/dvbdevice.c 2009-01-09 19:25:33.635708617 -0500 @@ -104,7 +104,7 @@ lastTimeoutReport = 0; diseqcCommands = NULL; tunerStatus = tsIdle; - if (frontendType == FE_QPSK) + if (frontendType == FE_QPSK || frontendType == FE_DVB_S || frontendType == FE_DVB_S2) CHECK(ioctl(fd_frontend, FE_SET_VOLTAGE, SEC_VOLTAGE_13)); // must explicitly turn on LNB power SetDescription("tuner on device %d", cardIndex + 1); Start(); @@ -173,13 +173,14 @@ bool cDvbTuner::SetFrontend(void) { - dvb_frontend_parameters Frontend; + dvb_frontend_parameters_new Frontend; memset(&Frontend, 0, sizeof(Frontend)); switch (frontendType) { - case FE_QPSK: { // DVB-S - + case FE_QPSK: // DVB-S + case FE_DVB_S: // DVB-S + case FE_DVB_S2: // DVB-S unsigned int frequency = channel.Frequency(); if (Setup.DiSEqC) { @@ -237,12 +238,17 @@ frequency = abs(frequency); // Allow for C-band, where the frequency is less than the LOF Frontend.frequency = frequency * 1000UL; Frontend.inversion = fe_spectral_inversion_t(channel.Inversion()); - Frontend.u.qpsk.symbol_rate = channel.Srate() * 1000UL; - Frontend.u.qpsk.fec_inner = fe_code_rate_t(channel.CoderateH()); + if (frontendType == FE_DVB_S2) { + Frontend.u.qpsk2.symbol_rate = channel.Srate() * 1000UL; + Frontend.u.qpsk2.fec_inner = fe_code_rate_t(channel.CoderateH()); + Frontend.u.qpsk2.modulation = fe_modulation_t(channel.Modulation()); + } else { + Frontend.u.qpsk.symbol_rate = channel.Srate() * 1000UL; + Frontend.u.qpsk.fec_inner = fe_code_rate_t(channel.CoderateH()); + } tuneTimeout = DVBS_TUNE_TIMEOUT; lockTimeout = DVBS_LOCK_TIMEOUT; - } break; case FE_QAM: { // DVB-C @@ -280,10 +286,17 @@ esyslog("ERROR: attempt to set channel with unknown DVB frontend type"); return false; } - if (ioctl(fd_frontend, FE_SET_FRONTEND, &Frontend) < 0) { - esyslog("ERROR: frontend %d: %m", cardIndex); - return false; + if (frontendType == FE_DVB_S2) { + if (ioctl(fd_frontend, FE_SET_FRONTEND2, &Frontend) == -1) { + esyslog("ERROR: frontend %d: %m", cardIndex); + return false; } + } else { + if (ioctl(fd_frontend, FE_SET_FRONTEND, &Frontend) == -1) { + esyslog("ERROR: frontend %d: %m", cardIndex); + return false; + } + } return true; } @@ -420,7 +433,16 @@ if (fd_frontend >= 0) { dvb_frontend_info feinfo; if (ioctl(fd_frontend, FE_GET_INFO, &feinfo) >= 0) { - frontendType = feinfo.type; + frontendType = feinfo.type; + if ( (feinfo.type == FE_QPSK) && (feinfo.caps & FE_HAS_EXTENDED_INFO) ) { + dvb_fe_caps_extended feextinfo; + if (ioctl(fd_frontend, FE_GET_EXTENDED_INFO, &feextinfo) >= 0) { + if (feextinfo.standards & FE_DVB_S2) { + CHECK(ioctl(fd_frontend, FE_SET_STANDARD, FE_DVB_S2)); + frontendType = FE_DVB_S2; + } + } + } dvbTuner = new cDvbTuner(fd_frontend, CardIndex(), frontendType); } else @@ -743,6 +765,8 @@ return type == cSource::stNone || type == cSource::stCable && frontendType == FE_QAM || type == cSource::stSat && frontendType == FE_QPSK + || type == cSource::stSat && frontendType == FE_DVB_S + || type == cSource::stSat && frontendType == FE_DVB_S2 || type == cSource::stTerr && frontendType == FE_OFDM; } @@ -751,13 +775,24 @@ return ProvidesSource(Channel->Source()) && (!cSource::IsSat(Channel->Source()) || !Setup.DiSEqC || Diseqcs.Get(Channel->Source(), Channel->Frequency(), Channel->Polarization())); } +bool cDvbDevice::ProvidesModulation(const cChannel *Channel) const +{ + if (Channel->Source() >= 32768 && Channel->Source() <= 36863) { + if ((Channel->Modulation() == 0 || Channel->Modulation() == 6) && (frontendType == 0x00 || frontendType == 0x20)) return true; + if ((Channel->Modulation() == 1 || Channel->Modulation() == 14 || Channel->Modulation() == 16 || Channel->Modulation() == 17 || Channel->Modulation() == 18) && (frontendType == 0x20)) return true; + return false; + } else { + return true; + } +} + bool cDvbDevice::ProvidesChannel(const cChannel *Channel, int Priority, bool *NeedsDetachReceivers) const { bool result = false; bool hasPriority = Priority < 0 || Priority > this->Priority(); bool needsDetachReceivers = false; - if (ProvidesSource(Channel->Source())) { + if (ProvidesSource(Channel->Source()) && ProvidesModulation(Channel)) { result = hasPriority; if (Priority >= 0 && Receiving(true)) { if (dvbTuner->IsTunedTo(Channel)) { diff -Naur vdr-1.5.8.org/dvbdevice.h vdr-1.5.8/dvbdevice.h --- vdr-1.5.8.org/dvbdevice.h 2009-01-09 19:24:58.375000403 -0500 +++ vdr-1.5.8/dvbdevice.h 2009-01-09 19:25:33.635708617 -0500 @@ -66,6 +66,7 @@ public: virtual bool ProvidesSource(int Source) const; virtual bool ProvidesTransponder(const cChannel *Channel) const; + virtual bool ProvidesModulation(const cChannel *Channel) const; virtual bool ProvidesChannel(const cChannel *Channel, int Priority = -1, bool *NeedsDetachReceivers = NULL) const; virtual bool IsTunedToTransponder(const cChannel *Channel); protected: diff -Naur vdr-1.5.8.org/libsi/descriptor.c vdr-1.5.8/libsi/descriptor.c --- vdr-1.5.8.org/libsi/descriptor.c 2007-02-03 06:45:58.000000000 -0500 +++ vdr-1.5.8/libsi/descriptor.c 2009-01-09 19:25:33.635708617 -0500 @@ -418,16 +418,20 @@ return s->polarization; } -int SatelliteDeliverySystemDescriptor::getModulationSystem() const { - return s->modulation_system; -} - -int SatelliteDeliverySystemDescriptor::getModulationType() const { - return s->modulation_type; -} +// int SatelliteDeliverySystemDescriptor::getModulationSystem() const { +// return s->modulation_system; +// } +// +// int SatelliteDeliverySystemDescriptor::getModulationType() const { +// return s->modulation_type; +// } +// +// int SatelliteDeliverySystemDescriptor::getRollOff() const { +// return s->roll_off; +// } -int SatelliteDeliverySystemDescriptor::getRollOff() const { - return s->roll_off; +int SatelliteDeliverySystemDescriptor::getModulation() const { + return s->modulation; } int SatelliteDeliverySystemDescriptor::getSymbolRate() const { diff -Naur vdr-1.5.8.org/libsi/descriptor.h vdr-1.5.8/libsi/descriptor.h --- vdr-1.5.8.org/libsi/descriptor.h 2007-02-03 06:45:58.000000000 -0500 +++ vdr-1.5.8/libsi/descriptor.h 2009-01-09 19:25:33.636857255 -0500 @@ -210,9 +210,10 @@ int getOrbitalPosition() const; int getWestEastFlag() const; int getPolarization() const; - int getModulationSystem() const; +/* int getModulationSystem() const; int getModulationType() const; - int getRollOff() const; + int getRollOff() const;*/ + int getModulation() const; int getSymbolRate() const; int getFecInner() const; protected: diff -Naur vdr-1.5.8.org/libsi/headers.h vdr-1.5.8/libsi/headers.h --- vdr-1.5.8.org/libsi/headers.h 2007-02-03 06:45:58.000000000 -0500 +++ vdr-1.5.8/libsi/headers.h 2009-01-09 19:25:33.636857255 -0500 @@ -946,9 +946,10 @@ u_char modulation_system :1; u_char modulation_type :2; #else - u_char modulation_type :2; +/* u_char modulation_type :2; u_char modulation_system :1; - u_char roll_off :2; + u_char roll_off :2;*/ + u_char modulation :5; u_char polarization :2; u_char west_east_flag :1; #endif diff -Naur vdr-1.5.8.org/nit.c vdr-1.5.8/nit.c --- vdr-1.5.8.org/nit.c 2009-01-09 19:24:14.394879828 -0500 +++ vdr-1.5.8/nit.c 2009-01-09 19:25:33.637735126 -0500 @@ -129,6 +129,8 @@ char Polarization = Polarizations[sd->getPolarization()]; static int CodeRates[] = { FEC_NONE, FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_NONE }; int CodeRate = CodeRates[sd->getFecInner()]; + static int Modulations[] = { MOD_QPSK, QPSK, MOD_QAM_16, QAM_16, MOD_QAM_32, QAM_32, MOD_QAM_64, QAM_64, MOD_QAM_128, QAM_128, MOD_QAM_256, QAM_256, MOD_QAM_AUTO, QAM_AUTO, MOD_BPSK, MOD_8PSK }; + int Modulation = Modulations[min(sd->getModulation(), 15)]; int SymbolRate = BCD2INT(sd->getSymbolRate()) / 10; if (ThisNIT >= 0) { for (int n = 0; n < NumFrequencies; n++) { @@ -154,14 +156,14 @@ } } if (ISTRANSPONDER(cChannel::Transponder(Frequency, Polarization), Transponder())) // only modify channels if we're actually receiving this transponder - Channel->SetSatTransponderData(Source, Frequency, Polarization, SymbolRate, CodeRate); + Channel->SetSatTransponderData(Source, Frequency, Polarization, SymbolRate, CodeRate, Modulation); found = true; } if (!found) { for (int n = 0; n < NumFrequencies; n++) { cChannel *Channel = new cChannel; Channel->SetId(ts.getOriginalNetworkId(), ts.getTransportStreamId(), 0, 0); - if (Channel->SetSatTransponderData(Source, Frequencies[n], Polarization, SymbolRate, CodeRate)) + if (Channel->SetSatTransponderData(Source, Frequencies[n], Polarization, SymbolRate, CodeRate, Modulation)) EITScanner.AddTransponder(Channel); else delete Channel; @@ -177,8 +179,8 @@ //XXX FEC_outer??? static int CodeRates[] = { FEC_NONE, FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_NONE }; int CodeRate = CodeRates[sd->getFecInner()]; - static int Modulations[] = { QPSK, QAM_16, QAM_32, QAM_64, QAM_128, QAM_256, QAM_AUTO }; - int Modulation = Modulations[min(sd->getModulation(), 6)]; + static int Modulations[] = { MOD_QPSK, MOD_8PSK, MOD_QAM_16, MOD_QAM_32, MOD_QAM_64, MOD_QAM_128, MOD_QAM_256, MOD_QAM_AUTO }; + int Modulation = Modulations[min(sd->getModulation(), 7)]; int SymbolRate = BCD2INT(sd->getSymbolRate()) / 10; if (ThisNIT >= 0) { for (int n = 0; n < NumFrequencies; n++) { diff -Naur vdr-1.5.8.org/tools.c vdr-1.5.8/tools.c --- vdr-1.5.8.org/tools.c 2009-01-09 19:24:14.497870707 -0500 +++ vdr-1.5.8/tools.c 2009-01-09 19:25:33.637735126 -0500 @@ -97,6 +97,13 @@ safe_write(filedes, &c, sizeof(c)); } +char *skipspace(const char *s) +{ + while (*s && isspace(*s)) + s++; + return (char *)s; +} + int WriteAllOrNothing(int fd, const uchar *Data, int Length, int TimeoutMs, int RetryMs) { int written = 0; diff -Naur vdr-1.5.8.org/tools.h vdr-1.5.8/tools.h --- vdr-1.5.8.org/tools.h 2009-01-09 19:24:14.515671830 -0500 +++ vdr-1.5.8/tools.h 2009-01-09 19:25:33.638770055 -0500 @@ -174,14 +174,7 @@ char *strn0cpy(char *dest, const char *src, size_t n); char *strreplace(char *s, char c1, char c2); char *strreplace(char *s, const char *s1, const char *s2); ///< re-allocates 's' and deletes the original string if necessary! -inline char *skipspace(const char *s) -{ - if ((uchar)*s > ' ') // most strings don't have any leading space, so handle this case as fast as possible - return (char *)s; - while (*s && (uchar)*s <= ' ') // avoiding isspace() here, because it is much slower - s++; - return (char *)s; -} +char *skipspace(const char *s); char *stripspace(char *s); char *compactspace(char *s); cString strescape(const char *s, const char *chars);