zapit/src/capmt.cpp: allocate demuxes in constructor

This commit is contained in:
[CST] Focus
2014-03-28 14:13:50 +04:00
parent 5b731ed216
commit 0c97279874
2 changed files with 9 additions and 12 deletions

View File

@@ -39,17 +39,14 @@
#define DEMUX_SOURCE_2 2 #define DEMUX_SOURCE_2 2
#define LIVE_DEMUX 0 #define LIVE_DEMUX 0
#define STREAM_DEMUX 1
#define RECORD_DEMUX 2
#define PIP_DEMUX 3
class CCam : public CBasicClient 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[MAX_DMX_UNITS]; int camask;
int *demuxes;
int source_demux; int source_demux;
uint8_t cabuf[2048]; uint8_t cabuf[2048];
int calen; int calen;
@@ -65,7 +62,7 @@ class CCam : public CBasicClient
CAPMT_UPDATE = 0x05 CAPMT_UPDATE = 0x05
}; };
CCam(); CCam();
virtual ~CCam() {}; virtual ~CCam();
bool sendMessage(const char * const data, const size_t length, bool update = false); bool sendMessage(const char * const data, const size_t length, bool update = false);
bool makeCaPmt(CZapitChannel * channel, bool add_private, uint8_t list = CAPMT_ONLY, const CaIdVector &caids = CaIdVector()); bool makeCaPmt(CZapitChannel * channel, bool add_private, uint8_t list = CAPMT_ONLY, const CaIdVector &caids = CaIdVector());
bool setCaPmt(bool update = false); bool setCaPmt(bool update = false);

View File

@@ -39,12 +39,18 @@
CCam::CCam() CCam::CCam()
{ {
camask = 0; camask = 0;
demuxes = new int[MAX_DMX_UNITS];
for(int i = 0; i < MAX_DMX_UNITS; i++) for(int i = 0; i < MAX_DMX_UNITS; i++)
demuxes[i] = 0; demuxes[i] = 0;
source_demux = -1; source_demux = -1;
calen = 0; calen = 0;
} }
CCam::~CCam()
{
delete []demuxes;
}
unsigned char CCam::getVersion(void) const unsigned char CCam::getVersion(void) const
{ {
return 0x9F; return 0x9F;
@@ -227,12 +233,6 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
source = channel->getRecordDemux(); source = channel->getRecordDemux();
demux = channel->getRecordDemux(); demux = channel->getRecordDemux();
break; break;
#if 0
case STREAM:
source = DEMUX_SOURCE_0;
demux = STREAM_DEMUX;
break;
#endif
case PIP: case PIP:
source = channel->getRecordDemux(); source = channel->getRecordDemux();
demux = channel->getPipDemux(); demux = channel->getPipDemux();