From 6e2f0f695f0c537ddeb0c61b51e298caf29bcbb3 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 20 Jan 2014 12:14:30 +0100 Subject: [PATCH] Now making sure the primary device goes into transfer mode for live viewing if the CAM wants to receive the TS data --- HISTORY | 4 +++- ci.h | 17 ++++++++++------- device.c | 5 ++++- dvbdevice.c | 18 ++++++++++++------ 4 files changed, 29 insertions(+), 15 deletions(-) diff --git a/HISTORY b/HISTORY index b9006040..29a89894 100644 --- a/HISTORY +++ b/HISTORY @@ -8132,7 +8132,7 @@ Video Disk Recorder Revision History and also to use the correct directory with --edit (the latter reported by Marko Mäkelä). -2014-01-18: Version 2.1.4 +2014-01-20: Version 2.1.4 - Updated 'sources.conf' (thanks to Antti Hartikainen). - cFont::CreateFont() now returns a dummy font in case there are no fonts installed. @@ -8155,3 +8155,5 @@ Video Disk Recorder Revision History - Fixed detecting frame borders in MPEG-2 streams that have "bottom fields" or varying GOP structures (reported by Christian Paulick, with help from Helmut Auer). - Now unassigning CAMs from their devices when they are no longer used. +- Now making sure the primary device goes into transfer mode for live viewing if the + CAM wants to receive the TS data. diff --git a/ci.h b/ci.h index 190e3e08..159552cf 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 3.5 2014/01/16 11:45:08 kls Exp $ + * $Id: ci.h 3.6 2014/01/20 12:01:01 kls Exp $ */ #ifndef __CI_H @@ -147,13 +147,13 @@ private: void Write(cTPDU *TPDU); cCiSession *GetSessionByResourceId(uint32_t ResourceId); public: - cCamSlot(cCiAdapter *CiAdapter, bool ReceiveCaPids = false); + cCamSlot(cCiAdapter *CiAdapter, bool WantsTsData = false); ///< Creates a new CAM slot for the given CiAdapter. ///< The CiAdapter will take care of deleting the CAM slot, ///< so the caller must not delete it! - ///< If ReceiveCaPids is true, the CAM slot will take care that the CA pids - ///< of the selected programmes will be included in the TS data stream that - ///< is presented to the Decrypt() function. + ///< If WantsTsData is true, the device this CAM slot is assigned to will + ///< call the Decrypt() function of this CAM slot, presenting it the complete + ///< TS data stream of the encrypted programme, including the CA pids. virtual ~cCamSlot(); bool Assign(cDevice *Device, bool Query = false); ///< Assigns this CAM slot to the given Device, if this is possible. @@ -166,6 +166,9 @@ public: ///< 'true'. cDevice *Device(void); ///< Returns the device this CAM slot is currently assigned to. + bool WantsTsData(void) const { return caPidReceiver != NULL; } + ///< Returns true if this CAM slot wants to receive the TS data through + ///< its Decrypt() function. int SlotIndex(void) { return slotIndex; } ///< Returns the index of this CAM slot within its CI adapter. ///< The first slot has an index of 0. @@ -261,8 +264,8 @@ public: ///< shall be set to 0 and the same Data pointer will be offered in the next ///< call to Decrypt(). ///< A derived class that implements this function will also need - ///< to set the ReceiveCaPids parameter in the call to the base class - ///< constructor to true in order to receive the CA pid data. + ///< to set the WantsTsData parameter in the call to the base class + ///< constructor to true in order to receive the TS data. }; class cCamSlots : public cList { diff --git a/device.c b/device.c index 75bb9181..5b9e1ec6 100644 --- a/device.c +++ b/device.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 3.9 2014/01/18 14:26:06 kls Exp $ + * $Id: device.c 3.10 2014/01/20 11:53:47 kls Exp $ */ #include "device.h" @@ -761,6 +761,9 @@ eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView) cDevice *Device = (LiveView && IsPrimaryDevice()) ? GetDevice(Channel, LIVEPRIORITY, true) : this; bool NeedsTransferMode = Device != this; + // If the CAM slot wants the TS data, we need to switch to Transfer Mode: + if (!NeedsTransferMode && LiveView && IsPrimaryDevice() && CamSlot() && CamSlot()->WantsTsData()) + NeedsTransferMode = true; eSetChannelResult Result = scrOk; diff --git a/dvbdevice.c b/dvbdevice.c index 6842a4ca..6d1c9562 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 3.9 2014/01/16 11:45:22 kls Exp $ + * $Id: dvbdevice.c 3.10 2014/01/20 11:46:26 kls Exp $ */ #include "dvbdevice.h" @@ -1664,12 +1664,18 @@ void cDvbDevice::CloseDvr(void) bool cDvbDevice::GetTSPacket(uchar *&Data) { if (tsBuffer) { - int Available; - Data = tsBuffer->Get(&Available); - if (Data && CamSlot()) { - Data = CamSlot()->Decrypt(Data, Available); - tsBuffer->Skip(Available); + if (cCamSlot *cs = CamSlot()) { + if (cs->WantsTsData()) { + int Available; + Data = tsBuffer->Get(&Available); + if (Data) { + Data = cs->Decrypt(Data, Available); + tsBuffer->Skip(Available); + } + return true; + } } + Data = tsBuffer->Get(); return true; } return false;