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.
- When checking for obsolete channels, those with an RID that is not 0 are now
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
* 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"
@ -575,7 +575,7 @@ void cDevice::StartSectionHandler(void)
AttachFilter(eitFilter = new cEitFilter);
AttachFilter(patFilter = new cPatFilter);
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
* 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"
@ -19,8 +19,9 @@
#define DVB_SYSTEM_1 0 // see also dvbdevice.c
#define DVB_SYSTEM_2 1
cNitFilter::cNitFilter(void)
cNitFilter::cNitFilter(cSdtFilter *SdtFilter)
{
sdtFilter = SdtFilter;
numNits = 0;
networkId = 0;
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;
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;
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;
case SI::ExtensionDescriptorTag: {

6
nit.h
View File

@ -4,13 +4,14 @@
* See the main source file 'vdr.c' for copyright information and
* 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
#define __NIT_H
#include "filter.h"
#include "sdt.h"
#define MAXNITS 16
#define MAXNETWORKNAME Utf8BufSize(256)
@ -26,13 +27,14 @@ private:
};
cSectionSyncer sectionSyncer;
cSdtFilter *sdtFilter;
cNit nits[MAXNITS];
u_short networkId;
int numNits;
protected:
virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length);
public:
cNitFilter(void);
cNitFilter(cSdtFilter *SdtFilter);
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
* 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"
@ -17,19 +17,30 @@
cSdtFilter::cSdtFilter(cPatFilter *PatFilter)
{
source = cSource::stNone;
patFilter = PatFilter;
Set(0x11, 0x42); // SDT
}
void cSdtFilter::SetStatus(bool On)
{
cMutexLock MutexLock(&mutex);
cFilter::SetStatus(On);
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)
{
if (!(Source() && Transponder()))
cMutexLock MutexLock(&mutex);
if (!(source && Transponder()))
return;
SI::SDT sdt(Data, false);
if (!sdt.CheckCRCAndParse())
@ -40,9 +51,9 @@ void cSdtFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
return;
SI::SDT::Service SiSdtService;
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)
channel = Channels.GetByChannelID(tChannelID(Source(), 0, Transponder(), SiSdtService.getServiceId()));
channel = Channels.GetByChannelID(tChannelID(source, 0, Transponder(), SiSdtService.getServiceId()));
if (channel)
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));
char *pn = compactspace(NameBuf);
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
// standard, but rather go their own way and use "name>short name":
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::Service Service;
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) {
link = Channels.NewChannel(Channel(), "NVOD", "", "", Service.getOriginalNetworkId(), Service.getTransportStream(), 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())
Channels.MarkObsoleteChannels(Source(), sdt.getOriginalNetworkId(), sdt.getTransportStreamId());
Channels.MarkObsoleteChannels(source, sdt.getOriginalNetworkId(), sdt.getTransportStreamId());
Channels.Unlock();
}

5
sdt.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* 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
@ -15,13 +15,16 @@
class cSdtFilter : public cFilter {
private:
cMutex mutex;
cSectionSyncer sectionSyncer;
int source;
cPatFilter *patFilter;
protected:
virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length);
public:
cSdtFilter(cPatFilter *PatFilter);
virtual void SetStatus(bool On);
void Trigger(int Source);
};
#endif //__SDT_H