Good article reproduced, the source of http://blog.csdn.net/fgwf1/archive/2011/01/05/6118686.aspx
To play a full-format multimedia file on the Android platform, we need to make a multimedia player by ourselves. Android's opencore system has fewer decoding formats, and only supports
MP4 and Ogg, and the structure is not well understood. It is too difficult to add other decoding methods. After consideration, it is easier to implement a full-featured player based on FFMPEG and the cost is relatively low.
(FFMPEG after transplantation content I have put on the git@github.com: windsome/ffmpeg-android.git, interested can directly under
Upload, edited on android2.1, and cannot be edited on other android versions)
This article discusses the first step of making a full-format multimedia player: FFMPEG porting.
Step 1: Get the FFMPEG on an old Android platform that someone else has transplanted. Address is http://gitorious.org /~ Olvaffe/FFMPEG-android, we will use its *. mk file. I put the source code in a temporary directory.
Step 2: Get the new FFMPEG version. The address is a http://ffmpeg.org/download.html. It is generally obtained by using git clone. I put the source code under the external/directory of the android source code tree.
Step 3: Configure FFMPEG to get the config. Mak and config. H files on the Android platform. Therefore, you only need to successfully configure and do not need to compile it. We will compile it under the android source code tree later.
Export prebuilt =/home/dev/Android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0
./Configure -- target-OS = Linux
-- Arch = armv41
-- Enable-Cross-compile
-- Cc = $ prebuilt/bin/ARM-Eabi-gcc
-- Cross-Prefix = $ prebuilt/bin/ARM-Eabi-
-- Nm = $ prebuilt/bin/ARM-Eabi-nm
-- Extra-cflags = "-FPIC-dandroid"
-- Enable-static
-- Disable-shared
-- Disable-ASM
-- Disable-yasm
-- Prefix = 'pwd'/android_bin
-- Extra-ldflags = "-wl,-T, $ prebuilt/ARM-Eabi/lib/ldscripts/armelf. x
-Wl,-rpath-link =/home/dev/Android/out/target/product/generic/obj/lib
-L/home/dev/Android/out/target/product/generic/obj/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"
To explain, prebuilt is the path of my android compiler. I use tool-Chian under the android source code tree. In the configure command, except the directories may be different, other changes do not need to be made.
Step 4: Copy *. mk under FFMPEG-android in the temporary directory to the external/FFMPEG directory of the android source code tree. This completes the transplantation. (In this step, you may need to modify the file. I have packed the file to be modified and placed it in the attachment)
Step 5: Make libavutil libavcodec libavformat libswscale In the android directory.
Note: I have uploaded based on the latest FFMPEG (version 0.6-git-6157eab) changes. You only need to extract the attachment and replace the corresponding file in the source FFMPEG, you can directly perform Step 5.