Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write VLC plugin that can interact with the operating system

Tags:

c++

c

plugins

lua

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.

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.

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.

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:

  1. Load settings file at VLC launch
  2. Need to be triggered by the player at specific times of the video stream
  3. Get the file name of the source video stream
  4. Open the file (script) with the same name but different extension
  5. Open a UDP socket
  6. Compose the message
  7. Send the message
  8. Continue the loop until the end of the video stream

Any information, example or site, link is greatly appreciated.

like image 651
Patrik Avatar asked Jul 31 '13 08:07

Patrik


1 Answers

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.

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.

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/

like image 177
feepk Avatar answered Nov 15 '22 17:11

feepk