]> git.vomp.tv Git - vompserver.git/commitdiff
Use VDR's Channels.GetByNumber() instead of own function
authorChris Tallon <chris@vomp.tv>
Sat, 11 Feb 2017 17:54:23 +0000 (17:54 +0000)
committerChris Tallon <chris@vomp.tv>
Sat, 11 Feb 2017 17:54:23 +0000 (17:54 +0000)
mvpreceiver.c
mvpreceiver.h
vompclient.c
vompclient.h
vompclientrrproc.c

index dde4d604574d47a86d7acf540d77f2167743d8e0..6cdc5be65685e747cd7eee6ca951372f4007cb57 100644 (file)
@@ -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
index e1acf39af9e40b680179500835854a0f0715eb56..eb4649e9d3dd32b1d4108ed40983a40425320468 100644 (file)
 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;
index 118eb5cd5125940c5f18b18b69f5319f55740315..f83c76efc3560512e6d4a91ebafd86dcbcad06d0 100644 (file)
@@ -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",
index 77f7fcb6d29a3dad90c420e4d745bd1e1520012e..b715ce6013383797fa79d42c4359b50bd631da8e 100644 (file)
@@ -105,7 +105,6 @@ class VompClient
     //void cleanConfig();
 
 #ifndef VOMPSTANDALONE
-    cChannel* channelFromNumber(ULONG channelNumber);
     void writeResumeData();
 
     MVPReceiver* lp;
index 8cea99ad8cccb850876826bea7147aa64fbf0ae4..31dc82cd1c980cd44a36c80f0f9a071eb7994c05 100644 (file)
@@ -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);