kodi-pvr / pvr.mediaportal.tvserver

Kodi: MediaPortal TVServer client addon
GNU General Public License v2.0
6 stars 27 forks source link

MepoRTSPClient fails to build against LiveMedia555 >= 20181016 #123

Open basilgello opened 4 years ago

basilgello commented 4 years ago

I am trying to update the Debian package for this add-on and it builds fine using the bundled TSReader / Live555 library from 2010.

However, Debian recommends linking against Live555 packaged in Debian. The Debian package versions are as follows;

https://packages.debian.org/jessie/liblivemedia-dev

I adapted @rbalint patch for Live555 detection to include system Live555 headers:

From 31cf19d9a14bfa79346bb5811b441863547fbfe2 Mon Sep 17 00:00:00 2001
From: Balint Reczey <balint@balintreczey.hu>
Date: Fri, 4 Nov 2016 16:37:59 +0100
Subject: [PATCH] Use system's Live555 libraries when they are available

[basilgello: -DLIVE555 is not declared in liblivemedia-dev but used
at lease in src/lib/tsreader/TSReader.cpp. Since embedded Live555
library is present in source tree anyway, let's set the flags
regardless of where Live555 was actually found]

Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
---
 CMakeLists.txt | 35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1226685..872159b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,16 +7,27 @@ find_package(Kodi REQUIRED)
 find_package(p8-platform REQUIRED)
 find_package(TinyXML REQUIRED)

-set(LIVE555_INCLUDE_DIR
-  src/lib/live555/liveMedia/include
-  src/lib/live555/BasicUsageEnvironment/include
-  src/lib/live555/UsageEnvironment/include
-  src/lib/live555/groupsock/include
-  src/lib/live555/
-)
+find_package(PkgConfig)
+pkg_check_modules(LIVE555 live555)
+
+if (NOT LIVE555_FOUND)
+  set(LIVE555_INCLUDE_DIR
+    src/lib/live555/liveMedia/include
+    src/lib/live555/BasicUsageEnvironment/include
+    src/lib/live555/UsageEnvironment/include
+    src/lib/live555/groupsock/include
+    src/lib/live555/
+    )
+endif()

 set(LIVE555_DEFINES -DLIVE555 -D_WINSOCK_DEPRECATED_NO_WARNINGS -DSOCKLEN_T=socklen_t -DBSD=1)

+add_definitions(-D__STDC_FORMAT_MACROS ${LIVE555_DEFINES})
+
+if (LIVE555_FOUND)
+  add_definitions(${LIVE555_CFLAGS})
+endif()
+
 include_directories(${p8-platform_INCLUDE_DIRS}
                     ${TINYXML_INCLUDE_DIR}
                     ${KODI_INCLUDE_DIR}/.. # Hack way with "/..", need bigger Kodi cmake rework to match right include ways
@@ -25,7 +36,6 @@ include_directories(${p8-platform_INCLUDE_DIRS}
                     ${LIVE555_INCLUDE_DIR}
 )

-add_definitions(-D__STDC_FORMAT_MACROS ${LIVE555_DEFINES})

 if (NOT WIN32)
   add_options(ALL_LANGUAGES ALL_BUILDS "-fPIC")
@@ -227,11 +237,18 @@ SET(LIVE555_HEADERS
 source_group("Header Files\\lib\\live555" FILES ${LIVE555_HEADERS})

 # Make sure that CMake adds all files to the MSVC project
-list(APPEND MPTV_SOURCES ${MPTV_HEADERS} ${TSREADER_SOURCES} ${TSREADER_HEADERS} ${LIVE555_SOURCES} ${LIVE555_HEADERS})
+list(APPEND MPTV_SOURCES ${MPTV_HEADERS} ${TSREADER_SOURCES} ${TSREADER_HEADERS})
+if (NOT LIVE555_FOUND)
+  list(APPEND MPTV_SOURCES ${LIVE555_SOURCES} ${LIVE555_HEADERS})
+endif()

 set(DEPLIBS ${p8-platform_LIBRARIES}
             ${TINYXML_LIBRARIES})

+if (LIVE555_FOUND)
+  set(DEPLIBS ${LIVE555_LIBRARIES} ${DEPLIBS})
+endif()
+
 if(WIN32)
   list(APPEND DEPLIBS ws2_32)
 endif(WIN32)
-- 
2.28.0

and tried rebuilding the addon but failed with the following log:

build-20200729201327.log

@margro Does it make sense to transplant TSReader 1.3.0 to the addon or let's stick with embedded version of the library there is now?

UPDATE: I figured out that Team MediaPortal uses patched Live555 library in 1.3.0 as well, so I am really stuck at what to do with this addon. Is it ever relevant for recent MediaPortal 2?

margro commented 4 years ago

It won't work with the official Live555 library. I've tested this multiple times. The embedded Live555 is only a subset and comes from MediaPortal itself.

I know that Debian and other Linux distro's prefer to use the system library instead, but that will break the addon, so for now this is not an option. Best option is still is to statically link the addon against the bundled Live555 subset.

basilgello commented 4 years ago

Hi Marcel!

First of all, thanks for your incredible work and response!

I know that Debian and other Linux distro's prefer to use the system library instead, but that will break the addon, so for now this is not an option. Best option is still is to statically link the addon against the bundled Live555 subset.

Live555 additional license clause (http://www.live555.com/liveMedia/faq.html#copyright-and-license) explicitly states that:

If you distribute a product (whether software or hardware; whether free or for pay) that uses the LIVE555 library code, then you must - when requested by either a customer, or Live Networks, Inc. - upgrade it as soon as possible to use the latest version of the LIVE555 library code (or else provide a way for your customers to perform this upgrade themselves). Similarly, you must allow any of your customers to - at their discretion - replace the LIVE555 libraries used by your product with their own version (that uses the same API). (Note that in particular, because Apple restricts which apps are made available on their 'App Store', you cannot use the LIVE555 library code in an app that's distributed through Apple's 'App Store'.)

Note that if you have a hardware product that is released 'as is', without any mechanism for upgrading its firmware, then this does not absolve you of this responsibility. If you have no mechanism for upgrading your product's firmware after it is released, then your product cannot use this software.)

so I have removed live555 dependency at all and excluded it from CMakeLists.txt: https://salsa.debian.org/basilgello-guest/kodi-pvr-mediaportal-tvserver/-/commits/master

Can you tell me please if functionality of an addon is severely impacted by removing RTSP client? AFAIK previous Debian packages were built without RTSP / Live555 too due to faulty Debian patch that did not propagate -DLIVE555 compiler define. No one complained at it, however.

Also, if you remember what issues did you specifically encounter with the current Live555 library, feel free to share it with me. Did you consult the Live555 mailing list to resolve them?