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

This commit is contained in:
Klaus Schmidinger 2014-03-11 09:32:48 +01:00
parent da404e00c0
commit ba9651e863
6 changed files with 37 additions and 14 deletions

View File

@ -7870,7 +7870,7 @@ Video Disk Recorder Revision History
and also to use the correct directory with --edit (the latter reported by Marko
Mäkelä).
2014-03-10: Version 2.0.6
2014-03-11: Version 2.0.6
- Updated 'sources.conf' (thanks to Antti Hartikainen).
- cFont::CreateFont() now returns a dummy font in case there are no fonts installed.
@ -7907,3 +7907,6 @@ Video Disk Recorder Revision History
- Fixed adding new source types in case they are already registered (reported by Rolf
Ahrenberg).
- Fixed drawing the live indicator in the LCARS skin in case there are no devices.
- 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 2.74.1.3 2014/02/18 14:12:08 kls Exp $
* $Id: device.c 2.74.1.4 2014/03/11 09:29:52 kls Exp $
*/
#include "device.h"
@ -574,7 +574,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 2.10 2013/03/07 09:42:29 kls Exp $
* $Id: nit.c 2.10.1.1 2014/03/11 09:29:59 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 2.0.1.1 2014/03/11 09:30: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);
};

23
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 2.5.1.1 2014/02/18 14:12:33 kls Exp $
* $Id: sdt.c 2.5.1.2 2014/03/11 09:30:59 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()));
cLinkChannels *LinkChannels = NULL;
SI::Descriptor *d;
@ -64,7 +75,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
@ -115,7 +126,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());

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 2.0.1.1 2014/03/11 09:31:08 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