1
0
mirror of https://github.com/rofafor/vdr-plugin-iptv.git synced 2023-10-10 13:37:03 +02:00

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

View File

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

View File

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