[SCM] kodi-pvr-hts/master: Add channel content, htsp v25 addition

tiber-guest at users.alioth.debian.org tiber-guest at users.alioth.debian.org
Fri Nov 4 23:23:41 UTC 2016


The following commit has been merged in the master branch:
commit ba5de72cf6b35f850455816af7f9a18704ec9ddf
Author: Glenn-1990 <g_christiaensen at msn.com>
Date:   Wed Jun 15 10:42:09 2016 +0200

    Add channel content, htsp v25 addition

diff --git a/src/HTSPTypes.h b/src/HTSPTypes.h
index c1e49bc..23b3b7e 100644
--- a/src/HTSPTypes.h
+++ b/src/HTSPTypes.h
@@ -80,6 +80,12 @@ typedef enum {
   DVR_RET_FOREVER   = INT32_MAX     // the server should never delete this recording or database entry, only the user can do this
 } dvr_retention_t;
 
+typedef enum {
+  CHANNEL_TYPE_OTHER = 0,
+  CHANNEL_TYPE_TV    = 1,
+  CHANNEL_TYPE_RADIO = 2
+} channel_type_t;
+
 enum eHTSPEventType
 {
   HTSP_EVENT_NONE = 0,
diff --git a/src/Tvheadend.cpp b/src/Tvheadend.cpp
index d81edb5..964ebb8 100644
--- a/src/Tvheadend.cpp
+++ b/src/Tvheadend.cpp
@@ -195,7 +195,7 @@ PVR_ERROR CTvheadend::GetTags ( ADDON_HANDLE handle, bool bRadio )
       /* Does group contain channels of the requested type?             */
       /* Note: tvheadend groups can contain both radio and tv channels. */
       /*       Thus, one tvheadend group can 'map' to two Kodi groups.  */
-      if (!entry.second.ContainsChannelType(bRadio))
+      if (!entry.second.ContainsChannelType(bRadio ? CHANNEL_TYPE_RADIO : CHANNEL_TYPE_TV))
         continue;
 
       PVR_CHANNEL_GROUP tag;
@@ -245,7 +245,8 @@ PVR_ERROR CTvheadend::GetTagMembers
       {
         auto cit = m_channels.find(channelId);
 
-        if (cit != m_channels.cend() && cit->second.IsRadio() == group.bIsRadio)
+        if (cit != m_channels.cend() && cit->second.GetType() == (group.bIsRadio ?
+            CHANNEL_TYPE_RADIO : CHANNEL_TYPE_TV))
         {
           PVR_CHANNEL_GROUP_MEMBER gm;
           memset(&gm, 0, sizeof(PVR_CHANNEL_GROUP_MEMBER));
@@ -295,14 +296,14 @@ PVR_ERROR CTvheadend::GetChannels ( ADDON_HANDLE handle, bool radio )
     {
       const auto &channel = entry.second;
 
-      if (radio != channel.IsRadio())
+      if (channel.GetType() != (radio ? CHANNEL_TYPE_RADIO : CHANNEL_TYPE_TV))
         continue;
 
       PVR_CHANNEL chn;
       memset(&chn, 0 , sizeof(PVR_CHANNEL));
 
       chn.iUniqueId         = channel.GetId();
-      chn.bIsRadio          = channel.IsRadio();
+      chn.bIsRadio          = radio;
       chn.iChannelNumber    = channel.GetNum();
       chn.iSubChannelNumber = channel.GetNumMinor();
       chn.iEncryptionSystem = channel.GetCaid();
@@ -482,10 +483,22 @@ PVR_ERROR CTvheadend::GetRecordings ( ADDON_HANDLE handle )
         auto cit = m_channels.find(rec.iChannelUid);
         if (cit == m_channels.cend())
           rec.channelType = PVR_RECORDING_CHANNEL_TYPE_UNKNOWN;
-        else if (cit->second.IsRadio())
-          rec.channelType = PVR_RECORDING_CHANNEL_TYPE_RADIO;
         else
-          rec.channelType = PVR_RECORDING_CHANNEL_TYPE_TV;
+        {
+          switch (cit->second.GetType())
+          {
+            case CHANNEL_TYPE_TV:
+              rec.channelType = PVR_RECORDING_CHANNEL_TYPE_TV;
+              break;
+            case CHANNEL_TYPE_RADIO:
+              rec.channelType = PVR_RECORDING_CHANNEL_TYPE_RADIO;
+              break;
+            case CHANNEL_TYPE_OTHER:
+            default:
+              rec.channelType = PVR_RECORDING_CHANNEL_TYPE_UNKNOWN;
+              break;
+          }
+        }
       }
 
       recs.push_back(rec);
@@ -1811,17 +1824,26 @@ void CTvheadend::ParseChannelAddOrUpdate ( htsmsg_t *msg, bool bAdd )
   {
     htsmsg_field_t *f;
     uint32_t caid  = 0;
-    bool     radio = false;
     HTSMSG_FOREACH(f, list)
     {
       if (f->hmf_type != HMF_MAP)
         continue;
 
-      /* Radio? */
-      if ((str = htsmsg_get_str(&f->hmf_msg, "type")) != NULL)
+      /* Channel type */
+      if (m_conn.GetProtocol() >= 25)
       {
-        if (!strcmp(str, "Radio"))
-          radio = true;
+        if (!htsmsg_get_u32(&f->hmf_msg, "content", &u32))
+          channel.SetType(u32);
+      }
+      else
+      {
+        if ((str = htsmsg_get_str(&f->hmf_msg, "type")) != NULL)
+        {
+          if (!strcmp(str, "Radio"))
+            channel.SetType(CHANNEL_TYPE_RADIO);
+          else
+            channel.SetType(CHANNEL_TYPE_TV);
+        }
       }
 
       /* CAID */
@@ -1829,7 +1851,6 @@ void CTvheadend::ParseChannelAddOrUpdate ( htsmsg_t *msg, bool bAdd )
         htsmsg_get_u32(&f->hmf_msg, "caid", &caid);
     }
 
-    channel.SetRadio(radio);
     channel.SetCaid(caid);
   }
 
diff --git a/src/tvheadend/entity/Channel.h b/src/tvheadend/entity/Channel.h
index ed62328..dba3750 100644
--- a/src/tvheadend/entity/Channel.h
+++ b/src/tvheadend/entity/Channel.h
@@ -25,6 +25,7 @@
 #include <string>
 #include <map>
 #include "Entity.h"
+#include "../../HTSPTypes.h"
 
 namespace tvheadend
 {
@@ -44,7 +45,7 @@ namespace tvheadend
       Channel() :
         m_num(0),
         m_numMinor(0),
-        m_radio(false),
+        m_type(CHANNEL_TYPE_OTHER),
         m_caid(0)
       {
       }
@@ -59,7 +60,7 @@ namespace tvheadend
         return m_id == other.m_id &&
                m_num == other.m_num &&
                m_numMinor == other.m_numMinor &&
-               m_radio == other.m_radio &&
+               m_type == other.m_type &&
                m_caid == other.m_caid &&
                m_name == other.m_name &&
                m_icon == other.m_icon;
@@ -76,8 +77,8 @@ namespace tvheadend
       uint32_t GetNumMinor() const { return m_numMinor; }
       void SetNumMinor(uint32_t numMinor) { m_numMinor = numMinor; }
 
-      bool IsRadio() const { return m_radio; }
-      void SetRadio(bool radio) { m_radio = radio; }
+      uint32_t GetType() const { return m_type; }
+      void SetType(uint32_t type) { m_type = type; }
 
       uint32_t GetCaid() const { return m_caid; }
       void SetCaid(uint32_t caid) { m_caid = caid; }
@@ -91,10 +92,10 @@ namespace tvheadend
     private:
       uint32_t         m_num;
       uint32_t         m_numMinor;
-      bool             m_radio;
+      uint32_t         m_type;
       uint32_t         m_caid;
       std::string      m_name;
       std::string      m_icon;
     };
   }
-}
\ No newline at end of file
+}
diff --git a/src/tvheadend/entity/Tag.cpp b/src/tvheadend/entity/Tag.cpp
index 79effcf..f261365 100644
--- a/src/tvheadend/entity/Tag.cpp
+++ b/src/tvheadend/entity/Tag.cpp
@@ -21,7 +21,6 @@
 
 #include "Tag.h"
 #include "Channel.h"
-#include "../../HTSPTypes.h"
 #include "../../Tvheadend.h"
 
 using namespace tvheadend::entity;
@@ -80,7 +79,7 @@ std::vector<uint32_t>& Tag::GetChannels()
   return m_channels;
 }
 
-bool Tag::ContainsChannelType(bool bRadio) const
+bool Tag::ContainsChannelType(channel_type_t eType) const
 {
   std::vector<uint32_t>::const_iterator it;
   Channels::const_iterator cit;
@@ -90,7 +89,7 @@ bool Tag::ContainsChannelType(bool bRadio) const
   {
     if ((cit = channels.find(*it)) != channels.end())
     {
-      if (bRadio == cit->second.IsRadio())
+      if (cit->second.GetType() == eType)
         return true;
     }
   }
diff --git a/src/tvheadend/entity/Tag.h b/src/tvheadend/entity/Tag.h
index 54fa380..1792f66 100644
--- a/src/tvheadend/entity/Tag.h
+++ b/src/tvheadend/entity/Tag.h
@@ -26,6 +26,7 @@
 #include <map>
 #include <vector>
 #include "Entity.h"
+#include "../../HTSPTypes.h"
 
 namespace tvheadend
 {
@@ -57,7 +58,7 @@ namespace tvheadend
       const std::vector<uint32_t>& GetChannels() const;
       std::vector<uint32_t>& GetChannels();
 
-      bool ContainsChannelType(bool bRadio) const;
+      bool ContainsChannelType(channel_type_t eType) const;
 
     private:
       uint32_t              m_index;

-- 
kodi-pvr-hts packaging



More information about the pkg-multimedia-commits mailing list