编译的环境是ubuntu 12.04,要安装好java,配置好环境变量,按照http://wiki.videolan.org/AndroidCompile配置好,就可以编译了。
export JAVA_HOME=/home/sunlit/jdk1.6.0_38/ export PATH=$JAVA_HOME/bin:$PATH export classPath=/home/sunlit/jdk1.6.0_38/ export ANDROID_SDK=/home/sunlit/sdk export ANDROID_NDK=/home/sunlit/android-ndk-r8c export PATH=$PATH:$ANDROID_SDK/platform-tools:$ANDROID_SDK/tools export ANDROID_ABI=armeabi-v7a
2014/03/26日更新开始
2014/03/26日更新结束
为了在android vlc上增加截图和保存视频的功能
要对android/configure.sh进行修改 删掉其中的-disable-sout
另外保存图片为png格式,需要让ffmpeg增加-enable-encoder=png的编码器(在android/vlc/contrib/src/ffmpeg/rules.mak中修改)
2014/03/26日更新开始
FFMPEGCONF += --disable-encoders --disable-muxers
2014/03/26日更新结束
在libvlcjni.c中增加函数:
jboolean Java_org_videolan_libvlc_LibVLC_takeSnapShot(JNIEnv *env, jobject thiz,jint number, jstring path, jint width,jint height) { jboolean isCopy; libvlc_media_player_t *mp = getMediaPlayer(env, thiz); /* Get C string */ const char* psz_path = (*env)->GetStringUTFChars(env, path, &isCopy); if (mp) if(libvlc_video_take_snapshot(mp, (int)number,psz_path , (int)width,(int)height)==0) return JNI_TRUE; return JNI_FALSE; }
在LibVlc.java中增加native函数的接口
private native boolean takeSnapShot( int num, String file, int width, int height);和调用方法
public boolean takeSnapShot(String file, int width, int height) { return takeSnapShot(0, file, width, height); }
2014/03/26日更新开始
jboolean Java_org_videolan_libvlc_LibVLC_takeSnapShot(JNIEnv *env, jobject thiz,jint number, jstring path, jint width,jint height) { jboolean isCopy; libvlc_media_player_t *mp = getMediaPlayer(env, thiz); /* Get C string */ const char* psz_path = (*env)->GetStringUTFChars(env, path, &isCopy); if (mp) if(libvlc_video_take_snapshot(mp, (int)number,psz_path , (int)width,(int)height)==0) return JNI_TRUE; return JNI_FALSE; } jboolean Java_org_videolan_libvlc_LibVLC_videoRecordStart(JNIEnv *env, jobject thiz,jstring path) { jboolean isCopy; libvlc_media_player_t *mp = getMediaPlayer(env, thiz); /* Get C string */ const char* psz_path = (*env)->GetStringUTFChars(env, path, &isCopy); //const char* psz_filename=(*env)->GetStringUTFChars(env, filename, &isCopy); if (mp) if(libvlc_media_player_record_start(mp,psz_path)==0) return JNI_TRUE; return JNI_FALSE; } jboolean Java_org_videolan_libvlc_LibVLC_videoRecordStop(JNIEnv *env, jobject thiz) { jboolean isCopy; libvlc_media_player_t *mp = getMediaPlayer(env, thiz); /* Get C string */ if (mp) if(libvlc_media_player_record_stop(mp)==0) return JNI_TRUE; return JNI_FALSE; } jboolean Java_org_videolan_libvlc_LibVLC_videoIsRecording(JNIEnv *env, jobject thiz) { jboolean isCopy; libvlc_media_player_t *mp = getMediaPlayer(env, thiz); if (mp) if(libvlc_media_player_is_recording(mp)) return JNI_TRUE; return JNI_FALSE; } jboolean Java_org_videolan_libvlc_LibVLC_videoIsRecordable(JNIEnv *env, jobject thiz) { jboolean isCopy; libvlc_media_player_t *mp = getMediaPlayer(env, thiz); if (mp) if(libvlc_media_player_is_recordable(mp)) return JNI_TRUE; return JNI_FALSE; } jint Java_org_videolan_libvlc_LibVLC_getState(JNIEnv *env, jobject thiz) { libvlc_media_player_t *mp = getMediaPlayer(env, thiz); if (mp){ libvlc_state_t state=libvlc_media_player_get_state(mp); return (jint)state; } else return -1; }
2014/03/26日更新结束
送佛送到西 源码下载地址http://pan.baidu.com/s/17Y4dO
有什么问题 请在评论中提出
如果编译过了 没问题 请向我支付宝账号布施或者捐赠1元人民币 账户是https://me.alipay.com/ares89 谢谢支持