Now making sure the primary device goes into transfer mode for live viewing if the CAM wants to receive the TS data

This commit is contained in:
Klaus Schmidinger 2014-01-20 12:14:30 +01:00
parent 6f9929b1c0
commit 6e2f0f695f
4 changed files with 29 additions and 15 deletions

View File

@ -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.

17
ci.h
View File

@ -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<cCamSlot> {

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 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;

View File

@ -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;