这里讲的是vlc-android截屏以及录像功能的实现,如果单纯想编译vlc-android的源码请移步至:http://blog.csdn.net/a358763471/article/details/38331121
1、首先按照上面编译文档的流程配置好ubuntu下的android环境;
2、安装好一大堆工具:
FFMPEGCONF += --disable-encoders --disable-muxers
LOCAL_LDLIBS := -L$(VLC_CONTRIB)/lib \ $(VLC_MODULES) \ $(VLC_BUILD_DIR)/lib/.libs/libvlc.a \ $(VLC_BUILD_DIR)/src/.libs/libvlccore.a \ $(VLC_BUILD_DIR)/compat/.libs/libcompat.a \ -ldl -lz -lm -llog \ -ldvbpsi -lebml -lmatroska -ltag \ -logg -lFLAC -ltheora -lvorbis -lvorbisfile -lvorbisenc \ -lmpeg2 -la52 \ -lavformat -lavcodec -lswscale -lavutil -lpostproc -lgsm -lopenjpeg \ -lliveMedia -lUsageEnvironment -lBasicUsageEnvironment -lgroupsock \ -lspeex -lspeexdsp \ -lxml2 -lpng -lgnutls -lgcrypt -lgpg-error \ -lnettle -lhogweed -lgmp \ -lfreetype -liconv -lass -lfribidi -lopus \ -lEGL -lGLESv2 -ljpeg \ $(CPP_STATIC)
SOURCES_access_output_dummy = dummy.c SOURCES_access_output_file = file.c SOURCES_access_output_udp = udp.c SOURCES_access_output_http = http.c bonjour.c bonjour.h SOURCES_access_output_shout = shout.c access_output_LTLIBRARIES += \ libaccess_output_dummy_plugin.la \ libaccess_output_file_plugin.la \ libaccess_output_udp_plugin.la \ libaccess_output_http_plugin.la #libaccess_output_udp_plugin_la_SOURCES = udp.c #libaccess_output_udp_plugin_la_LIBADD = $(SOCKET_LIBS) $(LIBPTHREAD) #access_output_LTLIBRARIES += libaccess_output_udp_plugin.la libaccess_output_livehttp_plugin_la_SOURCES = livehttp.c libaccess_output_livehttp_plugin_la_CFLAGS = $(AM_CFLAGS) $(GCRYPT_CFLAGS) libaccess_output_livehttp_plugin_la_LIBADD = $(GCRYPT_LIBS) -lgpg-error if HAVE_GCRYPT access_output_LTLIBRARIES += libaccess_output_livehttp_plugin.la endif
LIBVLC_API bool libvlc_media_player_is_recordable( libvlc_media_player_t *p_mi ); LIBVLC_API bool libvlc_media_player_is_recording( libvlc_media_player_t *p_mi ); LIBVLC_API int libvlc_media_player_record_start( libvlc_media_player_t *p_mi, const char *psz_filename ); LIBVLC_API int libvlc_media_player_record_stop( libvlc_media_player_t *p_mi );2)在vlc/lib/media_player.c最后添加:
bool libvlc_media_player_is_recordable( libvlc_media_player_t *p_mi ) { input_thread_t *p_input_thread; bool b_can_record; p_input_thread = libvlc_get_input_thread( p_mi ); if( !p_input_thread ) return false; b_can_record = var_GetBool( p_input_thread, "can-record" ); vlc_object_release( p_input_thread ); return b_can_record; } bool libvlc_media_player_is_recording( libvlc_media_player_t *p_mi ) { input_thread_t *p_input_thread; bool b_record; p_input_thread = libvlc_get_input_thread( p_mi ); if( !p_input_thread ) return false; b_record = var_GetBool( p_input_thread, "record" ); vlc_object_release( p_input_thread ); return b_record; } int libvlc_media_player_record_start( libvlc_media_player_t *p_mi, const char* psz_filename ) { input_thread_t *p_input_thread; p_input_thread = libvlc_get_input_thread( p_mi ); if( !p_input_thread ) return -1; var_SetString( p_input_thread, "input-record-path", psz_filename ); var_SetBool( p_input_thread, "record", true ); vlc_object_release( p_input_thread ); return 0; } int libvlc_media_player_record_stop( libvlc_media_player_t *p_mi ) { input_thread_t *p_input_thread; p_input_thread = libvlc_get_input_thread( p_mi ); if( !p_input_thread ) return -1; var_SetBool( p_input_thread, "record", false ); vlc_object_release( p_input_thread ); return 0; },ok修改完毕,重新sh compile.sh
public native boolean takeSnapShot( int num, String file, int width, int height); public native boolean videoRecordStart(String path); public native boolean videoRecordStop(); public native boolean videoIsRecording(); public native boolean videoIsRecordable(); public native int getState(); public boolean takeSnapShot(String file, int width, int height) { return takeSnapShot(0, file, width, height); }