Added ffmpeg lib - NOT TESTED
This commit is contained in:
35
project/jni/ffmpeg/ffmpeg-android/README
Normal file
35
project/jni/ffmpeg/ffmpeg-android/README
Normal file
@@ -0,0 +1,35 @@
|
||||
Downloaded from: http://bambuser.com/opensource
|
||||
|
||||
Toolchain setup
|
||||
---------------
|
||||
|
||||
Download the Android NDK Revision 5b from
|
||||
http://developer.android.com/sdk/ndk/index.html
|
||||
|
||||
Extract it into a folder (e.g. your home directory, the example is
|
||||
for the mac os x version):
|
||||
|
||||
tar -jxvf android-ndk-r5b-darwin-x86.tar.bz2
|
||||
mv android-ndk-r5b android-ndk
|
||||
|
||||
|
||||
Extracting the source
|
||||
---------------------
|
||||
|
||||
The original upstream source (and the patches, if any) can be extracted
|
||||
by running ./extract.sh.
|
||||
|
||||
Building
|
||||
--------
|
||||
|
||||
To build, first set the environment variable NDK to point to the
|
||||
directory where the NDK is installed:
|
||||
|
||||
export NDK=~/android-ndk
|
||||
|
||||
Then just call ./build.sh.
|
||||
|
||||
To clean up the newly built files (removed unused files, remove libraries
|
||||
with version numbers in the name), call ./clean-build.sh.
|
||||
|
||||
|
||||
60
project/jni/ffmpeg/ffmpeg-android/build.sh
Executable file
60
project/jni/ffmpeg/ffmpeg-android/build.sh
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$NDK" = "" ]; then
|
||||
echo NDK variable not set, assuming ${HOME}/android-ndk
|
||||
export NDK=${HOME}/android-ndk
|
||||
fi
|
||||
|
||||
SYSROOT=$NDK/platforms/android-3/arch-arm
|
||||
# Expand the prebuilt/* path into the correct one
|
||||
TOOLCHAIN=`echo $NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/*-x86`
|
||||
export PATH=$TOOLCHAIN/bin:$PATH
|
||||
|
||||
rm -rf build/ffmpeg
|
||||
mkdir -p build/ffmpeg
|
||||
cd ffmpeg
|
||||
|
||||
# Don't build any neon version for now
|
||||
for version in armv5te armv7a; do
|
||||
|
||||
DEST=../build/ffmpeg
|
||||
FLAGS="--target-os=linux --cross-prefix=arm-linux-androideabi- --arch=arm"
|
||||
FLAGS="$FLAGS --sysroot=$SYSROOT"
|
||||
FLAGS="$FLAGS --soname-prefix=/data/data/com.bambuser.broadcaster/lib/"
|
||||
FLAGS="$FLAGS --enable-shared --disable-symver"
|
||||
FLAGS="$FLAGS --enable-small --optimization-flags=-O2"
|
||||
FLAGS="$FLAGS --disable-everything"
|
||||
FLAGS="$FLAGS --enable-encoder=mpeg2video --enable-encoder=nellymoser"
|
||||
|
||||
case "$version" in
|
||||
neon)
|
||||
EXTRA_CFLAGS="-march=armv7-a -mfloat-abi=softfp -mfpu=neon"
|
||||
EXTRA_LDFLAGS="-Wl,--fix-cortex-a8"
|
||||
# Runtime choosing neon vs non-neon requires
|
||||
# renamed files
|
||||
ABI="armeabi-v7a"
|
||||
;;
|
||||
armv7a)
|
||||
EXTRA_CFLAGS="-march=armv7-a -mfloat-abi=softfp"
|
||||
EXTRA_LDFLAGS=""
|
||||
ABI="armeabi-v7a"
|
||||
;;
|
||||
*)
|
||||
EXTRA_CFLAGS=""
|
||||
EXTRA_LDFLAGS=""
|
||||
ABI="armeabi"
|
||||
;;
|
||||
esac
|
||||
DEST="$DEST/$ABI"
|
||||
FLAGS="$FLAGS --prefix=$DEST"
|
||||
|
||||
mkdir -p $DEST
|
||||
echo $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" > $DEST/info.txt
|
||||
./configure $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" | tee $DEST/configuration.txt
|
||||
[ $PIPESTATUS == 0 ] || exit 1
|
||||
make clean
|
||||
make -j4 || exit 1
|
||||
make install || exit 1
|
||||
|
||||
done
|
||||
|
||||
15
project/jni/ffmpeg/ffmpeg-android/clean-build.sh
Executable file
15
project/jni/ffmpeg/ffmpeg-android/clean-build.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
for base in build/ffmpeg/*; do
|
||||
# Remove symlinks, just keep the main versions
|
||||
mv $base/lib $base/lib-orig
|
||||
mkdir -p $base/lib
|
||||
for i in $base/lib-orig/lib*.so; do
|
||||
cp $base/lib-orig/`basename $i` $base/lib
|
||||
done
|
||||
rm -rf $base/lib-orig
|
||||
|
||||
# Remove unnecessary stuff
|
||||
rm -rf $base/share
|
||||
done
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
From 35a5863acf5ee7e1569e803e8471f9d5a51eacae Mon Sep 17 00:00:00 2001
|
||||
From: Martin Storsjo <martin@bambuser.com>
|
||||
Date: Fri, 9 Oct 2009 13:59:55 +0300
|
||||
Subject: [PATCH 1/3] Set the soname to be $(SLIBNAME) instead of $(SLIBNAME_WITH_MAJOR)
|
||||
|
||||
Both due to the ways the android linker works, and due to the apk
|
||||
builder that only includes files named *.so, we want to have the libs
|
||||
named and refer to each other in the form lib<name>.so.
|
||||
---
|
||||
subdir.mak | 7 ++-----
|
||||
1 files changed, 2 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/subdir.mak b/subdir.mak
|
||||
index 8a407fe..107d37c 100644
|
||||
--- a/subdir.mak
|
||||
+++ b/subdir.mak
|
||||
@@ -36,16 +36,13 @@ define RULES
|
||||
$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
|
||||
$$(LD) $(FFLDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS)
|
||||
|
||||
-$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
|
||||
- $(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
|
||||
-
|
||||
-$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver
|
||||
+$(SUBDIR)$(SLIBNAME): $(OBJS) $(SUBDIR)lib$(NAME).ver
|
||||
$(SLIB_CREATE_DEF_CMD)
|
||||
$$(LD) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
|
||||
$(SLIB_EXTRA_CMD)
|
||||
|
||||
ifdef SUBDIR
|
||||
-$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(DEP_LIBS)
|
||||
+$(SUBDIR)$(SLIBNAME): $(DEP_LIBS)
|
||||
endif
|
||||
|
||||
clean::
|
||||
--
|
||||
1.7.3.1
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
From f29136842eb089a545a26064f17824f4b773b45f Mon Sep 17 00:00:00 2001
|
||||
From: Martin Storsjo <martin@bambuser.com>
|
||||
Date: Fri, 9 Oct 2009 15:24:14 +0300
|
||||
Subject: [PATCH 2/3] Add a configure parameter for adding a prefix to the soname
|
||||
|
||||
---
|
||||
configure | 6 +++++-
|
||||
1 files changed, 5 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 2165382..98ea5c2 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -70,6 +70,7 @@ Standard options:
|
||||
--shlibdir=DIR install shared libs in DIR [PREFIX/lib]
|
||||
--incdir=DIR install includes in DIR [PREFIX/include]
|
||||
--mandir=DIR install man page in DIR [PREFIX/share/man]
|
||||
+ --soname-prefix=PREFIX add PREFIX before the libraries soname
|
||||
|
||||
Configuration options:
|
||||
--disable-static do not build static libraries [no]
|
||||
@@ -1110,6 +1111,7 @@ PATHS_LIST='
|
||||
mandir
|
||||
prefix
|
||||
shlibdir
|
||||
+ soname_prefix
|
||||
'
|
||||
|
||||
CMDLINE_SET="
|
||||
@@ -1544,6 +1546,7 @@ incdir_default='${prefix}/include'
|
||||
libdir_default='${prefix}/lib'
|
||||
mandir_default='${prefix}/share/man'
|
||||
shlibdir_default="$libdir_default"
|
||||
+soname_prefix_default=""
|
||||
|
||||
# toolchain
|
||||
ar_default="ar"
|
||||
@@ -1593,7 +1596,7 @@ enable swscale
|
||||
enable swscale_alpha
|
||||
|
||||
# build settings
|
||||
-SHFLAGS='-shared -Wl,-soname,$$(@F)'
|
||||
+SHFLAGS='-shared -Wl,-soname,$$(SONAME_PREFIX)$$(@F)'
|
||||
FFSERVERLDFLAGS=-Wl,-E
|
||||
LIBPREF="lib"
|
||||
LIBSUF=".a"
|
||||
@@ -3145,6 +3148,7 @@ INCDIR=\$(DESTDIR)$incdir
|
||||
BINDIR=\$(DESTDIR)$bindir
|
||||
DATADIR=\$(DESTDIR)$datadir
|
||||
MANDIR=\$(DESTDIR)$mandir
|
||||
+SONAME_PREFIX=$soname_prefix
|
||||
SRC_PATH="$source_path"
|
||||
SRC_PATH_BARE=$source_path
|
||||
BUILD_ROOT="$PWD"
|
||||
--
|
||||
1.7.3.1
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
From 792f45e9dc338240cfa4b1548bf06533baee2faa Mon Sep 17 00:00:00 2001
|
||||
From: Martin Storsjo <martin@bambuser.com>
|
||||
Date: Wed, 14 Oct 2009 18:40:10 +0300
|
||||
Subject: [PATCH 3/3] Add an option for overriding the optimization settings chosen by configure
|
||||
|
||||
---
|
||||
configure | 7 +++++++
|
||||
1 files changed, 7 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 98ea5c2..4416665 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -212,6 +212,7 @@ Advanced options (experts only):
|
||||
--extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
|
||||
--extra-libs=ELIBS add ELIBS [$ELIBS]
|
||||
--extra-version=STRING version string suffix []
|
||||
+ --optimization-flags=FLAGS use FLAGS instead of the optimization flags chosen by other options []
|
||||
--build-suffix=SUFFIX library name suffix []
|
||||
--arch=ARCH select architecture [$arch]
|
||||
--cpu=CPU select the minimum required CPU (affects
|
||||
@@ -1134,6 +1135,7 @@ CMDLINE_SET="
|
||||
logfile
|
||||
malloc_prefix
|
||||
nm
|
||||
+ optimization_flags
|
||||
samples
|
||||
source_path
|
||||
strip
|
||||
@@ -2909,6 +2911,11 @@ void ff_foo(void) {}
|
||||
EOF
|
||||
fi
|
||||
|
||||
+if test "$optimization_flags" != ""; then
|
||||
+ size_cflags="$optimization_flags"
|
||||
+ speed_cflags="$optimization_flags"
|
||||
+ noopt_cflags="$optimization_flags"
|
||||
+fi
|
||||
if enabled small; then
|
||||
add_cflags $size_cflags
|
||||
optimizations="small"
|
||||
--
|
||||
1.7.3.1
|
||||
|
||||
6
project/jni/ffmpeg/ffmpeg-android/extract.sh
Executable file
6
project/jni/ffmpeg/ffmpeg-android/extract.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
tar -zxvf ffmpeg-4f7d2fe-2010-12-16.tar.gz
|
||||
for i in `find diffs -type f`; do
|
||||
(cd ffmpeg && patch -p1 < ../$i)
|
||||
done
|
||||
Binary file not shown.
Reference in New Issue
Block a user