1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

The SDT is now only parsed *after* the NIT has been read

This commit is contained in:
Klaus Schmidinger 2014-03-10 14:50:58 +01:00
parent 0990c279c7
commit c5071cc87b
6 changed files with 37 additions and 14 deletions

View File

@ -8226,3 +8226,6 @@ Video Disk Recorder Revision History
- Fixed drawing the live indicator in the LCARS skin in case there are no devices. - Fixed drawing the live indicator in the LCARS skin in case there are no devices.
- When checking for obsolete channels, those with an RID that is not 0 are now - When checking for obsolete channels, those with an RID that is not 0 are now
ignored (suggested by Oliver Endriss). ignored (suggested by Oliver Endriss).
- The SDT is now only parsed *after* the NIT has been read, and it explicitly uses
the source value derived from the NIT. This should prevent new channels from being
created with the wrong source.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: device.c 3.12 2014/02/18 13:12:39 kls Exp $ * $Id: device.c 3.13 2014/03/10 14:12:27 kls Exp $
*/ */
#include "device.h" #include "device.h"
@ -575,7 +575,7 @@ void cDevice::StartSectionHandler(void)
AttachFilter(eitFilter = new cEitFilter); AttachFilter(eitFilter = new cEitFilter);
AttachFilter(patFilter = new cPatFilter); AttachFilter(patFilter = new cPatFilter);
AttachFilter(sdtFilter = new cSdtFilter(patFilter)); AttachFilter(sdtFilter = new cSdtFilter(patFilter));
AttachFilter(nitFilter = new cNitFilter); AttachFilter(nitFilter = new cNitFilter(sdtFilter));
} }
} }

8
nit.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: nit.c 3.1 2014/03/10 13:31:23 kls Exp $ * $Id: nit.c 3.2 2014/03/10 14:35:31 kls Exp $
*/ */
#include "nit.h" #include "nit.h"
@ -19,8 +19,9 @@
#define DVB_SYSTEM_1 0 // see also dvbdevice.c #define DVB_SYSTEM_1 0 // see also dvbdevice.c
#define DVB_SYSTEM_2 1 #define DVB_SYSTEM_2 1
cNitFilter::cNitFilter(void) cNitFilter::cNitFilter(cSdtFilter *SdtFilter)
{ {
sdtFilter = SdtFilter;
numNits = 0; numNits = 0;
networkId = 0; networkId = 0;
Set(0x10, 0x40); // NIT Set(0x10, 0x40); // NIT
@ -183,6 +184,7 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
} }
} }
} }
sdtFilter->Trigger(Source);
} }
break; break;
case SI::S2SatelliteDeliverySystemDescriptorTag: { case SI::S2SatelliteDeliverySystemDescriptorTag: {
@ -253,6 +255,7 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
} }
} }
} }
sdtFilter->Trigger(Source);
} }
break; break;
case SI::TerrestrialDeliverySystemDescriptorTag: { case SI::TerrestrialDeliverySystemDescriptorTag: {
@ -316,6 +319,7 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
} }
} }
} }
sdtFilter->Trigger(Source);
} }
break; break;
case SI::ExtensionDescriptorTag: { case SI::ExtensionDescriptorTag: {

6
nit.h
View File

@ -4,13 +4,14 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: nit.h 1.3 2007/06/10 08:50:21 kls Exp $ * $Id: nit.h 3.1 2014/03/10 14:12:05 kls Exp $
*/ */
#ifndef __NIT_H #ifndef __NIT_H
#define __NIT_H #define __NIT_H
#include "filter.h" #include "filter.h"
#include "sdt.h"
#define MAXNITS 16 #define MAXNITS 16
#define MAXNETWORKNAME Utf8BufSize(256) #define MAXNETWORKNAME Utf8BufSize(256)
@ -26,13 +27,14 @@ private:
}; };
cSectionSyncer sectionSyncer; cSectionSyncer sectionSyncer;
cSdtFilter *sdtFilter;
cNit nits[MAXNITS]; cNit nits[MAXNITS];
u_short networkId; u_short networkId;
int numNits; int numNits;
protected: protected:
virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length); virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length);
public: public:
cNitFilter(void); cNitFilter(cSdtFilter *SdtFilter);
virtual void SetStatus(bool On); virtual void SetStatus(bool On);
}; };

25
sdt.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: sdt.c 3.2 2014/02/18 10:37:50 kls Exp $ * $Id: sdt.c 3.3 2014/03/10 14:42:20 kls Exp $
*/ */
#include "sdt.h" #include "sdt.h"
@ -17,19 +17,30 @@
cSdtFilter::cSdtFilter(cPatFilter *PatFilter) cSdtFilter::cSdtFilter(cPatFilter *PatFilter)
{ {
source = cSource::stNone;
patFilter = PatFilter; patFilter = PatFilter;
Set(0x11, 0x42); // SDT Set(0x11, 0x42); // SDT
} }
void cSdtFilter::SetStatus(bool On) void cSdtFilter::SetStatus(bool On)
{ {
cMutexLock MutexLock(&mutex);
cFilter::SetStatus(On); cFilter::SetStatus(On);
sectionSyncer.Reset(); sectionSyncer.Reset();
if (!On)
source = cSource::stNone;
}
void cSdtFilter::Trigger(int Source)
{
cMutexLock MutexLock(&mutex);
source = Source;
} }
void cSdtFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length) void cSdtFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
{ {
if (!(Source() && Transponder())) cMutexLock MutexLock(&mutex);
if (!(source && Transponder()))
return; return;
SI::SDT sdt(Data, false); SI::SDT sdt(Data, false);
if (!sdt.CheckCRCAndParse()) if (!sdt.CheckCRCAndParse())
@ -40,9 +51,9 @@ void cSdtFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
return; return;
SI::SDT::Service SiSdtService; SI::SDT::Service SiSdtService;
for (SI::Loop::Iterator it; sdt.serviceLoop.getNext(SiSdtService, it); ) { for (SI::Loop::Iterator it; sdt.serviceLoop.getNext(SiSdtService, it); ) {
cChannel *channel = Channels.GetByChannelID(tChannelID(Source(), sdt.getOriginalNetworkId(), sdt.getTransportStreamId(), SiSdtService.getServiceId())); cChannel *channel = Channels.GetByChannelID(tChannelID(source, sdt.getOriginalNetworkId(), sdt.getTransportStreamId(), SiSdtService.getServiceId()));
if (!channel) if (!channel)
channel = Channels.GetByChannelID(tChannelID(Source(), 0, Transponder(), SiSdtService.getServiceId())); channel = Channels.GetByChannelID(tChannelID(source, 0, Transponder(), SiSdtService.getServiceId()));
if (channel) if (channel)
channel->SetSeen(); channel->SetSeen();
@ -66,7 +77,7 @@ void cSdtFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
sd->serviceName.getText(NameBuf, ShortNameBuf, sizeof(NameBuf), sizeof(ShortNameBuf)); sd->serviceName.getText(NameBuf, ShortNameBuf, sizeof(NameBuf), sizeof(ShortNameBuf));
char *pn = compactspace(NameBuf); char *pn = compactspace(NameBuf);
char *ps = compactspace(ShortNameBuf); char *ps = compactspace(ShortNameBuf);
if (!*ps && cSource::IsCable(Source())) { if (!*ps && cSource::IsCable(source)) {
// Some cable providers don't mark short channel names according to the // Some cable providers don't mark short channel names according to the
// standard, but rather go their own way and use "name>short name": // standard, but rather go their own way and use "name>short name":
char *p = strchr(pn, '>'); // fix for UPC Wien char *p = strchr(pn, '>'); // fix for UPC Wien
@ -117,7 +128,7 @@ void cSdtFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
SI::NVODReferenceDescriptor *nrd = (SI::NVODReferenceDescriptor *)d; SI::NVODReferenceDescriptor *nrd = (SI::NVODReferenceDescriptor *)d;
SI::NVODReferenceDescriptor::Service Service; SI::NVODReferenceDescriptor::Service Service;
for (SI::Loop::Iterator it; nrd->serviceLoop.getNext(Service, it); ) { for (SI::Loop::Iterator it; nrd->serviceLoop.getNext(Service, it); ) {
cChannel *link = Channels.GetByChannelID(tChannelID(Source(), Service.getOriginalNetworkId(), Service.getTransportStream(), Service.getServiceId())); cChannel *link = Channels.GetByChannelID(tChannelID(source, Service.getOriginalNetworkId(), Service.getTransportStream(), Service.getServiceId()));
if (!link && Setup.UpdateChannels >= 4) { if (!link && Setup.UpdateChannels >= 4) {
link = Channels.NewChannel(Channel(), "NVOD", "", "", Service.getOriginalNetworkId(), Service.getTransportStream(), Service.getServiceId()); link = Channels.NewChannel(Channel(), "NVOD", "", "", Service.getOriginalNetworkId(), Service.getTransportStream(), Service.getServiceId());
patFilter->Trigger(Service.getServiceId()); patFilter->Trigger(Service.getServiceId());
@ -142,6 +153,6 @@ void cSdtFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
} }
} }
if (sdt.getSectionNumber() == sdt.getLastSectionNumber()) if (sdt.getSectionNumber() == sdt.getLastSectionNumber())
Channels.MarkObsoleteChannels(Source(), sdt.getOriginalNetworkId(), sdt.getTransportStreamId()); Channels.MarkObsoleteChannels(source, sdt.getOriginalNetworkId(), sdt.getTransportStreamId());
Channels.Unlock(); Channels.Unlock();
} }

5
sdt.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: sdt.h 1.2 2004/01/05 14:30:14 kls Exp $ * $Id: sdt.h 3.1 2014/03/10 14:40:54 kls Exp $
*/ */
#ifndef __SDT_H #ifndef __SDT_H
@ -15,13 +15,16 @@
class cSdtFilter : public cFilter { class cSdtFilter : public cFilter {
private: private:
cMutex mutex;
cSectionSyncer sectionSyncer; cSectionSyncer sectionSyncer;
int source;
cPatFilter *patFilter; cPatFilter *patFilter;
protected: protected:
virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length); virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length);
public: public:
cSdtFilter(cPatFilter *PatFilter); cSdtFilter(cPatFilter *PatFilter);
virtual void SetStatus(bool On); virtual void SetStatus(bool On);
void Trigger(int Source);
}; };
#endif //__SDT_H #endif //__SDT_H