libvlc的录像功能

本文详细介绍了在LibVLC中实现录像功能的过程,包括在源代码中正确添加录像功能所需的函数定义及其实现,以及如何确保这些更改能被正确编译并链接到最终的库文件中。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://blog.youkuaiyun.com/huguohu2006/article/details/7981881

最近看到http://blog.youkuaiyun.com/sooth2008/article/details/6787459这位网友的博客实现libvlc的录像功能,但是照这篇博客确实做不出来。下面有网友问他为什么做不出来,他也没有回答。我自己实践了一下发现需要注意几点。

1、添加libvlc_video_toggle_record的时候在include/vlc/libvlc_media_player.h中添加

LIBVLC_API int libvlc_video_toggle_record( libvlc_media_player_t *p_mi,
                                const char *psz_filepath, const char *psz_filename );

注意前面的LIBVLC_API不能缺。

还有video.c是在lib/video.c目录。添加libvlc_video_toggle_record的实现部分。

光有以上这些是没有用的,重新编译后发现libvlc.dll中包含了libvlc_video_toggle_record的,但是libvlc.lib文件中不包含该函数,这样会提示连接器无法找到该函数。通过dll生成lib文件的方法发现生成的文件中也没有该函数。通过比较和实验发现还需要在lib/libvlc.sym文件中添加libvlc_video_toggle_record的声明。这样重新编译出来的lib文件就包含该函数。

2、可是按照这篇博客做出来的还是不能实现录像的功能,只有再分析一下这个函数了。待续....

版权声明:本文为博主原创文章,未经博主允许不得转载。


//创建初始化播放器资源 [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)] publ
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值