Browse Source

gerbera: add support for ffmpeg

Requires BUILD_PATENTED.

Added patch to fix compilation with it.

Removed include file hack. It's incorrect and it's also npupnp that
needs fixing.

Refreshed npupnp patch to the newest version sent upstream.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
lilik-openwrt-22.03
Rosen Penev 4 years ago
parent
commit
2e44682349
No known key found for this signature in database GPG Key ID: 36D31CFA845F0E3B
4 changed files with 127 additions and 263 deletions
  1. +8
    -5
      multimedia/gerbera/Makefile
  2. +31
    -0
      multimedia/gerbera/patches/010-ffmpeg.patch
  3. +0
    -156
      multimedia/gerbera/patches/010-treewide-include-upnp-upnp.h-instead-of-upnp.h.patch
  4. +88
    -102
      multimedia/gerbera/patches/020-Quick-changes-for-working-with-NPUPNP.patch

+ 8
- 5
multimedia/gerbera/Makefile View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=gerbera
PKG_VERSION:=1.6.0
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/gerbera/gerbera/tar.gz/v$(PKG_VERSION)?
@ -21,6 +21,7 @@ PKG_LICENSE_FILES:=LICENSE.md
PKG_BUILD_DEPENDS:=libmatroska pugixml spdlog taglib
PKG_BUILD_PARALLEL:=1
PKG_CONFIG_DEPENDS:=CONFIG_BUILD_PATENTED
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
@ -29,7 +30,7 @@ include $(INCLUDE_DIR)/nls.mk
define Package/gerbera
SECTION:=multimedia
CATEGORY:=Multimedia
DEPENDS:=+file +libnpupnp +libsqlite3 +libexif +libuuid +libfmt $(ICONV_DEPENDS)
DEPENDS:=+file +libnpupnp +libsqlite3 +libexif +libuuid +libfmt +BUILD_PATENTED:libffmpeg $(ICONV_DEPENDS)
TITLE:=A free media server
URL:=https://gerbera.io
USERID:=gerbera:gerbera
@ -54,7 +55,7 @@ CMAKE_OPTIONS += \
-DWITH_INOTIFY=ON \
-DWITH_JS=OFF \
-DWITH_TAGLIB=ON \
-DWITH_AVCODEC=OFF \
-DWITH_AVCODEC=$(if $(CONFIG_BUILD_PATENTED),ON,OFF) \
-DWITH_FFMPEGTHUMBNAILER=OFF \
-DWITH_EXIF=ON \
-DWITH_EXIV2=OFF \
@ -62,12 +63,14 @@ CMAKE_OPTIONS += \
-DWITH_SYSTEMD=OFF \
-DWITH_LASTFM=OFF \
-DWITH_DEBUG=OFF \
-DWITH_TESTS=OFF
-DWITH_TESTS=OFF \
-DWITH_NPUPNP=ON
TARGET_CFLAGS += \
-ffunction-sections \
-fdata-sections \
-flto
-flto \
-I$(STAGING_DIR)/usr/include/npupnp/upnp
TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed


+ 31
- 0
multimedia/gerbera/patches/010-ffmpeg.patch View File

@ -0,0 +1,31 @@
From 72f9db7bd75f03e9e7afeaaa0aa0ab7af9fe81a5 Mon Sep 17 00:00:00 2001
From: Yuri Timenkov <yuri@timenkov.ru>
Date: Sun, 26 Jul 2020 12:17:15 +0000
Subject: [PATCH] Fixed build with ffmnpeg but without thumbnailer
Fixes: #953
---
src/metadata/ffmpeg_handler.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/metadata/ffmpeg_handler.cc b/src/metadata/ffmpeg_handler.cc
index 4bba5655..e0ff84bb 100644
--- a/src/metadata/ffmpeg_handler.cc
+++ b/src/metadata/ffmpeg_handler.cc
@@ -265,6 +265,8 @@ void FfmpegHandler::fillMetadata(std::shared_ptr<CdsItem> item)
avformat_close_input(&pFormatCtx);
}
+#ifdef HAVE_FFMPEGTHUMBNAILER
+
fs::path getThumbnailCacheBasePath(Config& config)
{
if (auto configuredDir = config.getOption(CFG_SERVER_EXTOPTS_FFMPEGTHUMBNAILER_CACHE_DIR);
@@ -284,7 +286,6 @@ fs::path getThumbnailCachePath(const fs::path& base, const fs::path& movie)
return path;
}
-#ifdef HAVE_FFMPEGTHUMBNAILER
std::optional<std::vector<std::byte>> FfmpegHandler::readThumbnailCacheFile(const fs::path& movie_filename) const
{
auto path = getThumbnailCachePath(getThumbnailCacheBasePath(*config), movie_filename);

+ 0
- 156
multimedia/gerbera/patches/010-treewide-include-upnp-upnp.h-instead-of-upnp.h.patch View File

@ -1,156 +0,0 @@
From 664b9970687b3d888999f24ef55444add016ba95 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Fri, 24 Jul 2020 19:53:08 -0700
Subject: [PATCH] treewide: include upnp/upnp.h instead of upnp.h
pupnp installs in include/upnp. npupnp installs in include/npupnp/upnp.
This commit helps with compatibility between the two.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
src/action_request.h | 2 +-
src/iohandler/buffered_io_handler.h | 2 +-
src/iohandler/curl_io_handler.h | 2 +-
src/iohandler/io_handler.h | 2 +-
src/iohandler/io_handler_buffer_helper.h | 2 +-
src/subscription_request.h | 2 +-
src/transcoding/transcode_ext_handler.h | 2 +-
src/transcoding/transcode_handler.h | 2 +-
src/util/upnp_clients.cc | 2 +-
src/util/upnp_headers.h | 2 +-
10 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/action_request.h b/src/action_request.h
index 4f57bf22..28c9f66e 100644
--- a/src/action_request.h
+++ b/src/action_request.h
@@ -35,7 +35,7 @@
#include <memory>
#include <pugixml.hpp>
-#include <upnp.h>
+#include <upnp/upnp.h>
#include "common.h"
diff --git a/src/iohandler/buffered_io_handler.h b/src/iohandler/buffered_io_handler.h
index f110a9b2..d8ec1157 100644
--- a/src/iohandler/buffered_io_handler.h
+++ b/src/iohandler/buffered_io_handler.h
@@ -33,7 +33,7 @@
#define __BUFFERED_IO_HANDLER_H__
#include <memory>
-#include <upnp.h>
+#include <upnp/upnp.h>
#include "common.h"
#include "io_handler_buffer_helper.h"
diff --git a/src/iohandler/curl_io_handler.h b/src/iohandler/curl_io_handler.h
index 809274dd..d87ceefc 100644
--- a/src/iohandler/curl_io_handler.h
+++ b/src/iohandler/curl_io_handler.h
@@ -35,7 +35,7 @@
#define __CURL_IO_HANDLER_H__
#include <curl/curl.h>
-#include <upnp.h>
+#include <upnp/upnp.h>
#include "common.h"
#include "io_handler_buffer_helper.h"
diff --git a/src/iohandler/io_handler.h b/src/iohandler/io_handler.h
index 2dc03118..0b2b962a 100644
--- a/src/iohandler/io_handler.h
+++ b/src/iohandler/io_handler.h
@@ -32,7 +32,7 @@
#ifndef __IO_HANDLER_H__
#define __IO_HANDLER_H__
-#include <upnp.h>
+#include <upnp/upnp.h>
#include "common.h"
diff --git a/src/iohandler/io_handler_buffer_helper.h b/src/iohandler/io_handler_buffer_helper.h
index 660ee9d0..9c3b0c94 100644
--- a/src/iohandler/io_handler_buffer_helper.h
+++ b/src/iohandler/io_handler_buffer_helper.h
@@ -35,7 +35,7 @@
#include <condition_variable>
#include <mutex>
#include <pthread.h>
-#include <upnp.h>
+#include <upnp/upnp.h>
#include "common.h"
#include "io_handler.h"
diff --git a/src/subscription_request.h b/src/subscription_request.h
index 4c15d85b..17d6f7d5 100644
--- a/src/subscription_request.h
+++ b/src/subscription_request.h
@@ -33,7 +33,7 @@
#ifndef __SUBSCRIPTION_REQUEST_H__
#define __SUBSCRIPTION_REQUEST_H__
-#include <upnp.h>
+#include <upnp/upnp.h>
#include "common.h"
diff --git a/src/transcoding/transcode_ext_handler.h b/src/transcoding/transcode_ext_handler.h
index 64b5081b..aa197e5a 100644
--- a/src/transcoding/transcode_ext_handler.h
+++ b/src/transcoding/transcode_ext_handler.h
@@ -33,7 +33,7 @@
#define __TRANSCODE_EXTERNAL_HANDLER_H__
#include <memory>
-#include <upnp.h>
+#include <upnp/upnp.h>
#include "common.h"
#include "transcode_handler.h"
diff --git a/src/transcoding/transcode_handler.h b/src/transcoding/transcode_handler.h
index 295f2262..3ba2ba93 100644
--- a/src/transcoding/transcode_handler.h
+++ b/src/transcoding/transcode_handler.h
@@ -34,7 +34,7 @@
#include <memory>
#include <string>
-#include <upnp.h>
+#include <upnp/upnp.h>
#include "common.h"
diff --git a/src/util/upnp_clients.cc b/src/util/upnp_clients.cc
index 2033cf31..e866e456 100644
--- a/src/util/upnp_clients.cc
+++ b/src/util/upnp_clients.cc
@@ -29,7 +29,7 @@
#include "config/config.h"
#include "util/tools.h"
-#include <upnp.h>
+#include <upnp/upnp.h>
// table of supported clients (sequence of entries matters!)
std::vector<struct ClientInfo> Clients::clientInfo = std::vector<struct ClientInfo> {
diff --git a/src/util/upnp_headers.h b/src/util/upnp_headers.h
index 306ebfdf..c9896acb 100644
--- a/src/util/upnp_headers.h
+++ b/src/util/upnp_headers.h
@@ -28,7 +28,7 @@
#include <map>
#include <memory>
-#include <upnp.h>
+#include <upnp/upnp.h>
#include <vector>
class Headers {
--
2.26.2

+ 88
- 102
multimedia/gerbera/patches/020-Quick-changes-for-working-with-NPUPNP.patch View File

@ -1,4 +1,4 @@
From c454e03731808c8ea056c5609a599a7988dbea98 Mon Sep 17 00:00:00 2001
From 993e4e157e4a8c4898b45982045cf63e3b57a6a1 Mon Sep 17 00:00:00 2001
From: Jean-Francois Dockes <jf@dockes.org>
Date: Fri, 13 Mar 2020 09:19:04 +0100
Subject: [PATCH] Quick changes for working with NPUPNP
@ -6,36 +6,44 @@ Subject: [PATCH] Quick changes for working with NPUPNP
(Rebased and made default)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
CMakeLists.txt | 34 +++++++++++++++---------
CMakeLists.txt | 35 +++++++++++++++---------
src/action_request.cc | 11 +++++++-
src/device_description_handler.cc | 4 +++
src/file_request_handler.cc | 4 +++
src/iohandler/file_io_handler.cc | 2 ++
src/iohandler/io_handler.cc | 2 ++
src/iohandler/mem_io_handler.cc | 2 ++
src/iohandler/file_io_handler.cc | 1 -
src/iohandler/io_handler.cc | 1 -
src/iohandler/mem_io_handler.cc | 1 -
src/serve_request_handler.cc | 8 ++++++
src/server.cc | 8 ++++++
src/transcoding/transcode_ext_handler.cc | 2 ++
src/transcoding/transcode_ext_handler.cc | 1 -
src/upnp_cds.cc | 11 ++++++++
src/upnp_cm.cc | 11 ++++++++
src/upnp_mrreg.cc | 10 ++++++-
src/url_request_handler.cc | 6 +++++
src/util/upnp_clients.cc | 12 +++++++++
src/upnp_mrreg.cc | 7 ++++-
src/url_request_handler.cc | 5 +++-
src/util/upnp_clients.cc | 12 ++++++++
src/util/upnp_headers.cc | 14 ++++++++++
src/web/web_request_handler.cc | 4 +++
17 files changed, 130 insertions(+), 15 deletions(-)
17 files changed, 118 insertions(+), 20 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 81f7818e..d8107660 100644
index 81f7818e..56472b97 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -303,23 +303,31 @@ add_definitions(${LFS_DEFINITIONS})
@@ -35,6 +35,7 @@ if (CONAN_EXPORTED)
endif()
set(CMAKE_VERBOSE_MAKEFILE off CACHE BOOL "Show verbose build commands")
+set(WITH_NPUPNP 0 CACHE BOOL "Use npupnp instead of pupnp")
set(WITH_MAGIC 1 CACHE BOOL "Use libmagic to identify file mime types")
set(WITH_MYSQL 0 CACHE BOOL "Store media information in MySQL DB")
set(WITH_CURL 1 CACHE BOOL "CURL required for online services")
@@ -303,23 +304,31 @@ add_definitions(${LFS_DEFINITIONS})
add_compile_options(${LFS_COMPILE_OPTIONS})
target_link_libraries(libgerbera ${LFS_LIBRARIES})
-find_package (pupnp "1.12.1" REQUIRED)
+pkg_check_modules (NPUPNP libnpupnp)
+if (NPUPNP_FOUND)
+if (WITH_NPUPNP)
+ pkg_check_modules (NPUPNP REQUIRED libnpupnp)
+ include_directories (${NPUPNP_INCLUDE_DIRS})
+ set(CMAKE_REQUIRED_LIBRARIES npupnp)
+ add_definitions(-DUSING_NPUPNP)
@ -75,7 +83,7 @@ index 81f7818e..d8107660 100644
find_package(fmt REQUIRED)
target_link_libraries(libgerbera fmt::fmt)
diff --git a/src/action_request.cc b/src/action_request.cc
index fab0e910..0615dc58 100644
index fab0e910..5677e61e 100644
--- a/src/action_request.cc
+++ b/src/action_request.cc
@@ -65,10 +65,14 @@ std::string ActionRequest::getServiceID() const
@ -94,21 +102,21 @@ index fab0e910..0615dc58 100644
if (ret.status != pugi::xml_parse_status::status_ok)
throw_std_runtime_error("Unable to parse ixml");
@@ -94,6 +98,7 @@ void ActionRequest::update()
@@ -94,6 +98,10 @@ void ActionRequest::update()
std::string xml = buf.str();
log_debug("ActionRequest::update(): {}", xml.c_str());
+#if !defined(USING_NPUPNP)
+#if defined(USING_NPUPNP)
+ UpnpActionRequest_set_xmlResponse(upnp_request, xml);
+ UpnpActionRequest_set_ErrCode(upnp_request, errCode);
+#else
IXML_Document* result = nullptr;
int err = ixmlParseBufferEx(xml.c_str(), &result);
@@ -105,6 +110,10 @@ void ActionRequest::update()
@@ -105,6 +113,7 @@ void ActionRequest::update()
UpnpActionRequest_set_ActionResult(upnp_request, result);
UpnpActionRequest_set_ErrCode(upnp_request, errCode);
}
+#else
+ UpnpActionRequest_set_xmlResponse(upnp_request, xml);
+ UpnpActionRequest_set_ErrCode(upnp_request, errCode);
+#endif
} else {
// ok, here there can be two cases
@ -146,44 +154,38 @@ index cfa3eaed..915e411b 100644
headers->writeHeaders(info);
diff --git a/src/iohandler/file_io_handler.cc b/src/iohandler/file_io_handler.cc
index 7e239250..ab5155ec 100644
index 7e239250..b023e85b 100644
--- a/src/iohandler/file_io_handler.cc
+++ b/src/iohandler/file_io_handler.cc
@@ -32,7 +32,9 @@
@@ -32,7 +32,6 @@
#include "file_io_handler.h" // API
#include <cstdio>
+#ifndef USING_NPUPNP
#include <ixml.h>
+#endif
-#include <ixml.h>
#include <utility>
#include "cds_objects.h"
diff --git a/src/iohandler/io_handler.cc b/src/iohandler/io_handler.cc
index f9789425..75a36130 100644
index f9789425..1153ce6b 100644
--- a/src/iohandler/io_handler.cc
+++ b/src/iohandler/io_handler.cc
@@ -31,7 +31,9 @@
@@ -31,7 +31,6 @@
#include "io_handler.h" // API
+#ifndef USING_NPUPNP
#include <ixml.h>
+#endif
-#include <ixml.h>
#include <unistd.h>
#include "server.h"
diff --git a/src/iohandler/mem_io_handler.cc b/src/iohandler/mem_io_handler.cc
index 5574a16d..2916fd12 100644
index 5574a16d..223746ef 100644
--- a/src/iohandler/mem_io_handler.cc
+++ b/src/iohandler/mem_io_handler.cc
@@ -35,7 +35,9 @@
@@ -35,7 +35,6 @@
#include <cstdlib>
#include <cstring>
#include <ctime>
+#ifndef USING_NPUPNP
#include <ixml.h>
+#endif
-#include <ixml.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
@ -238,153 +240,146 @@ index a83c28cd..d4ce3e51 100644
Clients::addClientByDiscovery(destAddr, userAgent, location);
break;
diff --git a/src/transcoding/transcode_ext_handler.cc b/src/transcoding/transcode_ext_handler.cc
index 67ee79d9..ffc89eb2 100644
index 67ee79d9..1da59ea2 100644
--- a/src/transcoding/transcode_ext_handler.cc
+++ b/src/transcoding/transcode_ext_handler.cc
@@ -37,7 +37,9 @@
@@ -37,7 +37,6 @@
#include <cstring>
#include <fcntl.h>
#include <filesystem>
+#ifndef USING_NPUPNP
#include <ixml.h>
+#endif
-#include <ixml.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/src/upnp_cds.cc b/src/upnp_cds.cc
index 12ffeea2..b44268d3 100644
index 12ffeea2..5c2e1043 100644
--- a/src/upnp_cds.cc
+++ b/src/upnp_cds.cc
@@ -284,6 +284,7 @@ void ContentDirectoryService::processSubscriptionRequest(const std::unique_ptr<S
@@ -284,6 +284,11 @@ void ContentDirectoryService::processSubscriptionRequest(const std::unique_ptr<S
propset->print(buf, "", 0);
std::string xml = buf.str();
+#if !defined(USING_NPUPNP)
+#if defined(USING_NPUPNP)
+ UpnpAcceptSubscriptionXML(
+ deviceHandle, config->getOption(CFG_SERVER_UDN).c_str(),
+ DESC_CDS_SERVICE_ID, xml, request->getSubscriptionID().c_str());
+#else
IXML_Document* event = nullptr;
int err = ixmlParseBufferEx(xml.c_str(), &event);
if (err != IXML_SUCCESS) {
@@ -295,6 +296,11 @@ void ContentDirectoryService::processSubscriptionRequest(const std::unique_ptr<S
@@ -295,6 +300,7 @@ void ContentDirectoryService::processSubscriptionRequest(const std::unique_ptr<S
DESC_CDS_SERVICE_ID, event, request->getSubscriptionID().c_str());
ixmlDocument_free(event);
+#else
+ UpnpAcceptSubscriptionXML(
+ deviceHandle, config->getOption(CFG_SERVER_UDN).c_str(),
+ DESC_CDS_SERVICE_ID, xml, request->getSubscriptionID().c_str());
+#endif
log_debug("end");
}
@@ -313,6 +319,7 @@ void ContentDirectoryService::sendSubscriptionUpdate(const std::string& containe
@@ -313,6 +319,10 @@ void ContentDirectoryService::sendSubscriptionUpdate(const std::string& containe
propset->print(buf, "", 0);
std::string xml = buf.str();
+#if !defined(USING_NPUPNP)
+#if defined(USING_NPUPNP)
+ UpnpNotifyXML(deviceHandle, config->getOption(CFG_SERVER_UDN).c_str(),
+ DESC_CDS_SERVICE_ID, xml);
+#else
IXML_Document* event = nullptr;
int err = ixmlParseBufferEx(xml.c_str(), &event);
if (err != IXML_SUCCESS) {
@@ -325,6 +332,10 @@ void ContentDirectoryService::sendSubscriptionUpdate(const std::string& containe
@@ -325,6 +335,7 @@ void ContentDirectoryService::sendSubscriptionUpdate(const std::string& containe
DESC_CDS_SERVICE_ID, event);
ixmlDocument_free(event);
+#else
+ UpnpNotifyXML(deviceHandle, config->getOption(CFG_SERVER_UDN).c_str(),
+ DESC_CDS_SERVICE_ID, xml);
+#endif
log_debug("end");
}
diff --git a/src/upnp_cm.cc b/src/upnp_cm.cc
index aa608480..c6553d6f 100644
index aa608480..d7ab40cf 100644
--- a/src/upnp_cm.cc
+++ b/src/upnp_cm.cc
@@ -127,6 +127,7 @@ void ConnectionManagerService::processSubscriptionRequest(const std::unique_ptr<
@@ -127,6 +127,11 @@ void ConnectionManagerService::processSubscriptionRequest(const std::unique_ptr<
propset->print(buf, "", 0);
std::string xml = buf.str();
+#if !defined(USING_NPUPNP)
+#if defined(USING_NPUPNP)
+ UpnpAcceptSubscriptionXML(
+ deviceHandle, config->getOption(CFG_SERVER_UDN).c_str(),
+ DESC_CM_SERVICE_ID, xml, request->getSubscriptionID().c_str());
+#else
IXML_Document* event = nullptr;
int err = ixmlParseBufferEx(xml.c_str(), &event);
if (err != IXML_SUCCESS) {
@@ -138,6 +139,11 @@ void ConnectionManagerService::processSubscriptionRequest(const std::unique_ptr<
@@ -138,6 +143,7 @@ void ConnectionManagerService::processSubscriptionRequest(const std::unique_ptr<
DESC_CM_SERVICE_ID, event, request->getSubscriptionID().c_str());
ixmlDocument_free(event);
+#else
+ UpnpAcceptSubscriptionXML(
+ deviceHandle, config->getOption(CFG_SERVER_UDN).c_str(),
+ DESC_CM_SERVICE_ID, xml, request->getSubscriptionID().c_str());
+#endif
}
void ConnectionManagerService::sendSubscriptionUpdate(const std::string& sourceProtocol_CSV)
@@ -150,6 +156,7 @@ void ConnectionManagerService::sendSubscriptionUpdate(const std::string& sourceP
@@ -150,6 +156,10 @@ void ConnectionManagerService::sendSubscriptionUpdate(const std::string& sourceP
propset->print(buf, "", 0);
std::string xml = buf.str();
+#if !defined(USING_NPUPNP)
+#if defined(USING_NPUPNP)
+ UpnpNotifyXML(deviceHandle, config->getOption(CFG_SERVER_UDN).c_str(),
+ DESC_CM_SERVICE_ID, xml);
+#else
IXML_Document* event = nullptr;
int err = ixmlParseBufferEx(xml.c_str(), &event);
if (err != IXML_SUCCESS) {
@@ -162,4 +169,8 @@ void ConnectionManagerService::sendSubscriptionUpdate(const std::string& sourceP
@@ -162,4 +172,5 @@ void ConnectionManagerService::sendSubscriptionUpdate(const std::string& sourceP
DESC_CM_SERVICE_ID, event);
ixmlDocument_free(event);
+#else
+ UpnpNotifyXML(deviceHandle, config->getOption(CFG_SERVER_UDN).c_str(),
+ DESC_CM_SERVICE_ID, xml);
+#endif
}
diff --git a/src/upnp_mrreg.cc b/src/upnp_mrreg.cc
index 16eefaed..342c0cab 100644
index 16eefaed..ecb49025 100644
--- a/src/upnp_mrreg.cc
+++ b/src/upnp_mrreg.cc
@@ -34,7 +34,9 @@
@@ -34,7 +34,6 @@
#include <utility>
#include "config/config_manager.h"
-#include "ixml.h"
+#ifndef USING_NPUPNP
+#include <ixml.h>
+#endif
#include "server.h"
#include "storage/storage.h"
#include "upnp_xml.h"
@@ -120,6 +122,7 @@ void MRRegistrarService::processSubscriptionRequest(const std::unique_ptr<Subscr
@@ -120,6 +119,11 @@ void MRRegistrarService::processSubscriptionRequest(const std::unique_ptr<Subscr
propset->print(buf, "", 0);
std::string xml = buf.str();
+#if !defined(USING_NPUPNP)
+#if defined(USING_NPUPNP)
+ UpnpAcceptSubscriptionXML(
+ deviceHandle, config->getOption(CFG_SERVER_UDN).c_str(),
+ DESC_MRREG_SERVICE_ID, xml, request->getSubscriptionID().c_str());
+#else
IXML_Document* event = nullptr;
int err = ixmlParseBufferEx(xml.c_str(), &event);
if (err != IXML_SUCCESS) {
@@ -131,6 +134,11 @@ void MRRegistrarService::processSubscriptionRequest(const std::unique_ptr<Subscr
@@ -131,6 +135,7 @@ void MRRegistrarService::processSubscriptionRequest(const std::unique_ptr<Subscr
DESC_MRREG_SERVICE_ID, event, request->getSubscriptionID().c_str());
ixmlDocument_free(event);
+#else
+ UpnpAcceptSubscriptionXML(
+ deviceHandle, config->getOption(CFG_SERVER_UDN).c_str(),
+ DESC_MRREG_SERVICE_ID, xml, request->getSubscriptionID().c_str());
+#endif
}
// TODO: FIXME
diff --git a/src/url_request_handler.cc b/src/url_request_handler.cc
index f2a99c94..66af027b 100644
index f2a99c94..7de2227d 100644
--- a/src/url_request_handler.cc
+++ b/src/url_request_handler.cc
@@ -32,7 +32,9 @@
@@ -32,7 +32,6 @@
#ifdef HAVE_CURL
#include "url_request_handler.h" // API
+#ifndef USING_NPUPNP
#include <ixml.h>
+#endif
-#include <ixml.h>
#include <utility>
#include "config/config_manager.h"
@@ -138,7 +140,11 @@ void URLRequestHandler::getInfo(const char* filename, UpnpFileInfo* info)
@@ -138,7 +137,11 @@ void URLRequestHandler::getInfo(const char* filename, UpnpFileInfo* info)
// ixmlCloneDOMString(header.c_str()));
// }
@ -397,10 +392,10 @@ index f2a99c94..66af027b 100644
/// \todo transcoding for get_info
diff --git a/src/util/upnp_clients.cc b/src/util/upnp_clients.cc
index e866e456..4bf3033a 100644
index 2033cf31..1dd7964d 100644
--- a/src/util/upnp_clients.cc
+++ b/src/util/upnp_clients.cc
@@ -268,6 +268,15 @@ bool Clients::getInfoByType(const std::string& match, ClientMatchType type, cons
@@ -268,6 +268,17 @@ bool Clients::getInfoByType(const std::string& match, ClientMatchType type, cons
bool Clients::downloadDescription(const std::string& location, std::unique_ptr<pugi::xml_document>& xml)
{
@ -412,26 +407,20 @@ index e866e456..4bf3033a 100644
+ return false;
+ }
+ const char* cxml = description.c_str();
+ xml = std::make_unique<pugi::xml_document>();
+ auto ret = xml->load_string(cxml);
+#else
IXML_Document* descDoc = nullptr;
int errCode = UpnpDownloadXmlDoc(location.c_str(), &descDoc);
if (errCode != UPNP_E_SUCCESS) {
@@ -276,12 +285,15 @@ bool Clients::downloadDescription(const std::string& location, std::unique_ptr<p
}
DOMString cxml = ixmlPrintDocument(descDoc);
+#endif
xml = std::make_unique<pugi::xml_document>();
auto ret = xml->load_string(cxml);
@@ -281,6 +292,7 @@ bool Clients::downloadDescription(const std::string& location, std::unique_ptr<p
+#if !defined(USING_NPUPNP)
ixmlFreeDOMString(cxml);
ixmlDocument_free(descDoc);
+#endif
if (ret.status != pugi::xml_parse_status::status_ok) {
log_debug("Unable to parse xml client description from {}", location);
return false;
diff --git a/src/util/upnp_headers.cc b/src/util/upnp_headers.cc
index ef85106b..aec13850 100644
--- a/src/util/upnp_headers.cc
@ -504,6 +493,3 @@ index 60e2d028..117dcbfa 100644
Headers headers;
headers.addHeader(std::string { "Cache-Control" }, std::string { "no-cache, must-revalidate" });
headers.writeHeaders(info);
--
2.26.2

Loading…
Cancel
Save