如何编写可以与操作系统交互的VLC插件
我需要找出是否有可能以及如何(我不关心语言 C/C++、Lua、Python ...)来制作一个 VLC 插件,该插件的目的将由 VLC 播放器调用,并且在视频流的特定时间会做一些动作.
I need to find out if it is possible and how (I do not care about the language C/C++, Lua, Python ...) to make a VLC plugin which purpose will be to be called by the VLC player and at specific times of the video stream will do some action.
我需要做的操作是打开一个 UDP 套接字并发送一些从当前播放的视频随附的文件中读取的数据.
The action that I need to do is to open a UDP socket and send some data read from a file that comes along with the video currently played.
我需要做一个类似字幕阅读器的东西,它最好能初始化UDP套接字并将读取的数据发送到服务器.
I need to make something like a subtitle reader that on it's best can initialize UDP socket and send the read data to the server.
我不确定在 Lua 中是否可以创建 UDP 套接字,也许更好的选择是二进制 C/C++ 插件,但找不到任何示例.
I am not sure that creation of UDP socket is possible in Lua maybe the better option will be a binary C/C++ plugin but can't find any example.
总的来说,我的要求是:
In general at the best my requirements are:
- 在 VLC 启动时加载设置文件
- 需要在视频流的特定时间由播放器触发
- 获取源视频流的文件名
- 打开同名但扩展名不同的文件(脚本)
- 打开一个UDP套接字
- 撰写邮件
- 发送消息
- 继续循环直到视频流结束
非常感谢任何信息、示例或站点、链接.
Any information, example or site, link is greatly appreciated.
推荐答案
看起来您想创建一个控制界面模块.这些是在 VLC 上下文中用 C/C++ 编写的,反过来需要为您想要定位的每个平台(重新)编译.查看 audioscrobbler 模块,了解如何与当前输入流交互以及如何检索文件名等元数据.由于这些模块是用 C 编写的,因此打开套接字和传输数据并不是什么大问题.
Looks like you would like to create a control interface module. Those are written in C/C++ within the VLC context and in turn need to be (re-) compiled for each platform you would like to target. Have a look at the audioscrobbler module to see how to interact with the current input stream and how to retrieve metadata such as file name, etc. Since those modules are in C, opening sockets and transmitting data is not a big deal.
最大的警告可能是,如果您想面向 Windows 平台,您需要一个复杂的编译环境.查看 wiki 上的编译 HOWTO http://wiki.videolan.org/Compile_VLC/因为这可能是您在进行任何编码之前想要尝试的.
The biggest caveat is probably that you need a complex compilation environment if you would like to target the Windows platform. Have a look at the compilation HOWTO's on the wiki http://wiki.videolan.org/Compile_VLC/ since this is probably what you would like to try prior to doing any coding.
想一想,大概可以用lua实现类似功能的扩展,开发起来更容易(因为不需要自己编译VLC,而且会跨平台).不过,打开 UDP 套接字可能会有问题.TCP 将正常工作.此页面可能是一个不错的起点:http://www.coderholic.com/extending-vlc-with-lua/
Thinking about it, you can probably achieve a similarly featured extension in lua, which is easier to develop (since you don't need to compile VLC yourself and it will cross-platform). Opening UDP sockets might be problematic though. TCP will just work. This page could be a nice starting point: http://www.coderholic.com/extending-vlc-with-lua/
相关文章