diff --git a/src/native/build.xml b/src/native/build.xml index d06d0e635d7ac1aa492ac4adf168de2c58e9129c..c9cf429b79e9fcf0b504b5c0e308c540d3b5275a 100644 --- a/src/native/build.xml +++ b/src/native/build.xml @@ -261,7 +261,6 @@ <fail message="ffmpeg repository not set!" unless="ffmpeg" /> <fail message="x264 repository not set!" unless="x264" /> <fail message="lame repository not set!" unless="lame" /> - <fail message="libvpx repository not set!" unless="libvpx" /> <cc outtype="shared" name="gcc" outfile="${native_install_dir}/jnffmpeg" objdir="${obj}"> <!-- common compiler flags --> @@ -279,7 +278,6 @@ <linkerarg value="-L${ffmpeg}/libavformat" /> <linkerarg value="-L${ffmpeg}/libavutil" /> <linkerarg value="-L${ffmpeg}/libswscale" /> - <linkerarg value="-L${libvpx}" /> <!-- Depending on the way that lame is built, libmp3lame.a may be in libmp3lame/ or libmp3lame/.libs/. @@ -299,7 +297,6 @@ <linkerarg value="-lswscale" location="end" /> <linkerarg value="-lmp3lame" location="end" /> <linkerarg value="-lx264" location="end" /> - <linkerarg value="-lvpx" location="end" /> <!-- Linux specific flags --> <compilerarg value="-I${system.JAVA_HOME}/include" if="is.running.linux" /> @@ -658,6 +655,75 @@ </cc> </target> + <target name="libvpx" description="Build the libvpx shared library" depends="init-native"> + + <fail message="libvpx repository not set!" unless="libvpx"/> + + <cc outtype="shared" name="gcc" + objdir="${obj}" + outfile="${native_install_dir}/jnvpx"> + <!-- common compiler flags --> + <compilerarg value="-shared" /> + <compilerarg value="-Wall" /> + <compilerarg value="-fPIC"/> + <compilerarg value="-O2" /> + <compilerarg value="-I${libvpx}" unless="is.running.linux"/> + <compilerarg value="-I/usr/include/vpx" if="is.running.linux"/> + <compilerarg value="-D_JNI_IMPLEMENTATION_" /> + + <linkerarg value="-L${libvpx}" /> + + <!-- Linux specific flags --> + <compilerarg value="-m32" if="cross_32" unless="is.running.macos" /> + <compilerarg value="-m64" if="cross_64" unless="is.running.macos" /> + <compilerarg value="-I${system.JAVA_HOME}/include" if="is.running.linux" /> + <compilerarg value="-I${system.JAVA_HOME}/include/linux" if="is.running.linux" /> + + <linkerarg value="-m32" if="cross_32" unless="is.running.macos" /> + <linkerarg value="-m64" if="cross_64" unless="is.running.macos" /> + + <!-- static libraries MUST be at the end otherwise + they will not be added to shared library + --> + <!--<linkerarg value="-Wl,-Bstatic" location="end" if="is.running.linux" />--> + <linkerarg value="-lvpx" location="end" if="is.running.linux" /> + <!--<linkerarg value="-Wl,-Bdynamic" location="end" if="is.running.linux" />--> + + <!-- Mac OS X specific flags --> + <compilerarg value="-mmacosx-version-min=10.5" if="is.running.macos"/> + <compilerarg value="-arch" if="is.running.macos" /> + <compilerarg value="x86_64" if="is.running.macos" /> + <compilerarg value="-arch" if="is.running.macos" /> + <compilerarg value="i386" if="is.running.macos" /> + <compilerarg value="-arch" if="is.running.macos" /> + <compilerarg value="ppc" if="is.running.macos" /> + <compilerarg value="-I/System/Library/Frameworks/JavaVM.framework/Headers" if="is.running.macos" /> + + <linkerarg value="-o" location="end" if="is.running.macos" /> + <linkerarg value="libjnvpx.jnilib" location="end" if="is.running.macos" /> + <linkerarg value="-dynamiclib" if="is.running.macos" /> + <linkerarg value="-arch" if="is.running.macos" /> + <linkerarg value="x86_64" if="is.running.macos" /> + <linkerarg value="-arch" if="is.running.macos" /> + <linkerarg value="i386" if="is.running.macos" /> + <linkerarg value="-arch" if="is.running.macos" /> + <linkerarg value="ppc" if="is.running.macos" /> + <linkerarg value="-lvpx" location="end" if="is.running.macos" /> + + <!-- Windows specific flags --> + <compilerarg value="-I${system.JAVA_HOME}/include" if="is.running.windows" /> + <compilerarg value="-I${system.JAVA_HOME}/include/win32" if="is.running.windows" /> + + <linkerarg value="-ojnvpx.dll" if="is.running.windows" /> + <linkerarg value="-Wl,--no-undefined" if="is.running.windows" /> + <linkerarg value="-Wl,--kill-at" if="is.running.windows" /> + <linkerarg value="-Wl,-Bstatic" location="end" if="is.running.windows" /> + <linkerarg value="-lvpx" location="end" if="is.running.windows" /> + + <fileset dir="${src}/native/vpx" includes="*.c"/> + </cc> + </target> + <!-- compile jnvideo4linux2 library --> <target name="video4linux2" description="Build jnvideo4linux2 shared library" if="is.running.linux" depends="init-native"> diff --git a/src/native/ffmpeg/README b/src/native/ffmpeg/README index 6c01280dd64fa0b497ce38e8cafd872e10fccf90..0e3d0c490340bd31808a325f61a847407d550830 100644 --- a/src/native/ffmpeg/README +++ b/src/native/ffmpeg/README @@ -51,18 +51,7 @@ NDK_BASE=/../android-ndk-r8c --sysroot="$NDK_BASE/platforms/android-9/arch-arm/" \ --cross-prefix=$NDK_BASE/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi- -3. libvpx -./configure --disable-unit-tests --disable-examples --disable-docs \ - --enable-pic --enable-error-concealment - -- If the version used supports vp9, it should be disabled with --disable-vp9, -since we don't need it at the moment. - -- Max OS X -Add the following to the configure line: ---target=universal-darwin9-gcc - -4. ffmpeg +3. ffmpeg Apply the following to libavcodec/Makefile -OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o mpegaudiodecheader.o \ @@ -78,9 +67,8 @@ Apply the following to libavcodec/Makefile --enable-libx264 --enable-gpl \ --enable-decoder=h264 --enable-encoder=libx264 --enable-parser=h264 \ --enable-filter=buffer --enable-filter=hflip --enable-filter=scale --enable-filter=nullsink \ - --enable-libvpx --enable-encoder=libvpx --enable-decoder=vp8 \ - --extra-cflags="-I$MP3LAME_HOME/include -I$X264_HOME -I$LIBVPX_HOME" \ - --extra-ldflags="-L$MP3LAME_HOME/libmp3lame -L$MP3LAME_HOME/libmp3lame/.libs -L$X264_HOME -L$LIBVPX_HOME" + --extra-cflags="-I$MP3LAME_HOME/include -I$X264_HOME" \ + --extra-ldflags="-L$MP3LAME_HOME/libmp3lame -L$MP3LAME_HOME/libmp3lame/.libs -L$X264_HOME" - Windows @@ -113,7 +101,7 @@ Add the following to the configure line: Define the environment variable JAVA_HOME so that the JNI headers can be found. Change the current directory to libjitsi/ and run "ant ffmpeg" passing it -values for the ffmpeg, lame, x264 and libvpx properties which specify the paths +values for the ffmpeg, lame and x264 properties which specify the paths to the homes of the development trees of the respective libraries. For creating universal libraries for Mac OS X see the instructions in src/native/build.xml