//创建初始化播放器资源
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
extern public static IntPtr
libvlc_new(int argc, IntPtr argv);
//创建播放器实例
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr
libvlc_media_player_new(IntPtr
libvlc_instance);
// 释放
libvlc实例
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void
libvlc_release(IntPtr
libvlc_instance);
//获取库版本信息
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern String
libvlc_get_version();
// 从视频来源(例如Url)构建一个
libvlc_meida RTSP
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr
libvlc_media_new_location(IntPtr
libvlc_instance, IntPtr path);
// 从本地文件路径构建一个
libvlc_media rtsp串流不适合调用此接口
// [MarshalAs(UnmanagedType.LPStr)] string path
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr
libvlc_media_new_path(IntPtr
libvlc_instance, IntPtr path);
///
/// 影片长度
///
///
///
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr
libvlc_media_player_get_length(IntPtr
libvlc_media_player);
//释放对象
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void
libvlc_media_release(IntPtr
libvlc_media_inst);
// 将视频(
libvlc_media)绑定到播放器上
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void
libvlc_media_player_set_media(IntPtr
libvlc_media_player, IntPtr
libvlc_media);
//创建(
libvlc_media)播放窗口
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void
libvlc_media_player_new_from_media(IntPtr
libvlc_media_player);
// 设置图像输出的窗口
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void
libvlc_media_player_set_hwnd(IntPtr
libvlc_mediaplayer, Int32 drawable);
//播放
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void
libvlc_media_player_play(IntPtr
libvlc_mediaplayer);
//暂停
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void
libvlc_media_player_pause(IntPtr
libvlc_mediaplayer);
//停止
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void
libvlc_media_player_stop(IntPtr
libvlc_mediaplayer);
// 解析视频资源的媒体信息(如时长等)
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void
libvlc_media_parse(IntPtr
libvlc_media);
// 返回视频的时长(必须先调用
libvlc_media_parse之后,该函数才会生效)
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern Int64
libvlc_media_get_duration(IntPtr
libvlc_media);
// 当前播放的时间
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern Int64
libvlc_media_player_get_time(IntPtr
libvlc_mediaplayer);
// 设置播放位置(拖动)
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void
libvlc_media_player_set_time(IntPtr
libvlc_mediaplayer, Int64 time);
///
/// 抓图
///
///
///
经典0
///
完整路径,文件名英文或下划线开头
///
///
///
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern int
libvlc_video_take_snapshot(IntPtr
libvlc_mediaplayer, uint num, IntPtr filePath, uint i_width, uint i_height);
//media player release
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void
libvlc_media_player_release(IntPtr
libvlc_mediaplayer);
// 获取音量
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern int
libvlc_audio_get_volume(IntPtr
libvlc_media_player);
//设置音量
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void
libvlc_audio_set_volume(IntPtr
libvlc_media_player, int volume);
// 设置全屏
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void
libvlc_set_fullscreen(IntPtr
libvlc_media_player, int isFullScreen);
///
///判断是否可以录像
///
///
///
//Can the media player record the current media?
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern bool
libvlc_media_player_is_recordable(IntPtr
libvlc_media_player);
///
///判断是否在录像
///
///
///
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern bool
libvlc_media_player_is_recording(IntPtr
libvlc_media_player);
///
/// 录像开始
///
///
///
保存路径+文件名(d:\\record (将在D盘根目录保存为record.mp4))
///
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern int
libvlc_media_player_record_start(IntPtr
libvlc_media_player, IntPtr psz_PathFilename);
///
/// 录像停止
///
///
///
[DllImport("
libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern int
libvlc_media_player_record_stop(IntPtr
libvlc_media_player);
1