2004-01-11 15:54:37 +01:00
|
|
|
/*
|
|
|
|
* nit.c: NIT section filter
|
|
|
|
*
|
|
|
|
* See the main source file 'vdr.c' for copyright information and
|
|
|
|
* how to reach the author.
|
|
|
|
*
|
2022-11-30 12:02:00 +01:00
|
|
|
* $Id: nit.c 5.3 2022/11/30 12:02:00 kls Exp $
|
2004-01-11 15:54:37 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "nit.h"
|
|
|
|
#include <linux/dvb/frontend.h>
|
|
|
|
#include "channels.h"
|
2010-02-28 12:19:50 +01:00
|
|
|
#include "dvbdevice.h"
|
2004-01-11 15:54:37 +01:00
|
|
|
#include "eitscan.h"
|
|
|
|
#include "libsi/section.h"
|
|
|
|
#include "libsi/descriptor.h"
|
|
|
|
#include "tools.h"
|
|
|
|
|
2012-01-08 09:27:59 +01:00
|
|
|
#define DVB_SYSTEM_1 0 // see also dvbdevice.c
|
|
|
|
#define DVB_SYSTEM_2 1
|
|
|
|
|
2015-03-17 12:27:18 +01:00
|
|
|
#define MAXNETWORKNAME Utf8BufSize(256)
|
|
|
|
|
|
|
|
// Set to 'true' for debug output:
|
|
|
|
static bool DebugNit = false;
|
|
|
|
|
|
|
|
#define dbgnit(a...) if (DebugNit) fprintf(stderr, a)
|
|
|
|
|
2014-03-10 14:50:58 +01:00
|
|
|
cNitFilter::cNitFilter(cSdtFilter *SdtFilter)
|
2004-01-11 15:54:37 +01:00
|
|
|
{
|
2014-03-10 14:50:58 +01:00
|
|
|
sdtFilter = SdtFilter;
|
2015-03-17 12:27:18 +01:00
|
|
|
Set(0x10, SI::TableIdNIT);
|
2004-01-11 15:54:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void cNitFilter::SetStatus(bool On)
|
|
|
|
{
|
|
|
|
cFilter::SetStatus(On);
|
|
|
|
sectionSyncer.Reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
|
|
|
|
{
|
|
|
|
SI::NIT nit(Data, false);
|
|
|
|
if (!nit.CheckCRCAndParse())
|
|
|
|
return;
|
2021-03-16 15:10:54 +01:00
|
|
|
if (!sectionSyncer.Check(nit.getVersionNumber(), nit.getSectionNumber()))
|
2015-03-17 12:27:18 +01:00
|
|
|
return;
|
|
|
|
if (DebugNit) {
|
|
|
|
char NetworkName[MAXNETWORKNAME] = "";
|
|
|
|
SI::Descriptor *d;
|
|
|
|
for (SI::Loop::Iterator it; (d = nit.commonDescriptors.getNext(it)); ) {
|
|
|
|
switch (d->getDescriptorTag()) {
|
|
|
|
case SI::NetworkNameDescriptorTag: {
|
|
|
|
SI::NetworkNameDescriptor *nnd = (SI::NetworkNameDescriptor *)d;
|
|
|
|
nnd->name.getText(NetworkName, MAXNETWORKNAME);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default: ;
|
2004-01-18 16:31:58 +01:00
|
|
|
}
|
2015-03-17 12:27:18 +01:00
|
|
|
delete d;
|
|
|
|
}
|
|
|
|
dbgnit("NIT: %02X %2d %2d %2d %s %d %d '%s'\n", Tid, nit.getVersionNumber(), nit.getSectionNumber(), nit.getLastSectionNumber(), *cSource::ToString(Source()), nit.getNetworkId(), Transponder(), NetworkName);
|
2004-01-18 16:31:58 +01:00
|
|
|
}
|
2015-09-01 11:14:27 +02:00
|
|
|
cStateKey StateKey;
|
|
|
|
cChannels *Channels = cChannels::GetChannelsWrite(StateKey, 10);
|
2021-03-16 15:10:54 +01:00
|
|
|
if (!Channels)
|
2004-01-11 15:54:37 +01:00
|
|
|
return;
|
2015-09-01 11:14:27 +02:00
|
|
|
bool ChannelsModified = false;
|
2004-10-16 10:14:19 +02:00
|
|
|
SI::NIT::TransportStream ts;
|
|
|
|
for (SI::Loop::Iterator it; nit.transportStreamLoop.getNext(ts, it); ) {
|
2004-01-11 15:54:37 +01:00
|
|
|
SI::Descriptor *d;
|
2006-05-27 15:35:16 +02:00
|
|
|
|
|
|
|
SI::Loop::Iterator it2;
|
|
|
|
SI::FrequencyListDescriptor *fld = (SI::FrequencyListDescriptor *)ts.transportStreamDescriptors.getNext(it2, SI::FrequencyListDescriptorTag);
|
|
|
|
int NumFrequencies = fld ? fld->frequencies.getCount() + 1 : 1;
|
|
|
|
int Frequencies[NumFrequencies];
|
|
|
|
if (fld) {
|
|
|
|
int ct = fld->getCodingType();
|
|
|
|
if (ct > 0) {
|
|
|
|
int n = 1;
|
|
|
|
for (SI::Loop::Iterator it3; fld->frequencies.hasNext(it3); ) {
|
|
|
|
int f = fld->frequencies.getNext(it3);
|
|
|
|
switch (ct) {
|
2022-11-30 12:02:00 +01:00
|
|
|
case 1: f = round(BCD2INT(f) / 100.0); break;
|
|
|
|
case 2: f = round(BCD2INT(f) / 10.0); break;
|
2006-05-27 15:35:16 +02:00
|
|
|
case 3: f = f * 10; break;
|
2009-12-06 12:57:45 +01:00
|
|
|
default: ;
|
2006-05-27 15:35:16 +02:00
|
|
|
}
|
|
|
|
Frequencies[n++] = f;
|
2015-03-17 12:27:18 +01:00
|
|
|
dbgnit(" Frequencies[%d] = %d\n", n - 1, f);
|
2006-05-27 15:35:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
NumFrequencies = 1;
|
|
|
|
}
|
|
|
|
delete fld;
|
|
|
|
|
2019-05-31 13:25:00 +02:00
|
|
|
// Necessary for "backwards compatibility mode" according to ETSI EN 300 468:
|
|
|
|
bool ForceDVBS2 = false;
|
|
|
|
for (SI::Loop::Iterator it2; (d = ts.transportStreamDescriptors.getNext(it2)); ) {
|
|
|
|
if (d->getDescriptorTag() == SI::S2SatelliteDeliverySystemDescriptorTag) {
|
|
|
|
ForceDVBS2 = true;
|
2021-12-14 21:15:02 +01:00
|
|
|
delete d;
|
2019-05-31 13:25:00 +02:00
|
|
|
break;
|
|
|
|
}
|
2021-12-14 21:15:02 +01:00
|
|
|
delete d;
|
2019-05-31 13:25:00 +02:00
|
|
|
}
|
|
|
|
|
2004-01-11 15:54:37 +01:00
|
|
|
for (SI::Loop::Iterator it2; (d = ts.transportStreamDescriptors.getNext(it2)); ) {
|
|
|
|
switch (d->getDescriptorTag()) {
|
|
|
|
case SI::SatelliteDeliverySystemDescriptorTag: {
|
|
|
|
SI::SatelliteDeliverySystemDescriptor *sd = (SI::SatelliteDeliverySystemDescriptor *)d;
|
2010-02-28 12:19:50 +01:00
|
|
|
cDvbTransponderParameters dtp;
|
2004-01-11 15:54:37 +01:00
|
|
|
int Source = cSource::FromData(cSource::stSat, BCD2INT(sd->getOrbitalPosition()), sd->getWestEastFlag());
|
2022-11-30 12:02:00 +01:00
|
|
|
int Frequency = Frequencies[0] = round(BCD2INT(sd->getFrequency()) / 100.0);
|
2010-02-28 12:19:50 +01:00
|
|
|
static char Polarizations[] = { 'H', 'V', 'L', 'R' };
|
|
|
|
dtp.SetPolarization(Polarizations[sd->getPolarization()]);
|
2008-12-13 12:22:36 +01:00
|
|
|
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 };
|
2010-02-28 12:19:50 +01:00
|
|
|
dtp.SetCoderateH(CodeRates[sd->getFecInner()]);
|
2008-12-20 11:05:22 +01:00
|
|
|
static int Modulations[] = { QAM_AUTO, QPSK, PSK_8, QAM_16 };
|
2010-02-28 12:19:50 +01:00
|
|
|
dtp.SetModulation(Modulations[sd->getModulationType()]);
|
2019-05-31 13:25:00 +02:00
|
|
|
bool System = sd->getModulationSystem() || ForceDVBS2;
|
|
|
|
dtp.SetSystem(System ? DVB_SYSTEM_2 : DVB_SYSTEM_1);
|
2008-12-13 12:22:36 +01:00
|
|
|
static int RollOffs[] = { ROLLOFF_35, ROLLOFF_25, ROLLOFF_20, ROLLOFF_AUTO };
|
2019-05-31 13:25:00 +02:00
|
|
|
dtp.SetRollOff(System ? RollOffs[sd->getRollOff()] : ROLLOFF_AUTO);
|
2004-01-11 15:54:37 +01:00
|
|
|
int SymbolRate = BCD2INT(sd->getSymbolRate()) / 10;
|
2019-05-31 13:25:00 +02:00
|
|
|
dbgnit(" %s %d %c %d %d DVB-S%d\n", *cSource::ToString(Source), Frequency, dtp.Polarization(), SymbolRate, cChannel::Transponder(Frequency, dtp.Polarization()), System ? 2 : 1);
|
2007-08-17 14:06:09 +02:00
|
|
|
if (Setup.UpdateChannels >= 5) {
|
|
|
|
bool found = false;
|
2011-08-12 14:37:25 +02:00
|
|
|
bool forceTransponderUpdate = false;
|
2015-09-01 11:14:27 +02:00
|
|
|
for (cChannel *Channel = Channels->First(); Channel; Channel = Channels->Next(Channel)) {
|
2007-08-17 14:06:09 +02:00
|
|
|
if (!Channel->GroupSep() && Channel->Source() == Source && Channel->Nid() == ts.getOriginalNetworkId() && Channel->Tid() == ts.getTransportStreamId()) {
|
2018-03-18 10:52:21 +01:00
|
|
|
// Preserve parameters set separately in S2SatelliteDeliverySystemDescriptor:
|
|
|
|
cDvbTransponderParameters dtpc(Channel->Parameters());
|
|
|
|
dtp.SetStreamId(dtpc.StreamId());
|
|
|
|
//
|
2007-08-17 14:06:09 +02:00
|
|
|
int transponder = Channel->Transponder();
|
2010-02-28 12:19:50 +01:00
|
|
|
if (!ISTRANSPONDER(cChannel::Transponder(Frequency, dtp.Polarization()), transponder)) {
|
2007-04-29 11:40:31 +02:00
|
|
|
for (int n = 0; n < NumFrequencies; n++) {
|
2010-02-28 12:19:50 +01:00
|
|
|
if (ISTRANSPONDER(cChannel::Transponder(Frequencies[n], dtp.Polarization()), transponder)) {
|
2007-04-29 11:40:31 +02:00
|
|
|
Frequency = Frequencies[n];
|
|
|
|
break;
|
2006-05-27 15:35:16 +02:00
|
|
|
}
|
2007-04-29 11:40:31 +02:00
|
|
|
}
|
2006-05-27 15:35:16 +02:00
|
|
|
}
|
2019-03-12 13:05:33 +01:00
|
|
|
if (!ISTRANSPONDER(cChannel::Transponder(Frequency, dtp.Polarization()), transponder))
|
|
|
|
continue; // a channel with obsolete/wrong/other(?) transponder
|
|
|
|
found = true;
|
|
|
|
if (ISTRANSPONDER(transponder, Transponder())) // only modify channels if we're actually receiving this transponder
|
2015-09-01 11:14:27 +02:00
|
|
|
ChannelsModified |= Channel->SetTransponderData(Source, Frequency, SymbolRate, dtp.ToString('S'));
|
2011-08-12 14:37:25 +02:00
|
|
|
else if (Channel->Srate() != SymbolRate || strcmp(Channel->Parameters(), dtp.ToString('S')))
|
|
|
|
forceTransponderUpdate = true; // get us receiving this transponder
|
2006-05-27 15:35:16 +02:00
|
|
|
}
|
2004-01-11 15:54:37 +01:00
|
|
|
}
|
2011-08-12 14:37:25 +02:00
|
|
|
if (!found || forceTransponderUpdate) {
|
2007-08-17 14:06:09 +02:00
|
|
|
for (int n = 0; n < NumFrequencies; n++) {
|
|
|
|
cChannel *Channel = new cChannel;
|
2015-09-01 11:14:27 +02:00
|
|
|
Channel->SetId(NULL, ts.getOriginalNetworkId(), ts.getTransportStreamId(), 0, 0);
|
2010-02-28 12:19:50 +01:00
|
|
|
if (Channel->SetTransponderData(Source, Frequencies[n], SymbolRate, dtp.ToString('S')))
|
2007-08-17 14:06:09 +02:00
|
|
|
EITScanner.AddTransponder(Channel);
|
|
|
|
else
|
|
|
|
delete Channel;
|
|
|
|
}
|
|
|
|
}
|
2004-01-11 15:54:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2013-03-07 09:51:06 +01:00
|
|
|
case SI::S2SatelliteDeliverySystemDescriptorTag: {
|
|
|
|
if (Setup.UpdateChannels >= 5) {
|
2015-09-01 11:14:27 +02:00
|
|
|
for (cChannel *Channel = Channels->First(); Channel; Channel = Channels->Next(Channel)) {
|
2013-03-07 09:51:06 +01:00
|
|
|
if (!Channel->GroupSep() && cSource::IsSat(Channel->Source()) && Channel->Nid() == ts.getOriginalNetworkId() && Channel->Tid() == ts.getTransportStreamId()) {
|
|
|
|
SI::S2SatelliteDeliverySystemDescriptor *sd = (SI::S2SatelliteDeliverySystemDescriptor *)d;
|
|
|
|
cDvbTransponderParameters dtp(Channel->Parameters());
|
|
|
|
dtp.SetStreamId(sd->getInputStreamIdentifier());
|
2018-03-18 10:52:21 +01:00
|
|
|
dbgnit(" stream id = %d\n", dtp.StreamId());
|
2015-09-01 11:14:27 +02:00
|
|
|
ChannelsModified |= Channel->SetTransponderData(Channel->Source(), Channel->Frequency(), Channel->Srate(), dtp.ToString('S'));
|
2013-03-07 09:51:06 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2004-01-11 15:54:37 +01:00
|
|
|
case SI::CableDeliverySystemDescriptorTag: {
|
|
|
|
SI::CableDeliverySystemDescriptor *sd = (SI::CableDeliverySystemDescriptor *)d;
|
2010-02-28 12:19:50 +01:00
|
|
|
cDvbTransponderParameters dtp;
|
2004-01-11 15:54:37 +01:00
|
|
|
int Source = cSource::FromData(cSource::stCable);
|
2022-11-30 12:02:00 +01:00
|
|
|
int Frequency = Frequencies[0] = round(BCD2INT(sd->getFrequency()) / 10.0);
|
2004-01-11 15:54:37 +01:00
|
|
|
//XXX FEC_outer???
|
2008-12-13 12:22:36 +01:00
|
|
|
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 };
|
2010-02-28 12:19:50 +01:00
|
|
|
dtp.SetCoderateH(CodeRates[sd->getFecInner()]);
|
2008-12-13 12:22:36 +01:00
|
|
|
static int Modulations[] = { QPSK, QAM_16, QAM_32, QAM_64, QAM_128, QAM_256, QAM_AUTO };
|
2010-02-28 12:19:50 +01:00
|
|
|
dtp.SetModulation(Modulations[min(sd->getModulation(), 6)]);
|
2004-01-11 15:54:37 +01:00
|
|
|
int SymbolRate = BCD2INT(sd->getSymbolRate()) / 10;
|
2016-12-23 14:25:27 +01:00
|
|
|
dbgnit(" %s %d %d %d %d\n", *cSource::ToString(Source), Frequency, dtp.CoderateH(), dtp.Modulation(), SymbolRate);
|
2007-08-17 14:06:09 +02:00
|
|
|
if (Setup.UpdateChannels >= 5) {
|
|
|
|
bool found = false;
|
2011-08-12 14:37:25 +02:00
|
|
|
bool forceTransponderUpdate = false;
|
2015-09-01 11:14:27 +02:00
|
|
|
for (cChannel *Channel = Channels->First(); Channel; Channel = Channels->Next(Channel)) {
|
2007-08-17 14:06:09 +02:00
|
|
|
if (!Channel->GroupSep() && Channel->Source() == Source && Channel->Nid() == ts.getOriginalNetworkId() && Channel->Tid() == ts.getTransportStreamId()) {
|
|
|
|
int transponder = Channel->Transponder();
|
|
|
|
if (!ISTRANSPONDER(Frequency / 1000, transponder)) {
|
2007-04-29 11:40:31 +02:00
|
|
|
for (int n = 0; n < NumFrequencies; n++) {
|
2007-08-17 14:06:09 +02:00
|
|
|
if (ISTRANSPONDER(Frequencies[n] / 1000, transponder)) {
|
2007-04-29 11:40:31 +02:00
|
|
|
Frequency = Frequencies[n];
|
|
|
|
break;
|
2006-05-27 15:35:16 +02:00
|
|
|
}
|
2007-04-29 11:40:31 +02:00
|
|
|
}
|
2006-05-27 15:35:16 +02:00
|
|
|
}
|
2019-03-18 10:29:09 +01:00
|
|
|
if (!ISTRANSPONDER(Frequency / 1000, transponder))
|
2019-03-12 13:05:33 +01:00
|
|
|
continue; // a channel with obsolete/wrong/other(?) transponder
|
|
|
|
found = true;
|
|
|
|
if (ISTRANSPONDER(transponder, Transponder())) // only modify channels if we're actually receiving this transponder
|
2015-09-01 11:14:27 +02:00
|
|
|
ChannelsModified |= Channel->SetTransponderData(Source, Frequency, SymbolRate, dtp.ToString('C'));
|
2011-08-12 14:37:25 +02:00
|
|
|
else if (Channel->Srate() != SymbolRate || strcmp(Channel->Parameters(), dtp.ToString('C')))
|
|
|
|
forceTransponderUpdate = true; // get us receiving this transponder
|
2006-05-27 15:35:16 +02:00
|
|
|
}
|
2004-01-11 15:54:37 +01:00
|
|
|
}
|
2011-08-12 14:37:25 +02:00
|
|
|
if (!found || forceTransponderUpdate) {
|
2014-03-10 13:31:23 +01:00
|
|
|
for (int n = 0; n < NumFrequencies; n++) {
|
2007-08-17 14:06:09 +02:00
|
|
|
cChannel *Channel = new cChannel;
|
2015-09-01 11:14:27 +02:00
|
|
|
Channel->SetId(NULL, ts.getOriginalNetworkId(), ts.getTransportStreamId(), 0, 0);
|
2010-02-28 12:19:50 +01:00
|
|
|
if (Channel->SetTransponderData(Source, Frequencies[n], SymbolRate, dtp.ToString('C')))
|
2007-08-17 14:06:09 +02:00
|
|
|
EITScanner.AddTransponder(Channel);
|
|
|
|
else
|
|
|
|
delete Channel;
|
|
|
|
}
|
|
|
|
}
|
2004-01-11 15:54:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SI::TerrestrialDeliverySystemDescriptorTag: {
|
|
|
|
SI::TerrestrialDeliverySystemDescriptor *sd = (SI::TerrestrialDeliverySystemDescriptor *)d;
|
2010-02-28 12:19:50 +01:00
|
|
|
cDvbTransponderParameters dtp;
|
2004-01-18 16:34:25 +01:00
|
|
|
int Source = cSource::FromData(cSource::stTerr);
|
2006-05-27 15:35:16 +02:00
|
|
|
int Frequency = Frequencies[0] = sd->getFrequency() * 10;
|
2012-01-11 13:22:51 +01:00
|
|
|
static int Bandwidths[] = { 8000000, 7000000, 6000000, 5000000, 0, 0, 0, 0 };
|
2010-02-28 12:19:50 +01:00
|
|
|
dtp.SetBandwidth(Bandwidths[sd->getBandwidth()]);
|
2008-12-13 12:22:36 +01:00
|
|
|
static int Constellations[] = { QPSK, QAM_16, QAM_64, QAM_AUTO };
|
2010-02-28 12:19:50 +01:00
|
|
|
dtp.SetModulation(Constellations[sd->getConstellation()]);
|
2012-01-11 13:22:51 +01:00
|
|
|
dtp.SetSystem(DVB_SYSTEM_1);
|
2008-12-13 12:22:36 +01:00
|
|
|
static int Hierarchies[] = { HIERARCHY_NONE, HIERARCHY_1, HIERARCHY_2, HIERARCHY_4, HIERARCHY_AUTO, HIERARCHY_AUTO, HIERARCHY_AUTO, HIERARCHY_AUTO };
|
2010-02-28 12:19:50 +01:00
|
|
|
dtp.SetHierarchy(Hierarchies[sd->getHierarchy()]);
|
2008-12-13 12:22:36 +01:00
|
|
|
static int CodeRates[] = { FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8, FEC_AUTO, FEC_AUTO, FEC_AUTO };
|
2010-02-28 12:19:50 +01:00
|
|
|
dtp.SetCoderateH(CodeRates[sd->getCodeRateHP()]);
|
|
|
|
dtp.SetCoderateL(CodeRates[sd->getCodeRateLP()]);
|
2008-12-13 12:22:36 +01:00
|
|
|
static int GuardIntervals[] = { GUARD_INTERVAL_1_32, GUARD_INTERVAL_1_16, GUARD_INTERVAL_1_8, GUARD_INTERVAL_1_4 };
|
2010-02-28 12:19:50 +01:00
|
|
|
dtp.SetGuard(GuardIntervals[sd->getGuardInterval()]);
|
2012-01-11 13:22:51 +01:00
|
|
|
static int TransmissionModes[] = { TRANSMISSION_MODE_2K, TRANSMISSION_MODE_8K, TRANSMISSION_MODE_4K, TRANSMISSION_MODE_AUTO };
|
2010-02-28 12:19:50 +01:00
|
|
|
dtp.SetTransmission(TransmissionModes[sd->getTransmissionMode()]);
|
2016-12-23 14:25:27 +01:00
|
|
|
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());
|
2007-08-17 14:06:09 +02:00
|
|
|
if (Setup.UpdateChannels >= 5) {
|
|
|
|
bool found = false;
|
2011-08-12 14:37:25 +02:00
|
|
|
bool forceTransponderUpdate = false;
|
2015-09-01 11:14:27 +02:00
|
|
|
for (cChannel *Channel = Channels->First(); Channel; Channel = Channels->Next(Channel)) {
|
2007-08-17 14:06:09 +02:00
|
|
|
if (!Channel->GroupSep() && Channel->Source() == Source && Channel->Nid() == ts.getOriginalNetworkId() && Channel->Tid() == ts.getTransportStreamId()) {
|
2018-03-18 10:52:21 +01:00
|
|
|
// Preserve parameters set separately in T2DeliverySystemDescripto:
|
|
|
|
cDvbTransponderParameters dtpc(Channel->Parameters());
|
|
|
|
dtp.SetSystem(dtpc.System());
|
|
|
|
dtp.SetStreamId(dtpc.StreamId());
|
|
|
|
dtp.SetT2SystemId(dtp.T2SystemId());
|
|
|
|
dtp.SetSisoMiso(dtpc.SisoMiso());
|
|
|
|
dtp.SetBandwidth(dtpc.Bandwidth());
|
|
|
|
dtp.SetGuard(dtpc.Guard());
|
|
|
|
dtp.SetTransmission(dtpc.Transmission());
|
|
|
|
//
|
2007-08-17 14:06:09 +02:00
|
|
|
int transponder = Channel->Transponder();
|
|
|
|
if (!ISTRANSPONDER(Frequency / 1000000, transponder)) {
|
2007-04-29 11:40:31 +02:00
|
|
|
for (int n = 0; n < NumFrequencies; n++) {
|
2007-08-17 14:06:09 +02:00
|
|
|
if (ISTRANSPONDER(Frequencies[n] / 1000000, transponder)) {
|
2007-04-29 11:40:31 +02:00
|
|
|
Frequency = Frequencies[n];
|
|
|
|
break;
|
2006-05-27 15:35:16 +02:00
|
|
|
}
|
2007-04-29 11:40:31 +02:00
|
|
|
}
|
2006-05-27 15:35:16 +02:00
|
|
|
}
|
2019-03-12 13:05:33 +01:00
|
|
|
if (!ISTRANSPONDER(Frequency / 1000000, transponder))
|
|
|
|
continue; // a channel with obsolete/wrong/other(?) transponder
|
|
|
|
found = true;
|
|
|
|
if (ISTRANSPONDER(transponder, Transponder())) // only modify channels if we're actually receiving this transponder
|
2015-09-01 11:14:27 +02:00
|
|
|
ChannelsModified |= Channel->SetTransponderData(Source, Frequency, 0, dtp.ToString('T'));
|
2011-08-12 14:37:25 +02:00
|
|
|
else if (strcmp(Channel->Parameters(), dtp.ToString('T')))
|
|
|
|
forceTransponderUpdate = true; // get us receiving this transponder
|
2006-05-27 15:35:16 +02:00
|
|
|
}
|
2004-01-11 15:54:37 +01:00
|
|
|
}
|
2011-08-12 14:37:25 +02:00
|
|
|
if (!found || forceTransponderUpdate) {
|
2007-08-17 14:06:09 +02:00
|
|
|
for (int n = 0; n < NumFrequencies; n++) {
|
|
|
|
cChannel *Channel = new cChannel;
|
2015-09-01 11:14:27 +02:00
|
|
|
Channel->SetId(NULL, ts.getOriginalNetworkId(), ts.getTransportStreamId(), 0, 0);
|
2010-02-28 12:19:50 +01:00
|
|
|
if (Channel->SetTransponderData(Source, Frequencies[n], 0, dtp.ToString('T')))
|
2007-08-17 14:06:09 +02:00
|
|
|
EITScanner.AddTransponder(Channel);
|
|
|
|
else
|
|
|
|
delete Channel;
|
|
|
|
}
|
2014-03-10 13:31:23 +01:00
|
|
|
}
|
2004-01-11 15:54:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2012-01-11 13:22:51 +01:00
|
|
|
case SI::ExtensionDescriptorTag: {
|
|
|
|
SI::ExtensionDescriptor *sd = (SI::ExtensionDescriptor *)d;
|
|
|
|
switch (sd->getExtensionDescriptorTag()) {
|
|
|
|
case SI::T2DeliverySystemDescriptorTag: {
|
2012-01-12 08:43:52 +01:00
|
|
|
if (Setup.UpdateChannels >= 5) {
|
2015-09-01 11:14:27 +02:00
|
|
|
for (cChannel *Channel = Channels->First(); Channel; Channel = Channels->Next(Channel)) {
|
2012-01-12 08:43:52 +01:00
|
|
|
int Source = cSource::FromData(cSource::stTerr);
|
|
|
|
if (!Channel->GroupSep() && Channel->Source() == Source && Channel->Nid() == ts.getOriginalNetworkId() && Channel->Tid() == ts.getTransportStreamId()) {
|
|
|
|
SI::T2DeliverySystemDescriptor *td = (SI::T2DeliverySystemDescriptor *)d;
|
|
|
|
int Frequency = Channel->Frequency();
|
|
|
|
int SymbolRate = Channel->Srate();
|
|
|
|
cDvbTransponderParameters dtp(Channel->Parameters());
|
|
|
|
dtp.SetSystem(DVB_SYSTEM_2);
|
2013-03-07 09:51:06 +01:00
|
|
|
dtp.SetStreamId(td->getPlpId());
|
2014-03-16 10:48:30 +01:00
|
|
|
dtp.SetT2SystemId(td->getT2SystemId());
|
2012-01-12 08:43:52 +01:00
|
|
|
if (td->getExtendedDataFlag()) {
|
2014-03-16 10:48:30 +01:00
|
|
|
dtp.SetSisoMiso(td->getSisoMiso());
|
2012-01-12 08:43:52 +01:00
|
|
|
static int T2Bandwidths[] = { 8000000, 7000000, 6000000, 5000000, 10000000, 1712000, 0, 0 };
|
|
|
|
dtp.SetBandwidth(T2Bandwidths[td->getBandwidth()]);
|
|
|
|
static int T2GuardIntervals[] = { GUARD_INTERVAL_1_32, GUARD_INTERVAL_1_16, GUARD_INTERVAL_1_8, GUARD_INTERVAL_1_4, GUARD_INTERVAL_1_128, GUARD_INTERVAL_19_128, GUARD_INTERVAL_19_256, 0 };
|
|
|
|
dtp.SetGuard(T2GuardIntervals[td->getGuardInterval()]);
|
|
|
|
static int T2TransmissionModes[] = { TRANSMISSION_MODE_2K, TRANSMISSION_MODE_8K, TRANSMISSION_MODE_4K, TRANSMISSION_MODE_1K, TRANSMISSION_MODE_16K, TRANSMISSION_MODE_32K, TRANSMISSION_MODE_AUTO, TRANSMISSION_MODE_AUTO };
|
|
|
|
dtp.SetTransmission(T2TransmissionModes[td->getTransmissionMode()]);
|
|
|
|
//TODO add parsing of frequencies
|
|
|
|
}
|
2018-03-18 10:52:21 +01:00
|
|
|
dbgnit(" stream id = %d\n", dtp.StreamId());
|
2015-09-01 11:14:27 +02:00
|
|
|
ChannelsModified |= Channel->SetTransponderData(Source, Frequency, SymbolRate, dtp.ToString('T'));
|
2012-01-11 13:22:51 +01:00
|
|
|
}
|
|
|
|
}
|
2012-01-12 08:43:52 +01:00
|
|
|
}
|
2012-01-11 13:22:51 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default: ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2015-02-04 09:18:30 +01:00
|
|
|
case SI::LogicalChannelDescriptorTag:
|
|
|
|
if (Setup.StandardCompliance == STANDARD_NORDIG) {
|
|
|
|
SI::LogicalChannelDescriptor *lcd = (SI::LogicalChannelDescriptor *)d;
|
|
|
|
SI::LogicalChannelDescriptor::LogicalChannel LogicalChannel;
|
|
|
|
for (SI::Loop::Iterator it4; lcd->logicalChannelLoop.getNext(LogicalChannel, it4); ) {
|
|
|
|
if (LogicalChannel.getVisibleServiceFlag()) {
|
2016-12-23 14:25:27 +01:00
|
|
|
int lcn = LogicalChannel.getLogicalChannelNumber();
|
|
|
|
int sid = LogicalChannel.getServiceId();
|
2015-09-01 11:14:27 +02:00
|
|
|
for (cChannel *Channel = Channels->First(); Channel; Channel = Channels->Next(Channel)) {
|
2015-02-04 09:18:30 +01:00
|
|
|
if (!Channel->GroupSep() && Channel->Sid() == sid && Channel->Nid() == ts.getOriginalNetworkId() && Channel->Tid() == ts.getTransportStreamId()) {
|
2015-09-01 11:14:27 +02:00
|
|
|
ChannelsModified |= Channel->SetLcn(lcn);
|
2015-02-04 09:18:30 +01:00
|
|
|
break;
|
|
|
|
}
|
2015-02-01 13:49:10 +01:00
|
|
|
}
|
2015-02-04 09:18:30 +01:00
|
|
|
}
|
2015-02-01 13:49:10 +01:00
|
|
|
}
|
2015-02-04 09:18:30 +01:00
|
|
|
}
|
2015-02-01 13:49:10 +01:00
|
|
|
break;
|
2015-02-04 09:18:30 +01:00
|
|
|
case SI::HdSimulcastLogicalChannelDescriptorTag:
|
|
|
|
if (Setup.StandardCompliance == STANDARD_NORDIG) {
|
|
|
|
SI::HdSimulcastLogicalChannelDescriptor *lcd = (SI::HdSimulcastLogicalChannelDescriptor *)d;
|
|
|
|
SI::HdSimulcastLogicalChannelDescriptor::HdSimulcastLogicalChannel HdSimulcastLogicalChannel;
|
|
|
|
for (SI::Loop::Iterator it4; lcd->hdSimulcastLogicalChannelLoop.getNext(HdSimulcastLogicalChannel, it4); ) {
|
|
|
|
if (HdSimulcastLogicalChannel.getVisibleServiceFlag()) {
|
2016-12-23 14:25:27 +01:00
|
|
|
int lcn = HdSimulcastLogicalChannel.getLogicalChannelNumber();
|
|
|
|
int sid = HdSimulcastLogicalChannel.getServiceId();
|
2015-09-01 11:14:27 +02:00
|
|
|
for (cChannel *Channel = Channels->First(); Channel; Channel = Channels->Next(Channel)) {
|
2015-02-04 09:18:30 +01:00
|
|
|
if (!Channel->GroupSep() && Channel->Sid() == sid && Channel->Nid() == ts.getOriginalNetworkId() && Channel->Tid() == ts.getTransportStreamId()) {
|
2015-09-01 11:14:27 +02:00
|
|
|
ChannelsModified |= Channel->SetLcn(lcn);
|
2015-02-04 09:18:30 +01:00
|
|
|
break;
|
|
|
|
}
|
2015-02-01 13:49:10 +01:00
|
|
|
}
|
2015-02-04 09:18:30 +01:00
|
|
|
}
|
2015-02-01 13:49:10 +01:00
|
|
|
}
|
2015-02-04 09:18:30 +01:00
|
|
|
}
|
2015-02-01 13:49:10 +01:00
|
|
|
break;
|
2004-01-11 15:54:37 +01:00
|
|
|
default: ;
|
|
|
|
}
|
|
|
|
delete d;
|
|
|
|
}
|
|
|
|
}
|
2021-03-16 15:10:54 +01:00
|
|
|
if (sectionSyncer.Processed(nit.getSectionNumber(), nit.getLastSectionNumber())) {
|
2019-03-12 14:02:53 +01:00
|
|
|
dbgnit(" trigger sdtFilter for current tp %d\n", Transponder());
|
|
|
|
sdtFilter->Trigger(Source());
|
|
|
|
}
|
2015-09-01 11:14:27 +02:00
|
|
|
StateKey.Remove(ChannelsModified);
|
2004-01-11 15:54:37 +01:00
|
|
|
}
|