[SCM] kodi-pvr-hts/master: pass the streaming profile to use to the demuxer so it gets used (closes #40)

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


The following commit has been merged in the master branch:
commit a8504280516506067a97cc8c34bbea3b6a298c14
Author: Sam Stenvall <sam.stenvall at nordsoftware.com>
Date:   Sun Oct 18 13:36:02 2015 +0300

    pass the streaming profile to use to the demuxer so it gets used
    (closes #40)

diff --git a/pvr.hts/changelog.txt b/pvr.hts/changelog.txt
index 5c1c6aa..e2e8cbf 100644
--- a/pvr.hts/changelog.txt
+++ b/pvr.hts/changelog.txt
@@ -1,6 +1,7 @@
 2.2.9
 - 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
 
 2.2.8
 - Updated to PVR API v4.1.0
diff --git a/src/HTSPDemuxer.cpp b/src/HTSPDemuxer.cpp
index c5f3323..ea5c98a 100644
--- a/src/HTSPDemuxer.cpp
+++ b/src/HTSPDemuxer.cpp
@@ -224,6 +224,11 @@ PVR_ERROR CHTSPDemuxer::CurrentSignal ( PVR_SIGNAL_STATUS &sig )
   return PVR_ERROR_NO_ERROR;
 }
 
+void CHTSPDemuxer::SetStreamingProfile(const std::string &profile)
+{
+  m_subscription.SetProfile(profile);
+}
+
 /* **************************************************************************
  * Parse incoming data
  * *************************************************************************/
diff --git a/src/HTSPTypes.h b/src/HTSPTypes.h
index 9771099..1b1bb2d 100644
--- a/src/HTSPTypes.h
+++ b/src/HTSPTypes.h
@@ -25,6 +25,7 @@
 #include <algorithm>
 #include <vector>
 #include <map>
+#include <string>
 #include "client.h"
 
 typedef enum {
diff --git a/src/Tvheadend.cpp b/src/Tvheadend.cpp
index 18dd9ff..4a87b11 100644
--- a/src/Tvheadend.cpp
+++ b/src/Tvheadend.cpp
@@ -165,6 +165,16 @@ bool CTvheadend::HasStreamingProfile(const std::string &streamingProfile) const
   ) != m_profiles.cend();
 }
 
+std::string CTvheadend::GetStreamingProfile() const
+{
+  std::string streamingProfile;
+
+  if (HasStreamingProfile(Settings::GetInstance().GetStreamingProfile()))
+    streamingProfile = Settings::GetInstance().GetStreamingProfile();
+
+  return streamingProfile;
+}
+
 /* **************************************************************************
  * Tags
  * *************************************************************************/
@@ -1417,6 +1427,12 @@ void CTvheadend::SyncCompleted ( void )
         QUEUE_ERROR,
         XBMC->GetLocalizedString(30502), streamingProfile.c_str());
   }
+  else
+  {
+    /* Tell each demuxer to use this profile from now on */
+    for (auto *dmx : m_dmx)
+      dmx->SetStreamingProfile(streamingProfile);
+  }
 }
 
 void CTvheadend::SyncChannelsCompleted ( void )
diff --git a/src/Tvheadend.h b/src/Tvheadend.h
index aa1ab2c..76b5d73 100644
--- a/src/Tvheadend.h
+++ b/src/Tvheadend.h
@@ -284,6 +284,12 @@ public:
     return 0;
   }
 
+  /**
+   * Tells each demuxer to use the specified profile for new subscriptions
+   * @param profile the profile to use
+   */
+  void SetStreamingProfile(const std::string &profile);
+
 private:
   PLATFORM::CMutex                        m_mutex;
   CHTSPConnection                        &m_conn;
@@ -422,6 +428,12 @@ private:
   bool HasStreamingProfile(const std::string &streamingProfile) const;
 
   /**
+   * @return the streaming profile to use for new subscriptions, or an
+   *         empty string if no particular profile should be used
+   */
+  std::string GetStreamingProfile() const;
+
+  /**
    * The streaming profiles available on the server
    */
   tvheadend::Profiles         m_profiles;
diff --git a/src/tvheadend/Subscription.cpp b/src/tvheadend/Subscription.cpp
index 9c94ad6..f08d4a8 100644
--- a/src/tvheadend/Subscription.cpp
+++ b/src/tvheadend/Subscription.cpp
@@ -101,6 +101,18 @@ void Subscription::SetState(eSubsriptionState state)
   m_state = state;
 }
 
+std::string Subscription::GetProfile() const
+{
+  CLockObject lock(m_mutex);
+  return m_profile;
+}
+
+void Subscription::SetProfile(const std::string &profile)
+{
+  CLockObject lock(m_mutex);
+  m_profile = profile;
+}
+
 void Subscription::SendSubscribe(uint32_t channelId, uint32_t weight, bool restart)
 {
   /* We don't want to change anything when restarting a subscription */
@@ -120,6 +132,11 @@ void Subscription::SendSubscribe(uint32_t channelId, uint32_t weight, bool resta
   htsmsg_add_u32(m, "timeshiftPeriod", static_cast<uint32_t>(~0));
   htsmsg_add_u32(m, "normts",          1);
   htsmsg_add_u32(m, "queueDepth",      PACKET_QUEUE_DEPTH);
+
+  /* Use the specified profile if it has been set */
+  if (!GetProfile().empty())
+    htsmsg_add_str(m, "profile", GetProfile().c_str());
+
   tvhdebug("demux subscribe to %d",    GetChannelId());
 
   /* Send and Wait for response */
diff --git a/src/tvheadend/Subscription.h b/src/tvheadend/Subscription.h
index cea83aa..fff1b57 100644
--- a/src/tvheadend/Subscription.h
+++ b/src/tvheadend/Subscription.h
@@ -21,6 +21,7 @@
  *
  */
 
+#include <string>
 #include "platform/threads/mutex.h"
 
 extern "C"
@@ -71,6 +72,7 @@ namespace tvheadend
     uint32_t          GetWeight() const;
     int32_t           GetSpeed() const;
     eSubsriptionState GetState() const;
+    std::string       GetProfile() const;
 
     /**
      * Subscribe to a channel on the backend
@@ -78,7 +80,9 @@ namespace tvheadend
      * @param weight the desired subscription weight
      * @param restart restart the current subscription (i.e. after lost connection), other parameters will be ignored
      */
-    void SendSubscribe(uint32_t channelId = 0, uint32_t weight = SUBSCRIPTION_WEIGHT_NORMAL, bool restart = false);
+    void SendSubscribe(uint32_t channelId = 0,
+                       uint32_t weight = SUBSCRIPTION_WEIGHT_NORMAL,
+                       bool restart = false);
 
     /**
      * Unsubscribe from a channel on the backend
@@ -111,6 +115,12 @@ namespace tvheadend
      */
     void ParseSubscriptionStatus(htsmsg_t *m);
 
+    /**
+     * Use the specified profile for all new subscriptions
+     * @param profile the profile
+     */
+    void SetProfile(const std::string &profile);
+
   private:
 
     void SetId(uint32_t id);
@@ -134,6 +144,7 @@ namespace tvheadend
     uint32_t          m_weight;
     int32_t           m_speed;
     eSubsriptionState m_state;
+    std::string       m_profile;
     CHTSPConnection   &m_conn;
 
     mutable PLATFORM::CMutex  m_mutex;

-- 
kodi-pvr-hts packaging



More information about the pkg-multimedia-commits mailing list