zapit/src/capmt.cpp: use MAX_DMX_UNITS

This commit is contained in:
[CST] Focus
2013-02-13 13:16:46 +04:00
parent 702beba7d8
commit f1668c58e2
2 changed files with 6 additions and 4 deletions

View File

@@ -28,6 +28,7 @@
#include <OpenThreads/Mutex> #include <OpenThreads/Mutex>
#include <zapit/channel.h> #include <zapit/channel.h>
#include <dvbsi++/ca_program_map_section.h> #include <dvbsi++/ca_program_map_section.h>
#include <dmx_cs.h>
#define DEMUX_DECODE_0 1 #define DEMUX_DECODE_0 1
#define DEMUX_DECODE_1 2 #define DEMUX_DECODE_1 2
@@ -47,7 +48,7 @@ class CCam : public CBasicClient
private: private:
virtual unsigned char getVersion(void) const; virtual unsigned char getVersion(void) const;
virtual const char *getSocketName(void) const; virtual const char *getSocketName(void) const;
int camask, demuxes[4]; int camask, demuxes[MAX_DMX_UNITS];
int source_demux; int source_demux;
uint8_t cabuf[2048]; uint8_t cabuf[2048];
int calen; int calen;

View File

@@ -37,7 +37,8 @@
CCam::CCam() CCam::CCam()
{ {
camask = 0; camask = 0;
demuxes[0] = demuxes[1] = demuxes[2] = demuxes[3] = 0; for(int i = 0; i < MAX_DMX_UNITS; i++)
demuxes[i] = 0;
source_demux = -1; source_demux = -1;
calen = 0; calen = 0;
} }
@@ -147,11 +148,11 @@ int CCam::makeMask(int demux, bool add)
else if(demuxes[demux] > 0) else if(demuxes[demux] > 0)
demuxes[demux]--; demuxes[demux]--;
for(int i = 0; i < 4; i++) { for(int i = 0; i < MAX_DMX_UNITS; i++) {
if(demuxes[i] > 0) if(demuxes[i] > 0)
mask |= 1 << i; mask |= 1 << i;
} }
DBG("demuxes %d:%d:%d:%d old mask %d new mask %d", demuxes[0], demuxes[1], demuxes[2], demuxes[3], camask, mask); //DBG("demuxes %d:%d:%d:%d old mask %d new mask %d", demuxes[0], demuxes[1], demuxes[2], demuxes[3], camask, mask);
return mask; return mask;
} }