From 4952499f9c03d1b6537b0562ca26ab8571b7d57b Mon Sep 17 00:00:00 2001 From: pascalbaljet Date: Tue, 22 Aug 2017 23:14:31 +0200 Subject: [PATCH 1/3] Added librtmp Reverted OpenSSL back to the 1.0.2 branch --- ffmpeg/cppbuild.sh | 37 +++++++++++++++++++++++++------ ffmpeg/ffmpeg-3.3.2-android.patch | 26 +++++----------------- ffmpeg/ffmpeg-librtmp.patch | 13 +++++++++++ 3 files changed, 49 insertions(+), 27 deletions(-) create mode 100644 ffmpeg/ffmpeg-librtmp.patch diff --git a/ffmpeg/cppbuild.sh b/ffmpeg/cppbuild.sh index 1ffd749b573..3f59d891617 100755 --- a/ffmpeg/cppbuild.sh +++ b/ffmpeg/cppbuild.sh @@ -8,7 +8,7 @@ if [[ -z "$PLATFORM" ]]; then fi DISABLE="--disable-w32threads --disable-iconv --disable-opencl --disable-sdl --disable-bzlib --disable-lzma" -ENABLE="--enable-pthreads --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-runtime-cpudetect --enable-zlib --enable-libmp3lame --enable-libspeex --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-openssl --enable-libopenh264 --enable-libx264 --enable-libx265 --enable-libvpx" +ENABLE="--enable-pthreads --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-runtime-cpudetect --enable-zlib --enable-libmp3lame --enable-libspeex --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-openssl --enable-libopenh264 --enable-libx264 --enable-libx265 --enable-libvpx --enable-librtmp" # minimal configuration to support MPEG-4 streams with H.264 and AAC as well as Motion JPEG # DISABLE="--disable-w32threads --disable-iconv --disable-libxcb --disable-opencl --disable-sdl --disable-bzlib --disable-lzma --disable-everything" @@ -18,7 +18,7 @@ ZLIB=zlib-1.2.11 LAME=lame-3.99.5 SPEEX=speex-1.2.0 OPENCORE_AMR=opencore-amr-0.1.5 -OPENSSL=openssl-1.1.0f +OPENSSL=openssl-1.0.2l OPENH264_VERSION=1.7.0 X265=x265_2.4 VPX_VERSION=v1.6.1 @@ -39,6 +39,7 @@ download http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2 ffmpeg-$FFMPE mkdir -p $PLATFORM cd $PLATFORM INSTALL_PATH=`pwd` +git clone git://git.ffmpeg.org/rtmpdump echo "Decompressing archives..." tar --totals -xzf ../$ZLIB.tar.gz tar --totals -xzf ../$LAME.tar.gz @@ -66,7 +67,21 @@ case $PLATFORM in export CXXFLAGS="$CFLAGS" export LDFLAGS="-nostdlib -Wl,--fix-cortex-a8 -z text" export LIBS="-lgcc -ldl -lz -lm -lc" - cd $ZLIB + + cp ${ANDROID_ROOT}usr/lib/crtbegin_so.o rtmpdump/ + cp ${ANDROID_ROOT}usr/lib/crtend_so.o rtmpdump/ + cp ${ANDROID_ROOT}usr/lib/crtbegin_so.o rtmpdump/librtmp/ + cp ${ANDROID_ROOT}usr/lib/crtend_so.o rtmpdump/librtmp/ + + cp ${ANDROID_ROOT}usr/lib/crtbegin_dynamic.o rtmpdump/ + cp ${ANDROID_ROOT}usr/lib/crtend_android.o rtmpdump/ + cp ${ANDROID_ROOT}usr/lib/crtbegin_dynamic.o rtmpdump/librtmp/ + cp ${ANDROID_ROOT}usr/lib/crtend_android.o rtmpdump/librtmp/ + + cd ffmpeg-$FFMPEG_VERSION + patch -Np1 < ../../../ffmpeg-librtmp.patch + + cd ../$ZLIB ./configure --prefix=$INSTALL_PATH --static --uname=arm-linux make -j $MAKEJ make install @@ -86,10 +101,17 @@ case $PLATFORM in make -j $MAKEJ make install cd ../$OPENSSL - ./Configure --prefix=$INSTALL_PATH android-armeabi $CFLAGS no-shared + ./Configure --prefix=$INSTALL_PATH android-armv7 $CFLAGS no-shared ANDROID_DEV="$ANDROID_ROOT/usr" make # fails with -j > 1 - make install_sw - cd ../openh264-$OPENH264_VERSION + make install + cd ../rtmpdump/librtmp + OPENSSL_DIR="$INSTALL_PATH/$OPENSSL/" + export XLDFLAGS="-L${OPENSSL_DIR} -L${ANDROID_ROOT}usr/lib " + export CROSS_COMPILE="${ANDROID_BIN}-" + export XCFLAGS="${CFLAGS} -marm -I${OPENSSL_DIR}include -isysroot ${ANDROID_ROOT}" + export INC="-I${ANDROID_ROOT}" + make prefix=\"${INSTALL_PATH}\" OPT= install + cd ../../openh264-$OPENH264_VERSION LDFLAGS= make -j $MAKEJ PREFIX=$INSTALL_PATH OS=android ARCH=arm USE_ASM=No NDKROOT="$ANDROID_NDK" TARGET="$ANDROID_ROOT" libraries install-static cd ../$X264 ./configure --prefix=$INSTALL_PATH --enable-static --enable-pic --disable-cli --cross-prefix="$ANDROID_BIN-" --sysroot="$ANDROID_ROOT" --host=arm-linux --extra-cflags="$CFLAGS" --extra-ldflags="$LDFLAGS $LIBS" @@ -106,7 +128,8 @@ case $PLATFORM in make install cd ../ffmpeg-$FFMPEG_VERSION patch -Np1 < ../../../ffmpeg-$FFMPEG_VERSION-android.patch - ./configure --prefix=.. $DISABLE $ENABLE --enable-cross-compile --cross-prefix="$ANDROID_BIN-" --ranlib="$ANDROID_BIN-ranlib" --sysroot="$ANDROID_ROOT" --target-os=linux --arch=arm --extra-cflags="-I../include/ $CFLAGS" --extra-ldflags="$ANDROID_ROOT/usr/lib/crtbegin_so.o -L../lib/ -L$ANDROID_CPP/libs/armeabi/ $LDFLAGS" --extra-libs="-lgnustl_static $LIBS" --disable-symver --disable-programs + LIBRTMP_DIR="$INSTALL_PATH/rtmpdump/librtmp/" + ./configure --prefix=.. $DISABLE $ENABLE --enable-cross-compile --cross-prefix="$ANDROID_BIN-" --ranlib="$ANDROID_BIN-ranlib" --sysroot="$ANDROID_ROOT" --target-os=linux --arch=arm --extra-cflags="-I../include/ $CFLAGS -I${LIBRTMP_DIR}android/arm/include -L${LIBRTMP_DIR}android/arm/lib -lrtmp" --extra-ldflags="$ANDROID_ROOT/usr/lib/crtbegin_so.o -L../lib/ -L$ANDROID_CPP/libs/armeabi/ $LDFLAGS -L${LIBRTMP_DIR}android/arm/lib -lrtmp" --extra-libs="-lgnustl_static $LIBS" --disable-symver --disable-programs make -j $MAKEJ make install ;; diff --git a/ffmpeg/ffmpeg-3.3.2-android.patch b/ffmpeg/ffmpeg-3.3.2-android.patch index 84d7767ed4d..04f43aa1172 100644 --- a/ffmpeg/ffmpeg-3.3.2-android.patch +++ b/ffmpeg/ffmpeg-3.3.2-android.patch @@ -28,28 +28,14 @@ diff -ruN ffmpeg-3.3.2/configure ffmpeg-3.3.2-android/configure { check_cpp_condition x265.h "X265_BUILD >= 68" || die "ERROR: libx265 version must be >= 68."; } enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode -lxavs -@@ -5916,10 +5916,10 @@ - check_header OMX_Core.h ; } || - die "ERROR: OpenMAX IL headers not found"; } - enabled openssl && { use_pkg_config openssl openssl/ssl.h OPENSSL_init_ssl || -- use_pkg_config openssl openssl/ssl.h SSL_library_init || -- check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto || -- check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 || -- check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || -+ use_pkg_config openssl openssl/ssl.h OPENSSL_init_ssl || -+ check_lib openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto || -+ check_lib openssl/ssl.h OPENSSL_init_ssl -lssl32 -leay32 || -+ check_lib openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto -lws2_32 -lgdi32 || - die "ERROR: openssl not found"; } - enabled qtkit_indev && { check_header_objcc QTKit/QTKit.h || disable qtkit_indev; } - + diff -ruN ffmpeg-3.3.2/library.mak ffmpeg-3.3.2-android/library.mak --- ffmpeg-3.3.2/library.mak 2017-06-07 11:03:56.000000000 +0900 +++ ffmpeg-3.3.2-android/library.mak 2017-06-23 20:10:54.718543524 +0900 @@ -34,16 +34,13 @@ $(SUBDIR)lib$(NAME).ver: $(SUBDIR)lib$(NAME).v $(OBJS) $$(M)sed 's/MAJOR/$(lib$(NAME)_VERSION_MAJOR)/' $$< | $(VERSION_SCRIPT_POSTPROCESS_CMD) > $$@ - + -$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR) - $(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME) - @@ -58,15 +44,15 @@ diff -ruN ffmpeg-3.3.2/library.mak ffmpeg-3.3.2-android/library.mak $(SLIB_CREATE_DEF_CMD) $$(LD) $(SHFLAGS) $(LDFLAGS) $(LDLIBFLAGS) $$(LD_O) $$(filter %.o,$$^) $(FFEXTRALIBS) $(SLIB_EXTRA_CMD) - + ifdef SUBDIR -$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(DEP_LIBS) +$(SUBDIR)$(SLIBNAME): $(DEP_LIBS) endif - + clean:: @@ -56,9 +53,8 @@ - + install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME) $(Q)mkdir -p "$(SHLIBDIR)" - $$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIB_INSTALL_NAME)" @@ -79,7 +65,7 @@ diff -ruN ffmpeg-3.3.2/library.mak ffmpeg-3.3.2-android/library.mak $(if $(SLIB_INSTALL_EXTRA_LIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_LIB:%=$(SUBDIR)%) "$(LIBDIR)") @@ -77,9 +73,7 @@ $$(INSTALL) -m 644 $$^ "$(PKGCONFIGDIR)" - + uninstall-libs:: - -$(RM) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \ - "$(SHLIBDIR)/$(SLIBNAME)" \ diff --git a/ffmpeg/ffmpeg-librtmp.patch b/ffmpeg/ffmpeg-librtmp.patch new file mode 100644 index 00000000000..119af57c5dc --- /dev/null +++ b/ffmpeg/ffmpeg-librtmp.patch @@ -0,0 +1,13 @@ +diff --git a/configure b/configure +index 72ffaea..0eec3d8 100644 +--- a/configure ++++ b/configure +@@ -5730,7 +5730,7 @@ enabled libopenjpeg && { { check_lib2 openjpeg-2.1/openjpeg.h opj_version + enabled libopenmpt && require_pkg_config "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create + enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create + enabled libpulse && require_pkg_config libpulse pulse/pulseaudio.h pa_context_new +-enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket ++enabled librtmp && require librtmp librtmp/rtmp.h RTMP_Socket -L/Users/pascalbaljet/Android/javacpp-presets-new/ffmpeg/cppbuild/android-arm/lib -lrtmp + enabled librubberband && require_pkg_config "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new + enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init + enabled libshine && require_pkg_config shine shine/layer3.h shine_encode_buffer From 20cb06c2e7edbdeefc5890f28ff06933c7ad0361 Mon Sep 17 00:00:00 2001 From: pascalbaljet Date: Wed, 30 Aug 2017 11:29:23 +0200 Subject: [PATCH 2/3] Replaced absolute path with variable --- ffmpeg/cppbuild.sh | 1 + ffmpeg/ffmpeg-librtmp.patch | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ffmpeg/cppbuild.sh b/ffmpeg/cppbuild.sh index 3f59d891617..e63acd6fbbb 100755 --- a/ffmpeg/cppbuild.sh +++ b/ffmpeg/cppbuild.sh @@ -79,6 +79,7 @@ case $PLATFORM in cp ${ANDROID_ROOT}usr/lib/crtend_android.o rtmpdump/librtmp/ cd ffmpeg-$FFMPEG_VERSION + export INSTALL_PATH_LIB="$INSTALL_PATH/lib" patch -Np1 < ../../../ffmpeg-librtmp.patch cd ../$ZLIB diff --git a/ffmpeg/ffmpeg-librtmp.patch b/ffmpeg/ffmpeg-librtmp.patch index 119af57c5dc..b886c2e05d1 100644 --- a/ffmpeg/ffmpeg-librtmp.patch +++ b/ffmpeg/ffmpeg-librtmp.patch @@ -7,7 +7,7 @@ index 72ffaea..0eec3d8 100644 enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create enabled libpulse && require_pkg_config libpulse pulse/pulseaudio.h pa_context_new -enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket -+enabled librtmp && require librtmp librtmp/rtmp.h RTMP_Socket -L/Users/pascalbaljet/Android/javacpp-presets-new/ffmpeg/cppbuild/android-arm/lib -lrtmp ++enabled librtmp && require librtmp librtmp/rtmp.h RTMP_Socket -L${INSTALL_PATH_LIB} -lrtmp enabled librubberband && require_pkg_config "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init enabled libshine && require_pkg_config shine shine/layer3.h shine_encode_buffer From e6a5e524ff550f83c62c1dc9f2afc56cffa69976 Mon Sep 17 00:00:00 2001 From: pascalbaljet Date: Mon, 11 Sep 2017 00:09:33 +0200 Subject: [PATCH 3/3] Use latest OpenSSL --- ffmpeg/cppbuild.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ffmpeg/cppbuild.sh b/ffmpeg/cppbuild.sh index e63acd6fbbb..edf57c510f1 100755 --- a/ffmpeg/cppbuild.sh +++ b/ffmpeg/cppbuild.sh @@ -28,7 +28,7 @@ download http://zlib.net/$ZLIB.tar.gz $ZLIB.tar.gz download http://downloads.sourceforge.net/project/lame/lame/3.99/$LAME.tar.gz $LAME.tar.gz download http://downloads.xiph.org/releases/speex/$SPEEX.tar.gz $SPEEX.tar.gz download http://sourceforge.net/projects/opencore-amr/files/opencore-amr/$OPENCORE_AMR.tar.gz/download $OPENCORE_AMR.tar.gz -download https://www.openssl.org/source/$OPENSSL.tar.gz $OPENSSL.tar.gz +# download https://www.openssl.org/source/$OPENSSL.tar.gz $OPENSSL.tar.gz download https://github.com/cisco/openh264/archive/v$OPENH264_VERSION.tar.gz openh264-$OPENH264_VERSION.tar.gz download ftp://ftp.videolan.org/pub/videolan/x264/snapshots/last_stable_x264.tar.bz2 last_stable_x264.tar.bz2 download https://ftp.videolan.org/pub/videolan/x265/$X265.tar.gz $X265.tar.gz @@ -45,7 +45,7 @@ tar --totals -xzf ../$ZLIB.tar.gz tar --totals -xzf ../$LAME.tar.gz tar --totals -xzf ../$SPEEX.tar.gz tar --totals -xzf ../$OPENCORE_AMR.tar.gz -tar --totals -xzf ../$OPENSSL.tar.gz +# tar --totals -xzf ../$OPENSSL.tar.gz tar --totals -xzf ../openh264-$OPENH264_VERSION.tar.gz tar --totals -xjf ../last_stable_x264.tar.bz2 tar --totals -xzf ../$X265.tar.gz @@ -78,6 +78,11 @@ case $PLATFORM in cp ${ANDROID_ROOT}usr/lib/crtbegin_dynamic.o rtmpdump/librtmp/ cp ${ANDROID_ROOT}usr/lib/crtend_android.o rtmpdump/librtmp/ + git clone https://github.com/openssl/openssl.git $OPENSSL + cd $OPENSSL + git checkout OpenSSL_1_0_2-stable + cd .. + cd ffmpeg-$FFMPEG_VERSION export INSTALL_PATH_LIB="$INSTALL_PATH/lib" patch -Np1 < ../../../ffmpeg-librtmp.patch