AFPlayer
AFPlayer copied to clipboard
project intented to build a player that works on Android 1.5+
AFPlayer version 0.0.1
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/lgpl.html>.
This project is intented to build ffmpeg based player for Android.
- Building ffmpeg for Android
Make sure that you have environment variable ANDROID_HOME pointing to Android SDK, and NDK pointing to Android Native SDK. Then add them on your system path so you can work comfortably. Add the following line to ~/.bashrc or ~/.bash_profile, depending on your system
Specify here location of Android Native SDK
export NDK="$HOME/ndk-android"
export $NDK:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH
Now get the source code
git clone [email protected]:mikebevz/AFPlayer.git
cd AFPlayer
android update project -p . -s
cd jni
./download.sh
After this wait until ffmpeg is downloaded and built. If everything is okay, then continue. Otherwise submit your errors to Issues.
cd ..
ant clean debug install
This will build and install the program on the connected android phone. See the source code for examples on how to use ffmpeg from Java code. (It's not that much to see yet though)
- Example application - The application plays an audio stream (hardcoded for now) using FFMPEG decoder.
Structurally it looks like this
Activity -> ffmpeg.Manager (playStream) -> player.c (Java_org_fpl_ffmpeg_Manager_playStream) -> fplayer.cpp (start_audio_stream) -> ffmpeg.Manager (streamCallback) -> AudioTrack()
Thanks for inspiration and help to
- http://bambuser.com/opensource
- http://abitno.me/compile-ffmpeg-android-ndk
- http://abitno.me/a-simple-tutorial-to-jni
- http://abitno.me/a-simple-tutorial-to-android-ndk
- https://github.com/havlenapetr/FFMpeg
- http://www.android-dev.ro/2011/06/14/compiling-ffmpeg-on-android/
- http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-development/
- http://stackoverflow.com/questions/5448990/ffmpeg-and-types-of-samples
- http://android.wooyd.org/JNIExample/files/JNIExample.pdf
- http://cekirdek.pardus.org.tr/~ismail/ffmpeg-docs/libavcodec_2utils_8c.html
- http://cekirdek.pardus.org.tr/~ismail/ffmpeg-docs/api-example_8c-source.html
- http://java.sun.com/docs/books/jni/html/other.html
- http://stackoverflow.com/questions/2560748/how-do-i-handle-calls-to-audiotrack-from-jni-without-crashing
- http://stackoverflow.com/questions/4877880/how-to-play-aac-format-audio-file-in-android
- http://code.google.com/p/mplayer-ce/source/browse/branches/newgui/mplayer/libavcodec/api-example.c?spec=svn463&r=463
- http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=15&t=47
- http://pastebin.com/jC5CEddU