Fixed DeleteFilter() and commented some debug outputs.

This commit is contained in:
Rolf Ahrenberg 2007-09-24 21:25:53 +00:00
parent 49234919ea
commit c03e69a64f
2 changed files with 11 additions and 9 deletions

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: device.c,v 1.39 2007/09/24 17:20:58 rahrenbe Exp $ * $Id: device.c,v 1.40 2007/09/24 21:25:53 rahrenbe Exp $
*/ */
#include "common.h" #include "common.h"
@ -155,9 +155,10 @@ bool cIptvDevice::SetPid(cPidHandle *Handle, int Type, bool On)
bool cIptvDevice::DeleteFilter(unsigned int Index) bool cIptvDevice::DeleteFilter(unsigned int Index)
{ {
if ((Index < eMaxSecFilterCount) && secfilters[Index]) { if ((Index < eMaxSecFilterCount) && secfilters[Index]) {
debug("cIptvDevice::DeleteFilter(%d) Index=%d\n", deviceIndex, Index); //debug("cIptvDevice::DeleteFilter(%d) Index=%d\n", deviceIndex, Index);
delete secfilters[Index]; cIptvSectionFilter *tmp = secfilters[Index];
secfilters[Index] = NULL; secfilters[Index] = NULL;
delete tmp;
return true; return true;
} }
return false; return false;
@ -168,7 +169,7 @@ int cIptvDevice::OpenFilter(u_short Pid, u_char Tid, u_char Mask)
// Search the next free filter slot // Search the next free filter slot
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
if (!secfilters[i]) { if (!secfilters[i]) {
debug("cIptvDevice::OpenFilter(%d): Pid=%d Tid=%02X Mask=%02X Index=%d\n", deviceIndex, Pid, Tid, Mask, i); //debug("cIptvDevice::OpenFilter(%d): Pid=%d Tid=%02X Mask=%02X Index=%d\n", deviceIndex, Pid, Tid, Mask, i);
secfilters[i] = new cIptvSectionFilter(i, deviceIndex, Pid, Tid, Mask); secfilters[i] = new cIptvSectionFilter(i, deviceIndex, Pid, Tid, Mask);
return secfilters[i]->GetReadDesc(); return secfilters[i]->GetReadDesc();
} }
@ -179,10 +180,11 @@ int cIptvDevice::OpenFilter(u_short Pid, u_char Tid, u_char Mask)
bool cIptvDevice::CloseFilter(int Handle) bool cIptvDevice::CloseFilter(int Handle)
{ {
debug("cIptvDevice::CloseFilter(%d): %d\n", deviceIndex, Handle);
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
if (secfilters[i] && Handle == secfilters[i]->GetReadDesc()) if (secfilters[i] && (Handle == secfilters[i]->GetReadDesc())) {
//debug("cIptvDevice::CloseFilter(%d): %d\n", deviceIndex, Handle);
return DeleteFilter(i); return DeleteFilter(i);
}
} }
return false; return false;
} }

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: sectionfilter.c,v 1.3 2007/09/24 17:20:58 rahrenbe Exp $ * $Id: sectionfilter.c,v 1.4 2007/09/24 21:25:54 rahrenbe Exp $
*/ */
#include "sectionfilter.h" #include "sectionfilter.h"
@ -23,7 +23,7 @@ cIptvSectionFilter::cIptvSectionFilter(int Index, int devInd,
pid(Pid), pid(Pid),
id(Index) id(Index)
{ {
debug("cIptvSectionFilter::cIptvSectionFilter(%d)\n", Index); //debug("cIptvSectionFilter::cIptvSectionFilter(%d)\n", Index);
memset(secbuf_base, '\0', sizeof(secbuf_base)); memset(secbuf_base, '\0', sizeof(secbuf_base));
memset(filter_value, '\0', sizeof(filter_value)); memset(filter_value, '\0', sizeof(filter_value));
memset(filter_mask, '\0', sizeof(filter_mask)); memset(filter_mask, '\0', sizeof(filter_mask));
@ -64,7 +64,7 @@ cIptvSectionFilter::cIptvSectionFilter(int Index, int devInd,
cIptvSectionFilter::~cIptvSectionFilter() cIptvSectionFilter::~cIptvSectionFilter()
{ {
debug("cIptvSectionFilter::~cIptvSectionfilter(%d)\n", id); //debug("cIptvSectionFilter::~cIptvSectionfilter(%d)\n", id);
close(fifoDescriptor); close(fifoDescriptor);
close(readDescriptor); close(readDescriptor);
unlink(pipeName); unlink(pipeName);