Modified the filter code.

This commit is contained in:
Rolf Ahrenberg 2013-02-26 00:34:45 +02:00
parent 45192e924a
commit 980aafb206
3 changed files with 11 additions and 20 deletions

View File

@ -41,9 +41,7 @@ cIptvDevice::cIptvDevice(unsigned int indexP)
// Start section handler for iptv device
StartSectionHandler();
// Sid scanner must be created after the section handler
pSidScannerM = new cSidScanner();
if (pSidScannerM)
AttachFilter(pSidScannerM);
AttachFilter(pSidScannerM = new cSidScanner());
// Check if dvr fifo exists
struct stat sb;
cString filename = cString::sprintf(IPTV_DVR_FILENAME, deviceIndexM);
@ -58,8 +56,6 @@ cIptvDevice::cIptvDevice(unsigned int indexP)
cIptvDevice::~cIptvDevice()
{
debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
// Stop section handler of iptv device
StopSectionHandler();
DELETE_POINTER(pIptvStreamerM);
DELETE_POINTER(pUdpProtocolM);
DELETE_POINTER(pCurlProtocolM);
@ -68,11 +64,9 @@ cIptvDevice::~cIptvDevice()
DELETE_POINTER(pExtProtocolM);
DELETE_POINTER(tsBufferM);
DELETE_POINTER(pPidScannerM);
// Detach and destroy sid filter
if (pSidScannerM) {
Detach(pSidScannerM);
DELETE_POINTER(pSidScannerM);
}
DELETE_POINTER(pSidScannerM);
// Stop section handler of iptv device
StopSectionHandler();
// Destroy all filters
cMutexLock MutexLock(&mutexM);
for (int i = 0; i < eMaxSecFilterCount; ++i)

View File

@ -14,7 +14,8 @@ cSidScanner::cSidScanner(void)
: channelIdM(tChannelID::InvalidID),
sidFoundM(false),
nidFoundM(false),
tidFoundM(false)
tidFoundM(false),
isActiveM(false)
{
debug("cSidScanner::%s()", __FUNCTION__);
Set(0x00, 0x00); // PAT
@ -26,12 +27,6 @@ cSidScanner::~cSidScanner()
debug("cSidScanner::%s()", __FUNCTION__);
}
void cSidScanner::SetStatus(bool onP)
{
debug("cSidScanner::%s(%d)", __FUNCTION__, onP);
cFilter::SetStatus(onP);
}
void cSidScanner::SetChannel(const tChannelID &channelIdP)
{
debug("cSidScanner::%s(%s)", __FUNCTION__, *channelIdP.ToString());
@ -46,6 +41,8 @@ void cSidScanner::Process(u_short pidP, u_char tidP, const u_char *dataP, int le
int newSid = -1, newNid = -1, newTid = -1;
//debug("cSidScanner::%s()", __FUNCTION__);
if (!isActiveM)
return;
if (channelIdM.Valid()) {
if ((pidP == 0x00) && (tidP == 0x00)) {
debug("cSidScanner::%s(%d, %02X)", __FUNCTION__, pidP, tidP);

View File

@ -17,17 +17,17 @@ private:
bool sidFoundM;
bool nidFoundM;
bool tidFoundM;
bool isActiveM;
protected:
virtual void Process(u_short pidP, u_char tidP, const u_char *dataP, int lengthP);
virtual void SetStatus(bool onP);
public:
cSidScanner(void);
~cSidScanner();
void SetChannel(const tChannelID &channelIdP);
void Open() { SetStatus(true); }
void Close() { SetStatus(false); }
void Open() { isActiveM = true; }
void Close() { isActiveM = false; }
};
#endif // __SIDSCANNER_H