Skip to content

Commit

Permalink
Merge pull request #4 from AlwinEsch/build-fixes
Browse files Browse the repository at this point in the history
Bring in Windows and iOS support
  • Loading branch information
phunkyfish authored Jan 27, 2020
2 parents 4f4fd61 + 66f0c18 commit c9639b7
Show file tree
Hide file tree
Showing 106 changed files with 2,554 additions and 942 deletions.
70 changes: 45 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ project(inputstream.ffmpegdirect)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR})

find_package(PkgConfig)
if(WIN32)
find_package(LibXml2 REQUIRED)
find_package(Iconv REQUIRED)
find_package(OpenSSL REQUIRED)
endif()
find_package(p8-platform REQUIRED)
find_package(Kodi REQUIRED)
find_package(FFMPEG REQUIRED)
Expand All @@ -16,7 +21,6 @@ set(CATCHUP_SOURCES src/StreamManager.cpp
src/stream/FFmpegLog.cpp
src/stream/FFmpegStream.cpp
src/stream/commons/Exception.cpp
src/stream/platform/posix/XTimeUtils.cpp
src/stream/threads/Atomics.cpp
src/stream/threads/Event.cpp
src/stream/threads/Thread.cpp
Expand All @@ -35,8 +39,6 @@ set(CATCHUP_HEADERS src/StreamManager.h
src/stream/FFmpegStream.h
src/stream/IManageDemuxPacket.h
src/stream/commons/Exception.h
src/stream/platform/posix/PlatformDefs.h
src/stream/platform/posix/XTimeUtils.h
src/stream/threads/Atomics.h
src/stream/threads/Condition.h
src/stream/threads/CriticalSection.h
Expand All @@ -55,38 +57,56 @@ set(CATCHUP_HEADERS src/StreamManager.h
src/stream/url/UrlOptions.h
src/stream/url/Variant.h)

if(NOT WIN32)
list(APPEND CATCHUP_SOURCES src/stream/platform/posix/XTimeUtils.cpp)

list(APPEND CATCHUP_HEADERS src/stream/platform/posix/PlatformDefs.h
src/stream/platform/posix/XTimeUtils.h)
endif()

include_directories(${p8-platform_INCLUDE_DIRS}
${INCLUDES}
${FFMPEG_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
${BZIP2_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIR}
${LIBXML2_INCLUDE_DIRS}
${KODI_INCLUDE_DIR}/..) # Hack way with "/..", need bigger Kodi cmake rework to match right include ways (becomes done in future)

list(APPEND DEPLIBS ${p8-platform_LIBRARIES} ${FFMPEG_LIBRARIES} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES})
list(APPEND DEPLIBS ${p8-platform_LIBRARIES}
${FFMPEG_LIBRARIES}
${ZLIB_LIBRARIES}
${BZIP2_LIBRARIES})
if(WIN32)
list(APPEND DEPLIBS ${ICONV_LIBRARIES}
${OPENSSL_LIBRARIES}
${LIBXML2_LIBRARIES})
endif()

# to see linker output
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -v")

if(CORE_SYSTEM_NAME MATCHES "windows")
list(APPEND DEPLIBS Winmm.lib WS2_32.lib)
list(APPEND DEPLIBS Winmm.lib WS2_32.lib Bcrypt.lib Secur32.lib)
endif()

if(CORE_SYSTEM_NAME MATCHES "osx")
find_library(AUDIOTOOLBOX AudioToolbox)
find_library(COREFOUNDATION CoreFoundation)
find_library(COREMEDIA CoreMedia)
find_library(VIDEOTOOLBOX VideoToolbox)

include_directories(${AVFOUNDATION}
${COCOA}
${COREFOUNDATION}
${COREMEDIA}
${COREVIDEO}
${COREMEDIAIO}
${VIDEOTOOLBOX}
${COCOA})

list(APPEND DEPLIBS ${AUDIOTOOLBOX} ${COREFOUNDATION} ${COREMEDIA} ${VIDEOTOOLBOX})
if(CORE_SYSTEM_NAME STREQUAL osx OR
CORE_SYSTEM_NAME STREQUAL darwin_embedded)
find_library(AUDIOTOOLBOX AudioToolbox)
find_library(COREFOUNDATION CoreFoundation)
find_library(COREMEDIA CoreMedia)
find_library(VIDEOTOOLBOX VideoToolbox)

include_directories(${AVFOUNDATION}
${COCOA}
${COREFOUNDATION}
${COREMEDIA}
${COREVIDEO}
${COREMEDIAIO}
${VIDEOTOOLBOX}
${COCOA})

list(APPEND DEPLIBS ${AUDIOTOOLBOX} ${COREFOUNDATION} ${COREMEDIA} ${VIDEOTOOLBOX})
endif()

addon_version(inputstream.ffmpegdirect CATCHUP)
Expand All @@ -97,10 +117,10 @@ build_addon(inputstream.ffmpegdirect CATCHUP DEPLIBS)
set_target_properties(inputstream.ffmpegdirect PROPERTIES LINK_FLAGS "${FFMPEG_LDFLAGS}")

if(CORE_SYSTEM_NAME STREQUAL windowsstore)
# fix linking
set_target_properties(inputstream.ffmpegdirect PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/LTCG /defaultlib:vccorlib.lib /defaultlib:msvcrt.lib")
set_target_properties(inputstream.ffmpegdirect PROPERTIES LINK_FLAGS_RELEASE "/LTCG /defaultlib:vccorlib.lib /defaultlib:msvcrt.lib")
set_target_properties(inputstream.ffmpegdirect PROPERTIES LINK_FLAGS_DEBUG "/LTCG /defaultlib:vccorlibd.lib /defaultlib:msvcrtd.lib")
# fix linking
set_target_properties(inputstream.ffmpegdirect PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/LTCG /defaultlib:vccorlib.lib /defaultlib:msvcrt.lib")
set_target_properties(inputstream.ffmpegdirect PROPERTIES LINK_FLAGS_RELEASE "/LTCG /defaultlib:vccorlib.lib /defaultlib:msvcrt.lib")
set_target_properties(inputstream.ffmpegdirect PROPERTIES LINK_FLAGS_DEBUG "/LTCG /defaultlib:vccorlibd.lib /defaultlib:msvcrtd.lib")
endif()

include(CPack)
45 changes: 45 additions & 0 deletions FindIconv.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#.rst:
# FindICONV
# --------
# Finds the ICONV library
#
# This will define the following variables::
#
# ICONV_FOUND - system has ICONV
# ICONV_INCLUDE_DIRS - the ICONV include directory
# ICONV_LIBRARIES - the ICONV libraries
#
# and the following imported targets::
#
# ICONV::ICONV - The ICONV library

find_path(ICONV_INCLUDE_DIR NAMES iconv.h)

find_library(ICONV_LIBRARY NAMES iconv libiconv c)

set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
include(CheckFunctionExists)
check_function_exists(iconv HAVE_ICONV_FUNCTION)
if(NOT HAVE_ICONV_FUNCTION)
check_function_exists(libiconv HAVE_LIBICONV_FUNCTION2)
set(HAVE_ICONV_FUNCTION ${HAVE_LIBICONV_FUNCTION2})
unset(HAVE_LIBICONV_FUNCTION2)
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Iconv
REQUIRED_VARS ICONV_LIBRARY ICONV_INCLUDE_DIR HAVE_ICONV_FUNCTION)

if(ICONV_FOUND)
set(ICONV_LIBRARIES ${ICONV_LIBRARY})
set(ICONV_INCLUDE_DIRS ${ICONV_INCLUDE_DIR})

if(NOT TARGET ICONV::ICONV)
add_library(ICONV::ICONV UNKNOWN IMPORTED)
set_target_properties(ICONV::ICONV PROPERTIES
IMPORTED_LOCATION "${ICONV_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${ICONV_INCLUDE_DIR}")
endif()
endif()

mark_as_advanced(ICONV_INCLUDE_DIR ICONV_LIBRARY HAVE_ICONV_FUNCTION)
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
buildPlugin(version: "Matrix", deploy: ['android-aarch64', 'android-arm7', 'ios-aarch64', 'ios-arm7', 'osx-x86_64', 'ubuntu-ppa'])
buildPlugin(version: "Matrix")
32 changes: 22 additions & 10 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,27 @@ environment:
app_id: inputstream.ffmpegdirect

matrix:
- GENERATOR: "Visual Studio 15"
CONFIG: Release
- GENERATOR: "Visual Studio 15 Win64"
CONFIG: Release
- GENERATOR: "Visual Studio 15 Win64"
CONFIG: Release
- GENERATOR: "Visual Studio 15 2017"
ARCHITECTURE: Win32
CONFIGURATION: Release
- GENERATOR: "Visual Studio 15 2017"
ARCHITECTURE: x64
CONFIGURATION: Release
- GENERATOR: "Visual Studio 15 2017"
ARCHITECTURE: Win32
CONFIGURATION: Release
WINSTORE: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0.17763.0"
- GENERATOR: "Visual Studio 15 ARM"
CONFIG: Release
- GENERATOR: "Visual Studio 15 2017"
ARCHITECTURE: x64
CONFIGURATION: Release
WINSTORE: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0.17763.0"
- GENERATOR: "Visual Studio 15 2017"
ARCHITECTURE: ARM
CONFIGURATION: Release
WINSTORE: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0.17763.0"
- GENERATOR: "Visual Studio 15 2017"
ARCHITECTURE: ARM64
CONFIGURATION: Release
WINSTORE: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0.17763.0"

build_script:
Expand All @@ -29,5 +41,5 @@ build_script:
- cd build
- mkdir -p definition\%app_id%
- echo %app_id% %APPVEYOR_BUILD_FOLDER% %APPVEYOR_REPO_COMMIT% > definition\%app_id%\%app_id%.txt
- cmake -T host=x64 -G "%GENERATOR%" %WINSTORE% -DADDONS_TO_BUILD=%app_id% -DCMAKE_BUILD_TYPE=%CONFIG% -DADDONS_DEFINITION_DIR=%APPVEYOR_BUILD_FOLDER%/build/definition -DADDON_SRC_PREFIX=../.. -DCMAKE_INSTALL_PREFIX=../../xbmc/addons -DPACKAGE_ZIP=1 ../../xbmc/cmake/addons
- cmake --build . --config %CONFIG% --target %app_id%
- cmake -T host=x64 -G "%GENERATOR%" -A %ARCHITECTURE% %WINSTORE% -DADDONS_TO_BUILD=%app_id% -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DADDONS_DEFINITION_DIR=%APPVEYOR_BUILD_FOLDER%/build/definition -DADDON_SRC_PREFIX=../.. -DCMAKE_INSTALL_PREFIX=../../xbmc/addons -DPACKAGE_ZIP=1 ../../xbmc/cmake/addons
- cmake --build . --config %CONFIGURATION% --target %app_id%
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project(zvbi)
project(libzsvbi)

cmake_minimum_required(VERSION 3.5)

Expand All @@ -14,7 +14,7 @@ elseif (CORE_SYSTEM_NAME STREQUAL android)
endif()

include(ExternalProject)
externalproject_add(zvbi
externalproject_add(libzsvbi
SOURCE_DIR ${CMAKE_SOURCE_DIR}
CONFIGURE_COMMAND <SOURCE_DIR>/configure
--prefix=${CMAKE_INSTALL_PREFIX}
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions depends/android/libzvbi/libzvbi.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
libzvbi http://mirrors.kodi.tv/build-deps/sources/zvbi-0.2.35.tar.bz2
1 change: 0 additions & 1 deletion depends/android/zvbi/zvbi.txt

This file was deleted.

25 changes: 0 additions & 25 deletions depends/common/ffmpeg/0001-hack-fix.patch

This file was deleted.

This file was deleted.

12 changes: 12 additions & 0 deletions depends/common/ffmpeg/02-ffmpeg-zlib-config-conflict.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- a/configure
+++ b/configure
@@ -7197,6 +7197,9 @@
$CONFIG_EXTRA \
$ALL_COMPONENTS \

+echo "#if defined(HAVE_UNISTD_H) && HAVE_UNISTD_H == 0" >> $TMPH
+echo "#undef HAVE_UNISTD_H" >> $TMPH
+echo "#endif" >> $TMPH
echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
echo "endif # FFMPEG_CONFIG_MAK" >> ffbuild/config.mak

20 changes: 20 additions & 0 deletions depends/common/ffmpeg/03-ffmpeg-static.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- a/configure
+++ b/configure
@@ -5131,6 +5131,8 @@
enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres
enabled x86_32 && check_ldflags -Wl,--large-address-aware
shlibdir_default="$bindir_default"
+ LIBPREF=""
+ LIBSUF=".lib"
SLIBPREF=""
SLIBSUF=".dll"
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
@@ -5180,6 +5182,8 @@
fi
enabled x86_32 && check_ldflags -LARGEADDRESSAWARE
shlibdir_default="$bindir_default"
+ LIBPREF=""
+ LIBSUF=".lib"
SLIBPREF=""
SLIBSUF=".dll"
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From 4eae85a82f81fa2ff4c317797ca3d82caf35db86 Mon Sep 17 00:00:00 2001
From: Jun Zhao <[email protected]>
Date: Tue, 10 Dec 2019 17:41:56 +0800
Subject: [PATCH] lavf/tls_openssl: support both pre-1.1.0 and post-1.1.0 init

supporting both pre-1.1.0 and post-1.1.0 version of the OpenSSL
library as the link:
https://wiki.openssl.org/index.php/Library_Initialization

Signed-off-by: Jun Zhao <[email protected]>
---
libavformat/tls_openssl.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
index 7ae71bdaf36..53f8363a12a 100644
--- a/libavformat/tls_openssl.c
+++ b/libavformat/tls_openssl.c
@@ -70,8 +70,15 @@ int ff_openssl_init(void)
{
ff_lock_avformat();
if (!openssl_init) {
+ /* OpenSSL 1.0.2 or below, then you would use SSL_library_init. If you are
+ * using OpenSSL 1.1.0 or above, then the library will initialize
+ * itself automatically.
+ * https://wiki.openssl.org/index.php/Library_Initialization
+ */
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
SSL_library_init();
SSL_load_error_strings();
+#endif
#if HAVE_THREADS
if (!CRYPTO_get_locking_callback()) {
int i;
Loading

0 comments on commit c9639b7

Please sign in to comment.