summaryrefslogtreecommitdiff
path: root/nit.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2004-01-18 18:00:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2004-01-18 18:00:00 +0100
commitb8e837dbbbaa8a91c4dc257fde5c0131bedeb23e (patch)
tree15330a7e170ea0e78c04eff796594b59ec74bf08 /nit.c
parenta76a03c0d815680e3e8fc52f24f60a30177d3021 (diff)
downloadvdr-patch-lnbsharing-b8e837dbbbaa8a91c4dc257fde5c0131bedeb23e.tar.gz
vdr-patch-lnbsharing-b8e837dbbbaa8a91c4dc257fde5c0131bedeb23e.tar.bz2
Version 1.3.2vdr-1.3.2
- Fixed resetting the EPG data versions after changing the preferred languages (thanks to Teemu Rantanen for reporting this one and helping to debug it). - Added LinkageDescriptor handling to 'libsi' (thanks to Marcel Wiesweg). - Added Russian language texts (thanks to Vyacheslav Dikonov). Plugin authors may want to add the new entries to their I18N texts and contact the translators to have their texts translated. Note that there are now 17 different OSD languages, so please make sure you have 17 versions for each of your texts. - Some corrections and additions to the Finnish OSD texts (thanks to Rolf Ahrenberg and Niko Tarnanen). - Fixed a wrong 'delta' value in the call to the shutdown script (thanks to Stephan Epstein for reporting this one). - Activated detection of radio channels (to avoid reports about "channels not being detected that used to be detected with the 'scan' utility or the original 'autopid' patch ;-). - Channels with a zero VPID no longer write a PPID into channels.conf. - Short channel names are now only stored if they actually differ from the full name. - The EPG scan now scans newly found transponders together with already existing ones. - The "Red" button in the "Setup/EPG" menu can now be used to force an EPG scan on a single DVB card system (see MANUAL for details). - The new SVDRP command 'SCAN' can be used to force an EPG scan on a single DVB card system (see MANUAL under Setup/EPG for details). - Fixed handling PID changes in 'Transfer Mode'. - Excess blanks in channel names read from the SDT are now removed. - Fixed wrong parameter settings when scanning NITs for terrestrial transponders (thanks to Christian Tramnitz for pointing out this one). - Fixed some out of bounds parameter settings when scanning NITs for cable and satellite transponders. - Added 'libsi' include files to the 'include' directory, so that plugins can use them (thanks to Marcel Wiesweg). - Now only processing NITs that contain the transponder they are actually broadcast on. - Fixed setting the source type for newly detected terrestrial transponders (thanks to Christian Tramnitz for his support in debugging this).
Diffstat (limited to 'nit.c')
-rw-r--r--nit.c99
1 files changed, 88 insertions, 11 deletions
diff --git a/nit.c b/nit.c
index 1ac731c..f388716 100644
--- a/nit.c
+++ b/nit.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: nit.c 1.1 2004/01/11 15:42:51 kls Exp $
+ * $Id: nit.c 1.5 2004/01/18 16:32:45 kls Exp $
*/
#include "nit.h"
@@ -17,12 +17,16 @@
cNitFilter::cNitFilter(void)
{
+ numNits = 0;
+ networkId = 0;
Set(0x10, 0x40); // NIT
}
void cNitFilter::SetStatus(bool On)
{
cFilter::SetStatus(On);
+ numNits = 0;
+ networkId = 0;
sectionSyncer.Reset();
}
@@ -31,7 +35,59 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
SI::NIT nit(Data, false);
if (!nit.CheckCRCAndParse())
return;
- if (!sectionSyncer.Sync(nit.getVersionNumber(), nit.getSectionNumber(), nit.getLastSectionNumber()))
+ // Some broadcasters send more than one NIT, with no apparent way of telling which
+ // one is the right one to use. This is an attempt to find the NIT that contains
+ // the transponder it was transmitted on and use only that one:
+ int ThisNIT = -1;
+ if (!networkId) {
+ for (int i = 0; i < numNits; i++) {
+ if (nits[i].networkId == nit.getNetworkId()) {
+ if (nit.getSectionNumber() == 0) {
+ // all NITs have passed by
+ for (int j = 0; j < numNits; j++) {
+ if (nits[j].hasTransponder) {
+ networkId = nits[j].networkId;
+ //printf("taking NIT with network ID %d\n", networkId);
+ //XXX what if more than one NIT contaisn this transponder???
+ break;
+ }
+ }
+ if (!networkId) {
+ //printf("none of the NITs contains transponder %d\n", Transponder());
+ return;
+ }
+ }
+ else {
+ ThisNIT = i;
+ break;
+ }
+ }
+ }
+ if (!networkId && ThisNIT < 0 && numNits < MAXNITS) {
+ if (nit.getSectionNumber() == 0) {
+ *nits[numNits].name = 0;
+ 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(nits[numNits].name);
+ }
+ break;
+ default: ;
+ }
+ }
+ nits[numNits].networkId = nit.getNetworkId();
+ nits[numNits].hasTransponder = false;
+ //printf("NIT[%d] %5d '%s'\n", numNits, nits[numNits].networkId, nits[numNits].name);
+ ThisNIT = numNits;
+ numNits++;
+ }
+ }
+ }
+ else if (networkId != nit.getNetworkId())
+ return; // ignore all other NITs
+ else if (!sectionSyncer.Sync(nit.getVersionNumber(), nit.getSectionNumber(), nit.getLastSectionNumber()))
return;
if (!Channels.Lock(true, 10))
return;
@@ -46,9 +102,16 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
int Frequency = BCD2INT(sd->getFrequency()) / 100;
static char Polarizations[] = { 'h', 'v', 'l', 'r' };
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_NONE, FEC_NONE, FEC_NONE, FEC_NONE, FEC_NONE, FEC_NONE, FEC_NONE, FEC_NONE, FEC_NONE, FEC_NONE };
+ 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()];
int SymbolRate = BCD2INT(sd->getSymbolRate()) / 10;
+ if (ThisNIT >= 0) {
+ if (ISTRANSPONDER(Frequency, Transponder())) {
+ nits[ThisNIT].hasTransponder = true;
+ //printf("has transponder %d\n", Transponder());
+ }
+ break;
+ }
bool found = false;
for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) {
if (!Channel->GroupSep() && Channel->Source() == Source && Channel->Nid() == ts.getOriginalNetworkId() && Channel->Tid() == ts.getTransportStreamId()) {
@@ -72,11 +135,18 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
int Source = cSource::FromData(cSource::stCable);
int Frequency = BCD2INT(sd->getFrequency()) / 10;
//XXX FEC_outer???
- static int CodeRates[] = { FEC_NONE, FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8, FEC_NONE, FEC_NONE, FEC_NONE, FEC_NONE, FEC_NONE, FEC_NONE, FEC_NONE, FEC_NONE, FEC_NONE, FEC_NONE };
+ 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 };
- int Modulation = Modulations[sd->getModulation()];
+ 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) {
+ if (ISTRANSPONDER(Frequency / 1000, Transponder())) {
+ nits[ThisNIT].hasTransponder = true;
+ //printf("has transponder %d\n", Transponder());
+ }
+ break;
+ }
bool found = false;
for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) {
if (!Channel->GroupSep() && Channel->Source() == Source && Channel->Nid() == ts.getOriginalNetworkId() && Channel->Tid() == ts.getTransportStreamId()) {
@@ -97,21 +167,28 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
break;
case SI::TerrestrialDeliverySystemDescriptorTag: {
SI::TerrestrialDeliverySystemDescriptor *sd = (SI::TerrestrialDeliverySystemDescriptor *)d;
- int Source = cSource::FromData(cSource::stCable);
+ int Source = cSource::FromData(cSource::stTerr);
int Frequency = sd->getFrequency() * 10;
- static int Bandwidths[] = { BANDWIDTH_6_MHZ, BANDWIDTH_7_MHZ, BANDWIDTH_8_MHZ, BANDWIDTH_AUTO, BANDWIDTH_AUTO, BANDWIDTH_AUTO, BANDWIDTH_AUTO, 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[] = { QPSK, QAM_16, QAM_64, QAM_AUTO };
int Constellation = Constellations[sd->getConstellation()];
- static int Hierarchies[] = { HIERARCHY_NONE, HIERARCHY_1, HIERARCHY_2, HIERARCHY_4 };
+ 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_NONE, FEC_NONE, FEC_NONE };
+ 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[] = { GUARD_INTERVAL_1_4, GUARD_INTERVAL_1_8, GUARD_INTERVAL_1_16, GUARD_INTERVAL_1_32 };
+ 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[] = { TRANSMISSION_MODE_2K, TRANSMISSION_MODE_8K, TRANSMISSION_MODE_AUTO, TRANSMISSION_MODE_AUTO };
int TransmissionMode = TransmissionModes[sd->getTransmissionMode()];
+ if (ThisNIT >= 0) {
+ if (ISTRANSPONDER(Frequency / 1000000, Transponder())) {
+ nits[ThisNIT].hasTransponder = true;
+ //printf("has transponder %d\n", Transponder());
+ }
+ break;
+ }
bool found = false;
for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) {
if (!Channel->GroupSep() && Channel->Source() == Source && Channel->Nid() == ts.getOriginalNetworkId() && Channel->Tid() == ts.getTransportStreamId()) {