We want to develop our own media player on Android. The first thing we want to think of is to use FFMPEG for implementation. FFmpeg is a cross-platform failover function. We can call the APIS provided by FFMPEG to complete the process. In addition, FFMPEG provides a small program ffplay, which itself is a media player, so we plan to use ffplay as the program's basis.
Below is the development environment I used this time:
-Cygwin
-Android ndk: android-ndk-r4b-windows
-FFMPEG: 0.6.1
-SDL: 1.2.14
Step 1
First, create an android project.
Step 2
Create a resource $ (Project)/JNI/libs, and then test [Integrate FFMPEG to Android platform] And libavcodec. a. libavformat. a. libavutil. a. libpostproc. A And libswscale. a. Copy now.
Step 3
From the ffplay program example, you can find that the SDL function is used in the content. Because FFMPEG only supports video decoding, if you want to upload the obtained image information to the screen or play the audio, in this case, SDL is required to help you send the data to device. You can test [Integrate SDL into the Android platform] and copy libsdl. A to $ (Project)/JNI/libs.
Step 4
Put ffplay. C, cmdutils. C, and cmdutils. h under $ (Project)/JNI, and then create a makefile:
Target = libjniomx. So
Sources = $ (wildcard *. c)
Cflags =-I .. /.. /.. /build/platforms/tegra/include/openmax/il/-I/usr/local/include/SDL/-I. /FFMPEG/-STD = c99
Ldflags =-lstdc ++-LC-lm-llog-lnvomx-lavformat-lavcodec-lavutil-lswscale
Ldflags + =-L./FFMPEG/libs/-lsdl
Include ../build. mk
Step 5
Run make under $ (Project)/JNI and build the project through eclipse.
Step 6
When you install it on the Android platform, you will find that the program cannot run. We can use the debug mode to check the problem. The following message is displayed at this time:
No available video device
The trace program will get the loss of the startup/dev/graphics/fb0.
Step 7
The following links are taken as an example:
Http://groups.google.com/group/android-ndk/browse_thread/thread/9cb5a34e0baae1f0
In Linux, framebuffer may have permission issues during access, so our program cannot run normally.
Step 8
Conclusion: Media Player Based on FFMPEG and SDL cannot be used on the Android platform.
From http://blog.csdn.net/banyao2006/archive/2011/01/10/6126247.aspx