總的來講把VLC內嵌入本身的應用有4種途徑:
•直接調用VLC進程
•VLC的plugin for Mozilla
•VLC的ActiveX插件
•調用libvlcc++
最近須要VLC動態庫作開發,故須要編譯vlc,並修改VLC 將本身的API藉口添加到Lib動態庫中。shell
下面來編譯VLC2.0.1,從官網下載最新VLC。(新版本的VLC須要gcc和glibc的支持,因此使用centOS 6.2或者ubunt10.0版本)ide
若是想要加載所有功能,須要安裝以下庫函數
yum install a52dec a52dec-devel caca-utils dirac dirac-devel expat expat-devel faac faac-devel faad2 faad2-devel ffmpeg \ ffmpeg-libs flac flac-devel fribidi-devel gettext gnutls gnutls-devel gnutls-utils lame lame-devel live555 live555-devel \ libass libass-devel libcaca libcaca-devel libcddb libcddb-devel libcdio libcdio-devel libdap libdap-devel libdca-devel \ libdvbpsi libdvbpsi-devel libdvdnav libdvdnav-devel libdvdread libebml libebml-devel freetype freetype-devel fribidi \ libgcrypt libgcrypt-devel libgpg-error libgpg-error-devel libjpeg-turbo libmad libmad-devel libmatroska libmatroska-devel \ libmodplug libmodplug-devel libmpcdec-devel libmpeg2-devel libogg-devel liboil-devel libpng libpng-devel libshout \ libshout-devel libtheora-devel libtiff libupnp libupnp-devel libvorbis-devel libX11 libX11-devel libxcb libxcb-devel \ libxml2 libxml2-devel mpeg2dec portaudio-devel qt4 qt4-devel schroedinger-devel SDL-devel SDL_image SDL_image-devel speex \ speex-devel taglib-devel twolame twolame-devel vcdimager vcdimager-devel vcdimager-libs x264 x264-devel yasm zlib \ lua xcb-util-devel libsamplerate-devel
那這裏有好可能是我不想要的,因此在configure時將不須要的屏蔽掉了post
./configure --disable-nls --disable-dbus --disable-lua --disable-mad --disable-avcodec --disable-swscale --disable-postproc --disable-a52 --disable-xcb --disable-alsa --disable-libgcryptlua
生成makefile後,make;make install;spa
可能make 是缺乏gcc++ yum之,安裝後,記得從新configure。插件
增長自定義API接口: code
需求:增長VLC視頻存儲功能orm
1)在libvlc_media_play.h文件中聲明爲LIBVLC_API類型的接口函數
2)並將接口在lib/libvlc.sym 文件中添加,不然make編譯時會在鏈接進動態庫時變爲靜態,不可被外部調用。
include\vlc\libvlc_media_player.h文件,
搜索 libvlc_video_take_snapshot(實現截圖功能的)這個函數,找到libvlc_video_take_snapshot後,在其後面添加名
int libvlc_video_toggle_record( libvlc_media_player_t *p_mi, const char *psz_filepath, const char *psz_filename ) { input_thread_t *p_input = libvlc_get_input_thread( p_mi ); if(p_input == NULL) return -1; var_SetString( p_input, "input-record-path", psz_filepath ); var_SetString( p_input, "sout-record-dst-prefix", psz_filename ); var_ToggleBool( p_input, "record"); vlc_object_release(p_input); return 0; }
3)編譯本身程序時指定鏈接動態庫-lvlc
安裝成功!