ndk 8d compiled ffmpeg libstagefright

1.Download ffmpeg-0.11.2.tar.bz2

2.Enterffmpeg-0.11.2/tools

3.Modify build_libstagefright

#!/bin/bash

NDK=/opt/android-ndk-r8d
if [ "$NDK" = "" ]; then
    echo NDK variable not set, assuming ${HOME}/android-ndk
    export NDK=${HOME}/android-ndk
fi

echo "Fetching Android system headers"
git clone --depth=1 --branch gingerbread-release git://github.com/CyanogenMod/android_frameworks_base.git /opt/android-source/frameworks/base
git clone --depth=1 --branch gingerbread-release git://github.com/CyanogenMod/android_frameworks_av.git /opt/android-source/frameworks/av
git clone --depth=1 --branch gingerbread-release git://github.com/CyanogenMod/android_frameworks_native.git /opt/android-source/frameworks/native
git clone --depth=1 --branch gingerbread-release git://github.com/CyanogenMod/android_hardware_libhardware.git /opt/android-source/hardware/libhardware
git clone --depth=1 --branch gingerbread-release git://github.com/CyanogenMod/android_system_core.git /opt/android-source/system/core

echo "Fetching Android libraries for linking"
 Libraries from any froyo/gingerbread device/emulator should work
 fine, since the symbols used should be available on most of them.
if [ ! -d "/opt/android-libs" ]; then
    if [ ! -f "/opt/update-cm-7.0.3-N1-signed.zip" ]; then
        wget http://download.cyanogenmod.com/get/update-cm-7.0.3-N1-signed.zip -P../
    fi
    unzip /opt/update-cm-7.0.3-N1-signed.zip system/lib/* -d../
    mv /opt/system/lib /opt/android-libs
    rmdir /opt/system
fi


SYSROOT=$NDK/platforms/android-9/arch-arm
# Expand the prebuilt/* path into the correct one
#TOOLCHAIN=`echo $NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/*-x86`
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86
export PATH=$TOOLCHAIN/bin:$PATH
ANDROID_SOURCE=/opt/android-source
ANDROID_LIBS=/opt/android-libs
ABI="armeabi-v7a"
CC=$TOOLCHAIN/bin/arm-linux-androideabi-gcc 
NM=$TOOLCHAIN/bin/arm-linux-androideabi-nm
rm -rf ../build/stagefright
mkdir -p ../build/stagefright

DEST=../build/stagefright
DEST="$DEST/$ABI"
FLAGS="--target-os=linux --cross-prefix=arm-linux-androideabi- --arch=arm --cpu=armv7-a --cc=$CC --nm=$NM"
FLAGS="$FLAGS --sysroot=$SYSROOT"
FLAGS="$FLAGS --disable-avdevice --disable-encoders  --disable-decoder=h264 --disable-decoder=h264_vdpau --enable-libstagefright-h264 --enable-asm --enable-neon"
#FLAGS="$FLAGS --disable-shared --enable-static --disable-avdevice --disable-parsers --enable-parser=h264 --disable-filters --disable-decoders --disable-demuxers --disable-network --disable-protocols --disable-swscale --disable-swresample --enable-avformat --enable-avcodec --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-devices  --disable-postproc --disable-avfilter --disable-swscale-alpha --disable-bsfs --disable-encoders --disable-muxers --disable-indevs --disable-debug --disable-doc --enable-zlib --enable-pic --disable-optimizations --disable-decoder=h264 --disable-decoder=h264_vdpau --enable-libstagefright-h264 --enable-asm --enable-neon"


#EXTRA_CFLAGS="-I$ANDROID_SOURCE/frameworks/base/include -I$ANDROID_SOURCE/system/core/include"
#EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/base/media/libstagefright"
#EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/base/include/media/stagefright/openmax"
#EXTRA_CFLAGS="$EXTRA_CFLAGS -I$NDK/sources/cxx-stl/gnu-libstdc++/4.6/include -I$NDK/sources/cxx-stl/gnu-libstdc++/4.6/libs/$ABI/include"
#EXTRA_CFLAGS="/ffmpeg-0.11.2/build/stagefright/armeabi-v7a/include"
EXTRA_CFLAGS="-I$DEST/include"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/base/include"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/base/include/media/stagefright/openmax"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/native/include"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/native/include/media/openmax"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/av/include"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/system/core/include"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/hardware/libhardware/include"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$NDK/sources/cxx-stl/stlport/stlport"
#EXTRA_CFLAGS="$EXTRA_CFLAGS -I$NDK/sources/cxx-stl/gnu-libstdc++/4.6/include"
#EXTRA_CFLAGS="$EXTRA_CFLAGS -I$NDK/sources/cxx-stl/gnu-libstdc++/4.6/libs/$ABI/include"
EXTRA_CFLAGS="$EXTRA_CFLAGS -mfloat-abi=softfp -mfpu=neon -marm -march=armv7-a -mtune=cortex-a8"
EXTRA_CFLAGS="$EXTRA_CFLAGS -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -D_STLP_USE_NEWALLOC"
EXTRA_CFLAGS="$EXTRA_CFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
EXTRA_LDFLAGS=" -Wl,--fix-cortex-a8 -L$ANDROID_LIBS -Wl,-rpath-link,$ANDROID_LIBS -L$NDK/sources/cxx-stl/gnu-libstdc++/4.6/libs/$ABI"
EXTRA_CXXFLAGS="-Wno-multichar -fno-exceptions -fno-rtti"
FLAGS="$FLAGS --prefix=$DEST"

#mkdir -p $DEST

echo $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" --extra-cxxflags="$EXTRA_CXXFLAGS" > $DEST/info.txt
../configure $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" --extra-cxxflags="$EXTRA_CXXFLAGS" | tee $DEST/configuration.txt
#[ $PIPESTATUS == 0 ] || exit 1
make clean
make -j8 install 

$TOOLCHAIN/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o

$TOOLCHAIN/bin/arm-linux-androideabi-ld -rpath-link=$TOOLCHAIN/usr/lib -L$TOOLCHAIN/usr/lib -L$ANDROID_LIBS -soname libffmpeg-neon.so -shared -z noexecstack -Bsymbolic --whole-archive --no-undefined -o $DEST/libffmpeg-neon.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a -lc -lm -lz -ldl -llog -lstdc++ -lmedia -lutils -lstagefright -lbinder --dynamic-linker=/system/bin/linker /opt/android-ndk-r8d/sources/cxx-stl/stlport/libs/armeabi-v7a/libstlport_static.a  $NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a

4.result

root@zhangjie:/home/ffmpeg_j3/jni/ffmpeg/build/stagefright/armeabi-v7a# pwd
/home/ffmpeg_j3/jni/ffmpeg/build/stagefright/armeabi-v7a
root@zhangjie:/home/ffmpeg_j3/jni/ffmpeg/build/stagefright/armeabi-v7a# ls
bin  configuration.txt  include  info.txt  lib  libffmpeg-neon.so  share


5.configure

install prefix            ../build/stagefright/armeabi-v7a
source path               /home/ffmpeg_j3/jni/ffmpeg
C compiler                /opt/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc
ARCH                      arm (armv7-a)
big-endian                no
runtime cpu detection     no
ARMv5TE enabled           yes
ARMv6 enabled             yes
ARMv6T2 enabled           yes
ARM VFP enabled           yes
NEON enabled              yes
debug symbols             yes
strip symbols             yes
optimize for size         no
optimizations             yes
static                    yes
shared                    no
postprocessing support    no
new filter support        yes
network support           yes
threading support         pthreads
safe bitstream reader     yes
SDL support               no
libdxva2 enabled          no
libva enabled             no
libvdpau enabled          no
AVISynth enabled          no
frei0r enabled            no
gnutls enabled            no
libaacplus enabled        no
libass enabled            no
libcdio support           no
libcelt enabled           no
libdc1394 support         no
libfaac enabled           no
libgsm enabled            no
libmodplug enabled        no
libmp3lame enabled        no
libnut enabled            no
libopencore-amrnb support no
libopencore-amrwb support no
libopencv support         no
libopenjpeg enabled       no
libpulse enabled          no
librtmp enabled           no
libschroedinger enabled   no
libspeex enabled          no
libstagefright-h264 enabled    yes
libtheora enabled         no
libutvideo enabled        no
libv4l2 enabled           no
libvo-aacenc support      no
libvo-amrwbenc support    no
libvorbis enabled         no
libvpx enabled            no
libx264 enabled           no
libxavs enabled           no
libxvid enabled           no
openal enabled            no
openssl enabled           no
zlib enabled              yes
bzlib enabled             no

Enabled decoders:
aac            cinepak            lagarith
aac_latm        cljr            libstagefright_h264
aasc            cook            loco
ac3            cscd            mace3
adpcm_4xm        cyuv            mace6
adpcm_adx        dca            mdec
adpcm_ct        dfa            microdvd
adpcm_ea        dirac            mimic
adpcm_ea_maxis_xa    dnxhd            mjpeg
adpcm_ea_r1        dpx            mjpegb
adpcm_ea_r2        dsicinaudio        mlp
adpcm_ea_r3        dsicinvideo        mmvideo
adpcm_ea_xas        dvbsub            motionpixels
adpcm_g722        dvdsub            mp1
adpcm_g726        dvvideo            mp1float
adpcm_ima_amv        dxa            mp2
adpcm_ima_apc        dxtory            mp2float
adpcm_ima_dk3        eac3            mp3
adpcm_ima_dk4        eacmv            mp3adu
adpcm_ima_ea_eacs    eamad            mp3adufloat
adpcm_ima_ea_sead    eatgq            mp3float
adpcm_ima_iss        eatgv            mp3on4
adpcm_ima_qt        eatqi            mp3on4float
adpcm_ima_smjpeg    eightbps        mpc7
adpcm_ima_wav        eightsvx_exp        mpc8
adpcm_ima_ws        eightsvx_fib        mpeg1video
adpcm_ms        escape124        mpeg2video
adpcm_sbpro_2        escape130        mpeg4
adpcm_sbpro_3        exr            mpegvideo
adpcm_sbpro_4        ffv1            msmpeg4v1
adpcm_swf        ffvhuff            msmpeg4v2
adpcm_thp        ffwavesynth        msmpeg4v3
adpcm_xa        flac            msrle
adpcm_yamaha        flashsv            msvideo1
alac            flashsv2        mszh
als            flic            mxpeg
amrnb            flv            nellymoser
amrwb            fourxm            nuv
amv            fraps            pam
anm            frwu            pbm
ansi            g723_1            pcm_alaw
ape            g729            pcm_bluray
ass            gif            pcm_dvd
asv1            gsm            pcm_f32be
asv2            gsm_ms            pcm_f32le
atrac1            h261            pcm_f64be
atrac3            h263            pcm_f64le
aura            h263i            pcm_lxf
aura2            huffyuv            pcm_mulaw
avrp            idcin            pcm_s16be
avs            idf            pcm_s16le
avui            iff_byterun1        pcm_s16le_planar
ayuv            iff_ilbm        pcm_s24be
bethsoftvid        imc            pcm_s24daud
bfi            indeo2            pcm_s24le
bink            indeo3            pcm_s32be
binkaudio_dct        indeo4            pcm_s32le
binkaudio_rdft        indeo5            pcm_s8
bintext            interplay_dpcm        pcm_s8_planar
bmp            interplay_video        pcm_u16be
bmv_audio        jacosub            pcm_u16le
bmv_video        jpeg2000        pcm_u24be
c93            jpegls            pcm_u24le
cavs            jv            pcm_u32be
cdgraphics        kgv1            pcm_u32le
cdxl            kmvc            pcm_u8
pcm_zork        smc            vmdvideo
pcx            snow            vmnc
pgm            sol_dpcm        vorbis
pgmyuv            sonic            vp3
pgssub            sp5x            vp5
pictor            srt            vp6
png            sunrast            vp6a
ppm            svq1            vp6f
prores            svq3            vp8
prores_lgpl        targa            vqa
ptx            theora            wavpack
qcelp            thp            wmalossless
qdm2            tiertexseqvideo        wmapro
qdraw            tiff            wmav1
qpeg            tmv            wmav2
qtrle            truehd            wmavoice
r10k            truemotion1        wmv1
r210            truemotion2        wmv2
ra_144            truespeech        wmv3
ra_288            tscc            wmv3image
ralf            tta            wnv1
rawvideo        twinvq            ws_snd1
rl2            txd            xan_dpcm
roq            ulti            xan_wc3
roq_dpcm        utvideo            xan_wc4
rpza            v210            xbin
rv10            v210x            xbm
rv20            v308            xl
rv30            v408            xsub
rv40            v410            xwd
s302m            vb            y41p
sgi            vble            yop
shorten            vc1            yuv4
sipr            vc1image        zerocodec
smackaud        vcr1            zlib
smacker            vmdaudio        zmbv

Enabled encoders:

Enabled hwaccels:

Enabled parsers:
aac            dvdsub            mpegvideo
aac_latm        flac            png
ac3            gsm            pnm
adx            h261            rv30
cavsvideo        h263            rv40
cook            h264            vc1
dca            mjpeg            vorbis
dirac            mlp            vp3
dnxhd            mpeg4video        vp8
dvbsub            mpegaudio

Enabled demuxers:
aac            iff            pcm_u24be
ac3            image2            pcm_u24le
act            image2pipe        pcm_u32be
adf            ingenient        pcm_u32le
adx            ipmovie            pcm_u8
aea            iss            pmp
aiff            iv8            pva
amr            ivf            qcp
anm            jacosub            r3d
apc            jv            rawvideo
ape            latm            rl2
asf            lmlm4            rm
ass            loas            roq
au            lxf            rpl
avi            m4v            rso
avs            matroska        rtp
bethsoftvid        mgsts            rtsp
bfi            microdvd        sap
bink            mjpeg            sbg
bintext            mlp            sdp
bit            mm            segafilm
bmv            mmf            shorten
c93            mov            siff
caf            mp3            smacker
cavsvideo        mpc            smjpeg
cdg            mpc8            sol
cdxl            mpegps            sox
daud            mpegts            spdif
dfa            mpegtsraw        srt
dirac            mpegvideo        str
dnxhd            msnwc_tcp        swf
dsicin            mtv            thp
dts            mvi            tiertexseq
dv            mxf            tmv
dxa            mxg            truehd
ea            nc            tta
ea_cdata        nsv            tty
eac3            nut            txd
ffm            nuv            vc1
ffmetadata        ogg            vc1t
filmstrip        oma            vmd
flac            pcm_alaw        voc
flic            pcm_f32be        vqf
flv            pcm_f32le        w64
fourxm            pcm_f64be        wav
g722            pcm_f64le        wc3
g723_1            pcm_mulaw        wsaud
g729            pcm_s16be        wsvqa
gsm            pcm_s16le        wtv
gxf            pcm_s24be        wv
h261            pcm_s24le        xa
h263            pcm_s32be        xbin
h264            pcm_s32le        xmv
hls            pcm_s8            xwma
ico            pcm_u16be        yop
idcin            pcm_u16le        yuv4mpegpipe
idf

Enabled muxers:
a64            ipod            pcm_mulaw
ac3            ismv            pcm_s16be
adts            ivf            pcm_s16le
adx            jacosub            pcm_s24be
aiff            latm            pcm_s24le
amr            m4v            pcm_s32be
asf            matroska        pcm_s32le
asf_stream        matroska_audio        pcm_s8
ass            md5            pcm_u16be
au            microdvd        pcm_u16le
avi            mjpeg            pcm_u24be
avm2            mkvtimestamp_v2        pcm_u24le
bit            mlp            pcm_u32be
caf            mmf            pcm_u32le
cavsvideo        mov            pcm_u8
crc            mp2            psp
daud            mp3            rawvideo
dirac            mp4            rm
dnxhd            mpeg1system        roq
dts            mpeg1vcd        rso
dv            mpeg1video        rtp
eac3            mpeg2dvd        rtsp
ffm            mpeg2svcd        sap
ffmetadata        mpeg2video        segment
filmstrip        mpeg2vob        smjpeg
flac            mpegts            sox
flv            mpjpeg            spdif
framecrc        mxf            srt
framemd5        mxf_d10            swf
g722            null            tg2
g723_1            nut            tgp
gif            ogg            truehd
gxf            oma            vc1t
h261            pcm_alaw        voc
h263            pcm_f32be        wav
h264            pcm_f32le        webm
image2            pcm_f64be        wtv
image2pipe        pcm_f64le        yuv4mpegpipe

Enabled protocols:
applehttp        hls            pipe
cache            http            rtmp
concat            httpproxy        rtp
crypto            md5            tcp
file            mmsh            udp
gopher            mmst

Enabled filters:
abuffersink        earwax            pan
aconvert        fade            pixdesctest
aevalsrc        fieldorder        removelogo
aformat            fifo            rgbtestsrc
amerge            format            select
amix            fps            setdar
amovie            gradfun            setfield
anull            hflip            setpts
anullsink        idet            setsar
anullsrc        life            settb
aresample        lut            showinfo
ashowinfo        lutrgb            silencedetect
asplit            lutyuv            slicify
astreamsync        mandelbrot        split
bbox            movie            swapuv
blackdetect        negate            testsrc
buffersink        noformat        thumbnail
cellauto        null            tile
color            nullsink        transpose
copy            nullsrc            unsharp
crop            overlay            vflip
deshake            pad            volume
drawbox

Enabled bsfs:
aac_adtstoasc        mjpeg2jpeg        mp3_header_decompress
chomp            mjpega_dump_header    noise
dump_extradata        mov2textsub        remove_extradata
h264_mp4toannexb    mp3_header_compress    text2movsub
imx_dump_header

Enabled indevs:
dv1394            lavfi            v4l2
fbdev

Enabled outdevs:

License: LGPL version 2.1 or later
Creating config.mak and config.h...
libavutil/avconfig.h is unchanged

你可能感兴趣的:(ndk 8d compiled ffmpeg libstagefright)