[SCM] kodi-pvr-hts/master: factor out the various status structs to separate files under the tvheadend::status namespace

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


The following commit has been merged in the master branch:
commit e22dacbebd3f281de726bfbe44cf741937ab5a1d
Author: Sam Stenvall <sam.stenvall at nordsoftware.com>
Date:   Fri Oct 9 15:27:01 2015 +0300

    factor out the various status structs to separate files under the
    tvheadend::status namespace

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0d18327..98cdda1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -49,11 +49,18 @@ set(HTS_SOURCES_TVHEADEND_ENTITY
                 src/tvheadend/entity/TimeRecording.h
                 src/tvheadend/entity/TimeRecording.cpp)
 
+set(HTS_SOURCES_TVHEADEND_STATUS
+        src/tvheadend/status/Quality.h
+        src/tvheadend/status/QueueStatus.h
+        src/tvheadend/status/SourceInfo.h
+        src/tvheadend/status/TimeshiftStatus.h)
+
 set(HTS_SOURCES_TVHEADEND_UTILITIES
 				src/tvheadend/utilities/Utilities.h)
                 
 source_group("Source Files" FILES ${HTS_SOURCES})
 source_group("Source Files\\tvheadend\\entity" FILES ${HTS_SOURCES_TVHEADEND_ENTITY})
+source_group("Source Files\\tvheadend\\status" FILES ${HTS_SOURCES_TVHEADEND_STATUS})
 source_group("Source Files\\tvheadend\\utilities" FILES ${HTS_SOURCES_TVHEADEND_UTILITIES})
 
 # Resource files
diff --git a/src/HTSPTypes.h b/src/HTSPTypes.h
index 385b0d4..3125d98 100644
--- a/src/HTSPTypes.h
+++ b/src/HTSPTypes.h
@@ -73,86 +73,6 @@ enum eSubscriptionWeight {
   SUBSCRIPTION_WEIGHT_SERVERCONF = 0,
 };
 
-struct SQueueStatus
-{
-  uint32_t packets; // Number of data packets in queue.
-  uint32_t bytes;   // Number of bytes in queue.
-  uint32_t delay;   // Estimated delay of queue (in µs)
-  uint32_t bdrops;  // Number of B-frames dropped
-  uint32_t pdrops;  // Number of P-frames dropped
-  uint32_t idrops;  // Number of I-frames dropped
-
-  SQueueStatus() :
-    packets(0),
-    bytes  (0),
-    delay  (0),
-    bdrops (0),
-    pdrops (0),
-    idrops (0)
-  {
-  }
-};
-
-struct STimeshiftStatus
-{
-  bool    full;
-  int64_t shift;
-  int64_t start;
-  int64_t end;
-  
-  STimeshiftStatus() :
-    full (0),
-    shift(0),
-    start(0),
-    end  (0)
-  {
-  }
-};
-
-struct SQuality
-{
-  std::string fe_status;
-  uint32_t fe_snr;
-  uint32_t fe_signal;
-  uint32_t fe_ber;
-  uint32_t fe_unc;
-  
-  SQuality() :
-    fe_snr   (0),
-    fe_signal(0),
-    fe_ber   (0),
-    fe_unc   (0)
-  {
-  }
-
-  void Clear ()
-  {
-    fe_status.clear();
-    fe_snr    = 0;
-    fe_signal = 0;
-    fe_ber    = 0;
-    fe_unc    = 0;
-  }
-};
-
-struct SSourceInfo
-{
-  std::string si_adapter;
-  std::string si_network;
-  std::string si_mux;
-  std::string si_provider;
-  std::string si_service;
-
-  void Clear ()
-  {
-    si_adapter.clear();
-    si_network.clear();
-    si_mux.clear();
-    si_provider.clear();
-    si_service.clear();
-  }
-};
-
 struct SHTSPEvent
 {
   eHTSPEventType m_type;
diff --git a/src/Tvheadend.h b/src/Tvheadend.h
index 98334e0..69163c7 100644
--- a/src/Tvheadend.h
+++ b/src/Tvheadend.h
@@ -37,6 +37,9 @@
 #include "tvheadend/entity/Recording.h"
 #include "tvheadend/entity/Event.h"
 #include "tvheadend/entity/Schedule.h"
+#include "tvheadend/status/Quality.h"
+#include "tvheadend/status/SourceInfo.h"
+#include "tvheadend/status/TimeshiftStatus.h"
 #include "TimeRecordings.h"
 #include "AutoRecordings.h"
 #include <map>
@@ -286,9 +289,9 @@ private:
   std::map<int,int>                       m_streamStat;
   int64_t                                 m_seekTime;
   PLATFORM::CCondition<volatile int64_t>  m_seekCond;
-  SSourceInfo                             m_sourceInfo;
-  SQuality                                m_signalInfo;
-  STimeshiftStatus                        m_timeshiftStatus;
+  tvheadend::status::SourceInfo           m_sourceInfo;
+  tvheadend::status::Quality              m_signalInfo;
+  tvheadend::status::TimeshiftStatus      m_timeshiftStatus;
   SSubscription                           m_subscription;
   time_t                                  m_lastUse;
   
diff --git a/src/tvheadend/entity/Entity.h b/src/tvheadend/status/Quality.h
similarity index 54%
copy from src/tvheadend/entity/Entity.h
copy to src/tvheadend/status/Quality.h
index 5c624b4..34899b4 100644
--- a/src/tvheadend/entity/Entity.h
+++ b/src/tvheadend/status/Quality.h
@@ -1,8 +1,8 @@
 #pragma once
 
 /*
- *      Copyright (C) 2005-2011 Team XBMC
- *      http://www.xbmc.org
+ *      Copyright (C) 2005-2015 Team Kodi
+ *      http://kodi.tv
  *
  *  This Program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -21,61 +21,65 @@
  *
  */
 
-#include <cstdint>
+#include <string>
 
 namespace tvheadend
 {
-  namespace entity
+  namespace status
   {
-
     /**
-     * Abstract entity. An entity can be dirty or clean and has a numeric ID.
+     * Represents the current signal quality
      */
-    class Entity
+    struct Quality
     {
-    public:
-      Entity() : m_dirty(false), m_id(0) {};
-      virtual ~Entity() = default;
 
       /**
-       * @return if the entity is dirty
+       * Frontend status
        */
-      virtual bool IsDirty() const
-      {
-        return m_dirty;
-      }
+      std::string fe_status;
 
       /**
-       * Marks the entity as dirty or not
-       * @param dirty
+       * Signal to noise ratio
        */
-      virtual void SetDirty(bool dirty)
-      {
-        m_dirty = dirty;
-      }
+      uint32_t fe_snr;
+
+      /**
+       * Signal status percentage
+       */
+      uint32_t fe_signal;
 
       /**
-       * @return the entity ID
+       * Bit error rate
        */
-      uint32_t GetId() const
+      uint32_t fe_ber;
+
+      /**
+       * Uncorrected blocks
+       */
+      uint32_t fe_unc;
+
+      /**
+       * Constructor
+       */
+      Quality() :
+          fe_snr(0),
+          fe_signal(0),
+          fe_ber(0),
+          fe_unc(0)
       {
-        return m_id;
       }
 
       /**
-       * Sets the entity ID
-       * @param id
+       * Clears the current status
        */
-      void SetId(uint32_t id)
+      void Clear()
       {
-        m_id = id;
+        fe_status.clear();
+        fe_snr = 0;
+        fe_signal = 0;
+        fe_ber = 0;
+        fe_unc = 0;
       }
-
-    protected:
-      uint32_t m_id;
-
-    private:
-      bool m_dirty;
     };
   }
 }
diff --git a/src/tvheadend/entity/Entity.h b/src/tvheadend/status/QueueStatus.h
similarity index 51%
copy from src/tvheadend/entity/Entity.h
copy to src/tvheadend/status/QueueStatus.h
index 5c624b4..ac39535 100644
--- a/src/tvheadend/entity/Entity.h
+++ b/src/tvheadend/status/QueueStatus.h
@@ -1,8 +1,8 @@
 #pragma once
 
 /*
- *      Copyright (C) 2005-2011 Team XBMC
- *      http://www.xbmc.org
+ *      Copyright (C) 2005-2015 Team Kodi
+ *      http://kodi.tv
  *
  *  This Program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -21,61 +21,55 @@
  *
  */
 
-#include <cstdint>
-
-namespace tvheadend
-{
-  namespace entity
-  {
-
+namespace tvheadend {
+  namespace status {
     /**
-     * Abstract entity. An entity can be dirty or clean and has a numeric ID.
+     * Represents the current demuxer packet queue
      */
-    class Entity
+    struct QueueStatus
     {
-    public:
-      Entity() : m_dirty(false), m_id(0) {};
-      virtual ~Entity() = default;
+      /**
+       * Number of data packets in queue
+       */
+      uint32_t packets;
 
       /**
-       * @return if the entity is dirty
+       * Number of bytes in queue.
        */
-      virtual bool IsDirty() const
-      {
-        return m_dirty;
-      }
+      uint32_t bytes;
 
       /**
-       * Marks the entity as dirty or not
-       * @param dirty
+       * Estimated delay of queue (in µs)
        */
-      virtual void SetDirty(bool dirty)
-      {
-        m_dirty = dirty;
-      }
+      uint32_t delay;
 
       /**
-       * @return the entity ID
+       * Number of B-frames dropped
        */
-      uint32_t GetId() const
-      {
-        return m_id;
-      }
+      uint32_t bdrops;
 
       /**
-       * Sets the entity ID
-       * @param id
+       * Number of P-frames dropped
        */
-      void SetId(uint32_t id)
-      {
-        m_id = id;
-      }
+      uint32_t pdrops;
 
-    protected:
-      uint32_t m_id;
+      /**
+       * Number of I-frames dropped
+       */
+      uint32_t idrops;
 
-    private:
-      bool m_dirty;
+      /**
+       * Constructor
+       */
+      QueueStatus() :
+          packets(0),
+          bytes(0),
+          delay(0),
+          bdrops(0),
+          pdrops(0),
+          idrops(0)
+      {
+      }
     };
   }
 }
diff --git a/src/tvheadend/entity/Entity.h b/src/tvheadend/status/SourceInfo.h
similarity index 53%
copy from src/tvheadend/entity/Entity.h
copy to src/tvheadend/status/SourceInfo.h
index 5c624b4..611e757 100644
--- a/src/tvheadend/entity/Entity.h
+++ b/src/tvheadend/status/SourceInfo.h
@@ -1,8 +1,8 @@
 #pragma once
 
 /*
- *      Copyright (C) 2005-2011 Team XBMC
- *      http://www.xbmc.org
+ *      Copyright (C) 2005-2015 Team Kodi
+ *      http://kodi.tv
  *
  *  This Program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -21,61 +21,53 @@
  *
  */
 
-#include <cstdint>
+#include <string>
 
 namespace tvheadend
 {
-  namespace entity
+  namespace status
   {
-
     /**
-     * Abstract entity. An entity can be dirty or clean and has a numeric ID.
+     * Represents information about the current service
      */
-    class Entity
+    struct SourceInfo
     {
-    public:
-      Entity() : m_dirty(false), m_id(0) {};
-      virtual ~Entity() = default;
+      /**
+       * The current adapter used
+       */
+      std::string si_adapter;
 
       /**
-       * @return if the entity is dirty
+       * The network
        */
-      virtual bool IsDirty() const
-      {
-        return m_dirty;
-      }
+      std::string si_network;
 
       /**
-       * Marks the entity as dirty or not
-       * @param dirty
+       * The mux
        */
-      virtual void SetDirty(bool dirty)
-      {
-        m_dirty = dirty;
-      }
+      std::string si_mux;
 
       /**
-       * @return the entity ID
+       * The service provider
        */
-      uint32_t GetId() const
-      {
-        return m_id;
-      }
+      std::string si_provider;
 
       /**
-       * Sets the entity ID
-       * @param id
+       * The service name
        */
-      void SetId(uint32_t id)
+      std::string si_service;
+
+      /**
+       * Clears the current status
+       */
+      void Clear()
       {
-        m_id = id;
+        si_adapter.clear();
+        si_network.clear();
+        si_mux.clear();
+        si_provider.clear();
+        si_service.clear();
       }
-
-    protected:
-      uint32_t m_id;
-
-    private:
-      bool m_dirty;
     };
   }
 }
diff --git a/src/tvheadend/utilities/Utilities.h b/src/tvheadend/status/TimeshiftStatus.h
similarity index 56%
copy from src/tvheadend/utilities/Utilities.h
copy to src/tvheadend/status/TimeshiftStatus.h
index fed8100..173080e 100644
--- a/src/tvheadend/utilities/Utilities.h
+++ b/src/tvheadend/status/TimeshiftStatus.h
@@ -1,8 +1,8 @@
 #pragma once
 
 /*
- *      Copyright (C) 2005-2011 Team XBMC
- *      http://www.xbmc.org
+ *      Copyright (C) 2005-2015 Team Kodi
+ *      http://kodi.tv
  *
  *  This Program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -23,22 +23,43 @@
 
 namespace tvheadend
 {
-  namespace utilities
+  namespace status
   {
-
     /**
-     * std::remove_if() for maps. Borrowed from:
-     * http://stackoverflow.com/questions/800955/remove-if-equivalent-for-stdmap
+     * Represents the current timeshift status
      */
-    template< typename ContainerT, typename PredicateT >
-    void erase_if(ContainerT& items, const PredicateT& predicate)
+    struct TimeshiftStatus
     {
-      for (auto it = items.begin(); it != items.end();)
+
+      /**
+       * Whether the buffer is full or not
+       */
+      bool full;
+
+      /**
+       * Current position relative to live
+       */
+      int64_t shift;
+
+      /**
+       * PTS of the first frame in the buffer
+       */
+      int64_t start;
+
+      /**
+       * PTS of the last frame in the buffer
+       */
+      int64_t end;
+
+      /**
+       * Constructor
+       */
+      TimeshiftStatus() :
+          full(0),
+          shift(0),
+          start(0),
+          end(0)
       {
-        if (predicate(*it))
-          it = items.erase(it);
-        else
-          ++it;
       }
     };
   }

-- 
kodi-pvr-hts packaging



More information about the pkg-multimedia-commits mailing list