Hi,
Android built-in codec is too small, so we need to FFmpeg. Android provides the NDK, as we use the C language code for FFmpeg which offers convenience.
First create a standard project vPlayer Android
Then vPlayer directory
In ffmpeg under a new config.sh, which reads as follows, attention to PREBUILT and PLATFORM is set correctly. Also contains some parameters you can adjust, I am mainly a player in order to configure the settings and such.
Started running config.sh configure
configure complete, just edit the generated config.h, find the phrase
Android's GCC does not support the restrict keyword, then modified the following way
Edit libavutil / libm.h, static methods to remove them.
Were modified libavcodec, libavfilter, libavformat, libavutil, libpostproc and libswscale under the Makefile, delete the following two
To add a file in the ffmpeg av.mk, reads as follows
Next step is to add a series of Android.mk, in the root directory jni follows
In the ffmpeg directory, Android.mk
libavformat / Android.mk
libavcodec / Android.mk
libavfilter, libavutil, libpostproc and libswscale Android.mk as follows under
Outermost jni / Android.mk and jni / ffmpeg / Android.mk I'm just written this way, you should be rewritten according to their needs.
Finally, run the ndk-build, after a long wait to compile complete
So I made up the compiled so file, please download the attachment. Note that this file is compiled with optimizations for NEON, NEON does not support the ARM processor may not run.
Things seem to never written a long time, the following describes the general use of the next, hoping a little help.
Android First you have a project to put the project libffmpeg.so libs/armeabi-v7a / in. Then be prepared to FFmpeg's source files, put them in the directory you like, such as jni / ffmpeg / in.
Edit the items you need to use libffmpeg.so module Android.mk, in the right place to add the following
FFmpeg source code representative of the variable PATH_TO_FFMPEG_SOURCE path, PATH_TO_LIBFFMPEG_SO is to libffmpeg.so path.
Explain this so contains only avformat, avcodec and avutil three parts, and I also put them into the Android log method applied.
All OK, then you are free to use the FFmpeg.
In addition, the content of this article not been tested, but the content of images, but basically that is the case.
Recommended FFmpeg beginners look at this http://dranger.com/ffmpeg/ffmpeg.html
I think if someone can be encouraged to have a good player for Android and completely free. In our case, if only for S5PC110 optimized, go very well and very fluid.
Will anyone dare?
Download:
Thanks,
Alvaro
FFmpeg compiled with Android NDK
Android built-in codec is too small, so we need to FFmpeg. Android provides the NDK, as we use the C language code for FFmpeg which offers convenience.
First create a standard project vPlayer Android
- Code:
android create project-n vPlayer-t 8-p vPlayer-k me.abitno.vplayer-a PlayerView
Then vPlayer directory
- Code:
mkdir jni & & cd jni
wget http://ffmpeg.org/releases/ffmpeg-0.6.tar.bz2 wget http://ffmpeg.org/releases/ffmpeg-0.6.tar.bz2
tar xf ffmpeg-0.6.tar.bz2 && mv ffmpeg-0.6 ffmpeg && cd ffmpeg tar xf ffmpeg-0.6.tar.bz2 & & mv ffmpeg-0.6 ffmpeg & & cd ffmpeg
In ffmpeg under a new config.sh, which reads as follows, attention to PREBUILT and PLATFORM is set correctly. Also contains some parameters you can adjust, I am mainly a player in order to configure the settings and such.
- Code:
#! / Bin / bash
PREBUILT=/home/abitno/Android/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.4.0 PREBUILT = / home/abitno/Android/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.4.0
PLATFORM=/home/abitno/Android/android-ndk-r4/build/platforms/android-8/arch-arm PLATFORM = / home/abitno/Android/android-ndk-r4/build/platforms/android-8/arch-arm
./configure --target-os=linux \ . / Configure - target-os = linux \
--arch=arm \ - Arch = arm \
--enable-version3 \ - Enable-version3 \
--enable-gpl \ - Enable-gpl \
--enable-nonfree \ - Enable-nonfree \
--disable-stripping \ - Disable-stripping \
--disable-ffmpeg \ - Disable-ffmpeg \
--disable-ffplay \ - Disable-ffplay \
--disable-ffserver \ - Disable-ffserver \
--disable-ffprobe \ - Disable-ffprobe \
--disable-encoders \ - Disable-encoders \
--disable-muxers \ - Disable-muxers \
--disable-devices \ - Disable-devices \
--disable-protocols \ - Disable-protocols \
--enable-protocol=file \ - Enable-protocol = file \
--enable-avfilter \ - Enable-avfilter \
--disable-network \ - Disable-network \
--disable-mpegaudio-hp \ - Disable-mpegaudio-hp \
--disable-avdevice \ - Disable-avdevice \
--enable-cross-compile \ - Enable-cross-compile \
--cc= $ PREBUILT /bin/arm-eabi-gcc \ - Cc = $ PREBUILT / bin / arm-eabi-gcc \
--cross-prefix= $ PREBUILT /bin/arm-eabi- \ - Cross-prefix = $ PREBUILT / bin/arm-eabi- \
--nm= $ PREBUILT /bin/arm-eabi-nm \ - Nm = $ PREBUILT / bin / arm-eabi-nm \
--extra-cflags= " -fPIC -DANDROID " \ - Extra-cflags = "-fPIC-DANDROID" \
--disable-asm \ - Disable-asm \
--enable-neon \ - Enable-neon \
--enable-armv5te \ - Enable-armv5te \
--extra-ldflags= " -Wl,-T, $ PREBUILT /arm-eabi/lib/ldscripts/armelf.x -Wl,-rpath-link= $ PLATFORM /usr/lib -L $ PLATFORM /usr/lib -nostdlib $ PREBUILT /lib/gcc/arm-eabi/4.4.0/crtbegin.o $ PREBUILT /lib/gcc/arm-eabi/4.4.0/crtend.o -lc -lm -ldl " - Extra-ldflags = "-Wl,-T, $ PREBUILT / arm-eabi/lib/ldscripts/armelf.x-Wl,-rpath-link = $ PLATFORM / usr / lib-L $ PLATFORM / usr / lib - nostdlib $ PREBUILT / lib/gcc/arm-eabi/4.4.0/crtbegin.o $ PREBUILT / lib/gcc/arm-eabi/4.4.0/crtend.o-lc-lm-ldl "
Started running config.sh configure
- Code:
chmod + x config.sh
./config.sh . / Config.sh
configure complete, just edit the generated config.h, find the phrase
- Code:
# define restrict restrict
Android's GCC does not support the restrict keyword, then modified the following way
- Code:
# Define restrict
Edit libavutil / libm.h, static methods to remove them.
Were modified libavcodec, libavfilter, libavformat, libavutil, libpostproc and libswscale under the Makefile, delete the following two
- Code:
include $ (SUBDIR) .. / subdir.mak
include $( SUBDIR ) ../config.mak include $ (SUBDIR) .. / config.mak
To add a file in the ffmpeg av.mk, reads as follows
- Code:
# LOCAL_PATH is one of libavutil, libavcodec, libavformat, or libswscale
# include $(LOCAL_PATH)/../config-$(TARGET_ARCH).mak # Include $ (LOCAL_PATH )/../ config-$ (TARGET_ARCH). Mak
include $( LOCAL_PATH ) /../config.mak include $ (LOCAL_PATH) / .. / config.mak
OBJS := OBJS: =
OBJS-yes := OBJS-yes: =
MMX-OBJS-yes := MMX-OBJS-yes: =
include $( LOCAL_PATH ) /Makefile include $ (LOCAL_PATH) / Makefile
# collect objects # Collect objects
OBJS- $( HAVE_MMX ) += $( MMX-OBJS-yes ) OBJS-$ (HAVE_MMX) + = $ (MMX-OBJS-yes)
OBJS += $( OBJS-yes ) OBJS + = $ (OBJS-yes)
FFNAME := lib $( NAME ) FFNAME: = lib $ (NAME)
FFLIBS := $( foreach,NAME, $( FFLIBS ) ,lib $( NAME ) ) FFLIBS: = $ (foreach, NAME, $ (FFLIBS), lib $ (NAME))
FFCFLAGS = -DHAVE_AV_CONFIG_H -Wno-sign-compare -Wno-switch -Wno-pointer-sign FFCFLAGS =-DHAVE_AV_CONFIG_H-Wno-sign-compare-Wno-switch-Wno-pointer-sign
FFCFLAGS += -DTARGET_CONFIG= " config- $( TARGET_ARCH ) .h " FFCFLAGS + =-DTARGET_CONFIG = \ "config-$ (TARGET_ARCH). H "
ALL_S_FILES := $( wildcard $( LOCAL_PATH ) / $( TARGET_ARCH ) /*.S ) ALL_S_FILES: = $ (wildcard $ (LOCAL_PATH) / $ (TARGET_ARCH) / *. S)
ALL_S_FILES := $( addprefix $( TARGET_ARCH ) /, $( notdir $( ALL_S_FILES ) ) ) ALL_S_FILES: = $ (addprefix $ (TARGET_ARCH) /, $ (notdir $ (ALL_S_FILES)))
ifneq ( $( ALL_S_FILES ) ,) ifneq ($ (ALL_S_FILES),)
ALL_S_OBJS := $( patsubst %.S,%.o, $( ALL_S_FILES ) ) ALL_S_OBJS: = $ (patsubst%. S,%. O, $ (ALL_S_FILES))
C_OBJS := $( filter-out $( ALL_S_OBJS ) , $( OBJS ) ) C_OBJS: = $ (filter-out $ (ALL_S_OBJS), $ (OBJS))
S_OBJS := $( filter $( ALL_S_OBJS ) , $( OBJS ) ) S_OBJS: = $ (filter $ (ALL_S_OBJS), $ (OBJS))
else else
C_OBJS := $( OBJS ) C_OBJS: = $ (OBJS)
S_OBJS := S_OBJS: =
endif endif
C_FILES := $( patsubst %.o,%.c, $( C_OBJS ) ) C_FILES: = $ (patsubst%. O,%. C, $ (C_OBJS))
S_FILES := $( patsubst %.o,%.S, $( S_OBJS ) ) S_FILES: = $ (patsubst%. O,%. S, $ (S_OBJS))
FFFILES := $( sort $( S_FILES ) ) $( sort $( C_FILES ) ) FFFILES: = $ (sort $ (S_FILES)) $ (sort $ (C_FILES))
Next step is to add a series of Android.mk, in the root directory jni follows
- Code:
include $ (all-subdir-makefiles)
In the ffmpeg directory, Android.mk
- Code:
LOCAL_PATH: = $ (call my-dir)
include $( CLEAR_VARS ) include $ (CLEAR_VARS)
LOCAL_STATIC_LIBRARIES := libavformat libavcodec libavutil libpostproc libswscale LOCAL_STATIC_LIBRARIES: = libavformat libavcodec libavutil libpostproc libswscale
LOCAL_MODULE := ffmpeg LOCAL_MODULE: = ffmpeg
include $( BUILD_SHARED_LIBRARY ) include $ (BUILD_SHARED_LIBRARY)
include $( call all-makefiles-under, $( LOCAL_PATH ) ) include $ (call all-makefiles-under, $ (LOCAL_PATH))
libavformat / Android.mk
- Code:
LOCAL_PATH: = $ (call my-dir)
include $( CLEAR_VARS ) include $ (CLEAR_VARS)
include $( LOCAL_PATH ) /../av.mk include $ (LOCAL_PATH) / .. / av.mk
LOCAL_SRC_FILES := $( FFFILES ) LOCAL_SRC_FILES: = $ (FFFILES)
LOCAL_C_INCLUDES := \ LOCAL_C_INCLUDES: = \
$( LOCAL_PATH ) \ $ (LOCAL_PATH) \
$( LOCAL_PATH ) /.. $ (LOCAL_PATH) / ..
LOCAL_CFLAGS += $( FFCFLAGS ) LOCAL_CFLAGS + = $ (FFCFLAGS)
LOCAL_CFLAGS += -include " string.h " -Dipv6mr_interface=ipv6mr_ifindex LOCAL_CFLAGS + =-include "string.h"-Dipv6mr_interface = ipv6mr_ifindex
LOCAL_LDLIBS := -lz LOCAL_LDLIBS: =-lz
LOCAL_STATIC_LIBRARIES := $( FFLIBS ) LOCAL_STATIC_LIBRARIES: = $ (FFLIBS)
LOCAL_MODULE := $( FFNAME ) LOCAL_MODULE: = $ (FFNAME)
include $( BUILD_STATIC_LIBRARY ) include $ (BUILD_STATIC_LIBRARY)
libavcodec / Android.mk
- Code:
LOCAL_PATH: = $ (call my-dir)
include $( CLEAR_VARS ) include $ (CLEAR_VARS)
include $( LOCAL_PATH ) /../av.mk include $ (LOCAL_PATH) / .. / av.mk
LOCAL_SRC_FILES := $( FFFILES ) LOCAL_SRC_FILES: = $ (FFFILES)
LOCAL_C_INCLUDES := \ LOCAL_C_INCLUDES: = \
$( LOCAL_PATH ) \ $ (LOCAL_PATH) \
$( LOCAL_PATH ) /.. $ (LOCAL_PATH) / ..
LOCAL_CFLAGS += $( FFCFLAGS ) LOCAL_CFLAGS + = $ (FFCFLAGS)
LOCAL_LDLIBS := -lz LOCAL_LDLIBS: =-lz
LOCAL_STATIC_LIBRARIES := $( FFLIBS ) LOCAL_STATIC_LIBRARIES: = $ (FFLIBS)
LOCAL_MODULE := $( FFNAME ) LOCAL_MODULE: = $ (FFNAME)
include $( BUILD_STATIC_LIBRARY ) include $ (BUILD_STATIC_LIBRARY)
libavfilter, libavutil, libpostproc and libswscale Android.mk as follows under
- Code:
LOCAL_PATH: = $ (call my-dir)
include $( CLEAR_VARS ) include $ (CLEAR_VARS)
include $( LOCAL_PATH ) /../av.mk include $ (LOCAL_PATH) / .. / av.mk
LOCAL_SRC_FILES := $( FFFILES ) LOCAL_SRC_FILES: = $ (FFFILES)
LOCAL_C_INCLUDES := \ LOCAL_C_INCLUDES: = \
$( LOCAL_PATH ) \ $ (LOCAL_PATH) \
$( LOCAL_PATH ) /.. $ (LOCAL_PATH) / ..
LOCAL_CFLAGS += $( FFCFLAGS ) LOCAL_CFLAGS + = $ (FFCFLAGS)
LOCAL_STATIC_LIBRARIES := $( FFLIBS ) LOCAL_STATIC_LIBRARIES: = $ (FFLIBS)
LOCAL_MODULE := $( FFNAME ) LOCAL_MODULE: = $ (FFNAME)
include $( BUILD_STATIC_LIBRARY ) include $ (BUILD_STATIC_LIBRARY)
Outermost jni / Android.mk and jni / ffmpeg / Android.mk I'm just written this way, you should be rewritten according to their needs.
Finally, run the ndk-build, after a long wait to compile complete
Using libffmpeg.so in Android NDK
So I made up the compiled so file, please download the attachment. Note that this file is compiled with optimizations for NEON, NEON does not support the ARM processor may not run.
Things seem to never written a long time, the following describes the general use of the next, hoping a little help.
Android First you have a project to put the project libffmpeg.so libs/armeabi-v7a / in. Then be prepared to FFmpeg's source files, put them in the directory you like, such as jni / ffmpeg / in.
Edit the items you need to use libffmpeg.so module Android.mk, in the right place to add the following
- Code:
LOCAL_C_INCLUDES + = $ (PATH_TO_FFMPEG_SOURCE)
LOCAL_LDLIBS += -L $( PATH_TO_LIBFFMPEG_SO ) -lffmpeg LOCAL_LDLIBS + =-L $ (PATH_TO_LIBFFMPEG_SO)-lffmpeg
FFmpeg source code representative of the variable PATH_TO_FFMPEG_SOURCE path, PATH_TO_LIBFFMPEG_SO is to libffmpeg.so path.
Explain this so contains only avformat, avcodec and avutil three parts, and I also put them into the Android log method applied.
All OK, then you are free to use the FFmpeg.
In addition, the content of this article not been tested, but the content of images, but basically that is the case.
Recommended FFmpeg beginners look at this http://dranger.com/ffmpeg/ffmpeg.html
Conclusion
I think if someone can be encouraged to have a good player for Android and completely free. In our case, if only for S5PC110 optimized, go very well and very fluid.
Will anyone dare?
Download:
- Code:
http://www.mediafire.com/?qqsm8r6nz256y70
http://www.fileserve.com/file/9NPhyfz
http://www.multiupload.com/C5CFK45VYO
Thanks,
Alvaro



» Odroid-X2 CE-marking
» microphone in odroid u2
» [SOLVED] Webcam in Odroid-X (Ubuntu 12.10)
» eMMC rewrite on ODROID
» new to odroid forums.
» How can I install the Google Play (Android Market)?
» datasheet of max77686
» Flashing Android on SD card [X2]
» Only administrators?
» Admin view
» powersupply for ordoid u2
» using ordroid u2 for indoor navigation
» Source code: android emulators(NES, SNES, GG, GBC, GENS, Atari)
» emmc reader not working