From 7e5949d3d5acb5b4af172539ff3b2d27b361b778 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sat, 11 Feb 2017 17:54:23 +0000 Subject: [PATCH] Use VDR's Channels.GetByNumber() instead of own function --- mvpreceiver.c | 4 ++-- mvpreceiver.h | 4 ++-- vompclient.c | 21 --------------------- vompclient.h | 1 - vompclientrrproc.c | 14 +++++++------- 5 files changed, 11 insertions(+), 33 deletions(-) diff --git a/mvpreceiver.c b/mvpreceiver.c index dde4d60..6cdc5be 100644 --- a/mvpreceiver.c +++ b/mvpreceiver.c @@ -2,7 +2,7 @@ int MVPReceiver::numMVPReceivers = 0; -MVPReceiver* MVPReceiver::create(cChannel* channel, int priority) +MVPReceiver* MVPReceiver::create(const cChannel* channel, int priority) { #if VDRVERSNUM < 10500 bool NeedsDetachReceivers; @@ -34,7 +34,7 @@ MVPReceiver* MVPReceiver::create(cChannel* channel, int priority) return m; } -MVPReceiver::MVPReceiver(cChannel* channel, cDevice* device) +MVPReceiver::MVPReceiver(const cChannel* channel, cDevice* device) #if VDRVERSNUM < 10300 : cReceiver(channel->Ca(), 0, 7, channel->Vpid(), channel->Ppid(), channel->Apid1(), channel->Apid2(), channel->Dpid1(), channel->Dpid2(), channel->Tpid()) #elif VDRVERSNUM < 10500 diff --git a/mvpreceiver.h b/mvpreceiver.h index e1acf39..eb4649e 100644 --- a/mvpreceiver.h +++ b/mvpreceiver.h @@ -34,14 +34,14 @@ class MVPReceiver : public cReceiver, public Thread { public: - static MVPReceiver* create(cChannel*, int priority); + static MVPReceiver* create(const cChannel*, int priority); virtual ~MVPReceiver(); int init(TCP* tcp, ULONG streamID); bool isVdrActivated(); void detachMVPReceiver(); private: - MVPReceiver(cChannel* channel, cDevice* device); + MVPReceiver(const cChannel* channel, cDevice* device); Log* logger; bool vdrActivated; diff --git a/vompclient.c b/vompclient.c index 118eb5c..f83c76e 100644 --- a/vompclient.c +++ b/vompclient.c @@ -409,27 +409,6 @@ ULLONG VompClient::htonll(ULLONG a) #ifndef VOMPSTANDALONE -cChannel* VompClient::channelFromNumber(ULONG channelNumber) -{ - cChannel* channel = NULL; - - for (channel = Channels.First(); channel; channel = Channels.Next(channel)) - { - if (!channel->GroupSep()) - { -// log->log("Client", Log::DEBUG, "Looking for channel %lu::: number: %i name: '%s'", channelNumber, channel->Number(), channel->Name()); - if (channel->Number() == (int)channelNumber) return channel; - } - } - - if (!channel) - { - log->log("Client", Log::DEBUG, "Channel not found"); - } - - return channel; -} - void VompClient::writeResumeData() { /*config.setValueLong("ResumeData", diff --git a/vompclient.h b/vompclient.h index 77f7fcb..b715ce6 100644 --- a/vompclient.h +++ b/vompclient.h @@ -105,7 +105,6 @@ class VompClient //void cleanConfig(); #ifndef VOMPSTANDALONE - cChannel* channelFromNumber(ULONG channelNumber); void writeResumeData(); MVPReceiver* lp; diff --git a/vompclientrrproc.c b/vompclientrrproc.c index 8cea99a..31dc82c 100644 --- a/vompclientrrproc.c +++ b/vompclientrrproc.c @@ -1013,7 +1013,7 @@ int VompClientRRProc::processGetChannelPids() { ULONG channelNumber = ntohl(*(ULONG*)req->data); - cChannel* channel = x.channelFromNumber(channelNumber); + const cChannel* channel = Channels.GetByNumber(channelNumber); if (!channel) { resp->addULONG(0); @@ -1188,7 +1188,7 @@ int VompClientRRProc::processStartStreamingChannel() log->log("RRProc", Log::DEBUG, "req->dataLength = %i", req->dataLength); ULONG channelNumber = ntohl(*(ULONG*)req->data); - cChannel* channel = x.channelFromNumber(channelNumber); + const cChannel* channel = Channels.GetByNumber(channelNumber); if (!channel) { resp->addULONG(0); @@ -1450,7 +1450,7 @@ int VompClientRRProc::processGetChannelSchedule() log->log("RRProc", Log::DEBUG, "get schedule called for channel %lu", channelNumber); - cChannel* channel = x.channelFromNumber(channelNumber); + const cChannel* channel = Channels.GetByNumber(channelNumber); if (!channel) { resp->addULONG(0); @@ -2061,7 +2061,7 @@ int VompClientRRProc::processGetEventScraperEventType() ULONG eventid = ntohl(*(ULONG*)(req->data+4)); const cEvent *event = NULL; - cChannel* channel = x.channelFromNumber(channelid); + const cChannel* channel = Channels.GetByNumber(channelNumber); #if VDRVERSNUM < 10300 cMutexLock MutexLock; @@ -2276,7 +2276,7 @@ int VompClientRRProc::processLoadTvMediaEventThumb() UINT channelid = ntohl(*(ULONG*)req->data); tvreq.primary_id = ntohl(*(ULONG*)(req->data+4)); tvreq.secondary_id = 0; - cChannel* channel = x.channelFromNumber(channelid); + const cChannel* channel = Channels.GetByNumber(channelNumber); if (channel) tvreq.primary_name = std::string((const char*)channel->GetChannelID().ToString()); tvreq.type_pict = 1; @@ -2301,13 +2301,13 @@ int VompClientRRProc::processLoadChannelLogo() UINT channelid = ntohl(*(ULONG*)req->data); tvreq.primary_id = channelid; tvreq.secondary_id = 0; - cChannel* channel = x.channelFromNumber(channelid); + const cChannel* channel = Channels.GetByNumber(channelNumber); if (channel) tvreq.primary_name = std::string((const char*)channel->Name()); tvreq.type_pict = 1; tvreq.container = 0; tvreq.container_member = 0; - log->log("RRProc", Log::DEBUG, "TVMedia request %d %d %s",req->requestID,channelid, channel->Name()); + if (channel) log->log("RRProc", Log::DEBUG, "TVMedia request %d %d %s",req->requestID,channelid, channel->Name()); x.pict->addTVMediaRequest(tvreq); -- 2.39.2