--- vdr-1.7.0/channels.c 2008-10-07 20:44:25.000000000 +0200 +++ vdr-1.7.0-s2api/channels.c 2008-10-07 20:42:21.000000000 +0200 @@ -21,114 +21,101 @@ // --- Channel Parameter Maps ------------------------------------------------ const tChannelParameterMap InversionValues[] = { - { 0, DVBFE_INVERSION_OFF, trNOOP("off") }, - { 1, DVBFE_INVERSION_ON, trNOOP("on") }, - { 999, DVBFE_INVERSION_AUTO }, + { 0, INVERSION_OFF, trNOOP("off") }, + { 1, INVERSION_ON, trNOOP("on") }, + { 999, INVERSION_AUTO }, { -1 } }; const tChannelParameterMap BandwidthValues[] = { - { 5, DVBFE_BANDWIDTH_5_MHZ, "5 MHz" }, - { 6, DVBFE_BANDWIDTH_6_MHZ, "6 MHz" }, - { 7, DVBFE_BANDWIDTH_7_MHZ, "7 MHz" }, - { 8, DVBFE_BANDWIDTH_8_MHZ, "8 MHz" }, - { 999, DVBFE_BANDWIDTH_AUTO }, + { 6, BANDWIDTH_6_MHZ, "6 MHz" }, + { 7, BANDWIDTH_7_MHZ, "7 MHz" }, + { 8, BANDWIDTH_8_MHZ, "8 MHz" }, + { 999, BANDWIDTH_AUTO }, { -1 } }; const tChannelParameterMap CoderateValues[] = { - { 0, DVBFE_FEC_NONE, trNOOP("none") }, - { 12, DVBFE_FEC_1_2, "1/2" }, - { 13, DVBFE_FEC_1_3, "1/3" }, - { 14, DVBFE_FEC_1_4, "1/4" }, - { 23, DVBFE_FEC_2_3, "2/3" }, - { 25, DVBFE_FEC_2_5, "2/5" }, - { 34, DVBFE_FEC_3_4, "3/4" }, - { 35, DVBFE_FEC_3_5, "3/5" }, - { 45, DVBFE_FEC_4_5, "4/5" }, - { 56, DVBFE_FEC_5_6, "5/6" }, - { 67, DVBFE_FEC_6_7, "6/7" }, - { 78, DVBFE_FEC_7_8, "7/8" }, - { 89, DVBFE_FEC_8_9, "8/9" }, - { 910, DVBFE_FEC_9_10, "9/10" }, - { 999, DVBFE_FEC_AUTO }, + { 0, FEC_NONE, trNOOP("none") }, + { 12, FEC_1_2, "1/2" }, + { 23, FEC_2_3, "2/3" }, + { 34, FEC_3_4, "3/4" }, + { 35, FEC_3_5, "3/5" }, + { 45, FEC_4_5, "4/5" }, + { 56, FEC_5_6, "5/6" }, + { 67, FEC_6_7, "6/7" }, + { 78, FEC_7_8, "7/8" }, + { 89, FEC_8_9, "8/9" }, + { 910, FEC_9_10, "9/10" }, + { 999, FEC_AUTO }, { -1 } }; const tChannelParameterMap ModulationValues[] = { - { 0, DVBFE_MOD_NONE, trNOOP("none") }, - { 4, DVBFE_MOD_QAM4, "QAM4" }, - { 16, DVBFE_MOD_QAM16, "QAM16" }, - { 32, DVBFE_MOD_QAM32, "QAM32" }, - { 64, DVBFE_MOD_QAM64, "QAM64" }, - { 128, DVBFE_MOD_QAM128, "QAM128" }, - { 256, DVBFE_MOD_QAM256, "QAM256" }, - { 512, DVBFE_MOD_QAM512, "QAM512" }, - {1024, DVBFE_MOD_QAM1024, "QAM1024" }, - { 1, DVBFE_MOD_BPSK, "BPSK" }, - { 2, DVBFE_MOD_QPSK, "QPSK" }, - { 3, DVBFE_MOD_OQPSK, "OQPSK" }, - { 5, DVBFE_MOD_8PSK, "8PSK" }, - { 6, DVBFE_MOD_16APSK, "16APSK" }, - { 7, DVBFE_MOD_32APSK, "32APSK" }, - { 8, DVBFE_MOD_OFDM, "OFDM" }, - { 9, DVBFE_MOD_COFDM, "COFDM" }, - { 10, DVBFE_MOD_VSB8, "VSB8" }, - { 11, DVBFE_MOD_VSB16, "VSB16" }, - { 998, DVBFE_MOD_QAMAUTO, "QAMAUTO" }, - { 999, DVBFE_MOD_AUTO }, + { 16, QAM_16, "QAM16" }, + { 32, QAM_32, "QAM32" }, + { 64, QAM_64, "QAM64" }, + { 128, QAM_128, "QAM128" }, + { 256, QAM_256, "QAM256" }, + { 2, QPSK, "QPSK" }, + { 5, PSK_8, "8PSK" }, + { 6, APSK_16, "16APSK" }, + { 10, VSB_8, "VSB8" }, + { 11, VSB_16, "VSB16" }, + { 998, QAM_AUTO, "QAMAUTO" }, { -1 } }; const tChannelParameterMap SystemValues[] = { - { 0, DVBFE_DELSYS_DVBS, "DVB-S" }, - { 1, DVBFE_DELSYS_DVBS2, "DVB-S2" }, + { 0, SYS_DVBS, "DVB-S" }, + { 1, SYS_DVBS2, "DVB-S2" }, { -1 } }; const tChannelParameterMap TransmissionValues[] = { - { 2, DVBFE_TRANSMISSION_MODE_2K, "2K" }, - { 4, DVBFE_TRANSMISSION_MODE_4K, "4K" }, - { 8, DVBFE_TRANSMISSION_MODE_8K, "8K" }, - { 999, DVBFE_TRANSMISSION_MODE_AUTO }, + { 2, TRANSMISSION_MODE_2K, "2K" }, + { 8, TRANSMISSION_MODE_8K, "8K" }, + { 999, TRANSMISSION_MODE_AUTO }, { -1 } }; const tChannelParameterMap GuardValues[] = { - { 4, DVBFE_GUARD_INTERVAL_1_4, "1/4" }, - { 8, DVBFE_GUARD_INTERVAL_1_8, "1/8" }, - { 16, DVBFE_GUARD_INTERVAL_1_16, "1/16" }, - { 32, DVBFE_GUARD_INTERVAL_1_32, "1/32" }, - { 999, DVBFE_GUARD_INTERVAL_AUTO }, + { 4, GUARD_INTERVAL_1_4, "1/4" }, + { 8, GUARD_INTERVAL_1_8, "1/8" }, + { 16, GUARD_INTERVAL_1_16, "1/16" }, + { 32, GUARD_INTERVAL_1_32, "1/32" }, + { 999, GUARD_INTERVAL_AUTO }, { -1 } }; const tChannelParameterMap HierarchyValues[] = { - { 0, DVBFE_HIERARCHY_OFF, trNOOP("off") }, - { 1, DVBFE_HIERARCHY_ON, trNOOP("on") }, - { 999, DVBFE_HIERARCHY_AUTO }, + { 0, HIERARCHY_NONE, trNOOP("off") }, + { 1, HIERARCHY_1, trNOOP("1") }, + { 2, HIERARCHY_2, trNOOP("2") }, + { 4, HIERARCHY_4, trNOOP("4") }, + { 999, HIERARCHY_AUTO }, { -1 } }; -const tChannelParameterMap AlphaValues[] = { - { 0, 0 }, - { 1, DVBFE_ALPHA_1 }, - { 2, DVBFE_ALPHA_2 }, - { 4, DVBFE_ALPHA_4 }, - { -1 } - }; - -const tChannelParameterMap PriorityValues[] = { - { 0, DVBFE_STREAM_PRIORITY_HP, trNOOP("high") }, - { 1, DVBFE_STREAM_PRIORITY_LP, trNOOP("low") }, - { -1 } - }; +// const tChannelParameterMap AlphaValues[] = { +// { 0, 0 }, +// { 1, ALPHA_1 }, +// { 2, ALPHA_2 }, +// { 4, ALPHA_4 }, +// { -1 } +// }; +// +//const tChannelParameterMap PriorityValues[] = { +// { 0, STREAM_PRIORITY_HP, trNOOP("high") }, +// { 1, STREAM_PRIORITY_LP, trNOOP("low") }, +// { -1 } +// }; const tChannelParameterMap RollOffValues[] = { - { 0, DVBFE_ROLLOFF_UNKNOWN }, - { 20, DVBFE_ROLLOFF_20, "0.20" }, - { 25, DVBFE_ROLLOFF_25, "0.25" }, - { 35, DVBFE_ROLLOFF_35, "0.35" }, + { 0, ROLLOFF_AUTO }, + { 20, ROLLOFF_20, "0.20" }, + { 25, ROLLOFF_25, "0.25" }, + { 35, ROLLOFF_35, "0.35" }, { -1 } }; @@ -217,18 +204,18 @@ provider = strdup(""); portalName = strdup(""); memset(&__BeginData__, 0, (char *)&__EndData__ - (char *)&__BeginData__); - inversion = DVBFE_INVERSION_AUTO; - bandwidth = DVBFE_BANDWIDTH_AUTO; - coderateH = DVBFE_FEC_AUTO; - coderateL = DVBFE_FEC_AUTO; - modulation = DVBFE_MOD_AUTO; - system = DVBFE_DELSYS_DVBS; - transmission = DVBFE_TRANSMISSION_MODE_AUTO; - guard = DVBFE_GUARD_INTERVAL_AUTO; - hierarchy = DVBFE_HIERARCHY_AUTO; - alpha = 0; - priority = DVBFE_STREAM_PRIORITY_HP; - rollOff = DVBFE_ROLLOFF_UNKNOWN; + inversion = INVERSION_AUTO; + bandwidth = BANDWIDTH_AUTO; + coderateH = FEC_AUTO; + coderateL = FEC_AUTO; + modulation = QPSK; + system = SYS_DVBS; + transmission = TRANSMISSION_MODE_AUTO; + guard = GUARD_INTERVAL_AUTO; + hierarchy = HIERARCHY_AUTO; + //alpha = 0; + //priority = STREAM_PRIORITY_HP; + rollOff = ROLLOFF_AUTO; modification = CHANNELMOD_NONE; schedule = NULL; linkChannels = NULL; @@ -333,8 +320,8 @@ transmission = Channel->transmission; guard = Channel->guard; hierarchy = Channel->hierarchy; - alpha = Channel->alpha; - priority = Channel->priority; +// alpha = Channel->alpha; +// priority = Channel->priority; rollOff = Channel->rollOff; } } @@ -392,9 +379,9 @@ return true; } -bool cChannel::SetTerrTransponderData(int Source, int Frequency, int Bandwidth, int Modulation, int Hierarchy, int CoderateH, int CoderateL, int Guard, int Transmission, int Alpha, int Priority) +bool cChannel::SetTerrTransponderData(int Source, int Frequency, int Bandwidth, int Modulation, int Hierarchy, int CoderateH, int CoderateL, int Guard, int Transmission) { - if (source != Source || frequency != Frequency || bandwidth != Bandwidth || modulation != Modulation || hierarchy != Hierarchy || coderateH != CoderateH || coderateL != CoderateL || guard != Guard || transmission != Transmission || alpha != Alpha || priority != Priority) { + if (source != Source || frequency != Frequency || bandwidth != Bandwidth || modulation != Modulation || hierarchy != Hierarchy || coderateH != CoderateH || coderateL != CoderateL || guard != Guard || transmission != Transmission) { cString OldTransponderData = TransponderDataToString(); source = Source; frequency = Frequency; @@ -405,8 +392,8 @@ coderateL = CoderateL; guard = Guard; transmission = Transmission; - alpha = Alpha; - priority = Priority; +// alpha = Alpha; +// priority = Priority; schedule = NULL; if (Number()) { dsyslog("changing transponder data of channel %d from %s to %s", Number(), *OldTransponderData, *TransponderDataToString()); @@ -697,7 +684,7 @@ char *q = buffer; *q = 0; ST(" S ") q += sprintf(q, "%c", polarization); - ST(" T") q += PrintParameter(q, 'A', MapToUser(alpha, AlphaValues)); +// ST(" T") q += PrintParameter(q, 'A', MapToUser(alpha, AlphaValues)); ST(" T") q += PrintParameter(q, 'B', MapToUser(bandwidth, BandwidthValues)); ST("CST") q += PrintParameter(q, 'C', MapToUser(coderateH, CoderateValues)); ST(" T") q += PrintParameter(q, 'D', MapToUser(coderateL, CoderateValues)); @@ -705,7 +692,7 @@ ST("CST") q += PrintParameter(q, 'I', MapToUser(inversion, InversionValues)); ST("CST") q += PrintParameter(q, 'M', MapToUser(modulation, ModulationValues)); ST(" S ") q += PrintParameter(q, 'O', MapToUser(rollOff, RollOffValues)); - ST(" T") q += PrintParameter(q, 'P', MapToUser(priority, PriorityValues)); +// ST(" T") q += PrintParameter(q, 'P', MapToUser(priority, PriorityValues)); ST(" S ") q += PrintParameter(q, 'S', MapToUser(system, SystemValues)); ST(" T") q += PrintParameter(q, 'T', MapToUser(transmission, TransmissionValues)); ST(" T") q += PrintParameter(q, 'Y', MapToUser(hierarchy, HierarchyValues)); @@ -732,7 +719,7 @@ { while (s && *s) { switch (toupper(*s)) { - case 'A': s = ParseParameter(s, alpha, AlphaValues); break; +// case 'A': s = ParseParameter(s, alpha, AlphaValues); break; case 'B': s = ParseParameter(s, bandwidth, BandwidthValues); break; case 'C': s = ParseParameter(s, coderateH, CoderateValues); break; case 'D': s = ParseParameter(s, coderateL, CoderateValues); break; @@ -743,7 +730,7 @@ case 'M': s = ParseParameter(s, modulation, ModulationValues); break; case 'Z':// for compatibility with the original DVB-S2 patch - may be removed in future versions case 'O': s = ParseParameter(s, rollOff, RollOffValues); break; - case 'P': s = ParseParameter(s, priority, PriorityValues); break; +// case 'P': s = ParseParameter(s, priority, PriorityValues); break; case 'R': polarization = *s++; break; case 'S': s = ParseParameter(s, system, SystemValues); break; case 'T': s = ParseParameter(s, transmission, TransmissionValues); break; --- vdr-1.7.0/channels.h 2008-10-07 20:44:25.000000000 +0200 +++ vdr-1.7.0-s2api/channels.h 2008-10-03 08:59:07.000000000 +0200 @@ -66,8 +66,8 @@ extern const tChannelParameterMap TransmissionValues[]; extern const tChannelParameterMap GuardValues[]; extern const tChannelParameterMap HierarchyValues[]; -extern const tChannelParameterMap AlphaValues[]; -extern const tChannelParameterMap PriorityValues[]; +//extern const tChannelParameterMap AlphaValues[]; +//extern const tChannelParameterMap PriorityValues[]; extern const tChannelParameterMap RollOffValues[]; struct tChannelID { @@ -148,8 +148,8 @@ int transmission; int guard; int hierarchy; - int alpha; - int priority; + //int alpha; + //int priority; int rollOff; int __EndData__; int modification; @@ -210,8 +210,8 @@ int Transmission(void) const { return transmission; } int Guard(void) const { return guard; } int Hierarchy(void) const { return hierarchy; } - int Alpha(void) const { return alpha; } - int Priority(void) const { return priority; } + //int Alpha(void) const { return alpha; } + // int Priority(void) const { return priority; } int RollOff(void) const { return rollOff; } const cLinkChannels* LinkChannels(void) const { return linkChannels; } const cChannel *RefChannel(void) const { return refChannels ? refChannels->Last()->Channel() : 0; } @@ -225,7 +225,7 @@ void CopyTransponderData(const cChannel *Channel); bool SetSatTransponderData(int Source, int Frequency, char Polarization, int Srate, int CoderateH, int Modulation, int System, int RollOff); 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, int Alpha, int Priority); + 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); void SetName(const char *Name, const char *ShortName, const char *Provider); void SetPortalName(const char *PortalName); --- vdr-1.7.0/dvbdevice.c 2008-10-07 20:44:25.000000000 +0200 +++ vdr-1.7.0-s2api/dvbdevice.c 2008-10-07 20:38:39.000000000 +0200 @@ -76,7 +76,7 @@ int tuneTimeout; int lockTimeout; time_t lastTimeoutReport; - dvbfe_delsys frontendType; + fe_delivery_system frontendType; cChannel channel; const char *diseqcCommands; eTunerStatus tunerStatus; @@ -87,14 +87,14 @@ bool SetFrontend(void); virtual void Action(void); public: - cDvbTuner(int Fd_Frontend, int CardIndex, dvbfe_delsys FrontendType); + cDvbTuner(int Fd_Frontend, int CardIndex, fe_delivery_system FrontendType); virtual ~cDvbTuner(); bool IsTunedTo(const cChannel *Channel) const; void Set(const cChannel *Channel, bool Tune); bool Locked(int TimeoutMs = 0); }; -cDvbTuner::cDvbTuner(int Fd_Frontend, int CardIndex, dvbfe_delsys FrontendType) +cDvbTuner::cDvbTuner(int Fd_Frontend, int CardIndex, fe_delivery_system FrontendType) { fd_frontend = Fd_Frontend; cardIndex = CardIndex; @@ -104,7 +104,7 @@ lastTimeoutReport = 0; diseqcCommands = NULL; tunerStatus = tsIdle; - if (frontendType & (DVBFE_DELSYS_DVBS | DVBFE_DELSYS_DVBS2)) + if (frontendType == SYS_DVBS || frontendType == SYS_DVBS2) CHECK(ioctl(fd_frontend, FE_SET_VOLTAGE, SEC_VOLTAGE_13)); // must explicitly turn on LNB power SetDescription("tuner on device %d", cardIndex + 1); Start(); @@ -127,7 +127,7 @@ char Type = **cSource::ToString(Channel->Source()); #define ST(s, p) if (strchr(s, Type)) if (channel.p() != Channel->p()) return false; // Polarization is already checked as part of the Transponder. - ST(" T", Alpha); +// ST(" T", Alpha); ST(" T", Bandwidth); ST("CST", CoderateH); ST(" T", CoderateL); @@ -135,7 +135,7 @@ ST("CST", Inversion); ST("CST", Modulation); ST(" S ", RollOff); - ST(" T", Priority); +// ST(" T", Priority); ST(" S ", System); ST(" T", Transmission); ST(" T", Hierarchy); @@ -192,10 +192,20 @@ bool cDvbTuner::SetFrontend(void) { - dvbfe_params Frontend; +// dvbfe_params Frontend; + dtv_property Frontend[11]; memset(&Frontend, 0, sizeof(Frontend)); + dtv_properties cmdseq; + cmdseq.num = 1; + cmdseq.props = Frontend ; + Frontend[0].cmd = DTV_CLEAR; + if (ioctl(fd_frontend, FE_SET_PROPERTY, &cmdseq) < 0) { + esyslog("ERROR: frontend %d: %m", cardIndex); + return false; + } + cmdseq.num = 8; - if (frontendType & (DVBFE_DELSYS_DVBS | DVBFE_DELSYS_DVBS2)) { + if (frontendType == SYS_DVBS || frontendType == SYS_DVBS2) { unsigned int frequency = channel.Frequency(); if (Setup.DiSEqC) { cDiseqc *diseqc = Diseqcs.Get(channel.Source(), channel.Frequency(), channel.Polarization()); @@ -249,58 +259,116 @@ } frequency = abs(frequency); // Allow for C-band, where the frequency is less than the LOF - Frontend.delivery = dvbfe_delsys(channel.System()); - Frontend.frequency = frequency * 1000UL; - Frontend.inversion = fe_spectral_inversion_t(channel.Inversion()); - if (Frontend.delivery == DVBFE_DELSYS_DVBS) { - Frontend.delsys.dvbs.modulation = dvbfe_modulation(channel.Modulation()); - Frontend.delsys.dvbs.symbol_rate = channel.Srate() * 1000UL; - Frontend.delsys.dvbs.fec = dvbfe_fec(channel.CoderateH()); - } - else { - Frontend.delsys.dvbs2.modulation = dvbfe_modulation(channel.Modulation()); - Frontend.delsys.dvbs2.symbol_rate = channel.Srate() * 1000UL; - Frontend.delsys.dvbs2.fec = dvbfe_fec(channel.CoderateH()); - Frontend.delsys.dvbs2.rolloff = dvbfe_rolloff(channel.RollOff()); - } + if ( (frontendType == SYS_DVBS2) && (fe_delivery_system_t(channel.System()) == SYS_DVBS2) ) // Only DVB-S2 cards should + { // get DVB-S2 streams. + // DVB-S2 + Frontend[0].cmd = DTV_DELIVERY_SYSTEM; + Frontend[0].u.data = SYS_DVBS2; + Frontend[1].cmd = DTV_FREQUENCY; + Frontend[1].u.data = frequency * 1000UL; + Frontend[2].cmd = DTV_MODULATION; + printf("Modulation : %d\n", channel.Modulation()); + printf("QPSK : %d\n", QPSK); + printf("8PSK : %d\n", PSK_8); + Frontend[2].u.data = fe_modulation_t(channel.Modulation()); + Frontend[3].cmd = DTV_SYMBOL_RATE; + Frontend[3].u.data = channel.Srate() * 1000UL; + Frontend[4].cmd = DTV_INNER_FEC; + Frontend[4].u.data = fe_code_rate_t(channel.CoderateH()); + Frontend[5].cmd = DTV_PILOT; + Frontend[5].u.data = PILOT_AUTO; + Frontend[6].cmd = DTV_ROLLOFF; + Frontend[6].u.data = fe_rolloff_t(channel.RollOff()); + Frontend[7].cmd = DTV_INVERSION; + Frontend[7].u.data = fe_spectral_inversion_t(channel.Inversion()); + Frontend[8].cmd = DTV_TUNE; + cmdseq.num = 9; + cmdseq.props = Frontend; + } + else + { + // DVB-S + Frontend[0].cmd = DTV_DELIVERY_SYSTEM; + Frontend[0].u.data = SYS_DVBS; + Frontend[1].cmd = DTV_FREQUENCY; + Frontend[1].u.data = frequency * 1000UL; + Frontend[2].cmd = DTV_MODULATION; + Frontend[2].u.data = fe_modulation_t(channel.Modulation()); + Frontend[3].cmd = DTV_SYMBOL_RATE; + Frontend[3].u.data = channel.Srate() * 1000UL; + Frontend[4].cmd = DTV_INNER_FEC; + Frontend[4].u.data = fe_code_rate_t(channel.CoderateH()); + Frontend[5].cmd = DTV_ROLLOFF; + Frontend[5].u.data = ROLLOFF_35; // DVB-S allways has a ROLLOFF of 0.35 + Frontend[6].cmd = DTV_INVERSION; + Frontend[6].u.data = fe_spectral_inversion_t(channel.Inversion()); + Frontend[7].cmd = DTV_TUNE; + cmdseq.num = 8; + cmdseq.props = Frontend; + } - tuneTimeout = DVBS_TUNE_TIMEOUT; - lockTimeout = DVBS_LOCK_TIMEOUT; - } - else if (frontendType & DVBFE_DELSYS_DVBC) { - Frontend.delivery = DVBFE_DELSYS_DVBC; - Frontend.frequency = FrequencyToHz(channel.Frequency()); - Frontend.inversion = fe_spectral_inversion_t(channel.Inversion()); - Frontend.delsys.dvbc.symbol_rate = channel.Srate() * 1000UL; - Frontend.delsys.dvbc.fec = dvbfe_fec(channel.CoderateH()); - Frontend.delsys.dvbc.modulation = dvbfe_modulation(channel.Modulation()); + tuneTimeout = DVBS_TUNE_TIMEOUT; + lockTimeout = DVBS_LOCK_TIMEOUT; + + } + else if (frontendType == SYS_DVBC_ANNEX_AC || frontendType == SYS_DVBC_ANNEX_B) + { + // DVB-C - !!!Untested!!! + Frontend[0].cmd = DTV_DELIVERY_SYSTEM; + Frontend[0].u.data = fe_delivery_system_t(channel.System()); + Frontend[1].cmd = DTV_FREQUENCY; + Frontend[1].u.data = FrequencyToHz(channel.Frequency()); + Frontend[2].cmd = DTV_INVERSION; + Frontend[2].u.data = fe_spectral_inversion_t(channel.Inversion()); + Frontend[3].cmd = DTV_SYMBOL_RATE; + Frontend[3].u.data = channel.Srate() * 1000UL; + Frontend[4].cmd = DTV_INNER_FEC; + Frontend[4].u.data = fe_code_rate_t(channel.CoderateH()); + Frontend[5].cmd = DTV_MODULATION; + Frontend[5].u.data = fe_modulation_t(channel.Modulation()); + //Frontend[5].u.data = QAM_AUTO; + Frontend[6].cmd = DTV_TUNE; + cmdseq.num = 7; + cmdseq.props = Frontend; tuneTimeout = DVBC_TUNE_TIMEOUT; lockTimeout = DVBC_LOCK_TIMEOUT; - } - else if (frontendType & DVBFE_DELSYS_DVBT) { - Frontend.delivery = DVBFE_DELSYS_DVBT; - Frontend.frequency = FrequencyToHz(channel.Frequency()); - Frontend.inversion = fe_spectral_inversion_t(channel.Inversion()); - Frontend.delsys.dvbt.bandwidth = dvbfe_bandwidth(channel.Bandwidth()); - Frontend.delsys.dvbt.code_rate_HP = dvbfe_fec(channel.CoderateH()); - Frontend.delsys.dvbt.code_rate_LP = dvbfe_fec(channel.CoderateL()); - Frontend.delsys.dvbt.constellation = dvbfe_modulation(channel.Modulation()); - Frontend.delsys.dvbt.transmission_mode = dvbfe_transmission_mode(channel.Transmission()); - Frontend.delsys.dvbt.guard_interval = dvbfe_guard_interval(channel.Guard()); - Frontend.delsys.dvbt.hierarchy = dvbfe_hierarchy(channel.Hierarchy()); - Frontend.delsys.dvbt.alpha = dvbfe_alpha(channel.Alpha()); - Frontend.delsys.dvbt.priority = dvbfe_stream_priority(channel.Priority()); + } + else if (frontendType == SYS_DVBT) + { + // DVB-T + Frontend[0].cmd = DTV_DELIVERY_SYSTEM; + Frontend[0].u.data = fe_delivery_system_t(channel.System()); + Frontend[1].cmd = DTV_FREQUENCY; + Frontend[1].u.data = FrequencyToHz(channel.Frequency()); + Frontend[2].cmd = DTV_INVERSION; + Frontend[2].u.data = fe_spectral_inversion_t(channel.Inversion()); + Frontend[3].cmd = DTV_BANDWIDTH_HZ; + Frontend[3].u.data = fe_bandwidth_t(channel.Bandwidth()); + Frontend[4].cmd = DTV_CODE_RATE_HP; + Frontend[4].u.data = fe_code_rate_t(channel.CoderateH()); + Frontend[5].cmd = DTV_CODE_RATE_LP; + Frontend[5].u.data = fe_code_rate_t(channel.CoderateL()); + Frontend[6].cmd = DTV_MODULATION; + Frontend[6].u.data = fe_modulation_t(channel.Modulation()); + Frontend[7].cmd = DTV_TRANSMISSION_MODE; + Frontend[7].u.data = fe_transmit_mode_t(channel.Transmission()); + Frontend[8].cmd = DTV_GUARD_INTERVAL; + Frontend[8].u.data = fe_guard_interval_t(channel.Guard()); + Frontend[9].cmd = DTV_HIERARCHY; + Frontend[9].u.data = fe_hierarchy_t(channel.Hierarchy()); + Frontend[10].cmd = DTV_TUNE; + cmdseq.num = 11; + cmdseq.props = Frontend; tuneTimeout = DVBT_TUNE_TIMEOUT; lockTimeout = DVBT_LOCK_TIMEOUT; - } + } else { esyslog("ERROR: attempt to set channel with unknown DVB frontend type"); return false; } - CHECK(ioctl(fd_frontend, DVBFE_SET_DELSYS, &Frontend.delivery)); //switch system - if (ioctl(fd_frontend, DVBFE_SET_PARAMS, &Frontend) < 0) { + if (ioctl(fd_frontend, FE_SET_PROPERTY, &cmdseq) < 0) { esyslog("ERROR: frontend %d: %m", cardIndex); return false; } @@ -386,7 +454,7 @@ { ciAdapter = NULL; dvbTuner = NULL; - frontendType = DVBFE_DELSYS_DUMMY; + frontendType = SYS_DVBS; numProvidedSystems = 0; spuDecoder = NULL; digitalAudio = false; @@ -449,9 +517,23 @@ // We only check the devices that must be present - the others will be checked before accessing them://XXX if (fd_frontend >= 0) { - if (ioctl(fd_frontend, DVBFE_GET_DELSYS, &frontendType) >= 0) { +// if (ioctl(fd_frontend, DVBFE_GET_DELSYS, &frontendType) >= 0) { + dvb_frontend_info feinfo; + fe_type fetype; + if (ioctl(fd_frontend, FE_GET_INFO, &feinfo) >= 0) { + fetype = feinfo.type; + if (fetype == FE_QPSK) + frontendType = SYS_DVBS; + if (fetype == FE_OFDM) + frontendType = SYS_DVBT; + if (fetype == FE_QAM) + frontendType = SYS_DVBC_ANNEX_AC; + if (fetype == FE_ATSC) + frontendType = SYS_ATSC; + const char **DeliverySystem = DeliverySystems; cString ds; + cString check; for (int i = 0; i < 32; i++) { if (frontendType & (1u << i)) { numProvidedSystems++; @@ -465,6 +547,17 @@ } if (*ds) isyslog("device %d provides:%s", CardIndex() + 1, *ds); + + // Following is a hack so that DVB-S cards don't get DVB-S2 transports. + // If check has a value and is not NULL, it means that the card can handle + // DVB-S2 transports and frontendType is forces to SYS_DVBS2. + check = strstr(ds,"DVBS2"); + if (*check) + { + isyslog("device %d forced to frontendType SYS_DVBS2\n", CardIndex() + 1); + frontendType = SYS_DVBS2; + } + dvbTuner = new cDvbTuner(fd_frontend, CardIndex(), frontendType); } else @@ -789,9 +882,9 @@ { int type = Source & cSource::st_Mask; return type == cSource::stNone - || type == cSource::stCable && (frontendType & DVBFE_DELSYS_DVBC) - || type == cSource::stSat && (frontendType & (DVBFE_DELSYS_DVBS | DVBFE_DELSYS_DVBS2)) - || type == cSource::stTerr && (frontendType & DVBFE_DELSYS_DVBT); + || type == cSource::stCable && (frontendType == SYS_DVBC_ANNEX_AC || frontendType == SYS_DVBC_ANNEX_B) + || type == cSource::stSat && (frontendType == SYS_DVBS || frontendType == SYS_DVBS2) + || type == cSource::stTerr && (frontendType == SYS_DVBT); } bool cDvbDevice::ProvidesTransponder(const cChannel *Channel) const --- vdr-1.7.0/dvbdevice.h 2008-04-12 13:20:48.000000000 +0200 +++ vdr-1.7.0-s2api/dvbdevice.h 2008-10-03 08:59:07.000000000 +0200 @@ -15,8 +15,8 @@ #include "device.h" #include "dvbspu.h" -#if DVB_API_VERSION != 3 || DVB_API_VERSION_MINOR != 3 -#error VDR requires Linux DVB driver API version 3.3! +#if DVB_API_VERSION != 5 || DVB_API_VERSION_MINOR != 0 +#error VDR requires Linux DVB driver API version 5.0! #endif #define MAXDVBDEVICES 8 @@ -35,7 +35,7 @@ ///< Must be called before accessing any DVB functions. ///< \return True if any devices are available. private: - dvbfe_delsys frontendType; + fe_delivery_system frontendType; int numProvidedSystems; int fd_osd, fd_audio, fd_video, fd_dvr, fd_stc, fd_ca; protected: --- vdr-1.7.0/menu.c 2008-10-07 20:44:25.000000000 +0200 +++ vdr-1.7.0-s2api/menu.c 2008-10-03 08:59:07.000000000 +0200 @@ -252,8 +252,8 @@ ST(" T") Add(new cMenuEditMapItem( tr("Transmission"), &data.transmission, TransmissionValues)); ST(" T") Add(new cMenuEditMapItem( tr("Guard"), &data.guard, GuardValues)); ST(" T") Add(new cMenuEditMapItem( tr("Hierarchy"), &data.hierarchy, HierarchyValues)); - ST(" T") Add(new cMenuEditMapItem( tr("Alpha"), &data.alpha, AlphaValues)); - ST(" T") Add(new cMenuEditMapItem( tr("Priority"), &data.priority, PriorityValues)); +// ST(" T") Add(new cMenuEditMapItem( tr("Alpha"), &data.alpha, AlphaValues)); +// ST(" T") Add(new cMenuEditMapItem( tr("Priority"), &data.priority, PriorityValues)); ST(" S ") Add(new cMenuEditMapItem( tr("Rolloff"), &data.rollOff, RollOffValues)); SetCurrent(Get(current)); --- vdr-1.7.0/nit.c 2008-10-07 20:44:25.000000000 +0200 +++ vdr-1.7.0-s2api/nit.c 2008-10-07 20:41:51.000000000 +0200 @@ -127,13 +127,13 @@ int Frequency = Frequencies[0] = BCD2INT(sd->getFrequency()) / 100; static char Polarizations[] = { 'h', 'v', 'l', 'r' }; char Polarization = Polarizations[sd->getPolarization()]; - static int CodeRates[] = { DVBFE_FEC_NONE, DVBFE_FEC_1_2, DVBFE_FEC_2_3, DVBFE_FEC_3_4, DVBFE_FEC_5_6, DVBFE_FEC_7_8, DVBFE_FEC_8_9, DVBFE_FEC_3_5, DVBFE_FEC_4_5, DVBFE_FEC_9_10, DVBFE_FEC_AUTO, DVBFE_FEC_AUTO, DVBFE_FEC_AUTO, DVBFE_FEC_AUTO, DVBFE_FEC_AUTO, DVBFE_FEC_NONE }; + static int CodeRates[] = { FEC_NONE, FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8, FEC_8_9, FEC_3_5, FEC_4_5, FEC_9_10, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_NONE }; int CodeRate = CodeRates[sd->getFecInner()]; - static int Modulations[] = { DVBFE_MOD_AUTO, DVBFE_MOD_QPSK, DVBFE_MOD_8PSK, DVBFE_MOD_QAM16 }; + static int Modulations[] = { QPSK, PSK_8, QAM_16 }; int Modulation = Modulations[sd->getModulationType()]; - int System = sd->getModulationSystem() ? DVBFE_DELSYS_DVBS2 : DVBFE_DELSYS_DVBS; - static int RollOffs[] = { DVBFE_ROLLOFF_35, DVBFE_ROLLOFF_25, DVBFE_ROLLOFF_20, DVBFE_ROLLOFF_UNKNOWN }; - int RollOff = sd->getModulationSystem() ? RollOffs[sd->getRollOff()] : DVBFE_ROLLOFF_UNKNOWN; + int System = sd->getModulationSystem() ? SYS_DVBS2 : SYS_DVBS; + static int RollOffs[] = { ROLLOFF_35, ROLLOFF_25, ROLLOFF_20, ROLLOFF_AUTO }; + int RollOff = sd->getModulationSystem() ? RollOffs[sd->getRollOff()] : ROLLOFF_AUTO; int SymbolRate = BCD2INT(sd->getSymbolRate()) / 10; if (ThisNIT >= 0) { for (int n = 0; n < NumFrequencies; n++) { @@ -151,15 +151,15 @@ for (cChannel *Channel = ChannelIterator.First(); Channel; Channel = ChannelIterator.Next()) { int transponder = Channel->Transponder(); found = true; - if (!ISTRANSPONDER(cChannel::Transponder(Frequency, Polarization), transponder)) { + if (!ISTRANSPONDER(Frequency / 1000000, transponder)) { for (int n = 0; n < NumFrequencies; n++) { - if (ISTRANSPONDER(cChannel::Transponder(Frequencies[n], Polarization), transponder)) { + if (ISTRANSPONDER(Frequencies[n] / 1000000, transponder)) { Frequency = Frequencies[n]; break; } } } - if (ISTRANSPONDER(cChannel::Transponder(Frequency, Polarization), Transponder())) // only modify channels if we're actually receiving this transponder + if (ISTRANSPONDER(Frequency / 1000000, Transponder())) // only modify channels if we're actually receiving this transponder Channel->SetSatTransponderData(Source, Frequency, Polarization, SymbolRate, CodeRate, Modulation, System, RollOff); } if (!found) { @@ -180,9 +180,9 @@ int Source = cSource::FromData(cSource::stCable); int Frequency = Frequencies[0] = BCD2INT(sd->getFrequency()) / 10; //XXX FEC_outer??? - static int CodeRates[] = { DVBFE_FEC_NONE, DVBFE_FEC_1_2, DVBFE_FEC_2_3, DVBFE_FEC_3_4, DVBFE_FEC_5_6, DVBFE_FEC_7_8, DVBFE_FEC_8_9, DVBFE_FEC_3_5, DVBFE_FEC_4_5, DVBFE_FEC_9_10, DVBFE_FEC_AUTO, DVBFE_FEC_AUTO, DVBFE_FEC_AUTO, DVBFE_FEC_AUTO, DVBFE_FEC_AUTO, DVBFE_FEC_NONE }; + static int CodeRates[] = { FEC_NONE, FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8, FEC_8_9, FEC_3_5, FEC_4_5, FEC_9_10, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_NONE }; int CodeRate = CodeRates[sd->getFecInner()]; - static int Modulations[] = { DVBFE_MOD_NONE, DVBFE_MOD_QAM16, DVBFE_MOD_QAM32, DVBFE_MOD_QAM64, DVBFE_MOD_QAM128, DVBFE_MOD_QAM256, QAM_AUTO }; + static int Modulations[] = { QPSK, QAM_16, QAM_32, QAM_64, QAM_128, QAM_256, QAM_AUTO }; int Modulation = Modulations[min(sd->getModulation(), 6)]; int SymbolRate = BCD2INT(sd->getSymbolRate()) / 10; if (ThisNIT >= 0) { @@ -229,22 +229,19 @@ SI::TerrestrialDeliverySystemDescriptor *sd = (SI::TerrestrialDeliverySystemDescriptor *)d; int Source = cSource::FromData(cSource::stTerr); int Frequency = Frequencies[0] = sd->getFrequency() * 10; - static int Bandwidths[] = { DVBFE_BANDWIDTH_8_MHZ, DVBFE_BANDWIDTH_7_MHZ, DVBFE_BANDWIDTH_6_MHZ, DVBFE_BANDWIDTH_5_MHZ, DVBFE_BANDWIDTH_AUTO, DVBFE_BANDWIDTH_AUTO, DVBFE_BANDWIDTH_AUTO, DVBFE_BANDWIDTH_AUTO }; + static int Bandwidths[] = { BANDWIDTH_8_MHZ, BANDWIDTH_7_MHZ, BANDWIDTH_6_MHZ, BANDWIDTH_AUTO, BANDWIDTH_AUTO, BANDWIDTH_AUTO, BANDWIDTH_AUTO, BANDWIDTH_AUTO }; int Bandwidth = Bandwidths[sd->getBandwidth()]; - static int Constellations[] = { DVBFE_MOD_QPSK, DVBFE_MOD_QAM16, DVBFE_MOD_QAM64, DVBFE_MOD_AUTO }; + static int Constellations[] = { QPSK, QAM_16, QAM_64, QAM_AUTO }; int Constellation = Constellations[sd->getConstellation()]; - static int CodeRates[] = { DVBFE_FEC_1_2, DVBFE_FEC_2_3, DVBFE_FEC_3_4, DVBFE_FEC_5_6, DVBFE_FEC_7_8, DVBFE_FEC_AUTO, DVBFE_FEC_AUTO, DVBFE_FEC_AUTO }; + static int Hierarchies[] = { HIERARCHY_NONE, HIERARCHY_1, HIERARCHY_2, HIERARCHY_4, HIERARCHY_AUTO, HIERARCHY_AUTO, HIERARCHY_AUTO, HIERARCHY_AUTO }; + int Hierarchy = Hierarchies[sd->getHierarchy()]; + static int CodeRates[] = { FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8, FEC_AUTO, FEC_AUTO, FEC_AUTO }; int CodeRateHP = CodeRates[sd->getCodeRateHP()]; int CodeRateLP = CodeRates[sd->getCodeRateLP()]; - static int GuardIntervals[] = { DVBFE_GUARD_INTERVAL_1_32, DVBFE_GUARD_INTERVAL_1_16, DVBFE_GUARD_INTERVAL_1_8, DVBFE_GUARD_INTERVAL_1_4 }; + static int GuardIntervals[] = { GUARD_INTERVAL_1_32, GUARD_INTERVAL_1_16, GUARD_INTERVAL_1_8, GUARD_INTERVAL_1_4 }; int GuardInterval = GuardIntervals[sd->getGuardInterval()]; - static int TransmissionModes[] = { DVBFE_TRANSMISSION_MODE_2K, DVBFE_TRANSMISSION_MODE_8K, DVBFE_TRANSMISSION_MODE_4K, DVBFE_TRANSMISSION_MODE_AUTO }; + static int TransmissionModes[] = { TRANSMISSION_MODE_2K, TRANSMISSION_MODE_8K, TRANSMISSION_MODE_AUTO, TRANSMISSION_MODE_AUTO }; int TransmissionMode = TransmissionModes[sd->getTransmissionMode()]; - static int Priorities[] = { DVBFE_STREAM_PRIORITY_LP, DVBFE_STREAM_PRIORITY_HP }; - int Priority = Priorities[sd->getPriority()]; - static int Alphas[] = { 0, DVBFE_ALPHA_1, DVBFE_ALPHA_2, DVBFE_ALPHA_4 }; - int Alpha = Alphas[sd->getHierarchy() & 3]; - int Hierarchy = Alpha ? DVBFE_HIERARCHY_ON : DVBFE_HIERARCHY_OFF; if (ThisNIT >= 0) { for (int n = 0; n < NumFrequencies; n++) { if (ISTRANSPONDER(Frequencies[n] / 1000000, Transponder())) { @@ -257,26 +254,27 @@ } if (Setup.UpdateChannels >= 5) { bool found = false; - cIterator ChannelIterator = Channels.GetChannelsBySourceNidTid(Source, ts.getOriginalNetworkId(), ts.getTransportStreamId()); - for (cChannel *Channel = ChannelIterator.First(); Channel; Channel = ChannelIterator.Next()) { - int transponder = Channel->Transponder(); - found = true; - if (!ISTRANSPONDER(Frequency / 1000000, transponder)) { - for (int n = 0; n < NumFrequencies; n++) { - if (ISTRANSPONDER(Frequencies[n] / 1000000, transponder)) { - Frequency = Frequencies[n]; - break; + for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) { + if (!Channel->GroupSep() && Channel->Source() == Source && Channel->Nid() == ts.getOriginalNetworkId() && Channel->Tid() == ts.getTransportStreamId()) { + int transponder = Channel->Transponder(); + found = true; + if (!ISTRANSPONDER(Frequency / 1000000, transponder)) { + for (int n = 0; n < NumFrequencies; n++) { + if (ISTRANSPONDER(Frequencies[n] / 1000000, transponder)) { + Frequency = Frequencies[n]; + break; + } } - } + } + if (ISTRANSPONDER(Frequency / 1000000, Transponder())) // only modify channels if we're actually receiving this transponder + Channel->SetTerrTransponderData(Source, Frequency, Bandwidth, Constellation, Hierarchy, CodeRateHP, CodeRateLP, GuardInterval, TransmissionMode); } - if (ISTRANSPONDER(Frequency / 1000000, Transponder())) // only modify channels if we're actually receiving this transponder - Channel->SetTerrTransponderData(Source, Frequency, Bandwidth, Constellation, Hierarchy, CodeRateHP, CodeRateLP, GuardInterval, TransmissionMode, Alpha, Priority); } if (!found) { for (int n = 0; n < NumFrequencies; n++) { cChannel *Channel = new cChannel; Channel->SetId(ts.getOriginalNetworkId(), ts.getTransportStreamId(), 0, 0); - if (Channel->SetTerrTransponderData(Source, Frequencies[n], Bandwidth, Constellation, Hierarchy, CodeRateHP, CodeRateLP, GuardInterval, TransmissionMode, Alpha, Priority)) + if (Channel->SetTerrTransponderData(Source, Frequencies[n], Bandwidth, Constellation, Hierarchy, CodeRateHP, CodeRateLP, GuardInterval, TransmissionMode)) EITScanner.AddTransponder(Channel); else delete Channel;