Added missing rounding when dividing frequencies in processing the NIT

This commit is contained in:
Klaus Schmidinger 2022-11-30 12:02:00 +01:00
parent 4425918d31
commit 76445411a5
3 changed files with 9 additions and 6 deletions

View File

@ -2795,6 +2795,7 @@ Winfried K
std::min(), std::max() and std::swap() is available
for adding some missing "AUTO" values to vdr.5
for fixing default values for DVB-T
for adding missing rounding when dividing frequencies in processing the NIT
Hans-Werner Hilse <hilse@web.de>
for adding the command line option --userdump to enable core dumps in case VDR

View File

@ -9780,7 +9780,7 @@ Video Disk Recorder Revision History
out by Onur Sentürk).
- Official release.
2022-11-28:
2022-11-30:
- Added UPDATE-2.6.0, which was missing in the official 2.6.0 release.
- Fixed unexpected calls of the '-r' script when a recording is interrupted and
@ -9813,3 +9813,5 @@ Video Disk Recorder Revision History
Onur Sentürk).
- Fixed regenerating the index file of a recording in case it is present, but empty
(reported by Stefan Herdler).
- Added missing rounding when dividing frequencies in processing the NIT (thanks to
Winfried Köhler).

10
nit.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: nit.c 5.2 2021/12/14 21:15:02 kls Exp $
* $Id: nit.c 5.3 2022/11/30 12:02:00 kls Exp $
*/
#include "nit.h"
@ -81,8 +81,8 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
for (SI::Loop::Iterator it3; fld->frequencies.hasNext(it3); ) {
int f = fld->frequencies.getNext(it3);
switch (ct) {
case 1: f = BCD2INT(f) / 100; break;
case 2: f = BCD2INT(f) / 10; break;
case 1: f = round(BCD2INT(f) / 100.0); break;
case 2: f = round(BCD2INT(f) / 10.0); break;
case 3: f = f * 10; break;
default: ;
}
@ -112,7 +112,7 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
SI::SatelliteDeliverySystemDescriptor *sd = (SI::SatelliteDeliverySystemDescriptor *)d;
cDvbTransponderParameters dtp;
int Source = cSource::FromData(cSource::stSat, BCD2INT(sd->getOrbitalPosition()), sd->getWestEastFlag());
int Frequency = Frequencies[0] = BCD2INT(sd->getFrequency()) / 100;
int Frequency = Frequencies[0] = round(BCD2INT(sd->getFrequency()) / 100.0);
static char Polarizations[] = { 'H', 'V', 'L', 'R' };
dtp.SetPolarization(Polarizations[sd->getPolarization()]);
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 };
@ -184,7 +184,7 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
SI::CableDeliverySystemDescriptor *sd = (SI::CableDeliverySystemDescriptor *)d;
cDvbTransponderParameters dtp;
int Source = cSource::FromData(cSource::stCable);
int Frequency = Frequencies[0] = BCD2INT(sd->getFrequency()) / 10;
int Frequency = Frequencies[0] = round(BCD2INT(sd->getFrequency()) / 10.0);
//XXX FEC_outer???
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 };
dtp.SetCoderateH(CodeRates[sd->getFecInner()]);