From be06e04d5583264f67d365d2fe32ebe89472c722 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 23 Mar 2003 15:20:00 +0100 Subject: [PATCH] CAM access only for CA channels and no longer during replay --- HISTORY | 6 ++++++ ci.c | 5 ++++- ci.h | 4 +++- config.h | 4 ++-- dvbdevice.c | 12 ++++++++++-- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/HISTORY b/HISTORY index a5c70f0b..9077cec6 100644 --- a/HISTORY +++ b/HISTORY @@ -1987,3 +1987,9 @@ Video Disk Recorder Revision History - Modified the EPG scanner to avoid CPU load peaks (thanks to Steffen Becker for reporting this one). - Fixed support for Viaccess CAMs (thanks to Axel Gruber for helping to debug this). + +2003-03-23: Version 1.1.27 + +- The CAM is now accessed only if the current channel actually has a non-zero Ca + value, and CAM access is completely suppressed during replay, which avoids + problems in case the CAM is attached to the primary DVB device. diff --git a/ci.c b/ci.c index 62bbed7e..a3d64df3 100644 --- a/ci.c +++ b/ci.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: ci.c 1.8 2003/03/16 22:32:47 kls Exp $ + * $Id: ci.c 1.9 2003/03/23 15:18:40 kls Exp $ */ /* XXX TODO @@ -1273,6 +1273,7 @@ void cCiCaPmt::AddCaDescriptor(int Length, uint8_t *Data) cCiHandler::cCiHandler(int Fd, int NumSlots) { numSlots = NumSlots; + enabled = true; for (int i = 0; i < MAX_CI_SESSION; i++) sessions[i] = NULL; tpl = new cCiTransportLayer(Fd, numSlots); @@ -1425,6 +1426,8 @@ int cCiHandler::CloseAllSessions(int Slot) bool cCiHandler::Process(void) { + if (!enabled) + return false; bool result = true; cMutexLock MutexLock(&mutex); for (int Slot = 0; Slot < numSlots; Slot++) { diff --git a/ci.h b/ci.h index 255292a2..a9f27f1e 100644 --- a/ci.h +++ b/ci.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: ci.h 1.3 2003/02/16 10:55:21 kls Exp $ + * $Id: ci.h 1.4 2003/03/23 15:18:40 kls Exp $ */ #ifndef __CI_H @@ -80,6 +80,7 @@ class cCiHandler { private: cMutex mutex; int numSlots; + bool enabled; cCiSession *sessions[MAX_CI_SESSION]; cCiTransportLayer *tpl; cCiTransportConnection *tc; @@ -95,6 +96,7 @@ private: public: ~cCiHandler(); static cCiHandler *CreateCiHandler(const char *FileName); + void SetEnabled(bool Enabled) { enabled = Enabled; } bool Process(void); bool EnterMenu(int Slot); cCiMenu *GetMenu(void); diff --git a/config.h b/config.h index 20604586..321407df 100644 --- a/config.h +++ b/config.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 1.150 2003/03/09 10:01:02 kls Exp $ + * $Id: config.h 1.151 2003/03/23 14:42:35 kls Exp $ */ #ifndef __CONFIG_H @@ -19,7 +19,7 @@ #include "device.h" #include "tools.h" -#define VDRVERSION "1.1.26" +#define VDRVERSION "1.1.27" #define MAXPRIORITY 99 #define MAXLIFETIME 99 diff --git a/dvbdevice.c b/dvbdevice.c index ba608706..24f582f3 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.46 2003/02/16 15:10:39 kls Exp $ + * $Id: dvbdevice.c 1.47 2003/03/23 15:18:40 kls Exp $ */ #include "dvbdevice.h" @@ -263,7 +263,7 @@ void cDvbTuner::Action(void) } } if (tunerStatus >= tsLocked) { - if (ciHandler) { + if (ciHandler && channel.Ca()) { if (ciHandler->Process()) { if (tunerStatus != tsCam) {//XXX TODO update in case the CA descriptors have changed uchar buffer[2048]; @@ -773,11 +773,15 @@ bool cDvbDevice::SetPlayMode(ePlayMode PlayMode) CHECK(ioctl(fd_audio, AUDIO_SET_MUTE, false)); if (siProcessor) siProcessor->SetStatus(true); + if (ciHandler) + ciHandler->SetEnabled(true); break; case pmAudioVideo: case pmAudioOnlyBlack: if (siProcessor) siProcessor->SetStatus(false); + if (ciHandler) + ciHandler->SetEnabled(false); CHECK(ioctl(fd_video, VIDEO_SET_BLANK, true)); CHECK(ioctl(fd_audio, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_MEMORY)); CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, PlayMode == pmAudioVideo)); @@ -788,6 +792,8 @@ bool cDvbDevice::SetPlayMode(ePlayMode PlayMode) case pmAudioOnly: if (siProcessor) siProcessor->SetStatus(false); + if (ciHandler) + ciHandler->SetEnabled(false); CHECK(ioctl(fd_video, VIDEO_SET_BLANK, true)); CHECK(ioctl(fd_audio, AUDIO_STOP, true)); CHECK(ioctl(fd_audio, AUDIO_CLEAR_BUFFER)); @@ -799,6 +805,8 @@ bool cDvbDevice::SetPlayMode(ePlayMode PlayMode) case pmExtern_THIS_SHOULD_BE_AVOIDED: if (siProcessor) siProcessor->SetStatus(false); + if (ciHandler) + ciHandler->SetEnabled(false); close(fd_video); close(fd_audio); fd_video = fd_audio = -1;