1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Now clearing the MTD buffer

This commit is contained in:
Klaus Schmidinger 2017-03-19 13:33:53 +01:00
parent 367557039a
commit e2756f8e9a
2 changed files with 9 additions and 3 deletions

9
mtd.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: mtd.c 1.1 2017/03/18 14:31:34 kls Exp $ * $Id: mtd.c 1.2 2017/03/19 13:33:53 kls Exp $
*/ */
#include "mtd.h" #include "mtd.h"
@ -223,6 +223,7 @@ cMtdCamSlot::cMtdCamSlot(cCamSlot *MasterSlot, int Index)
mtdBuffer = new cRingBufferLinear(MTD_BUFFER_SIZE, TS_SIZE, true, "MTD buffer"); mtdBuffer = new cRingBufferLinear(MTD_BUFFER_SIZE, TS_SIZE, true, "MTD buffer");
mtdMapper = new cMtdMapper(Index + 1, MasterSlot->SlotNumber()); mtdMapper = new cMtdMapper(Index + 1, MasterSlot->SlotNumber());
delivered = false; delivered = false;
clearBuffer = false;
ciAdapter = MasterSlot->ciAdapter; // we don't pass the CI adapter in the constructor, to prevent this one from being inserted into CamSlots ciAdapter = MasterSlot->ciAdapter; // we don't pass the CI adapter in the constructor, to prevent this one from being inserted into CamSlots
} }
@ -271,7 +272,7 @@ void cMtdCamSlot::StopDecrypting(void)
{ {
cCamSlot::StopDecrypting(); cCamSlot::StopDecrypting();
mtdMapper->Clear(); mtdMapper->Clear();
//XXX mtdBuffer->Clear(); //XXX would require locking? clearBuffer = true;
} }
bool cMtdCamSlot::IsDecrypting(void) bool cMtdCamSlot::IsDecrypting(void)
@ -297,6 +298,10 @@ uchar *cMtdCamSlot::Decrypt(uchar *Data, int &Count)
mtdBuffer->Del(TS_SIZE); mtdBuffer->Del(TS_SIZE);
delivered = false; delivered = false;
} }
if (clearBuffer) {
mtdBuffer->Clear();
clearBuffer = false;
}
// Receive data from buffer: // Receive data from buffer:
int c = 0; int c = 0;
uchar *d = mtdBuffer->Get(c); uchar *d = mtdBuffer->Get(c);

3
mtd.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: mtd.h 1.2 2017/03/19 10:48:52 kls Exp $ * $Id: mtd.h 1.3 2017/03/19 13:32:48 kls Exp $
*/ */
#ifndef __MTD_H #ifndef __MTD_H
@ -154,6 +154,7 @@ private:
cMtdMapper *mtdMapper; cMtdMapper *mtdMapper;
cRingBufferLinear *mtdBuffer; cRingBufferLinear *mtdBuffer;
bool delivered; bool delivered;
bool clearBuffer;
protected: protected:
virtual const int *GetCaSystemIds(void); virtual const int *GetCaSystemIds(void);
virtual void SendCaPmt(uint8_t CmdId); virtual void SendCaPmt(uint8_t CmdId);