Skip to content

Commit 1a26b7d

Browse files
committed
new ffpyplayer / ffmpeg2 recipes
1 parent 6ada83b commit 1a26b7d

File tree

2 files changed

+152
-0
lines changed

2 files changed

+152
-0
lines changed

recipes/ffmpeg2/recipe.sh

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#!/bin/bash
2+
# Recent change made ffmpeg2 not compatible with python-for-android yet.
3+
# Only h264+aac build are working.
4+
5+
VERSION_ffmpeg2=${VERSION_ffmpeg2:-2.7.1}
6+
URL_ffmpeg2=http://ffmpeg.org/releases/ffmpeg-$VERSION_ffmpeg2.tar.bz2
7+
DEPS_ffmpeg2=(sdl)
8+
MD5_ffmpeg2=
9+
BUILD_ffmpeg2=$BUILD_PATH/ffmpeg2/$(get_directory $URL_ffmpeg2)
10+
RECIPE_ffmpeg2=$RECIPES_PATH/ffmpeg2
11+
ARCH_ffmpeg2=${ARCH_ffmpeg2:-armv7a}
12+
13+
function prebuild_ffmpeg2() {
14+
true
15+
}
16+
17+
function shouldbuild_ffmpeg2() {
18+
if [ -f "$BUILD_ffmpeg2/build/ffmpeg/armeabi-v7a/lib/libavcodec.so" ]; then
19+
DO_BUILD=0
20+
fi
21+
}
22+
23+
function build_ffmpeg2() {
24+
cd $BUILD_ffmpeg2
25+
26+
# build ffmpeg2
27+
export NDK=$ANDROIDNDK
28+
push_arm
29+
30+
# configure
31+
DEST=build/ffmpeg
32+
33+
for version in $ARCH_ffmpeg2; do
34+
35+
FLAGS="--disable-everything"
36+
FLAGS="$FLAGS --enable-parser=h264,aac"
37+
FLAGS="$FLAGS --enable-decoder=h263,h264,aac"
38+
FLAGS="$FLAGS --enable-filter=aresample,resample,crop"
39+
FLAGS="$FLAGS --enable-protocol=file,http"
40+
FLAGS="$FLAGS --enable-demuxer=sdp --enable-pic"
41+
FLAGS="$FLAGS --enable-small"
42+
FLAGS="$FLAGS --enable-hwaccels"
43+
FLAGS="$FLAGS --disable-static --enable-shared"
44+
# libpostproc is GPL: https://ffmpeg.org/pipermail/ffmpeg-user/2012-February/005162.html
45+
FLAGS="$FLAGS --enable-gpl"
46+
47+
# needed to prevent _ffmpeg.so: version node not found for symbol av_init_packet@LIBAVFORMAT_52
48+
# /usr/bin/ld: failed to set dynamic section sizes: Bad value
49+
FLAGS="$FLAGS --disable-symver"
50+
51+
# disable some unused algo
52+
# note: "golomb" are the one used in our video test, so don't use --disable-golomb
53+
# note: and for aac decoding: "rdft", "mdct", and "fft" are needed
54+
FLAGS="$FLAGS --disable-dxva2 --disable-vdpau --disable-vaapi"
55+
FLAGS="$FLAGS --disable-dct"
56+
57+
# disable binaries / doc
58+
FLAGS="$FLAGS --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver"
59+
FLAGS="$FLAGS --disable-doc"
60+
61+
case "$version" in
62+
x86)
63+
64+
EXTRA_CFLAGS=""
65+
#EXTRA_LDFLAGS="-Wl,-Bsymbolic"
66+
EXTRA_LDFLAGS=""
67+
ABI="x86"
68+
;;
69+
armv7a)
70+
ARM_FLAGS="--target-os=android --cross-prefix=arm-linux-androideabi- --arch=arm"
71+
ARM_FLAGS="$ARM_FLAGS --sysroot=$NDKPLATFORM"
72+
FLAGS="$ARM_FLAGS $FLAGS"
73+
FLAGS="$FLAGS --enable-neon"
74+
EXTRA_CFLAGS="-march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -fPIC -DANDROID"
75+
EXTRA_LDFLAGS=""
76+
ABI="armeabi-v7a"
77+
;;
78+
*)
79+
echo "Unknown platform $version"
80+
exit 1
81+
;;
82+
esac
83+
DEST="$DEST/$ABI"
84+
FLAGS="$FLAGS --prefix=$DEST"
85+
86+
mkdir -p $DEST
87+
make distclean
88+
try ./configure $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS"
89+
make clean
90+
try make -j4
91+
try make install
92+
93+
done
94+
95+
# install
96+
FFMPEG_LIB="$BUILD_ffmpeg2/build/ffmpeg/armeabi-v7a/lib"
97+
try cp -a "$FFMPEG_LIB/libavcodec.so" "$LIBS_PATH/libavcodec.so"
98+
try cp -a "$FFMPEG_LIB/libavdevice.so" "$LIBS_PATH/libavdevice.so"
99+
try cp -a "$FFMPEG_LIB/libavfilter.so" "$LIBS_PATH/libavfilter.so"
100+
try cp -a "$FFMPEG_LIB/libavformat.so" "$LIBS_PATH/libavformat.so"
101+
try cp -a "$FFMPEG_LIB/libavutil.so" "$LIBS_PATH/libavutil.so"
102+
try cp -a "$FFMPEG_LIB/libswscale.so" "$LIBS_PATH/libswscale.so"
103+
try cp -a "$FFMPEG_LIB/libswresample.so" "$LIBS_PATH/libswresample.so"
104+
try cp -a "$FFMPEG_LIB/libpostproc.so" "$LIBS_PATH/libpostproc.so"
105+
106+
pop_arm
107+
}
108+
109+
function postbuild_ffmpeg2() {
110+
true
111+
}

recipes/ffpyplayer/recipe.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
VERSION_ffpyplayer=${VERSION_ffpyplayer:-master}
4+
URL_ffpyplayer=http://github.com/tito/ffpyplayer/archive/$VERSION_ffpyplayer.zip
5+
DEPS_ffpyplayer=(python ffmpeg2)
6+
MD5_ffpyplayer=
7+
BUILD_ffpyplayer=$BUILD_PATH/ffpyplayer/$(get_directory $URL_ffpyplayer)
8+
RECIPE_ffpyplayer=$RECIPES_PATH/ffpyplayer
9+
10+
function prebuild_ffpyplayer() {
11+
true
12+
}
13+
14+
function shouldbuild_ffpyplayer() {
15+
if [ -d "$SITEPACKAGES_PATH/ffpyplayer" ]; then
16+
DO_BUILD=0
17+
fi
18+
}
19+
20+
function build_ffpyplayer() {
21+
cd $BUILD_ffpyplayer
22+
23+
push_arm
24+
25+
export FFMPEG_INCLUDE_DIR="$BUILD_ffmpeg2/build/ffmpeg/armeabi-v7a/include"
26+
export FFMPEG_LIB_DIR="$BUILD_ffmpeg2/build/ffmpeg/armeabi-v7a/lib"
27+
export SDL_INCLUDE_DIR="$SRC_PATH/jni/sdl/include"
28+
export LDFLAGS="-L$LIBS_PATH"
29+
30+
$HOSTPYTHON setup.py build_ext -v
31+
try find . -iname '*.pyx' -exec $CYTHON {} \;
32+
try $HOSTPYTHON setup.py build_ext -v
33+
export PYTHONPATH=$BUILD_hostpython/Lib/site-packages
34+
try $BUILD_hostpython/hostpython setup.py install -O2 --root=$BUILD_PATH/python-install --install-lib=lib/python2.7/site-packages
35+
36+
pop_arm
37+
}
38+
39+
function postbuild_ffpyplayer() {
40+
true
41+
}

0 commit comments

Comments
 (0)