diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2016-12-23 14:25:27 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2016-12-23 14:25:27 +0100 |
commit | bac0ca39babafb53f3aa8084f885937daf5f15d4 (patch) | |
tree | 3162328f03c7d33e2d9f1ff4af2256cc2a4669f6 | |
parent | 68acf8815c369e1bedfc0fa8f066975001803454 (diff) | |
download | vdr-bac0ca39babafb53f3aa8084f885937daf5f15d4.tar.gz vdr-bac0ca39babafb53f3aa8084f885937daf5f15d4.tar.bz2 |
Avoiding some duplicate code and unnecessary work in nit.c
-rw-r--r-- | CONTRIBUTORS | 1 | ||||
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | nit.c | 16 |
3 files changed, 11 insertions, 8 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 51507ea2..a25051e7 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2065,6 +2065,7 @@ Ville Skyttä <ville.skytta@iki.fi> for reporting a superfluous assignment in cPipe::Open() for avoiding unnecessary pkg-config warnings in plugin Makefiles for fixing building VDR with systemd >= 230 + for avoiding some duplicate code and unnecessary work in nit.c Steffen Beyer <cpunk@reactor.de> for fixing setting the colored button help after deleting a recording in case the next @@ -8876,3 +8876,5 @@ Video Disk Recorder Revision History Hanisch). - Fixed a possible buffer overflow in handling CA descriptors (suggested by Lars Hanisch). +- Avoiding some duplicate code and unnecessary work in nit.c (thanks to Ville + Skyttä). @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: nit.c 4.3 2015/07/26 09:24:36 kls Exp $ + * $Id: nit.c 4.4 2016/12/23 14:16:59 kls Exp $ */ #include "nit.h" @@ -114,7 +114,7 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length static int RollOffs[] = { ROLLOFF_35, ROLLOFF_25, ROLLOFF_20, ROLLOFF_AUTO }; dtp.SetRollOff(sd->getModulationSystem() ? RollOffs[sd->getRollOff()] : ROLLOFF_AUTO); int SymbolRate = BCD2INT(sd->getSymbolRate()) / 10; - dbgnit(" %s %d %c %d %d\n", *cSource::ToString(Source), Frequency, Polarizations[sd->getPolarization()], SymbolRate, cChannel::Transponder(Frequency, Polarizations[sd->getPolarization()])); + dbgnit(" %s %d %c %d %d\n", *cSource::ToString(Source), Frequency, dtp.Polarization(), SymbolRate, cChannel::Transponder(Frequency, dtp.Polarization())); if (Setup.UpdateChannels >= 5) { bool found = false; bool forceTransponderUpdate = false; @@ -177,7 +177,7 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length static int Modulations[] = { QPSK, QAM_16, QAM_32, QAM_64, QAM_128, QAM_256, QAM_AUTO }; dtp.SetModulation(Modulations[min(sd->getModulation(), 6)]); int SymbolRate = BCD2INT(sd->getSymbolRate()) / 10; - dbgnit(" %s %d %d %d %d\n", *cSource::ToString(Source), Frequency, CodeRates[sd->getFecInner()], Modulations[min(sd->getModulation(), 6)], SymbolRate); + dbgnit(" %s %d %d %d %d\n", *cSource::ToString(Source), Frequency, dtp.CoderateH(), dtp.Modulation(), SymbolRate); if (Setup.UpdateChannels >= 5) { bool found = false; bool forceTransponderUpdate = false; @@ -233,7 +233,7 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length dtp.SetGuard(GuardIntervals[sd->getGuardInterval()]); static int TransmissionModes[] = { TRANSMISSION_MODE_2K, TRANSMISSION_MODE_8K, TRANSMISSION_MODE_4K, TRANSMISSION_MODE_AUTO }; dtp.SetTransmission(TransmissionModes[sd->getTransmissionMode()]); - dbgnit(" %s %d %d %d %d %d %d %d %d\n", *cSource::ToString(Source), Frequency, Bandwidths[sd->getBandwidth()], Constellations[sd->getConstellation()], Hierarchies[sd->getHierarchy()], CodeRates[sd->getCodeRateHP()], CodeRates[sd->getCodeRateLP()], GuardIntervals[sd->getGuardInterval()], TransmissionModes[sd->getTransmissionMode()]); + dbgnit(" %s %d %d %d %d %d %d %d %d\n", *cSource::ToString(Source), Frequency, dtp.Bandwidth(), dtp.Modulation(), dtp.Hierarchy(), dtp.CoderateH(), dtp.CoderateL(), dtp.Guard(), dtp.Transmission()); if (Setup.UpdateChannels >= 5) { bool found = false; bool forceTransponderUpdate = false; @@ -310,9 +310,9 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length SI::LogicalChannelDescriptor *lcd = (SI::LogicalChannelDescriptor *)d; SI::LogicalChannelDescriptor::LogicalChannel LogicalChannel; for (SI::Loop::Iterator it4; lcd->logicalChannelLoop.getNext(LogicalChannel, it4); ) { - int lcn = LogicalChannel.getLogicalChannelNumber(); - int sid = LogicalChannel.getServiceId(); if (LogicalChannel.getVisibleServiceFlag()) { + int lcn = LogicalChannel.getLogicalChannelNumber(); + int sid = LogicalChannel.getServiceId(); for (cChannel *Channel = Channels->First(); Channel; Channel = Channels->Next(Channel)) { if (!Channel->GroupSep() && Channel->Sid() == sid && Channel->Nid() == ts.getOriginalNetworkId() && Channel->Tid() == ts.getTransportStreamId()) { ChannelsModified |= Channel->SetLcn(lcn); @@ -328,9 +328,9 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length SI::HdSimulcastLogicalChannelDescriptor *lcd = (SI::HdSimulcastLogicalChannelDescriptor *)d; SI::HdSimulcastLogicalChannelDescriptor::HdSimulcastLogicalChannel HdSimulcastLogicalChannel; for (SI::Loop::Iterator it4; lcd->hdSimulcastLogicalChannelLoop.getNext(HdSimulcastLogicalChannel, it4); ) { - int lcn = HdSimulcastLogicalChannel.getLogicalChannelNumber(); - int sid = HdSimulcastLogicalChannel.getServiceId(); if (HdSimulcastLogicalChannel.getVisibleServiceFlag()) { + int lcn = HdSimulcastLogicalChannel.getLogicalChannelNumber(); + int sid = HdSimulcastLogicalChannel.getServiceId(); for (cChannel *Channel = Channels->First(); Channel; Channel = Channels->Next(Channel)) { if (!Channel->GroupSep() && Channel->Sid() == sid && Channel->Nid() == ts.getOriginalNetworkId() && Channel->Tid() == ts.getTransportStreamId()) { ChannelsModified |= Channel->SetLcn(lcn); |