This article from csdn lidp http://blog.csdn.net/perfectpdl, reprinted to indicate the source, thank you.
Based on the libvlc library development, You can embed the VLC function into our own applications. The following is the development process of using the libvlc library on the Linux platform (centos.
1. Install libvlc SDK
On the Linux platform, you can directly install it by using commands. On the centos platform, the command is yum install libvlc-devel.
You can also install it based on the official source code (GIT: // git.videolan.org/vlc.git ).
After installation, the dynamic library libvlc, so, and header file will be displayed.
2. SDK-based API Development
Introduce the header file VLC. h In the program.
# Include <stdio. h> # include <stdlib. h> # include <VLC/VLC. h> int main (INT argc, char * argv []) {libvlc_instance_t * inst; libvlc_media_player_t * MP; libvlc_media_t * m;/* load VLC engine */Inst = libvlc_new (0, null);/* Create a new item */M = libvlc_media_new_path (Inst, "http://mytest.mov");/* create a media player playing environement */MP = libvlc_media_player_new_from_media (m ); /* No need to keep the media now */libvlc_media_release (m); # If 0/* The code below is the handle of a specific platform image or sound rendering */libvlc_media_player_set_xdrawable (MP, xdrawable);/* or on Windows */libvlc_media_player_set_hwnd (MP, hwnd);/* or on Mac OS */libvlc_media_player_set_nsobject (MP, view ); # endif/* play the media_player */libvlc_media_player_play (MP); sleep (10);/* Let it play a bit * // * Stop playing */libvlc_media_player_stop (MP ); /* free the media_player */libvlc_media_player_release (MP); libvlc_release (insT); Return 0 ;}
3. Compile
Libvlc. So
Gcc-I $ {vlc_src}/include/-lvlc-l vlc_libs test. c
-VLC-o Test
4. Summary
The above is only the basic process of using libvlc. The libvlc SDK provides many APIs to external interfaces, such as specifying the callback of audio or video streams.
The available APIs I have extracted are as follows:
libvlc_errmsglibvlc_clearerrlibvlc_printerrlibvlc_vprinterrlibvlc_add_intflibvlc_audio_output_device_countlibvlc_audio_output_device_idlibvlc_audio_output_device_longnamelibvlc_audio_output_device_setlibvlc_audio_output_get_device_typelibvlc_audio_output_list_getlibvlc_audio_output_list_releaselibvlc_audio_output_setlibvlc_audio_output_set_device_typelibvlc_audio_get_channellibvlc_audio_get_delaylibvlc_audio_get_mutelibvlc_audio_get_tracklibvlc_audio_get_track_countlibvlc_audio_get_track_descriptionlibvlc_audio_get_volumelibvlc_audio_set_channellibvlc_audio_set_delaylibvlc_audio_set_mutelibvlc_audio_set_tracklibvlc_audio_set_volumelibvlc_audio_toggle_mutelibvlc_audio_set_formatlibvlc_audio_set_format_callbackslibvlc_audio_set_callbackslibvlc_audio_set_volume_callbacklibvlc_clocklibvlc_event_attachlibvlc_event_detachlibvlc_event_manager_newlibvlc_event_manager_register_event_typelibvlc_event_manager_releaselibvlc_event_type_namelibvlc_freelibvlc_get_changesetlibvlc_get_compilerlibvlc_get_fullscreenlibvlc_get_input_threadlibvlc_get_log_verbositylibvlc_get_versionlibvlc_log_clearlibvlc_log_closelibvlc_log_countlibvlc_log_get_iteratorlibvlc_log_iterator_freelibvlc_log_iterator_has_nextlibvlc_log_iterator_nextlibvlc_log_openlibvlc_media_add_optionlibvlc_media_add_option_flaglibvlc_media_discoverer_event_managerlibvlc_media_discoverer_is_runninglibvlc_media_discoverer_localized_namelibvlc_media_discoverer_media_listlibvlc_media_discoverer_new_from_namelibvlc_media_discoverer_releaselibvlc_media_duplicatelibvlc_media_event_managerlibvlc_media_get_durationlibvlc_media_get_metalibvlc_media_get_mrllibvlc_media_get_statelibvlc_media_get_statslibvlc_media_get_user_datalibvlc_media_get_tracks_infolibvlc_media_is_parsedlibvlc_media_library_loadlibvlc_media_library_media_listlibvlc_media_library_newlibvlc_media_library_releaselibvlc_media_library_retainlibvlc_media_list_add_file_contentlibvlc_media_list_add_medialibvlc_media_list_countlibvlc_media_list_event_managerlibvlc_media_list_index_of_itemlibvlc_media_list_insert_medialibvlc_media_list_is_readonlylibvlc_media_list_item_at_indexlibvlc_media_list_locklibvlc_media_list_medialibvlc_media_list_newlibvlc_media_list_player_event_managerlibvlc_media_list_player_get_statelibvlc_media_list_player_is_playinglibvlc_media_list_player_newlibvlc_media_list_player_nextlibvlc_media_list_player_pauselibvlc_media_list_player_playlibvlc_media_list_player_play_itemlibvlc_media_list_player_play_item_at_indexlibvlc_media_list_player_previouslibvlc_media_list_player_releaselibvlc_media_list_player_retainlibvlc_media_list_player_set_media_listlibvlc_media_list_player_set_media_playerlibvlc_media_list_player_set_playback_modelibvlc_media_list_player_stoplibvlc_media_list_releaselibvlc_media_list_remove_indexlibvlc_media_list_retainlibvlc_media_list_set_medialibvlc_media_list_unlocklibvlc_media_new_fdlibvlc_media_new_locationlibvlc_media_new_pathlibvlc_media_new_as_nodelibvlc_media_new_from_input_itemlibvlc_media_parselibvlc_media_parse_asynclibvlc_media_player_can_pauselibvlc_media_player_next_framelibvlc_media_player_event_managerlibvlc_media_player_get_agllibvlc_media_player_get_chapterlibvlc_media_player_get_chapter_countlibvlc_media_player_get_chapter_count_for_titlelibvlc_media_player_get_fpslibvlc_media_player_get_hwndlibvlc_media_player_get_lengthlibvlc_media_player_get_medialibvlc_media_player_get_nsobjectlibvlc_media_player_get_positionlibvlc_media_player_get_ratelibvlc_media_player_get_statelibvlc_media_player_get_timelibvlc_media_player_get_titlelibvlc_media_player_get_title_countlibvlc_media_player_get_xwindowlibvlc_media_player_has_voutlibvlc_media_player_is_seekablelibvlc_media_player_is_playinglibvlc_media_player_newlibvlc_media_player_new_from_medialibvlc_media_player_next_chapterlibvlc_media_player_set_pauselibvlc_media_player_pauselibvlc_media_player_playlibvlc_media_player_previous_chapterlibvlc_media_player_releaselibvlc_media_player_retainlibvlc_media_player_set_agllibvlc_media_player_set_chapterlibvlc_media_player_set_hwndlibvlc_media_player_set_medialibvlc_media_player_set_nsobjectlibvlc_media_player_set_positionlibvlc_media_player_set_ratelibvlc_media_player_set_timelibvlc_media_player_set_titlelibvlc_media_player_set_xwindowlibvlc_media_player_stoplibvlc_media_player_will_playlibvlc_media_player_navigatelibvlc_media_releaselibvlc_media_retainlibvlc_media_save_metalibvlc_media_set_metalibvlc_media_set_statelibvlc_media_set_user_datalibvlc_media_subitemslibvlc_newlibvlc_playlist_playlibvlc_releaselibvlc_retainlibvlc_set_fullscreenlibvlc_set_log_verbositylibvlc_set_user_agentlibvlc_toggle_fullscreenlibvlc_toggle_teletextlibvlc_track_description_releaselibvlc_track_description_list_releaselibvlc_video_get_adjust_floatlibvlc_video_get_adjust_intlibvlc_video_get_aspect_ratiolibvlc_video_get_chapter_descriptionlibvlc_video_get_crop_geometrylibvlc_video_get_sizelibvlc_video_get_heightlibvlc_video_get_cursorlibvlc_video_get_logo_intlibvlc_video_get_marquee_intlibvlc_video_get_marquee_stringlibvlc_video_get_scalelibvlc_video_get_spulibvlc_video_get_spu_countlibvlc_video_get_spu_delaylibvlc_video_get_spu_descriptionlibvlc_video_get_teletextlibvlc_video_get_title_descriptionlibvlc_video_get_tracklibvlc_video_get_track_countlibvlc_video_get_track_descriptionlibvlc_video_get_widthlibvlc_video_set_adjust_floatlibvlc_video_set_adjust_intlibvlc_video_set_aspect_ratiolibvlc_video_set_callbackslibvlc_video_set_crop_geometrylibvlc_video_set_deinterlacelibvlc_video_set_formatlibvlc_video_set_format_callbackslibvlc_video_set_key_inputlibvlc_video_set_logo_intlibvlc_video_set_logo_stringlibvlc_video_set_marquee_intlibvlc_video_set_marquee_stringlibvlc_video_set_mouse_inputlibvlc_video_set_scalelibvlc_video_set_spulibvlc_video_set_spu_delaylibvlc_video_set_subtitle_filelibvlc_video_set_teletextlibvlc_video_set_tracklibvlc_video_take_snapshotlibvlc_vlm_add_broadcastlibvlc_vlm_add_vodlibvlc_vlm_add_inputlibvlc_vlm_change_medialibvlc_vlm_del_medialibvlc_vlm_get_event_managerlibvlc_vlm_get_media_instance_lengthlibvlc_vlm_get_media_instance_positionlibvlc_vlm_get_media_instance_ratelibvlc_vlm_get_media_instance_timelibvlc_vlm_pause_medialibvlc_vlm_play_medialibvlc_vlm_releaselibvlc_vlm_seek_medialibvlc_vlm_set_enabledlibvlc_vlm_set_inputlibvlc_vlm_set_looplibvlc_vlm_set_muxlibvlc_vlm_set_outputlibvlc_vlm_show_medialibvlc_vlm_stop_medialibvlc_set_exit_handlerlibvlc_waitlibvlc_audio_filter_list_getlibvlc_video_filter_list_getlibvlc_module_description_list_release