//创建初始化播放器资源
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
extern public static IntPtr lib
vlc_new(int argc, IntPtr argv);
//创建播放器实例
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr lib
vlc_media_player_new(IntPtr lib
vlc_instance);
// 释放lib
vlc实例
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void lib
vlc_release(IntPtr lib
vlc_instance);
//获取库版本信息
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern String lib
vlc_get_version();
// 从视频来源(例如Url)构建一个lib
vlc_meida RTSP
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr lib
vlc_media_new_location(IntPtr lib
vlc_instance, IntPtr path);
// 从本地文件路径构建一个lib
vlc_media rtsp串流不适合调用此接口
// [MarshalAs(UnmanagedType.LPStr)] string path
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr lib
vlc_media_new_path(IntPtr lib
vlc_instance, IntPtr path);
///
/// 影片长度
///
///
///
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr lib
vlc_media_player_get_length(IntPtr lib
vlc_media_player);
//释放对象
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void lib
vlc_media_release(IntPtr lib
vlc_media_inst);
// 将视频(lib
vlc_media)绑定到播放器上
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void lib
vlc_media_player_set_media(IntPtr lib
vlc_media_player, IntPtr lib
vlc_media);
//创建(lib
vlc_media)播放窗口
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void lib
vlc_media_player_new_from_media(IntPtr lib
vlc_media_player);
// 设置图像输出的窗口
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void lib
vlc_media_player_set_hwnd(IntPtr lib
vlc_mediaplayer, Int32 drawable);
//播放
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void lib
vlc_media_player_play(IntPtr lib
vlc_mediaplayer);
//暂停
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void lib
vlc_media_player_pause(IntPtr lib
vlc_mediaplayer);
//停止
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void lib
vlc_media_player_stop(IntPtr lib
vlc_mediaplayer);
// 解析视频资源的媒体信息(如时长等)
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void lib
vlc_media_parse(IntPtr lib
vlc_media);
// 返回视频的时长(必须先调用lib
vlc_media_parse之后,该函数才会生效)
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 lib
vlc_media_get_duration(IntPtr lib
vlc_media);
// 当前播放的时间
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 lib
vlc_media_player_get_time(IntPtr lib
vlc_mediaplayer);
// 设置播放位置(拖动)
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void lib
vlc_media_player_set_time(IntPtr lib
vlc_mediaplayer, Int64 time);
///
/// 抓图
///
///
///
经典0
///
完整路径,文件名英文或下划线开头
///
///
///
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern int lib
vlc_video_take_snapshot(IntPtr lib
vlc_mediaplayer, uint num, IntPtr filePath, uint i_width, uint i_height);
//media player release
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void lib
vlc_media_player_release(IntPtr lib
vlc_mediaplayer);
// 获取音量
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern int lib
vlc_audio_get_volume(IntPtr lib
vlc_media_player);
//设置音量
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void lib
vlc_audio_set_volume(IntPtr lib
vlc_media_player, int volume);
// 设置全屏
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void lib
vlc_set_fullscreen(IntPtr lib
vlc_media_player, int isFullScreen);
///
///判断是否可以录像
///
///
///
//Can the media player record the current media?
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern bool lib
vlc_media_player_is_recordable(IntPtr lib
vlc_media_player);
///
///判断是否在录像
///
///
///
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern bool lib
vlc_media_player_is_recording(IntPtr lib
vlc_media_player);
///
/// 录像开始
///
///
///
保存路径+文件名(d:\\record (将在D盘根目录保存为record.mp4))
///
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern int lib
vlc_media_player_record_start(IntPtr lib
vlc_media_player, IntPtr psz_PathFilename);
///
/// 录像停止
///
///
///
[DllImport("lib
vlc", CallingConvention = CallingConvention.Cdecl)]
public static extern int lib
vlc_media_player_record_stop(IntPtr lib
vlc_media_player);
1