diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2003-02-09 11:54:22 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2003-02-09 11:54:22 +0100 |
commit | 777f330c77a0b66e4f3af3d62b840c46d44a702d (patch) | |
tree | 06c2d6408708cc3976ea9ff61e7032046d0128d7 /dvbdevice.c | |
parent | b7777e230c82ddc9f7ce6bd309ac70cc9216e834 (diff) | |
download | vdr-777f330c77a0b66e4f3af3d62b840c46d44a702d.tar.gz vdr-777f330c77a0b66e4f3af3d62b840c46d44a702d.tar.bz2 |
Improved CAM support
Diffstat (limited to 'dvbdevice.c')
-rw-r--r-- | dvbdevice.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/dvbdevice.c b/dvbdevice.c index 1ffe067a..01d828fa 100644 --- a/dvbdevice.c +++ b/dvbdevice.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbdevice.c 1.42 2003/02/02 15:31:31 kls Exp $ + * $Id: dvbdevice.c 1.43 2003/02/09 11:47:02 kls Exp $ */ #include "dvbdevice.h" @@ -238,6 +238,7 @@ bool cDvbTuner::SetFrontend(void) void cDvbTuner::Action(void) { + time_t StartTime = time(NULL); dsyslog("tuner thread started on device %d (pid=%d)", cardIndex + 1, getpid()); active = true; while (active) { @@ -258,24 +259,28 @@ void cDvbTuner::Action(void) continue; } } - if (ciHandler && !caSet) {//XXX TODO update in case the CA descriptors have changed - uchar buffer[2048]; - int length = cSIProcessor::GetCaDescriptors(channel.Source(), channel.Frequency(), channel.Sid(), sizeof(buffer), buffer); - if (length > 0) { - cCiCaPmt CaPmt(channel.Sid()); - CaPmt.AddCaDescriptor(length, buffer); - if (channel.Vpid()) - CaPmt.AddPid(channel.Vpid()); - if (channel.Apid1()) - CaPmt.AddPid(channel.Apid1()); - if (channel.Apid2()) - CaPmt.AddPid(channel.Apid2()); - if (channel.Dpid1()) - CaPmt.AddPid(channel.Dpid1()); - caSet = ciHandler->SetCaPmt(CaPmt); + if (ciHandler) { + ciHandler->Process(); + if (!caSet) {//XXX TODO update in case the CA descriptors have changed + uchar buffer[2048]; + int length = cSIProcessor::GetCaDescriptors(channel.Source(), channel.Frequency(), channel.Sid(), sizeof(buffer), buffer); + if (length > 0) { + cCiCaPmt CaPmt(channel.Sid()); + CaPmt.AddCaDescriptor(length, buffer); + if (channel.Vpid()) + CaPmt.AddPid(channel.Vpid()); + if (channel.Apid1()) + CaPmt.AddPid(channel.Apid1()); + if (channel.Apid2()) + CaPmt.AddPid(channel.Apid2()); + if (channel.Dpid1()) + CaPmt.AddPid(channel.Dpid1()); + caSet = ciHandler->SetCaPmt(CaPmt); + } } } - newSet.TimedWait(mutex, 1000); + // in the beginning we loop more often to let the CAM connection start up fast + newSet.TimedWait(mutex, (ciHandler && (time(NULL) - StartTime < 20)) ? 100 : 1000); } dsyslog("tuner thread ended on device %d (pid=%d)", cardIndex + 1, getpid()); } |