本文vlc-android的版本为:2.2.0-pre1 Weatherwax
一般按照官网来就行(https://wiki.videolan.org/AndroidCompile),以下是遇到的几个问题:
1、环境变量配置
export ANDROID_NDK=/Users/nmbb/Android/android-ndk-r9d
export ANDROID_SDK=/Users/nmbb/Android/android-sdk-macosx
export PATH= PATH: ANDROID_SDK/platform-tools:$ANDROID_SDK/tools
export ANDROID_ABI=armeabi-v7a
export ANDROID_SDK=/Users/nmbb/Android/android-sdk-macosx
export PATH= PATH: ANDROID_SDK/platform-tools:$ANDROID_SDK/tools
export ANDROID_ABI=armeabi-v7a
2、编译错误
如果遇到sed: RE error: illegal byte sequence,增加 export LANG=C 即可。
3、不编译jar和apk
注释掉Makefile的下面三行:
# git rev-parse --short HEAD > $(SRC)/assets/revision.txt
# ./gen-env.sh $(SRC)
# (VERBOSE)cd(SRC) && ant (ANTOPTS)(ANT_TARGET)
4、少了iomx-jbmr2.so和iomx-kk.so
解注释Makefile下面这行
LIBVLC_LIBS += libiomx-kk libiomx-jbmr2
但是注意说明:
# The following iomx libs are used for DEBUG only.
# (after android Jelly Bean, we prefer to use MediaCodec instead of iomx)
# (after android Jelly Bean, we prefer to use MediaCodec instead of iomx)
5、 让VLC显示缓冲进度
5.1 解注释 EventHandler的如下行:
public
static
final
int MediaPlayerBuffering = 0x103;
5.2 修改jni/libvlcjni.c,增加如下行389行:
static
const libvlc_event_type_t mp_events[] = {
libvlc_MediaPlayerPlaying,
libvlc_MediaPlayerPaused,
libvlc_MediaPlayerEndReached,
libvlc_MediaPlayerStopped,
libvlc_MediaPlayerVout,
libvlc_MediaPlayerPositionChanged,
libvlc_MediaPlayerTimeChanged,
libvlc_MediaPlayerEncounteredError,
libvlc_MediaPlayerBuffering
};
libvlc_MediaPlayerPlaying,
libvlc_MediaPlayerPaused,
libvlc_MediaPlayerEndReached,
libvlc_MediaPlayerStopped,
libvlc_MediaPlayerVout,
libvlc_MediaPlayerPositionChanged,
libvlc_MediaPlayerTimeChanged,
libvlc_MediaPlayerEncounteredError,
libvlc_MediaPlayerBuffering
};
然后重新编译生成so。截止到发文章,这个还没来得及测,参考这篇文章:
vlc-android 获取MediaPlayerEncounteredError,MediaPlayerBuffering等各种事件的响应 http://blog.csdn.net/memegood123/article/details/8769008
6、系列文章
本文转自博客园农民伯伯的博客,原文链接:【VLC-Android】Mac下编译vlc-android,如需转载请自行联系原博主。