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)) {
virtual void Clear(void)
Immediately clears the ring buffer.
virtual bool ProvidesCa(const int *CaSystemIds)
Returns true if the CAM in this slot provides one of the given CaSystemIds.
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 ...
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 InjectEit(int Sid)
Injects a generated EIT with a "present event" for the given Sid into the TS data stream sent to the ...
virtual void StartDecrypting(void)
Sends all CA_PMT entries to the CAM that have been modified since the last call to this function...
virtual const int * GetCaSystemIds(void)
virtual void Append(T Data)
cMtdCamSlot(cCamSlot *MasterSlot, int Index)
Creates a new "Multi Transponder Decryption" CAM slot, connected to the given physical MasterSlot...
uint16_t realPids[MAX_UNIQ_PIDS]
void TsSetPid(uchar *p, int Pid)
int Put(const uchar *Data, int Count)
Puts at most Count bytes of Data into the ring buffer.
int IndexOf(const T &Data)
cMtdHandler(void)
Creates a new MTD handler that distributes TS data received through calls to the Put() function to th...
int TsPid(const uchar *p)
void CancelActivation(void)
Tells all active MTD CAM slots to cancel activation.
void MtdMapPid(uchar *p, cMtdMapper *MtdMapper)
uint16_t RealToUniqSid(uint16_t RealSid)
cVector< cMtdCamSlot * > camSlots
virtual void StartDecrypting(void)
Sends all CA_PMT entries to the CAM that have been modified since the last call to this function...
cRingBufferLinear * mtdBuffer
void StartDecrypting(void)
Tells all active MTD CAM slots to start decrypting.
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...
virtual bool ProvidesCa(const int *CaSystemIds)
Returns true if the CAM in this slot provides one of the given CaSystemIds.
cMtdCamSlot * GetMtdCamSlot(cCamSlot *MasterSlot)
Creates a new MTD CAM slot, or reuses an existing one that is currently unused.
uint16_t uniqPids[MAX_REAL_PIDS]
cMtdMapper(int Number, int MasterCamSlotNumber)
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.
cVector< uint16_t > uniqSids
virtual const int * GetCaSystemIds(void)
virtual void StopDecrypting(void)
Clears the list of CA_PMT entries and tells the CAM to stop decrypting.
void Del(int Count)
Deletes at most Count bytes from the ring buffer.
cCamSlot * MasterSlot(void)
Returns this CAM slot's master slot, or a pointer to itself if it is a master slot.
int PutCat(const uchar *Data, int Count)
void SendCaPmts(cCiCaPmtList &CaPmtList)
Sends the given list of CA_PMTs to the CAM.
virtual bool IsDecrypting(void)
Returns true if the CAM in this slot is currently used for decrypting.
bool IsDecrypting(void)
Returns true if any of the active MTD CAM slots is currently 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...
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...
void MtdMapSid(uchar *p, cMtdMapper *MtdMapper)
uint16_t RealToUniqPid(uint16_t RealPid)
#define TS_SYNC(Data, Length)
uchar * Get(int &Count)
Gets data from the ring buffer.
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...
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...
uint16_t MakeUniqPid(uint16_t RealPid)
virtual void StopDecrypting(void)
Clears the list of CA_PMT entries and tells the CAM to stop decrypting.
void UnAssignAll(void)
Unassigns all MTD CAM slots from their devices.
virtual bool Assign(cDevice *Device, bool Query=false)
Assigns this CAM slot to the given Device, if this is possible.
bool IsActivating(void)
Returns true if any of the active MTD CAM slots is currently activating.
virtual void SendCaPmt(uint8_t CmdId)
int Priority(void)
Returns the maximum priority of any of the active MTD CAM slots.
int SlotNumber(void)
Returns the number of this CAM slot within the whole system.
uint16_t UniqToRealPid(uint16_t UniqPid)
virtual bool RepliesToQuery(void)
Returns true if the CAM in this slot replies to queries and thus supports MCD ("Multi Channel Decrypt...
virtual bool RepliesToQuery(void)
Returns true if the CAM in this slot replies to queries and thus supports MCD ("Multi Channel Decrypt...