Added SetPid() into cIptvProtocolIf().

This commit is contained in:
Rolf Ahrenberg 2014-02-09 19:22:02 +02:00
parent 57e0af0ade
commit 9839b47229
16 changed files with 86 additions and 18 deletions

View File

@ -293,7 +293,7 @@ bool cIptvDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP)
}
sidScanEnabledM = itp.SidScan() ? true : false;
pidScanEnabledM = itp.PidScan() ? true : false;
if (pIptvStreamerM->Set(itp.Address(), itp.Parameter(), deviceIndexM, protocol)) {
if (pIptvStreamerM && pIptvStreamerM->SetSource(itp.Address(), itp.Parameter(), deviceIndexM, protocol)) {
channelM = *channelP;
if (sidScanEnabledM && pSidScannerM && IptvConfig.GetSectionFiltering())
pSidScannerM->SetChannel(channelM.GetChannelID());
@ -306,22 +306,30 @@ bool cIptvDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP)
bool cIptvDevice::SetPid(cPidHandle *handleP, int typeP, bool onP)
{
debug("cIptvDevice::%s(%d): pid=%d type=%d on=%d", __FUNCTION__, deviceIndexM, handleP->pid, typeP, onP);
if (pIptvStreamerM && handleP)
return pIptvStreamerM->SetPid(handleP->pid, typeP, onP);
return true;
}
int cIptvDevice::OpenFilter(u_short pidP, u_char tidP, u_char maskP)
{
//debug("cIptvDevice::%s(%d): pid=%d tid=%d mask=%d", __FUNCTION__, deviceIndexM, pidP, tidP, maskP);
if (pIptvSectionM && IptvConfig.GetSectionFiltering())
if (pIptvSectionM && IptvConfig.GetSectionFiltering()) {
if (pIptvStreamerM)
pIptvStreamerM->SetPid(pidP, ptOther, true);
return pIptvSectionM->Open(pidP, tidP, maskP);
}
return -1;
}
void cIptvDevice::CloseFilter(int handleP)
{
//debug("cIptvDevice::%s(%d): handle=%d", __FUNCTION__, deviceIndexM, handleP);
if (pIptvSectionM)
if (pIptvSectionM) {
if (pIptvStreamerM)
pIptvStreamerM->SetPid(pIptvSectionM->GetPid(handleP), ptOther, false);
pIptvSectionM->Close(handleP);
}
}
bool cIptvDevice::OpenDvr(void)

View File

@ -503,7 +503,7 @@ int cIptvProtocolCurl::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
return len;
}
bool cIptvProtocolCurl::Set(const char* locationP, const int parameterP, const int indexP)
bool cIptvProtocolCurl::SetSource(const char* locationP, const int parameterP, const int indexP)
{
debug("cIptvProtocolCurl::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
if (!isempty(locationP)) {
@ -531,6 +531,12 @@ bool cIptvProtocolCurl::Set(const char* locationP, const int parameterP, const i
return true;
}
bool cIptvProtocolCurl::SetPid(int pidP, int typeP, bool onP)
{
//debug("cIptvProtocolCurl::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
return true;
}
cString cIptvProtocolCurl::GetInformation(void)
{
//debug("cIptvProtocolCurl::%s()", __FUNCTION__);

View File

@ -60,7 +60,8 @@ public:
cIptvProtocolCurl();
virtual ~cIptvProtocolCurl();
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
bool Set(const char* locationP, const int parameterP, const int indexP);
bool SetSource(const char* locationP, const int parameterP, const int indexP);
bool SetPid(int pidP, int typeP, bool onP);
bool Open(void);
bool Close(void);
cString GetInformation(void);

View File

@ -152,7 +152,7 @@ int cIptvProtocolExt::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
return cIptvUdpSocket::Read(bufferAddrP, bufferLenP);
}
bool cIptvProtocolExt::Set(const char* locationP, const int parameterP, const int indexP)
bool cIptvProtocolExt::SetSource(const char* locationP, const int parameterP, const int indexP)
{
debug("cIptvProtocolExt::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
if (!isempty(locationP)) {
@ -170,6 +170,12 @@ bool cIptvProtocolExt::Set(const char* locationP, const int parameterP, const in
return true;
}
bool cIptvProtocolExt::SetPid(int pidP, int typeP, bool onP)
{
//debug("cIptvProtocolExt::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
return true;
}
cString cIptvProtocolExt::GetInformation(void)
{
//debug("cIptvProtocolExt::%s()", __FUNCTION__);

View File

@ -27,7 +27,8 @@ public:
cIptvProtocolExt();
virtual ~cIptvProtocolExt();
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
bool Set(const char* locationP, const int parameterP, const int indexP);
bool SetSource(const char* locationP, const int parameterP, const int indexP);
bool SetPid(int pidP, int typeP, bool onP);
bool Open(void);
bool Close(void);
cString GetInformation(void);

View File

@ -95,7 +95,7 @@ bool cIptvProtocolFile::Close(void)
return true;
}
bool cIptvProtocolFile::Set(const char* locationP, const int parameterP, const int indexP)
bool cIptvProtocolFile::SetSource(const char* locationP, const int parameterP, const int indexP)
{
debug("cIptvProtocolFile::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
if (!isempty(locationP)) {
@ -110,6 +110,12 @@ bool cIptvProtocolFile::Set(const char* locationP, const int parameterP, const i
return true;
}
bool cIptvProtocolFile::SetPid(int pidP, int typeP, bool onP)
{
//debug("cIptvProtocolFile::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
return true;
}
cString cIptvProtocolFile::GetInformation(void)
{
//debug("cIptvProtocolFile::%s()", __FUNCTION__);

View File

@ -26,7 +26,8 @@ public:
cIptvProtocolFile();
virtual ~cIptvProtocolFile();
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
bool Set(const char* locationP, const int parameterP, const int indexP);
bool SetSource(const char* locationP, const int parameterP, const int indexP);
bool SetPid(int pidP, int typeP, bool onP);
bool Open(void);
bool Close(void);
cString GetInformation(void);

View File

@ -177,7 +177,7 @@ int cIptvProtocolHttp::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
return cIptvTcpSocket::Read(bufferAddrP, bufferLenP);
}
bool cIptvProtocolHttp::Set(const char* locationP, const int parameterP, const int indexP)
bool cIptvProtocolHttp::SetSource(const char* locationP, const int parameterP, const int indexP)
{
debug("cIptvProtocolHttp::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
if (!isempty(locationP)) {
@ -199,6 +199,12 @@ bool cIptvProtocolHttp::Set(const char* locationP, const int parameterP, const i
return true;
}
bool cIptvProtocolHttp::SetPid(int pidP, int typeP, bool onP)
{
//debug("cIptvProtocolHttp::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
return true;
}
cString cIptvProtocolHttp::GetInformation(void)
{
//debug("cIptvProtocolHttp::%s()", __FUNCTION__);

View File

@ -28,7 +28,8 @@ public:
cIptvProtocolHttp();
virtual ~cIptvProtocolHttp();
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
bool Set(const char* locationP, const int parameterP, const int indexP);
bool SetSource(const char* locationP, const int parameterP, const int indexP);
bool SetPid(int pidP, int typeP, bool onP);
bool Open(void);
bool Close(void);
cString GetInformation(void);

View File

@ -13,7 +13,8 @@ public:
cIptvProtocolIf() {}
virtual ~cIptvProtocolIf() {}
virtual int Read(unsigned char* bufferAddrP, unsigned int bufferLenP) = 0;
virtual bool Set(const char* locationP, const int parameterP, const int indexP) = 0;
virtual bool SetSource(const char* locationP, const int parameterP, const int indexP) = 0;
virtual bool SetPid(int pidP, int typeP, bool onP) = 0;
virtual bool Open(void) = 0;
virtual bool Close(void) = 0;
virtual cString GetInformation(void) = 0;

View File

@ -70,7 +70,7 @@ int cIptvProtocolUdp::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
return cIptvUdpSocket::Read(bufferAddrP, bufferLenP);
}
bool cIptvProtocolUdp::Set(const char* locationP, const int parameterP, const int indexP)
bool cIptvProtocolUdp::SetSource(const char* locationP, const int parameterP, const int indexP)
{
debug("cIptvProtocolUdp::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
if (!isempty(locationP)) {
@ -103,6 +103,12 @@ bool cIptvProtocolUdp::Set(const char* locationP, const int parameterP, const in
return true;
}
bool cIptvProtocolUdp::SetPid(int pidP, int typeP, bool onP)
{
//debug("cIptvProtocolUdp::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
return true;
}
cString cIptvProtocolUdp::GetInformation(void)
{
//debug("cIptvProtocolUdp::%s()", __FUNCTION__);

View File

@ -23,7 +23,8 @@ public:
cIptvProtocolUdp();
virtual ~cIptvProtocolUdp();
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
bool Set(const char* locationP, const int parameterP, const int indexP);
bool SetSource(const char* locationP, const int parameterP, const int indexP);
bool SetPid(int pidP, int typeP, bool onP);
bool Open(void);
bool Close(void);
cString GetInformation(void);

View File

@ -380,6 +380,20 @@ void cIptvSectionFilterHandler::Close(int handleP)
}
}
int cIptvSectionFilterHandler::GetPid(int handleP)
{
// Lock
cMutexLock MutexLock(&mutexM);
// Search the filter for data
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
if (filtersM[i] && (handleP == filtersM[i]->GetFd())) {
debug("cIptvSectionFilterHandler::%s(%d): pid=%d handle=%d index=%d", __FUNCTION__, deviceIndexM, filtersM[i]->GetPid(), filtersM[i]->GetFd(), i);
return filtersM[i]->GetPid();
}
}
return -1;
}
void cIptvSectionFilterHandler::Write(uchar *bufferP, int lengthP)
{
//debug("cIptvSectionFilterHandler::%s(%d): length=%d", __FUNCTION__, deviceIndexM, lengthP);

View File

@ -84,6 +84,7 @@ public:
cString GetInformation(void);
int Open(u_short pidP, u_char tidP, u_char maskP);
void Close(int handleP);
int GetPid(int handleP);
void Write(u_char *bufferP, int lengthP);
};

View File

@ -79,7 +79,7 @@ bool cIptvStreamer::Close(void)
return true;
}
bool cIptvStreamer::Set(const char* locationP, const int parameterP, const int indexP, cIptvProtocolIf* protocolP)
bool cIptvStreamer::SetSource(const char* locationP, const int parameterP, const int indexP, cIptvProtocolIf* protocolP)
{
debug("cIptvStreamer::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
if (!isempty(locationP)) {
@ -89,16 +89,24 @@ bool cIptvStreamer::Set(const char* locationP, const int parameterP, const int i
protocolM->Close();
protocolM = protocolP;
if (protocolM) {
protocolM->Set(locationP, parameterP, indexP);
protocolM->SetSource(locationP, parameterP, indexP);
protocolM->Open();
}
}
else if (protocolM)
protocolM->Set(locationP, parameterP, indexP);
protocolM->SetSource(locationP, parameterP, indexP);
}
return true;
}
bool cIptvStreamer::SetPid(int pidP, int typeP, bool onP)
{
debug("cIptvStreamer::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
if (protocolM)
return protocolM->SetPid(pidP, typeP, onP);
return true;
}
cString cIptvStreamer::GetInformation(void)
{
//debug("cIptvStreamer::%s()", __FUNCTION__);

View File

@ -30,7 +30,8 @@ protected:
public:
cIptvStreamer(cIptvDeviceIf &deviceP, unsigned int packetLenP);
virtual ~cIptvStreamer();
bool Set(const char* locationP, const int parameterP, const int indexP, cIptvProtocolIf* protocolP);
bool SetSource(const char* locationP, const int parameterP, const int indexP, cIptvProtocolIf* protocolP);
bool SetPid(int pidP, int typeP, bool onP);
bool Open(void);
bool Close(void);
cString GetInformation(void);