[SCM] kodi-pvr-hts/master: Added support for oneshot timer enable/disable (HTSP v23 feature), closes #131

tiber-guest at users.alioth.debian.org tiber-guest at users.alioth.debian.org
Wed Mar 2 23:01:49 UTC 2016


The following commit has been merged in the master branch:
commit a1b0ef2fad4c6fb7b3c55ffd177d24d4783d1981
Author: Kai Sommerfeld <kai.sommerfeld at gmx.com>
Date:   Sun Sep 27 14:19:35 2015 +0200

    Added support for oneshot timer enable/disable (HTSP v23 feature), closes #131

diff --git a/pvr.hts/changelog.txt b/pvr.hts/changelog.txt
index e2e8cbf..3d787a6 100644
--- a/pvr.hts/changelog.txt
+++ b/pvr.hts/changelog.txt
@@ -2,6 +2,7 @@
 - refactored the code by factoring out lots of things into separate files
 - refactored the Settings class into a singleton to avoid having to include client.h everywhere
 - added: support for specifying which streaming profile to use
+- added: support for enabling/disabling oneshot timers (HTSP v23 and above)
 
 2.2.8
 - Updated to PVR API v4.1.0
diff --git a/src/Tvheadend.cpp b/src/Tvheadend.cpp
index 4a87b11..5f78305 100644
--- a/src/Tvheadend.cpp
+++ b/src/Tvheadend.cpp
@@ -655,7 +655,7 @@ PVR_ERROR CTvheadend::GetTimerTypes ( PVR_TIMER_TYPE types[], int *size )
     deDupValues.push_back(std::make_pair(DVR_AUTOREC_RECORD_ONCE_PER_DAY,             XBMC->GetLocalizedString(30361)));
   }
 
-  static const unsigned int TIMER_ONCE_MANUAL_ATTRIBS
+  unsigned int TIMER_ONCE_MANUAL_ATTRIBS
     = PVR_TIMER_TYPE_IS_MANUAL           |
       PVR_TIMER_TYPE_SUPPORTS_CHANNELS   |
       PVR_TIMER_TYPE_SUPPORTS_START_TIME |
@@ -663,7 +663,7 @@ PVR_ERROR CTvheadend::GetTimerTypes ( PVR_TIMER_TYPE types[], int *size )
       PVR_TIMER_TYPE_SUPPORTS_PRIORITY   |
       PVR_TIMER_TYPE_SUPPORTS_LIFETIME;
 
-  static const unsigned int TIMER_ONCE_EPG_ATTRIBS
+  unsigned int TIMER_ONCE_EPG_ATTRIBS
     = PVR_TIMER_TYPE_SUPPORTS_CHANNELS          |
       PVR_TIMER_TYPE_SUPPORTS_START_TIME        |
       PVR_TIMER_TYPE_SUPPORTS_END_TIME          |
@@ -672,6 +672,12 @@ PVR_ERROR CTvheadend::GetTimerTypes ( PVR_TIMER_TYPE types[], int *size )
       PVR_TIMER_TYPE_SUPPORTS_PRIORITY          |
       PVR_TIMER_TYPE_SUPPORTS_LIFETIME;
 
+  if (m_conn.GetProtocol() >= 23)
+  {
+    TIMER_ONCE_MANUAL_ATTRIBS |= PVR_TIMER_TYPE_SUPPORTS_ENABLE_DISABLE;
+    TIMER_ONCE_EPG_ATTRIBS    |= PVR_TIMER_TYPE_SUPPORTS_ENABLE_DISABLE;
+  }
+
   /* Timer types definition. */
   static std::vector< std::unique_ptr<TimerType> > timerTypes;
   if (timerTypes.size() == 0)
@@ -845,7 +851,14 @@ bool CTvheadend::CreateTimer ( const Recording &tvhTmr, PVR_TIMER &tmr )
           "", sizeof(tmr.strDirectory) - 1);       // n/a for one-shot timers
   strncpy(tmr.strSummary,
           tvhTmr.GetDescription().c_str(), sizeof(tmr.strSummary) - 1);
-  tmr.state              = tvhTmr.GetState();
+
+  if (m_conn.GetProtocol() >= 23)
+    tmr.state            = !tvhTmr.IsEnabled()
+                            ? PVR_TIMER_STATE_DISABLED
+                            : tvhTmr.GetState();
+  else
+    tmr.state            = tvhTmr.GetState();
+
   tmr.iPriority          = tvhTmr.GetPriority();
   tmr.iLifetime          = tvhTmr.GetRetention();
   tmr.iTimerType         = tvhTmr.GetTimerType();
@@ -877,9 +890,7 @@ PVR_ERROR CTvheadend::GetTimers ( ADDON_HANDLE handle )
   {
     CLockObject lock(m_mutex);
 
-    /*
-     * One-shot timers
-     */
+    /* One-shot timers */
     for (const auto &entry : m_recordings)
     {
       const auto &recording = entry.second;
@@ -944,6 +955,9 @@ PVR_ERROR CTvheadend::AddTimer ( const PVR_TIMER &timer )
       htsmsg_add_str(m, "description",  timer.strSummary);
     }
 
+    if (m_conn.GetProtocol() >= 23)
+      htsmsg_add_u32(m, "enabled",  timer.state == PVR_TIMER_STATE_DISABLED ? 0 : 1);
+
     htsmsg_add_s64(m, "startExtra", timer.iMarginStart);
     htsmsg_add_s64(m, "stopExtra",  timer.iMarginEnd);
     htsmsg_add_u32(m, "retention",  timer.iLifetime);
@@ -1047,6 +1061,9 @@ PVR_ERROR CTvheadend::UpdateTimer ( const PVR_TIMER &timer )
 
     htsmsg_add_str(m, "title",        timer.strTitle);
 
+    if (m_conn.GetProtocol() >= 23)
+      htsmsg_add_u32(m, "enabled",    timer.state == PVR_TIMER_STATE_DISABLED ? 0 : 1);
+
     int64_t start = timer.startTime;
     if (start == 0)
     {
@@ -1704,7 +1721,7 @@ void CTvheadend::ParseChannelDelete ( htsmsg_t *msg )
 void CTvheadend::ParseRecordingAddOrUpdate ( htsmsg_t *msg, bool bAdd )
 {
   const char *state, *str;
-  uint32_t id, channel, eventId, retention, priority;
+  uint32_t id, channel, eventId, retention, priority, enabled;
   int64_t start, stop, startExtra, stopExtra;
 
   /* Channels must be complete */
@@ -1811,6 +1828,8 @@ void CTvheadend::ParseRecordingAddOrUpdate ( htsmsg_t *msg, bool bAdd )
   /* Add optional fields */
   if (!htsmsg_get_u32(msg, "eventId", &eventId))
     rec.SetEventId(eventId);
+  if (!htsmsg_get_u32(msg, "enabled", &enabled))
+    rec.SetEnabled(enabled);
   if ((str = htsmsg_get_str(msg, "title")) != NULL)
     rec.SetTitle(str);
   if ((str = htsmsg_get_str(msg, "subtitle")) != NULL)
diff --git a/src/Tvheadend.h b/src/Tvheadend.h
index 76b5d73..65a896a 100644
--- a/src/Tvheadend.h
+++ b/src/Tvheadend.h
@@ -68,7 +68,7 @@ extern "C" {
  * Configuration defines
  */
 #define HTSP_MIN_SERVER_VERSION       (19) // Server must support at least this htsp version
-#define HTSP_CLIENT_VERSION           (22) // Client uses HTSP features up to this version. If the respective
+#define HTSP_CLIENT_VERSION           (23) // Client uses HTSP features up to this version. If the respective
                                            // addon feature requires htsp features introduced after
                                            // HTSP_MIN_SERVER_VERSION this feature will only be available if the
                                            // actual server HTSP version matches (runtime htsp version check).
diff --git a/src/tvheadend/entity/Recording.h b/src/tvheadend/entity/Recording.h
index d6ef4a0..8492dbd 100644
--- a/src/tvheadend/entity/Recording.h
+++ b/src/tvheadend/entity/Recording.h
@@ -52,6 +52,7 @@ namespace tvheadend
     {
     public:
       Recording() :
+        m_enabled(0),
         m_channel(0),
         m_eventId(0),
         m_start(0),
@@ -67,6 +68,7 @@ namespace tvheadend
       bool operator==(const Recording &other) const
       {
         return m_id == other.m_id &&
+               m_enabled == other.m_enabled &&
                m_channel == other.m_channel &&
                m_eventId == other.m_eventId &&
                m_start == other.m_start &&
@@ -119,6 +121,9 @@ namespace tvheadend
           return TIMER_ONCE_MANUAL;
       }
 
+      bool IsEnabled() const { return m_enabled > 0; }
+      void SetEnabled(uint32_t enabled) { m_enabled = enabled; }
+
       uint32_t GetChannel() const { return m_channel; }
       void SetChannel(uint32_t channel) { m_channel = channel; }
 
@@ -172,6 +177,7 @@ namespace tvheadend
       void SetPriority(uint32_t priority) { m_priority = priority; }
 
     private:
+      uint32_t         m_enabled;
       uint32_t         m_channel;
       uint32_t         m_eventId;
       int64_t          m_start;

-- 
kodi-pvr-hts packaging



More information about the pkg-multimedia-commits mailing list