Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for libopus #457

Merged
merged 8 commits into from
Sep 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 42 additions & 3 deletions ffmpeg/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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-libfreetype"
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-libfreetype --enable-libopus"

# 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"
Expand All @@ -17,6 +17,7 @@ ENABLE="--enable-pthreads --enable-shared --enable-gpl --enable-version3 --enabl
ZLIB=zlib-1.2.11
LAME=lame-3.99.5
SPEEX=speex-1.2.0
OPUS=opus-1.1.5
OPENCORE_AMR=opencore-amr-0.1.5
OPENSSL=openssl-1.1.0f
OPENH264_VERSION=1.7.0
Expand All @@ -28,6 +29,7 @@ FREETYPE_VERSION=2.8
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 https://archive.mozilla.org/pub/opus/$OPUS.tar.gz $OPUS.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://github.com/cisco/openh264/archive/v$OPENH264_VERSION.tar.gz openh264-$OPENH264_VERSION.tar.gz
Expand All @@ -45,6 +47,7 @@ echo "Decompressing archives..."
tar --totals -xzf ../$ZLIB.tar.gz
tar --totals -xzf ../$LAME.tar.gz
tar --totals -xzf ../$SPEEX.tar.gz
tar --totals -xzf ../$OPUS.tar.gz
tar --totals -xzf ../$OPENCORE_AMR.tar.gz
tar --totals -xzf ../$OPENSSL.tar.gz
tar --totals -xzf ../openh264-$OPENH264_VERSION.tar.gz
Expand Down Expand Up @@ -84,7 +87,11 @@ case $PLATFORM in
make install
cd ../include
make install
cd ../../$OPENCORE_AMR
cd ../../$OPUS
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=arm-linux
make -j $MAKEJ
make install
cd ../$OPENCORE_AMR
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=arm-linux
make -j $MAKEJ
make install
Expand Down Expand Up @@ -145,7 +152,11 @@ case $PLATFORM in
make install
cd ../include
make install
cd ../../$OPENCORE_AMR
cd ../../$OPUS
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=i686-linux
make -j $MAKEJ
make install
cd ../$OPENCORE_AMR
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=i686-linux
make -j $MAKEJ
make install
Expand Down Expand Up @@ -192,6 +203,10 @@ case $PLATFORM in
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=i686-linux CFLAGS="-m32"
make -j $MAKEJ
make install
cd ../$OPUS
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=i686-linux CFLAGS="-m32"
make -j $MAKEJ
make install
cd ../$OPENCORE_AMR
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=i686-linux CFLAGS="-m32" CXXFLAGS="-m32"
make -j $MAKEJ
Expand Down Expand Up @@ -238,6 +253,10 @@ case $PLATFORM in
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=x86_64-linux CFLAGS="-m64"
make -j $MAKEJ
make install
cd ../$OPUS
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=x86_64-linux CFLAGS="-m64"
make -j $MAKEJ
make install
cd ../$OPENCORE_AMR
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=x86_64-linux CFLAGS="-m64" CXXFLAGS="-m64"
make -j $MAKEJ
Expand Down Expand Up @@ -299,6 +318,10 @@ case $PLATFORM in
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=arm-linux-gnueabihf
make -j $MAKEJ
make install
cd ../$OPUS
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=arm-linux-gnueabihf
make -j $MAKEJ
make install
cd ../$OPENCORE_AMR
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=arm-linux-gnueabihf
make -j $MAKEJ
Expand Down Expand Up @@ -374,6 +397,10 @@ case $PLATFORM in
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --build=ppc64le-linux CFLAGS="-m64"
make -j $MAKEJ
make install
cd ../$OPUS
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --build=ppc64le-linux CFLAGS="-m64" CXXFLAGS="-m64"
make -j $MAKEJ
make install
cd ../$OPENCORE_AMR
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --build=ppc64le-linux CFLAGS="-m64" CXXFLAGS="-m64"
make -j $MAKEJ
Expand Down Expand Up @@ -420,6 +447,10 @@ case $PLATFORM in
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic
make -j $MAKEJ
make install
cd ../$OPUS
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic
make -j $MAKEJ
make install
cd ../$OPENCORE_AMR
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic
make -j $MAKEJ
Expand Down Expand Up @@ -464,6 +495,10 @@ case $PLATFORM in
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --build=i686-w64-mingw32 CFLAGS="-m32"
make -j $MAKEJ
make install
cd ../$OPUS
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --build=i686-w64-mingw32 CFLAGS="-m32"
make -j $MAKEJ
make install
cd ../$OPENCORE_AMR
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --build=i686-w64-mingw32 CFLAGS="-m32" CXXFLAGS="-m32"
make -j $MAKEJ
Expand Down Expand Up @@ -508,6 +543,10 @@ case $PLATFORM in
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --build=x86_64-w64-mingw32 CFLAGS="-m64"
make -j $MAKEJ
make install
cd ../$OPUS
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --build=x86_64-w64-mingw32 CFLAGS="-m64"
make -j $MAKEJ
make install
cd ../$OPENCORE_AMR
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --build=x86_64-w64-mingw32 CFLAGS="-m64" CXXFLAGS="-m64"
make -j $MAKEJ
Expand Down
23 changes: 14 additions & 9 deletions ffmpeg/ffmpeg-3.3.2-android.patch
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ diff -ruN ffmpeg-3.3.2/configure ffmpeg-3.3.2-android/configure
{
echo "#include <ft2build.h>"
echo "#include FT_FREETYPE_H"

diff -ruN ffmpeg-3.3.2/configure ffmpeg-3.3.2-android/configure
--- ffmpeg-3.3.2/configure 2017-06-07 11:04:02.000000000 +0900
+++ ffmpeg-3.3.2-android/configure 2017-06-23 20:32:00.139387669 +0900
@@ -5802,7 +5802,7 @@
@@ -5804,7 +5802,7 @@
{ use_pkg_config opencv opencv2/core/core_c.h cvCreateImageHeader ||
require opencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader; }
Expand All @@ -27,7 +23,16 @@ diff -ruN ffmpeg-3.3.2/configure ffmpeg-3.3.2-android/configure
enabled libopenjpeg && { { check_lib openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
check_lib openjpeg-2.1/openjpeg.h opj_version -lopenjp2 ||
{ check_lib openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
@@ -5821,7 +5821,7 @@
@@ -5812,7 +5810,7 @@
{ check_lib openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
die "ERROR: libopenjpeg not found"; }
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 libopus && add_cppflags -I ../include/opus/ && require opus opus_multistream.h opus_multistream_decoder_create -lopus
enabled libpulse && require_pkg_config libpulse pulse/pulseaudio.h pa_context_new
enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
enabled librubberband && require_pkg_config "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new
@@ -5823,7 +5821,7 @@
enabled libsnappy && require snappy snappy-c.h snappy_compress -lsnappy
enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr && LIBSOXR="-lsoxr"
enabled libssh && require_pkg_config libssh libssh/sftp.h sftp_init
Expand All @@ -36,7 +41,7 @@ diff -ruN ffmpeg-3.3.2/configure ffmpeg-3.3.2-android/configure
enabled libtesseract && require_pkg_config tesseract tesseract/capi.h TessBaseAPICreate
enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame &&
@@ -5869,7 +5869,7 @@
@@ -5871,7 +5869,7 @@
die "ERROR: libx264 must be installed and version must be >= 0.118."; } &&
{ check_cpp_condition x264.h "X264_MPEG2" &&
enable libx262; }
Expand All @@ -45,7 +50,7 @@ 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
@@ -5914,10 +5914,10 @@
@@ -5916,10 +5914,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 ||
Expand All @@ -59,7 +64,7 @@ diff -ruN ffmpeg-3.3.2/configure ffmpeg-3.3.2-android/configure
+ 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
Expand Down