From 5aaf171deb1e31c7e3df173d109eb114499e5f45 Mon Sep 17 00:00:00 2001
From: "h.udo" <hudokkow@gmail.com>
Date: Wed, 6 Jan 2016 15:08:54 +0000
Subject: [PATCH 1/2] [src] Update to p8-platform

---
 src/categories.cpp                         |  2 +-
 src/cppmyth/MythScheduleHelper75.cpp       |  2 +-
 src/cppmyth/MythScheduleHelperNoHelper.cpp | 10 +++++-----
 src/cppmyth/MythScheduleHelperNoHelper.h   |  2 +-
 src/cppmyth/MythScheduleManager.cpp        |  2 +-
 src/cppmyth/MythScheduleManager.h          |  4 ++--
 src/demux.cpp                              |  4 ++--
 src/demux.h                                | 12 ++++++------
 src/demuxer/tsDemuxer.cpp                  | 26 +++++++++++++-------------
 src/demuxer/tsDemuxer.h                    |  4 ++--
 src/fileOps.cpp                            |  2 +-
 src/fileOps.h                              |  8 ++++----
 src/filestreaming.cpp                      |  2 +-
 src/pvrclient-mythtv.cpp                   |  2 +-
 src/pvrclient-mythtv.h                     |  8 ++++----
 src/tools.h                                |  2 +-
 16 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/src/categories.cpp b/src/categories.cpp
index 1a10f9c..03d1867 100644
--- a/src/categories.cpp
+++ b/src/categories.cpp
@@ -22,7 +22,7 @@
 
 #include "categories.h"
 #include "client.h"
-#include <platform/os.h>
+#include <p8-platform/os.h>
 
 #define CATEGORIES_FILENAME       "eit_categories.txt"
 #define CATEGORIES_MAXLINESIZE    255
diff --git a/src/cppmyth/MythScheduleHelper75.cpp b/src/cppmyth/MythScheduleHelper75.cpp
index 58f0a87..be8beb9 100644
--- a/src/cppmyth/MythScheduleHelper75.cpp
+++ b/src/cppmyth/MythScheduleHelper75.cpp
@@ -34,7 +34,7 @@ using namespace ADDON;
 
 MythTimerTypeList MythScheduleHelper75::GetTimerTypes() const
 {
-  PLATFORM::CLockObject lock(m_lock);
+  P8PLATFORM::CLockObject lock(m_lock);
   if (!m_timerTypeListInit)
   {
     m_timerTypeListInit = true;
diff --git a/src/cppmyth/MythScheduleHelperNoHelper.cpp b/src/cppmyth/MythScheduleHelperNoHelper.cpp
index 26358fc..751b895 100644
--- a/src/cppmyth/MythScheduleHelperNoHelper.cpp
+++ b/src/cppmyth/MythScheduleHelperNoHelper.cpp
@@ -40,7 +40,7 @@ MythScheduleHelperNoHelper::MythScheduleHelperNoHelper()
 
 MythTimerTypeList MythScheduleHelperNoHelper::GetTimerTypes() const
 {
-  PLATFORM::CLockObject lock(m_lock);
+  P8PLATFORM::CLockObject lock(m_lock);
   return m_timerTypeList;
 }
 
@@ -103,7 +103,7 @@ static inline uint32_t expiration_key(const MythScheduleHelperNoHelper::RuleExpi
 
 int MythScheduleHelperNoHelper::GetRuleExpirationId(const RuleExpiration& expiration) const
 {
-  PLATFORM::CLockObject lock(m_lock);
+  P8PLATFORM::CLockObject lock(m_lock);
   if (!m_expirationByKeyInit)
   {
     m_expirationByKeyInit = true;
@@ -119,7 +119,7 @@ int MythScheduleHelperNoHelper::GetRuleExpirationId(const RuleExpiration& expira
 
 MythScheduleHelperNoHelper::RuleExpiration MythScheduleHelperNoHelper::GetRuleExpiration(int id) const
 {
-  PLATFORM::CLockObject lock(m_lock);
+  P8PLATFORM::CLockObject lock(m_lock);
   static RuleExpiration _empty(false, 0, false);
   RuleExpirationMap::const_iterator it = GetRuleExpirationMap().find(id);
   if (it != m_expirationMap.end())
@@ -129,7 +129,7 @@ MythScheduleHelperNoHelper::RuleExpiration MythScheduleHelperNoHelper::GetRuleEx
 
 int MythScheduleHelperNoHelper::GetRuleRecordingGroupId(const std::string& name) const
 {
-  PLATFORM::CLockObject lock(m_lock);
+  P8PLATFORM::CLockObject lock(m_lock);
   if (!m_recGroupByNameInit)
   {
     m_recGroupByNameInit = true;
@@ -145,7 +145,7 @@ int MythScheduleHelperNoHelper::GetRuleRecordingGroupId(const std::string& name)
 
 std::string MythScheduleHelperNoHelper::GetRuleRecordingGroupName(int id) const
 {
-  PLATFORM::CLockObject lock(m_lock);
+  P8PLATFORM::CLockObject lock(m_lock);
   static std::string _empty = "";
   if (!m_recGroupByIdInit)
   {
diff --git a/src/cppmyth/MythScheduleHelperNoHelper.h b/src/cppmyth/MythScheduleHelperNoHelper.h
index 686c770..e3ec012 100644
--- a/src/cppmyth/MythScheduleHelperNoHelper.h
+++ b/src/cppmyth/MythScheduleHelperNoHelper.h
@@ -73,7 +73,7 @@ class MythScheduleHelperNoHelper : public MythScheduleManager::VersionHelper
   virtual const MythTimerType::AttributeList& GetRuleExpirationNameList() const;
   virtual const MythTimerType::AttributeList& GetRuleRecordingGroupList() const;
 
-  mutable PLATFORM::CMutex m_lock;
+  mutable P8PLATFORM::CMutex m_lock;
 
   mutable bool                            m_timerTypeListInit;
   mutable MythTimerTypeList               m_timerTypeList;
diff --git a/src/cppmyth/MythScheduleManager.cpp b/src/cppmyth/MythScheduleManager.cpp
index 3381496..7466ac6 100644
--- a/src/cppmyth/MythScheduleManager.cpp
+++ b/src/cppmyth/MythScheduleManager.cpp
@@ -32,7 +32,7 @@
 #include <math.h>
 
 using namespace ADDON;
-using namespace PLATFORM;
+using namespace P8PLATFORM;
 
 enum
 {
diff --git a/src/cppmyth/MythScheduleManager.h b/src/cppmyth/MythScheduleManager.h
index 00b0b6b..3106c2d 100644
--- a/src/cppmyth/MythScheduleManager.h
+++ b/src/cppmyth/MythScheduleManager.h
@@ -26,7 +26,7 @@
 #include "MythChannel.h"
 
 #include <kodi/xbmc_pvr_types.h>
-#include <platform/threads/mutex.h>
+#include <p8-platform/threads/mutex.h>
 
 #include <vector>
 #include <list>
@@ -209,7 +209,7 @@ class MythScheduleManager
   static uint32_t MakeIndex(const MythRecordingRule& rule);
 
 private:
-  mutable PLATFORM::CMutex m_lock;
+  mutable P8PLATFORM::CMutex m_lock;
   Myth::Control *m_control;
 
   int m_protoVersion;
diff --git a/src/demux.cpp b/src/demux.cpp
index 452f786..98243fb 100644
--- a/src/demux.cpp
+++ b/src/demux.cpp
@@ -20,7 +20,7 @@
  *
  */
 
-#include <platform/os.h>
+#include <p8-platform/os.h>
 #include <kodi/libXBMC_pvr.h>
 #include <kodi/xbmc_codec_types.h>
 
@@ -34,7 +34,7 @@
 #define READAV_TIMEOUT          10000                     // 10 secs
 
 using namespace ADDON;
-using namespace PLATFORM;
+using namespace P8PLATFORM;
 
 void DemuxLog(int level, char *msg)
 {
diff --git a/src/demux.h b/src/demux.h
index f86e27a..b84c1bc 100644
--- a/src/demux.h
+++ b/src/demux.h
@@ -25,9 +25,9 @@
 #include "client.h"
 
 #include <mythstream.h>
-#include <platform/threads/threads.h>
-#include <platform/threads/mutex.h>
-#include <platform/util/buffer.h>
+#include <p8-platform/threads/threads.h>
+#include <p8-platform/threads/mutex.h>
+#include <p8-platform/util/buffer.h>
 #include <kodi/xbmc_stream_utils.hpp>
 
 #include <map>
@@ -35,7 +35,7 @@
 
 #define AV_BUFFER_SIZE          131072
 
-class Demux : public TSDemux::TSDemuxer, PLATFORM::CThread
+class Demux : public TSDemux::TSDemuxer, P8PLATFORM::CThread
 {
 public:
   Demux(Myth::Stream *file);
@@ -56,8 +56,8 @@ class Demux : public TSDemux::TSDemuxer, PLATFORM::CThread
 private:
   Myth::Stream *m_file;
   uint16_t m_channel;
-  PLATFORM::SyncedBuffer<DemuxPacket*> m_demuxPacketBuffer;
-  PLATFORM::CMutex m_mutex;
+  P8PLATFORM::SyncedBuffer<DemuxPacket*> m_demuxPacketBuffer;
+  P8PLATFORM::CMutex m_mutex;
   ADDON::XbmcStreamProperties m_streams;
 
   bool get_stream_data(TSDemux::STREAM_PKT* pkt);
diff --git a/src/demuxer/tsDemuxer.cpp b/src/demuxer/tsDemuxer.cpp
index 00e40c1..fc283a8 100644
--- a/src/demuxer/tsDemuxer.cpp
+++ b/src/demuxer/tsDemuxer.cpp
@@ -56,7 +56,7 @@ AVContext::AVContext(TSDemuxer* const demux, uint64_t pos, uint16_t channel)
 
 void AVContext::Reset(void)
 {
-  PLATFORM::CLockObject lock(mutex);
+  P8PLATFORM::CLockObject lock(mutex);
 
   pid = 0xffff;
   transport_error = false;
@@ -75,7 +75,7 @@ uint16_t AVContext::GetPID() const
 
 PACKET_TYPE AVContext::GetPIDType() const
 {
-  PLATFORM::CLockObject lock(mutex);
+  P8PLATFORM::CLockObject lock(mutex);
 
   if (packet)
     return packet->packet_type;
@@ -84,7 +84,7 @@ PACKET_TYPE AVContext::GetPIDType() const
 
 uint16_t AVContext::GetPIDChannel() const
 {
-  PLATFORM::CLockObject lock(mutex);
+  P8PLATFORM::CLockObject lock(mutex);
 
   if (packet)
     return packet->channel;
@@ -93,7 +93,7 @@ uint16_t AVContext::GetPIDChannel() const
 
 bool AVContext::HasPIDStreamData() const
 {
-  PLATFORM::CLockObject lock(mutex);
+  P8PLATFORM::CLockObject lock(mutex);
 
   // PES packets append frame buffer of elementary stream until next start of unit
   // On new unit start, flag is held
@@ -109,7 +109,7 @@ bool AVContext::HasPIDPayload() const
 
 ElementaryStream* AVContext::GetPIDStream()
 {
-  PLATFORM::CLockObject lock(mutex);
+  P8PLATFORM::CLockObject lock(mutex);
 
   if (packet && packet->packet_type == PACKET_TYPE_PES)
     return packet->stream;
@@ -118,7 +118,7 @@ ElementaryStream* AVContext::GetPIDStream()
 
 std::vector<ElementaryStream*> AVContext::GetStreams()
 {
-  PLATFORM::CLockObject lock(mutex);
+  P8PLATFORM::CLockObject lock(mutex);
 
   std::vector<ElementaryStream*> v;
   for (std::map<uint16_t, Packet>::iterator it = packets.begin(); it != packets.end(); ++it)
@@ -129,7 +129,7 @@ std::vector<ElementaryStream*> AVContext::GetStreams()
 
 void AVContext::StartStreaming(uint16_t pid)
 {
-  PLATFORM::CLockObject lock(mutex);
+  P8PLATFORM::CLockObject lock(mutex);
 
   std::map<uint16_t, Packet>::iterator it = packets.find(pid);
   if (it != packets.end())
@@ -138,7 +138,7 @@ void AVContext::StartStreaming(uint16_t pid)
 
 void AVContext::StopStreaming(uint16_t pid)
 {
-  PLATFORM::CLockObject lock(mutex);
+  P8PLATFORM::CLockObject lock(mutex);
 
   std::map<uint16_t, Packet>::iterator it = packets.find(pid);
   if (it != packets.end())
@@ -147,7 +147,7 @@ void AVContext::StopStreaming(uint16_t pid)
 
 ElementaryStream* AVContext::GetStream(uint16_t pid) const
 {
-  PLATFORM::CLockObject lock(mutex);
+  P8PLATFORM::CLockObject lock(mutex);
 
   std::map<uint16_t, Packet>::const_iterator it = packets.find(pid);
   if (it != packets.end())
@@ -157,7 +157,7 @@ ElementaryStream* AVContext::GetStream(uint16_t pid) const
 
 uint16_t AVContext::GetChannel(uint16_t pid) const
 {
-  PLATFORM::CLockObject lock(mutex);
+  P8PLATFORM::CLockObject lock(mutex);
 
   std::map<uint16_t, Packet>::const_iterator it = packets.find(pid);
   if (it != packets.end())
@@ -167,7 +167,7 @@ uint16_t AVContext::GetChannel(uint16_t pid) const
 
 void AVContext::ResetPackets()
 {
-  PLATFORM::CLockObject lock(mutex);
+  P8PLATFORM::CLockObject lock(mutex);
 
   for (std::map<uint16_t, Packet>::iterator it = packets.begin(); it != packets.end(); ++it)
   {
@@ -391,7 +391,7 @@ uint64_t AVContext::GetPosition() const
  */
 int AVContext::ProcessTSPacket()
 {
-  PLATFORM::CLockObject lock(mutex);
+  P8PLATFORM::CLockObject lock(mutex);
 
   int ret = AVCONTEXT_CONTINUE;
   std::map<uint16_t, Packet>::iterator it;
@@ -516,7 +516,7 @@ int AVContext::ProcessTSPacket()
  */
 int AVContext::ProcessTSPayload()
 {
-  PLATFORM::CLockObject lock(mutex);
+  P8PLATFORM::CLockObject lock(mutex);
 
   if (!this->packet)
     return AVCONTEXT_CONTINUE;
diff --git a/src/demuxer/tsDemuxer.h b/src/demuxer/tsDemuxer.h
index 2efbb58..ebb779e 100644
--- a/src/demuxer/tsDemuxer.h
+++ b/src/demuxer/tsDemuxer.h
@@ -24,7 +24,7 @@
 
 #include "tsPacket.h"
 #include "elementaryStream.h"
-#include <platform/threads/mutex.h>
+#include <p8-platform/threads/mutex.h>
 
 #include <map>
 #include <vector>
@@ -102,7 +102,7 @@ namespace TSDemux
     int parse_ts_pes();
 
     // Critical section
-    mutable PLATFORM::CMutex mutex;
+    mutable P8PLATFORM::CMutex mutex;
 
     // AV stream owner
     TSDemuxer* m_demux;
diff --git a/src/fileOps.cpp b/src/fileOps.cpp
index 80d6462..71a71f9 100644
--- a/src/fileOps.cpp
+++ b/src/fileOps.cpp
@@ -34,7 +34,7 @@
 #define FILEOPS_RECORDING_DUMMY_ICON  "recording.png"
 
 using namespace ADDON;
-using namespace PLATFORM;
+using namespace P8PLATFORM;
 
 FileOps::FileOps(FileConsumer *consumer, const std::string& server, unsigned wsapiport, const std::string& wsapiSecurityPin)
 : CThread()
diff --git a/src/fileOps.h b/src/fileOps.h
index 58081f4..90c023b 100644
--- a/src/fileOps.h
+++ b/src/fileOps.h
@@ -25,7 +25,7 @@
 #include "cppmyth/MythProgramInfo.h"
 
 #include <mythwsapi.h>
-#include <platform/threads/threads.h>
+#include <p8-platform/threads/threads.h>
 
 #include <string>
 #include <vector>
@@ -39,7 +39,7 @@ class FileConsumer
   virtual void HandleCleanedCache() = 0;
 };
 
-class FileOps : public PLATFORM::CThread
+class FileOps : public P8PLATFORM::CThread
 {
 public:
   enum FileType
@@ -152,7 +152,7 @@ class FileOps : public PLATFORM::CThread
     int             m_errorCount;
   };
 
-  PLATFORM::CMutex m_lock;
-  PLATFORM::CEvent m_queueContent;
+  P8PLATFORM::CMutex m_lock;
+  P8PLATFORM::CEvent m_queueContent;
   std::list<FileOps::JobItem> m_jobQueue;
 };
diff --git a/src/filestreaming.cpp b/src/filestreaming.cpp
index d25680e..eeaa672 100644
--- a/src/filestreaming.cpp
+++ b/src/filestreaming.cpp
@@ -22,7 +22,7 @@
 
 #include "filestreaming.h"
 #include "client.h"
-#include <platform/os.h>
+#include <p8-platform/os.h>
 
 #define MAX_READ_SIZE  131072
 
diff --git a/src/pvrclient-mythtv.cpp b/src/pvrclient-mythtv.cpp
index 5901d55..f0ed353 100644
--- a/src/pvrclient-mythtv.cpp
+++ b/src/pvrclient-mythtv.cpp
@@ -31,7 +31,7 @@
 #include <cassert>
 
 using namespace ADDON;
-using namespace PLATFORM;
+using namespace P8PLATFORM;
 
 PVRClientMythTV::PVRClientMythTV()
 : m_connectionError(CONN_ERROR_NO_ERROR)
diff --git a/src/pvrclient-mythtv.h b/src/pvrclient-mythtv.h
index e9efc64..561fee3 100644
--- a/src/pvrclient-mythtv.h
+++ b/src/pvrclient-mythtv.h
@@ -28,7 +28,7 @@
 #include "filestreaming.h"
 
 #include <kodi/xbmc_pvr_types.h>
-#include <platform/threads/mutex.h>
+#include <p8-platform/threads/mutex.h>
 #include <mythsharedptr.h>
 #include <mythcontrol.h>
 #include <mytheventhandler.h>
@@ -162,7 +162,7 @@ class PVRClientMythTV : public Myth::EventSubscriber, FileConsumer
   // Backend
   FileOps *m_fileOps;
   MythScheduleManager *m_scheduleManager;
-  PLATFORM::CMutex m_lock;
+  P8PLATFORM::CMutex m_lock;
 
   // Categories
   Categories m_categories;
@@ -182,7 +182,7 @@ class PVRClientMythTV : public Myth::EventSubscriber, FileConsumer
   PVRChannelGroupMap m_PVRChannelGroups;
   typedef std::map<unsigned int, unsigned int> PVRChannelMap;
   PVRChannelMap m_PVRChannelUidById;
-  mutable PLATFORM::CMutex m_channelsLock;
+  mutable P8PLATFORM::CMutex m_channelsLock;
   int FillChannelsAndChannelGroups();
   MythChannel FindChannel(uint32_t channelId) const;
   int FindPVRChannelUid(uint32_t channelId) const;
@@ -192,7 +192,7 @@ class PVRClientMythTV : public Myth::EventSubscriber, FileConsumer
 
   // Recordings
   ProgramInfoMap m_recordings;
-  mutable PLATFORM::CMutex m_recordingsLock;
+  mutable P8PLATFORM::CMutex m_recordingsLock;
   unsigned m_recordingChangePinCount;
   bool m_recordingsAmountChange;
   int m_recordingsAmount;
diff --git a/src/tools.h b/src/tools.h
index 45666bf..7ad3af9 100644
--- a/src/tools.h
+++ b/src/tools.h
@@ -21,7 +21,7 @@
  *
  */
 
-#include <platform/os.h>
+#include <p8-platform/os.h>
 #include <math.h>
 
 #ifdef __WINDOWS__

From 960830c023c74b54883ed558763275877088be90 Mon Sep 17 00:00:00 2001
From: "h.udo" <hudokkow@gmail.com>
Date: Wed, 6 Jan 2016 15:21:40 +0000
Subject: [PATCH 2/2] [cmake] Update to p8-platform

---
 CMakeLists.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 79d1b98..95fdbbb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,10 +9,10 @@ enable_language(C)
 
 find_package(kodi REQUIRED)
 find_package(kodiplatform REQUIRED)
-find_package(platform REQUIRED)
+find_package(p8-platform REQUIRED)
 
 include_directories(${kodiplatform_INCLUDE_DIRS}
-                    ${platform_INCLUDE_DIRS}
+                    ${p8-platform_INCLUDE_DIRS}
                     ${KODI_INCLUDE_DIR}
                     ${PROJECT_SOURCE_DIR}/lib/cppmyth/src)
 
@@ -54,7 +54,7 @@ set(MYTHTV_SOURCES src/avinfo.cpp
 
 add_subdirectory(lib/cppmyth)
 
-set(DEPLIBS ${platform_LIBRARIES} cppmyth)
+set(DEPLIBS ${p8-platform_LIBRARIES} cppmyth)
 if(WIN32)
   list(APPEND DEPLIBS ws2_32)
 else()