VLC for Android源码下载和编译
1.vlc for android 已经发布了,开源的地址是:
http://wiki.videolan.org/AndroidCompile
这里面有详细的使用说明,
其中源码获取是:
git clone git://git.videolan.org/vlc-ports/android.git
再次感谢git这个伟大的工具。
2.源码编译:
最新版的源码编译已经简化多了,不用从网上找pdf的文档了,那个已经不适用了。只要按照wiki上的说明操作即可。
运行到:
sh compile.sh
之后会出现:
dr@dr-OptiPlex-3010:~/vlc_android/android$ sh compile.sh
ForanARMv6devicewithoutFPU,youneedabuildwithoutFPU:
$exportNO_FPU=1
ForanARMv5deviceortheAndroidemulator,youneedanARMv5build:
$exportNO_ARMV6=1
Ifyouplantouseareleasebuild,run'compile.shrelease'
VLCsourcenotfound,cloning
Cloninginto'vlc'...
remote:Countingobjects:389435,done.
remote: Compressing objects: 100% (77835/77835), done.接下来会下载vlc的源码文件,就会在原有的git下载的目录下,再新建一个vlc的文件夹里面。估计是按照文档里面不同的编译
配置选项下载的不同的vlc的源码。比如,arm5或7,NEON和NONEON,等等。下载约202MB的东西。
编译过程输出:
Switched to a new branch 'android' Applying the patches Applying: libavcodec: add NEON runtime autodetection Applying: libvlc: add language and frame rate to libvlc_media_track_info_t Building the contribs Guessing build system... x86_64-linux-gnu Creating configuration file... config.mak Bootstrap completed. Run "make" to start compilation. Other targets: * make install same as "make" * make prebuilt fetch and install prebuilt binaries * make list list packages * make fetch fetch required source tarballs * make fetch-all fetch all source tarballs * make distclean clean everything and undo bootstrap * make mostlyclean clean everything except source tarballs * make clean clean everything * make package prepare prebuilt packages curl -f -L -- "http://downloads.videolan.org/pub/videolan/testing/contrib/a52dec-0.7.4.tar.gz" > "../../contrib/tarballs/a52dec-0.7.4.tar.gz" % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 235k 100 235k 0 0 9905 0 0:00:24 0:00:24 --:--:-- 18338 grep -- " a52dec-0.7.4.tar.gz$" "../../contrib/src/a52/SHA512SUMS" && (cd ../../contrib/tarballs && sha512sum --check /dev/stdin) < "../../contrib/src/a52/SHA512SUMS" 4b26fe9492f218b775fb190b76ecf06edaeb656adfe6dcbd24d0a0f86871c3ba917edb88a398eb12dccedaa1605b6f0a0be06b09f9fddd9a46e457b7dd244848 a52dec-0.7.4.tar.gz a52dec-0.7.4.tar.gz: OK touch .sum-a52 curl -f -L -- "http://libass.googlecode.com/files/libass-0.10.1.tar.gz" > "../../contrib/tarballs/libass-0.10.1.tar.gz" % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 368k 100 368k 0 0 20113 0 0:00:18 0:00:18 --:--:-- 15260 grep -- " libass-0.10.1.tar.gz$" "../../contrib/src/ass/SHA512SUMS" && (cd ../../contrib/tarballs && sha512sum --check /dev/stdin) < "../../contrib/src/ass/SHA512SUMS" 531b48a173f4d7bc50ea443ff71c8fe5c1287e8563c44a5dbf72b0a9e5fb16570fe2285ad2bac8ccdada6e6d195b4f451b1036dca17f2aa6de5803e8946cb9a3 libass-0.10.1.tar.gz libass-0.10.1.tar.gz: OK touch .sum-ass curl -f -L -- "http://downloads.videolan.org/pub/videolan/libdca/0.0.5/libdca-0.0.5.tar.bz2" > "../../contrib/tarballs/libdca-0.0.5.tar.bz2" % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 384k 100 384k 0 0 10600 0 0:00:37 0:00:37 --:--:-- 15121 grep -- " libdca-0.0.5.tar.bz2$" "../../contrib/src/dca/SHA512SUMS" && (cd ../../contrib/tarballs && sha512sum --check /dev/stdin) < "../../contrib/src/dca/SHA512SUMS" d9f0ed34efeb3f27af8424fcb3e6df56744c6735854a65b5709c02b42b4513b9c4618dcc19eb44293afa051bd95616651bda5fc3b49dfabe975d0babfb1bc287 libdca-0.0.5.tar.bz2 libdca-0.0.5.tar.bz2: OK touch .sum-dca curl -f -L -- "http://downloads.videolan.org/pub/videolan/libdvbpsi/0.2.2/libdvbpsi-0.2.2.tar.bz2" > "../../contrib/tarballs/libdvbpsi-0.2.2.tar.bz2" % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 322k 100 322k 0 0 14946 0 0:00:22 0:00:22 --:--:-- 21309 grep -- " libdvbpsi-0.2.2.tar.bz2$" "../../contrib/src/dvbpsi/SHA512SUMS" && (cd ../../contrib/tarballs && sha512sum --check /dev/stdin) < "../../contrib/src/dvbpsi/SHA512SUMS" 9077a87d31b6c142773d68a5679a5b864df1c063f66d8b405964127b5e2f0b6b8ab4c1c003f873c221ba5657022667bfdb19cc399211be52bbc94a227de262a7 libdvbpsi-0.2.2.tar.bz2 libdvbpsi-0.2.2.tar.bz2: OK touch .sum-dvbpsi curl -f -L -- "http://dl.matroska.org/downloads/libebml/libebml-1.2.2.tar.bz2" > "../../contrib/tarballs/libebml-1.2.2.tar.bz2" % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 60802 100 60802 0 0 4941 0 0:00:12 0:00:12 --:--:-- 43121 grep -- " libebml-1.2.2.tar.bz2$" "../../contrib/src/ebml/SHA512SUMS" && (cd ../../contrib/tarballs && sha512sum --check /dev/stdin) < "../../contrib/src/ebml/SHA512SUMS" aa9b446aadbfea6cd7031a08a8cd0251a764febb8ef43ee3ba44d066b945698311bda7db6bb2d983d5f0c1e24f108ae4cf1c6551b04337210b13daf7e2236135 libebml-1.2.2.tar.bz2 libebml-1.2.2.tar.bz2: OK touch .sum-ebml curl -f -L -- "http://git.libav.org/?p=libav.git;a=snapshot;h=1a8c6917f68f;sf=tgz" > "../../contrib/tarballs/ffmpeg-git.tar.gz" % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 5577k 0 5577k 0 0 17615 0 --:--:-- 0:05:24 --:--:-- 12273 ../../contrib/src/ffmpeg/rules.mak:136: Not implemented. touch .sum-ffmpeg curl -f -L -- "http://heanet.dl.sourceforge.net/sourceforge/flac/flac-src/flac-1.2.1-src/flac-1.2.1.tar.gz" > "../../contrib/tarballs/flac-1.2.1.tar.gz" % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 409 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- 0:00:12 --:--:-- 0 100 1962k 100 1962k 0 0 17063 0 0:01:57 0:01:57 --:--:-- 15064 grep -- " flac-1.2.1.tar.gz$" "../../contrib/src/flac/SHA512SUMS" && (cd ../../contrib/tarballs && sha512sum --check /dev/stdin) < "../../contrib/src/flac/SHA512SUMS" 39b216239341fbfe210c3a2fc0d0531ecae26c425365c4b6d4fc1081e44e6dc7a9aba8d4c79cc8025386d0a7bb0d25c413c9b64cf7da9ab04ca34a56d2699787 flac-1.2.1.tar.gz flac-1.2.1.tar.gz: OK touch .sum-flac curl -f -L -- "http://heanet.dl.sourceforge.net/sourceforge/freetype/freetype2/2.4.10/freetype-2.4.10.tar.gz" > "../../contrib/tarballs/freetype-2.4.10.tar.gz" % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 411 0 0 0 0 0 0 --:--:-- 0:00:11 --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- 0:00:13 --:--:-- 0 100 1959k 100 1959k 0 0 15040 0 0:02:13 0:02:13 --:--:-- 21090 grep -- " freetype-2.4.10.tar.gz$" "../../contrib/src/freetype2/SHA512SUMS" && (cd ../../contrib/tarballs && sha512sum --check /dev/stdin) < "../../contrib/src/freetype2/SHA512SUMS" 507d1c03d394b695b5a96041ad7ee03b375964c89f007678db864a7e5bd2ee69d83e6c638f4aadaf348c921d37c16741a03ef9bee03196bda2b94ceea409b688 freetype-2.4.10.tar.gz freetype-2.4.10.tar.gz: OK touch .sum-freetype2 curl -f -L -- "http://fribidi.org/download/fribidi-0.19.4.tar.bz2" > "../../contrib/tarballs/fribidi-0.19.4.tar.bz2" % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 593k 100 593k 0 0 11802 0 0:00:51 0:00:51 --:--:-- 16848 grep -- " fribidi-0.19.4.tar.bz2$" "../../contrib/src/fribidi/SHA512SUMS" && (cd ../../contrib/tarballs && sha512sum --check /dev/stdin) < "../../contrib/src/fribidi/SHA512SUMS" 6095421de6652202f54ce008eba881e514059e4ac2fd84fdbaabad504f147b332e9c688982b1857cd4d04d6d0346ca9dd16e6a5a5d2ef5acd4d1c400e054968c fribidi-0.19.4.tar.bz2 fribidi-0.19.4.tar.bz2: OK touch .sum-fribidi curl -f -L -- "ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.5.0.tar.bz2" > "../../contrib/tarballs/libgcrypt-1.5.0.tar.bz2" curl: (6) Couldn't resolve host 'ftp.gnupg.org' make: *** [../../contrib/tarballs/libgcrypt-1.5.0.tar.bz2] Error 6 make: *** Deleting file `../../contrib/tarballs/libgcrypt-1.5.0.tar.bz2'
编译出错了,Fuck!是因为网速慢,继续运行sh compile.sh就行了,可以继续下载。
待下载完成会自动进行编译,编译的时间较长,耐心等待。
我的编译过程中出错了,错误信息如下:
[crunch] Processing image to cache: /home/dr/vlc_android/android/java-libs/ActionBarSherlock/res/drawable-xhdpi/abs__tab_unselected_pressed_holo.9.png => /home/dr/vlc_android/android/java-libs/ActionBarSherlock/bin/res/drawable-xhdpi/abs__tab_unselected_pressed_holo.9.png [crunch] (processed image to cache entry /home/dr/vlc_android/android/java-libs/ActionBarSherlock/bin/res/drawable-xhdpi/abs__tab_unselected_pressed_holo.9.png: 0% size of source) [crunch] Crunched 201 PNG files to update cache -package-resources: [echo] Library project: do not package resources... -package: [echo] Library project: do not package apk... -post-package: -do-debug: [echo] Library project: do not create apk... [propertyfile] Creating new property file: /home/dr/vlc_android/android/java-libs/ActionBarSherlock/bin/build.prop [propertyfile] Updating property file: /home/dr/vlc_android/android/java-libs/ActionBarSherlock/bin/build.prop [propertyfile] Updating property file: /home/dr/vlc_android/android/java-libs/ActionBarSherlock/bin/build.prop [propertyfile] Updating property file: /home/dr/vlc_android/android/java-libs/ActionBarSherlock/bin/build.prop -post-build: debug: -pre-build: -code-gen: [mergemanifest] Merging AndroidManifest files into one. [mergemanifest] Manifest merger disabled. Using project manifest only. [echo] Handling aidl files... [aidl] Found 2 AIDL files. [aidl] Compiling 2 AIDL files. [echo] ---------- [echo] Handling RenderScript files... [renderscript] No RenderScript files to compile. [echo] ---------- [echo] Handling Resources... [aapt] Generating resource IDs... [aapt] aapt: warning: string 'filebrowser_parent' has no default translation in /home/dr/vlc_android/android/java-libs/SlidingMenu/res; found: eu fr gd hr mr te uk wa [aapt] aapt: warning: string 'search_found_results' has no default translation in /home/dr/vlc_android/android/java-libs/SlidingMenu/res; found: es eu gd hr mr te uk wa [aapt] aapt: warning: string 'time_0' has no default translation in /home/dr/vlc_android/android/java-libs/SlidingMenu/res; found: es eu fr gd hr mr te uk wa [echo] ---------- [echo] Handling BuildConfig class... [buildconfig] Generating BuildConfig class. -pre-compile: -compile: [javac] Compiling 70 source files to /home/dr/vlc_android/android/vlc-android/bin/classes [javac] /home/dr/vlc_android/android/vlc-android/src/org/videolan/vlc/Util.java:244: cannot find symbol [javac] symbol : variable JELLY_BEAN [javac] location: class android.os.Build.VERSION_CODES [javac] return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN; [javac] ^ [javac] 1 error BUILD FAILED /home/dr/android-sdk-linux/tools/ant/build.xml:679: The following error occurred while executing this line: /home/dr/android-sdk-linux/tools/ant/build.xml:692: Compile failed; see the compiler error output for details. Total time: 10 seconds make: *** [vlc-android/bin/VLC-debug.apk] Error 1 rm android-libs/libmedia.c android-libs/libutils.c android-libs/libstagefright.c android-libs/libbinder.c
JELLY_BEAN是4.1的sdk版本,我需要先更新一下sdk,然后继续。之前他说sdk要最新的,没想到是真的,Fuck!
也要注意的是ndk的版本是要求r8的,一开始的说明要仔细看呢。
更新了sdk应该可以了,可是仍不行,后来我才想起来是我修改了工程的配置文件:project.properties
把里面的target=android-16修改成了14,Fuck,我干了蠢事啊。
那么改回来继续编译:
哈哈,编译成功了:
log如下:
-package: [apkbuilder] Current build type is different than previous build: forced apkbuilder run. [apkbuilder] Creating VLC-debug-unaligned.apk and signing it with a debug key... -post-package: -do-debug: [zipalign] Running zip align on final apk... [echo] Debug Package: /home/dr/vlc_android/android/vlc-android/bin/VLC-debug.apk [propertyfile] Creating new property file: /home/dr/vlc_android/android/vlc-android/bin/build.prop [propertyfile] Updating property file: /home/dr/vlc_android/android/vlc-android/bin/build.prop [propertyfile] Updating property file: /home/dr/vlc_android/android/vlc-android/bin/build.prop [propertyfile] Updating property file: /home/dr/vlc_android/android/vlc-android/bin/build.prop -post-build: debug: BUILD SUCCESSFUL Total time: 17 seconds rm android-libs/libmedia.c android-libs/libutils.c android-libs/libstagefright.c android-libs/libbinder.c
3.虽然res下面还有红叉,但是apk已经编译出来了,就在bin下面,看来eclipse没起作用。只是用来看代码的吧。
那么该研究研究vlc for android了,这可是好东西啊。以后还要集成DRM呢。