It involves making a frame widget in Tcl, and then passing its Windows
HWND or X Window ID to C (use
winfo id window) to initialize the
libVLC media player. Alternatively, a photo image can be passed
which receives the decoded video frames.
User also can use this extension in console program, just not pass HWND
tkvlc::init to initialize (after version 0.4).
However, tkvlc in console program now only work when interactive with tclsh.
|tkvlc::init HANDLE ?id||photo?|
HANDLE open filename
HANDLE openurl url
HANDLE volume ?value?
HANDLE time ?value?
HANDLE position ?value? HANDLE isseekable
HANDLE rate ?value?
HANDLE destroy HANDLE event ?cmd? HANDLE repeat ?flag? HANDLE info
duration get duration (in second) of movie time.
time get or set the current movie time (in second).
position get or set movie position as percentage between 0.0 and 1.0.
isseekable return true if the media player can seek.
state get current movie state.
rate get or set relative playback speed
repeat get or set replay flag
event get or set event callback
info return array set list with information media player
Movie state has states (string): idle, opening, buffering, playing, paused, stopped, ended, and error.
The event callback is invoked with an additional argument, which is made up of the event type (string): media, state, time, position, audio, and frame.
The event type frame occurs when new pixels have been rendered into a photo image.
Only test on openSUSE LEAP 42.2 and Ubuntu 14.04.
First is to install libVLC development files. Below is an example for openSUSE:
sudo zypper in vlc-devel
Below is an example for Ubuntu:
sudo apt-get install libvlc-dev
And please notice, I think user still needs VLC codec package when playing a multimedia file.
Building under most UNIX systems is easy, just run the configure script and then run make. For more information about the build process, see the tcl/unix/README file in the Tcl src dist. The following minimal example will install the extension in the /opt/tcl directory.
$ cd tkvlc $ ./configure --prefix=/opt/tcl $ make $ make install
If you need setup directory containing tcl configuration (tclConfig.sh), below is an example:
$ cd tkvlc $ ./configure --with-tcl=/opt/activetcl/lib $ make $ make install
TEA_PROG_WISH check, because this extension needs Tk toolkit.
So if you need specify Tk include path, below is an example:
$ cd tkvlc $ ./configure --with-tkinclude=/usr/include/tk $ make $ make install
VLC binary installers for Windows do not include the LibVLC SDK.
To build this extension, user needs libVLC import libraries and development headers. Please check LibVLC_Tutorial. Copy libraries to C:msys64mingw64lib and headers (vlc folder) to C:msys64mingw64include.
When execute tkvlc, user needs libvlc.dll, libvlccore.dll and plugins files.
Next step is to build tkvlc.
$ ./configure --with-tcl=/c/tcl/lib $ make $ make install
Please check example folder.