summaryrefslogtreecommitdiff
path: root/sdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'sdt.c')
-rw-r--r--sdt.c86
1 files changed, 35 insertions, 51 deletions
diff --git a/sdt.c b/sdt.c
index a4e91b8..9d760bf 100644
--- a/sdt.c
+++ b/sdt.c
@@ -4,42 +4,47 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: sdt.c 1.1 2004/01/04 11:54:42 kls Exp $
+ * $Id: sdt.c 1.4 2004/01/11 14:28:28 kls Exp $
*/
#include "sdt.h"
#include "channels.h"
+#include "config.h"
#include "libsi/section.h"
#include "libsi/descriptor.h"
-// --- cSDT ------------------------------------------------------------------
+// --- cSdtFilter ------------------------------------------------------------
-class cSDT : public SI::SDT {
-public:
- cSDT(int Source, int Transponder, uchar &lastSdtVersion, cPatFilter *PatFilter, const u_char *Data);
- };
+cSdtFilter::cSdtFilter(cPatFilter *PatFilter)
+{
+ patFilter = PatFilter;
+ Set(0x11, 0x42); // SDT
+}
-cSDT::cSDT(int Source, int Transponder, uchar &lastSdtVersion, cPatFilter *PatFilter, const u_char *Data)
-:SI::SDT(Data, false)
+void cSdtFilter::SetStatus(bool On)
{
- if (!CheckCRCAndParse())
- return;
+ cFilter::SetStatus(On);
+ sectionSyncer.Reset();
+}
- if (getVersionNumber() == lastSdtVersion)
+void cSdtFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
+{
+ if (!(Source() && Transponder()))
+ return;
+ SI::SDT sdt(Data, false);
+ if (!sdt.CheckCRCAndParse())
+ return;
+ if (!sectionSyncer.Sync(sdt.getVersionNumber(), sdt.getSectionNumber(), sdt.getLastSectionNumber()))
return;
-
if (!Channels.Lock(true, 10))
return;
-
- lastSdtVersion = getVersionNumber();
-
SI::SDT::Service SiSdtService;
- for (SI::Loop::Iterator it; serviceLoop.hasNext(it); ) {
- SiSdtService = serviceLoop.getNext(it);
+ for (SI::Loop::Iterator it; sdt.serviceLoop.hasNext(it); ) {
+ SiSdtService = sdt.serviceLoop.getNext(it);
- cChannel *Channel = Channels.GetByChannelID(tChannelID(Source, getOriginalNetworkId(), getTransportStreamId(), SiSdtService.getServiceId()));
- if (!Channel)
- Channel = Channels.GetByChannelID(tChannelID(Source, 0, Transponder, 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()));
SI::Descriptor *d;
for (SI::Loop::Iterator it2; (d = SiSdtService.serviceDescriptors.getNext(it2)); ) {
@@ -78,18 +83,19 @@ cSDT::cSDT(int Source, int Transponder, uchar &lastSdtVersion, cPatFilter *PatFi
strcpy(ps, NameBuf);
pn = ShortNameBuf;
}
- if (Channel) {
- Channel->SetId(getOriginalNetworkId(), getTransportStreamId(), SiSdtService.getServiceId());
- Channel->SetName(pn);
+ if (channel) {
+ channel->SetId(sdt.getOriginalNetworkId(), sdt.getTransportStreamId(), SiSdtService.getServiceId());
+ if (Setup.UpdateChannels >= 1)
+ channel->SetName(pn);
// Using SiSdtService.getFreeCaMode() is no good, because some
// tv stations set this flag even for non-encrypted channels :-(
// The special value 0xFFFF was supposed to mean "unknown encryption"
// and would have been overwritten with real CA values later:
- // Channel->SetCa(SiSdtService.getFreeCaMode() ? 0xFFFF : 0);
+ // channel->SetCa(SiSdtService.getFreeCaMode() ? 0xFFFF : 0);
}
- else if (*pn) {
- Channel = Channels.NewChannel(Source, Transponder, pn, getOriginalNetworkId(), getTransportStreamId(), SiSdtService.getServiceId());
- PatFilter->Trigger();
+ else if (*pn && Setup.UpdateChannels >= 3) {
+ channel = Channels.NewChannel(Channel(), pn, sdt.getOriginalNetworkId(), sdt.getTransportStreamId(), SiSdtService.getServiceId());
+ patFilter->Trigger();
}
}
}
@@ -100,9 +106,9 @@ cSDT::cSDT(int Source, int Transponder, uchar &lastSdtVersion, cPatFilter *PatFi
/*
case SI::CaIdentifierDescriptorTag: {
SI::CaIdentifierDescriptor *cid = (SI::CaIdentifierDescriptor *)d;
- if (Channel) {
+ if (channel) {
for (SI::Loop::Iterator it; cid->identifiers.hasNext(it); )
- Channel->SetCa(cid->identifiers.getNext(it));
+ channel->SetCa(cid->identifiers.getNext(it));
}
}
break;
@@ -122,25 +128,3 @@ cSDT::cSDT(int Source, int Transponder, uchar &lastSdtVersion, cPatFilter *PatFi
}
Channels.Unlock();
}
-
-
-// --- cSdtFilter ------------------------------------------------------------
-
-cSdtFilter::cSdtFilter(cPatFilter *PatFilter)
-{
- lastSdtVersion = 0xFF;
- patFilter = PatFilter;
- Set(0x11, 0x42); // SDT
-}
-
-void cSdtFilter::SetStatus(bool On)
-{
- cFilter::SetStatus(On);
- lastSdtVersion = 0xFF;
-}
-
-void cSdtFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
-{
- if (Source() && Transponder())
- cSDT SDT(Source(), Transponder(), lastSdtVersion, patFilter, Data);
-}