Permalink
Browse files

Merge pull request #4717 from Montellese/platinum-logging

UPnP: enable log messages from Platinum SDK
  • Loading branch information...
2 parents cb5af37 + 215860a commit 45e2cb145358ae870ac712693862fa4ed93c4d81 @Montellese Montellese committed May 17, 2014
View
7 language/English/strings.po
@@ -2861,7 +2861,12 @@ msgctxt "#677"
msgid "Verbose logging for AirTunes library"
msgstr ""
-#empty strings from id 678 to 699
+#: xbmc/settings/AdvancedSettings.cpp
+msgctxt "#678"
+msgid "Verbose logging for UPnP components"
+msgstr ""
+
+#empty strings from id 679 to 699
msgctxt "#700"
msgid "Cleaning up library"
View
4 lib/libUPnP/Makefile.in
@@ -43,9 +43,11 @@ SRCS= Platinum/Source/Core/PltAction.cpp \
Neptune/Source/Core/NptHash.cpp \
Neptune/Source/Core/NptHttp.cpp \
Neptune/Source/Core/NptList.cpp \
+ Neptune/Source/Core/NptLogging.cpp \
Neptune/Source/Core/NptMessaging.cpp \
Neptune/Source/Core/NptNetwork.cpp \
Neptune/Source/Core/NptQueue.cpp \
+ Neptune/Source/Core/NptResults.cpp \
Neptune/Source/Core/NptRingBuffer.cpp \
Neptune/Source/Core/NptSimpleMessageQueue.cpp \
Neptune/Source/Core/NptSockets.cpp \
@@ -89,6 +91,8 @@ endif
INCLUDES=-I./Neptune/Source/Core -I./Platinum/Source/Core -I./Platinum/Source/Platinum -I./Platinum/Source/Devices/MediaConnect -I./Platinum/Source/Devices/MediaRenderer -I./Platinum/Source/Devices/MediaServer -I./Neptune/Source/System/Posix -I./Platinum/Source/Extras
+CXXFLAGS+=-DNPT_CONFIG_ENABLE_LOGGING
+
LIB=libupnp.a
include ../../Makefile.include
View
37 lib/libUPnP/patches/0026-platinum-enable-logging.patch
@@ -0,0 +1,37 @@
+From 1dbb70de6caf307d87aa61e21fe324bbb1709a39 Mon Sep 17 00:00:00 2001
+From: montellese <montellese@xbmc.org>
+Date: Tue, 13 May 2014 21:31:41 +0200
+Subject: [PATCH] platinum: enable logging
+
+---
+ lib/libUPnP/Makefile.in | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/lib/libUPnP/Makefile.in b/lib/libUPnP/Makefile.in
+index e1f9462..e194a58 100644
+--- a/lib/libUPnP/Makefile.in
++++ b/lib/libUPnP/Makefile.in
+@@ -43,9 +43,11 @@ SRCS= Platinum/Source/Core/PltAction.cpp \
+ Neptune/Source/Core/NptHash.cpp \
+ Neptune/Source/Core/NptHttp.cpp \
+ Neptune/Source/Core/NptList.cpp \
++ Neptune/Source/Core/NptLogging.cpp \
+ Neptune/Source/Core/NptMessaging.cpp \
+ Neptune/Source/Core/NptNetwork.cpp \
+ Neptune/Source/Core/NptQueue.cpp \
++ Neptune/Source/Core/NptResults.cpp \
+ Neptune/Source/Core/NptRingBuffer.cpp \
+ Neptune/Source/Core/NptSimpleMessageQueue.cpp \
+ Neptune/Source/Core/NptSockets.cpp \
+@@ -89,6 +91,8 @@ endif
+
+ INCLUDES=-I./Neptune/Source/Core -I./Platinum/Source/Core -I./Platinum/Source/Platinum -I./Platinum/Source/Devices/MediaConnect -I./Platinum/Source/Devices/MediaRenderer -I./Platinum/Source/Devices/MediaServer -I./Neptune/Source/System/Posix -I./Platinum/Source/Extras
+
++CXXFLAGS+=-DNPT_CONFIG_ENABLE_LOGGING
++
+ LIB=libupnp.a
+
+ include ../../Makefile.include
+--
+1.7.11.msysgit.0
+
View
2 tools/darwin/Configurations/Common.xcconfig
@@ -18,6 +18,6 @@
//
//
-XBMC_GCC_PREPROCESSOR_DEFINITIONS_COMMON = TARGET_POSIX TARGET_DARWIN _LINUX _REENTRANT _FILE_DEFINED _FILE_OFFSET_BITS=64 _LARGEFILE64_SOURCE __STDC_CONSTANT_MACROS HAVE_CONFIG_H HAS_SPC_CODEC
+XBMC_GCC_PREPROCESSOR_DEFINITIONS_COMMON = TARGET_POSIX TARGET_DARWIN _LINUX _REENTRANT _FILE_DEFINED _FILE_OFFSET_BITS=64 _LARGEFILE64_SOURCE __STDC_CONSTANT_MACROS HAVE_CONFIG_H HAS_SPC_CODEC NPT_CONFIG_ENABLE_LOGGING
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
View
1 xbmc/commons/ilog.h
@@ -51,6 +51,7 @@
#define LOGJSONRPC (1 << (LOGMASKBIT + 6))
#define LOGAUDIO (1 << (LOGMASKBIT + 7))
#define LOGAIRTUNES (1 << (LOGMASKBIT + 8))
+#define LOGUPNP (1 << (LOGMASKBIT + 9))
#ifdef __GNUC__
#define ATTRIB_LOG_FORMAT __attribute__((format(printf,3,4)))
View
17 xbmc/network/upnp/UPnP.cpp
@@ -38,6 +38,7 @@
#include "utils/log.h"
#include "URL.h"
#include "profiles/ProfilesManager.h"
+#include "settings/AdvancedSettings.h"
#include "settings/Settings.h"
#include "GUIUserMessages.h"
#include "FileItem.h"
@@ -98,9 +99,15 @@ DLNA_ORG_FLAGS_VAL = '01500000000000000000000000000000'
| NPT_Console::Output
+---------------------------------------------------------------------*/
void
-NPT_Console::Output(const char* message)
+NPT_Console::Output(const char* msg) { }
+
+void
+UPnPLogger(const NPT_LogRecord* record)
{
- CLog::Log(LOGDEBUG, "%s", message);
+ if (!g_advancedSettings.CanLogComponent(LOGUPNP))
+ return;
+
+ CLog::Log((record->m_Level / 100) - 1, "Platinum [%s]: %s", record->m_LoggerName, record->m_Message);
}
namespace UPNP
@@ -391,10 +398,15 @@ class CMediaController
CUPnP::CUPnP() :
m_MediaBrowser(NULL),
m_MediaController(NULL),
+ m_LogHandler(NULL),
m_ServerHolder(new CDeviceHostReferenceHolder()),
m_RendererHolder(new CRendererReferenceHolder()),
m_CtrlPointHolder(new CCtrlPointReferenceHolder())
{
+ NPT_LogManager::GetDefault().Configure("plist:.level=FINE;.handlers=CustomHandler;");
+ NPT_LogHandler::Create("CustomHandler", "xbmc", m_LogHandler);
+ m_LogHandler->SetCustomHandlerFunction(&UPnPLogger);
+
// initialize upnp context
m_UPnP = new PLT_UPnP();
@@ -423,6 +435,7 @@ CUPnP::~CUPnP()
StopServer();
delete m_UPnP;
+ delete m_LogHandler;
delete m_ServerHolder;
delete m_RendererHolder;
delete m_CtrlPointHolder;
View
2 xbmc/network/upnp/UPnP.h
@@ -25,6 +25,7 @@
#include "utils/StdString.h"
+class NPT_LogHandler;
class PLT_UPnP;
class PLT_SyncMediaBrowser;
class PLT_MediaController;
@@ -89,6 +90,7 @@ class CUPnP
private:
CStdString m_IP;
PLT_UPnP* m_UPnP;
+ NPT_LogHandler* m_LogHandler;
CDeviceHostReferenceHolder* m_ServerHolder;
CRendererReferenceHolder* m_RendererHolder;
CCtrlPointReferenceHolder* m_CtrlPointHolder;
View
2 xbmc/network/upnp/UPnPRenderer.cpp
@@ -43,6 +43,8 @@
#include "playlists/PlayList.h"
#include "GUIUserMessages.h"
+NPT_SET_LOCAL_LOGGER("xbmc.upnp.renderer")
+
using namespace ANNOUNCEMENT;
namespace UPNP
View
2 xbmc/network/upnp/UPnPServer.cpp
@@ -46,6 +46,8 @@
#include "xbmc/GUIUserMessages.h"
#include "utils/FileUtils.h"
+NPT_SET_LOCAL_LOGGER("xbmc.upnp.server")
+
using namespace std;
using namespace ANNOUNCEMENT;
using namespace XFILE;
View
3 xbmc/settings/AdvancedSettings.cpp
@@ -1388,6 +1388,9 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se
#ifdef HAS_AIRTUNES
list.push_back(std::make_pair(g_localizeStrings.Get(677), LOGAIRTUNES));
#endif
+#ifdef HAS_UPNP
+ list.push_back(std::make_pair(g_localizeStrings.Get(678), LOGUPNP));
+#endif
}
void CAdvancedSettings::setExtraLogLevel(const std::vector<CVariant> &components)

0 comments on commit 45e2cb1

Please sign in to comment.