Go to the documentation of this file.
15 #define DBGMTD(a...) dsyslog(a)
22 #define MAX_REAL_PIDS MAXPID // real PIDs are 13 bit (0x0000 - 0x1FFF)
24 #define MAX_UNIQ_PIDS MAXPID
25 #define UNIQ_PID_MASK 0x1FFF
27 #define MAX_UNIQ_PIDS 256 // uniq PIDs are 8 bit (0x00 - 0xFF)
28 #define UNIQ_PID_MASK 0x00FF
29 #define UNIQ_PID_SHIFT 8
41 dsyslog(
"CAM %d/%d: deleting MTD CAM slot",
camSlots[i]->MasterSlot()->SlotNumber(), i + 1);
64 if (
int Skipped =
TS_SYNC(Data, Count))
65 return Used + Skipped;
66 int Pid =
TsPid(Data);
77 esyslog(
"ERROR: incomplete MTD packet written (%d) in PID %d (%04X)", Index + 1, Pid, Pid);
80 esyslog(
"ERROR: invalid MTD number (%d) in PID %d (%04X)", Index + 1, Pid, Pid);
134 return DeviceNumbers.
Size() > 0;
145 #define MTD_INVALID_PID 0xFFFF
157 cMtdMapper(
int Number,
int MasterCamSlotNumber);
197 esyslog(
"ERROR: MTD %d: mapper ran out of unique PIDs",
number);
227 uint16_t RealSid = p[0] << 8 | p[1];
230 p[1] = UniqSid & 0xff;
240 #define MTD_BUFFER_SIZE MEGABYTE(1)
308 int Pid =
TsPid(Data);
326 if (
int Skipped =
TS_SYNC(d, c)) {
#define TS_SYNC(Data, Length)
virtual bool RepliesToQuery(void)
Returns true if the CAM in this slot replies to queries and thus supports MCD ("Multi Channel Decrypt...
void TsSetPid(uchar *p, int Pid)
void MtdMapSid(uchar *p, cMtdMapper *MtdMapper)
virtual void Clear(void)
Immediately clears the ring buffer.
virtual const int * GetCaSystemIds(void)
int Put(const uchar *Data, int Count)
Puts at most Count bytes of Data into the ring buffer.
void SendCaPmts(cCiCaPmtList &CaPmtList)
Sends the given list of CA_PMTs to the CAM.
uint16_t realPids[MAX_UNIQ_PIDS]
virtual void StartDecrypting(void)
Sends all CA_PMT entries to the CAM that have been modified since the last call to this function.
uint16_t UniqToRealPid(uint16_t UniqPid)
virtual const int * GetCaSystemIds(void)
cVector< cMtdCamSlot * > camSlots
uint16_t uniqPids[MAX_REAL_PIDS]
void BuildCaPmts(uint8_t CmdId, cCiCaPmtList &CaPmtList, cMtdMapper *MtdMapper=NULL)
Generates all CA_PMTs with the given CmdId and stores them in the given CaPmtList.
void StartDecrypting(void)
Tells all active MTD CAM slots to start decrypting.
void MtdMapPid(uchar *p, cMtdMapper *MtdMapper)
void CancelActivation(void)
Tells all active MTD CAM slots to cancel activation.
virtual bool Assign(cDevice *Device, bool Query=false)
Assigns this CAM slot to the given Device, if this is possible.
int TsPid(const uchar *p)
cMtdHandler(void)
Creates a new MTD handler that distributes TS data received through calls to the Put() function to th...
cRingBufferLinear * mtdBuffer
void Del(int Count)
Deletes at most Count bytes from the ring buffer.
int PutCat(const uchar *Data, int Count)
virtual uchar * Decrypt(uchar *Data, int &Count)
If this is a CAM slot that can be freely assigned to any device, but will not be directly inserted in...
cMtdCamSlot * GetMtdCamSlot(cCamSlot *MasterSlot)
Creates a new MTD CAM slot, or reuses an existing one that is currently unused.
virtual bool ProvidesCa(const int *CaSystemIds)
Returns true if the CAM in this slot provides one of the given CaSystemIds.
virtual void StartDecrypting(void)
Sends all CA_PMT entries to the CAM that have been modified since the last call to this function.
cMtdMapper(int Number, int MasterCamSlotNumber)
bool IsDecrypting(void)
Returns true if any of the active MTD CAM slots is currently decrypting.
virtual bool RepliesToQuery(void)
Returns true if the CAM in this slot replies to queries and thus supports MCD ("Multi Channel Decrypt...
uchar * Get(int &Count)
Gets data from the ring buffer.
int IndexOf(const T &Data)
cCamSlot * MasterSlot(void)
Returns this CAM slot's master slot, or a pointer to itself if it is a master slot.
uint16_t RealToUniqSid(uint16_t RealSid)
virtual void StopDecrypting(void)
Clears the list of CA_PMT entries and tells the CAM to stop decrypting.
virtual bool CanDecrypt(const cChannel *Channel, cMtdMapper *MtdMapper=NULL)
Returns true if there is a CAM in this slot that is able to decrypt the given Channel (or at least cl...
virtual bool ProvidesCa(const int *CaSystemIds)
Returns true if the CAM in this slot provides one of the given CaSystemIds.
virtual bool IsDecrypting(void)
Returns true if the CAM in this slot is currently used for decrypting.
uint16_t MakeUniqPid(uint16_t RealPid)
virtual bool CanDecrypt(const cChannel *Channel, cMtdMapper *MtdMapper=NULL)
Returns true if there is a CAM in this slot that is able to decrypt the given Channel (or at least cl...
virtual void InjectEit(int Sid)
Injects a generated EIT with a "present event" for the given Sid into the TS data stream sent to the ...
uint16_t RealToUniqPid(uint16_t RealPid)
virtual void Append(T Data)
bool IsActivating(void)
Returns true if any of the active MTD CAM slots is currently activating.
int SlotNumber(void)
Returns the number of this CAM slot within the whole system.
virtual uchar * Decrypt(uchar *Data, int &Count)
If this is a CAM slot that can be freely assigned to any device, but will not be directly inserted in...
int Put(const uchar *Data, int Count)
Puts at most Count bytes of Data into the CAM slot which's index is derived from the PID of the TS pa...
virtual void SendCaPmt(uint8_t CmdId)
virtual void InjectEit(int Sid)
Injects a generated EIT with a "present event" for the given Sid into the TS data stream sent to the ...
void UnAssignAll(void)
Unassigns all MTD CAM slots from their devices.
cVector< uint16_t > uniqSids
bool Devices(cVector< int > &DeviceNumbers)
Adds the numbers of the devices of any active MTD CAM slots to the given DeviceNumbers.
int PutData(const uchar *Data, int Count)
virtual void StopDecrypting(void)
Clears the list of CA_PMT entries and tells the CAM to stop decrypting.
int Priority(void)
Returns the maximum priority of any of the active MTD CAM slots.