zapit ci.cpp: add constructors and ca_pmt_pid member

This commit is contained in:
[CST] Focus
2012-01-13 15:20:24 +04:00
parent abf326252d
commit 2de6b90c55
2 changed files with 29 additions and 6 deletions

View File

@@ -81,7 +81,10 @@ class CCaPmt : public CCaTable
unsigned ca_pmt_length; unsigned ca_pmt_length;
public: public:
CCaPmt();
CCaPmt(const unsigned char * const buffer);
~CCaPmt(void); ~CCaPmt(void);
unsigned getLength(void); unsigned getLength(void);
unsigned writeToBuffer(unsigned char * const buffer, int demux = 1, int camask = 3); unsigned writeToBuffer(unsigned char * const buffer, int demux = 1, int camask = 3);
@@ -91,6 +94,8 @@ class CCaPmt : public CCaTable
unsigned version_number : 5; unsigned version_number : 5;
unsigned current_next_indicator : 1; unsigned current_next_indicator : 1;
unsigned short ca_pmt_pid;
std::vector<CEsInfo *> es_info; std::vector<CEsInfo *> es_info;
}; };

View File

@@ -22,7 +22,7 @@
#include <zapit/ci.h> #include <zapit/ci.h>
#include <messagetools.h> #include <messagetools.h>
extern int curpmtpid; #include <stdio.h>
/* /*
* conditional access descriptors * conditional access descriptors
*/ */
@@ -51,7 +51,6 @@ unsigned int CCaDescriptor::writeToBuffer(unsigned char * const buffer) // retur
return descriptor_length + 2; return descriptor_length + 2;
} }
/* /*
* generic table containing conditional access descriptors * generic table containing conditional access descriptors
*/ */
@@ -89,7 +88,6 @@ CCaTable::~CCaTable(void)
delete ca_descriptor[i]; delete ca_descriptor[i];
} }
/* /*
* elementary stream information * elementary stream information
*/ */
@@ -111,10 +109,30 @@ unsigned int CEsInfo::writeToBuffer(unsigned char * const buffer) // returns num
//return 3 + CCaTable::writeToBuffer(&(buffer[3])); //return 3 + CCaTable::writeToBuffer(&(buffer[3]));
} }
/* /*
* contitional access program map table * contitional access program map table
*/ */
CCaPmt::CCaPmt()
{
ca_pmt_list_management = 0;
program_number = 0;
reserved1 = 0;
version_number = 0;
current_next_indicator = 0;
ca_pmt_pid = 0;
}
CCaPmt::CCaPmt(const unsigned char * const buffer)
{
program_number = (buffer[3] << 8) + buffer[4];
reserved1 = buffer[5] >> 6;
version_number = (buffer[5] >> 1) & 0x1F;
current_next_indicator = buffer[5] & 0x01;
reserved2 = buffer[10] >> 4;
ca_pmt_pid = 0;
}
CCaPmt::~CCaPmt(void) CCaPmt::~CCaPmt(void)
{ {
for (unsigned int i = 0; i < es_info.size(); i++) for (unsigned int i = 0; i < es_info.size(); i++)
@@ -153,8 +171,8 @@ unsigned int CCaPmt::writeToBuffer(unsigned char * const buffer, int demux, int
buffer[27] = 0x84; // pmt pid buffer[27] = 0x84; // pmt pid
buffer[28] = 0x02; buffer[28] = 0x02;
buffer[29] = (curpmtpid >> 8) & 0xFF; buffer[29] = (ca_pmt_pid >> 8) & 0xFF;
buffer[30] = curpmtpid & 0xFF; // 30 buffer[30] = ca_pmt_pid & 0xFF; // 30
int lenpos=10; int lenpos=10;
int len=19; int len=19;