After one weekend of browsing through all the docs I could, I surrender... I have tried to cross compile an example plugin with VLC source code from current HEAD, revision 1.1.7 and 2.0.3. Either didn't succeed or the generated plugin didn't load.
The current HEAD generates plugins with an entry point which I think isn't yet valid for VLC 2.0.3 (current version for Windows), so I've discard this.
I then checked out from GIT version 1.1.7, but never was able to configure the stuff for compilation. With 2.0.3 I was able to generate libvlccore, but can't link the sample plugin, with the error below:
Code: Select all
lscn@lscn-VirtualBox:~/Desktop/vlc-2.0/win32/win32_$ i686-w64-mingw32-gcc -std=gnu99 `pkg-config --cflags --libs hello` -o libhello_plugin.dll hello.c
In file included from hello.c:15:0:
/home/lscn/Desktop/vlc-2.0/include/vlc_common.h:405:0: warning: "stat" redefined [enabled by default]
/usr/lib/gcc/i686-w64-mingw32/4.6/../../../../i686-w64-mingw32/include/sys/stat.h:255:0: note: this is the location of the previous definition
/home/lscn/Desktop/vlc-2.0/include/vlc_common.h:406:0: warning: "fstat" redefined [enabled by default]
/usr/lib/gcc/i686-w64-mingw32/4.6/../../../../i686-w64-mingw32/include/sys/stat.h:256:0: note: this is the location of the previous definition
/tmp/cc77N1wO.o:hello.c:(.text+0x75): undefined reference to `_var_Inherit'
/tmp/cc77N1wO.o:hello.c:(.text+0x386): undefined reference to `_vlc_Log'
/tmp/cc77N1wO.o:hello.c:(.text+0x3cb): undefined reference to `_vlc_Log'
/tmp/cc77N1wO.o:hello.c:(.text+0x40a): undefined reference to `_vlc_Log'
collect2: ld returned 1 exit status
Code: Select all
/**
* @file hello.c
* @brief Hello world interface VLC module example
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#define DOMAIN "vlc-myplugin"
#define _(str) dgettext(DOMAIN, str)
#define N_(str) (str)
#include <stdlib.h>
/* VLC core API headers */
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_interface.h>
#define MODULE_STRING "hello"
/* Forward declarations */
static int Open(vlc_object_t *);
static void Close(vlc_object_t *);
/* Module descriptor */
vlc_module_begin()
set_shortname(N_("Hello"))
set_description(N_("Hello interface"))
set_capability("interface", 0)
set_callbacks(Open, Close)
set_category(CAT_INTERFACE)
add_string("hello-who", "world", "Target", "Whom to say hello to.", false)
vlc_module_end ()
/* Internal state for an instance of the module */
struct intf_sys_t
{
char *who;
};
/**
* Starts our example interface.
*/
static int Open(vlc_object_t *obj)
{
intf_thread_t *intf = (intf_thread_t *)obj;
/* Allocate internal state */
intf_sys_t *sys = (intf_sys_t *) malloc(sizeof (*sys));
if (unlikely(sys == NULL))
return VLC_ENOMEM;
intf->p_sys = sys;
/* Read settings */
char *who = var_InheritString(intf, "hello-who");
if (who == NULL)
{
msg_Err(intf, "Nobody to say hello to!");
goto error;
}
sys->who = who;
msg_Info(intf, "Hello %s!", who);
return VLC_SUCCESS;
error:
free(sys);
return VLC_EGENERIC;
}
/**
* Stops the interface.
*/
static void Close(vlc_object_t *obj)
{
intf_thread_t *intf = (intf_thread_t *)obj;
intf_sys_t *sys = intf->p_sys;
msg_Info(intf, "Good bye %s!");
/* Free internal state */
free(sys->who);
free(sys);
}
int main()
{
}
Code: Select all
prefix=/home/lscn/Desktop/vlc-2.0/contrib/win32/win32_
exec_prefix=/home/lscn/Desktop/vlc-2.0
includedir=${exec_prefix}/include
datarootdir=${exec_prefix}/share
libdir=${exec_prefix}/win32/src/.libs
datadir=${datarootdir}
pkgincludedir=${exec_prefix}/include/vlc
pkgdatadir=${datadir}/vlc
pkglibdir=${libdir}/vlc
pluginsdir=${pkglibdir}/plugins
Name: Hello
Description: VLC media player plugin hello world
Version: 2.0.3
Cflags: -I${includedir} \
-D__PLUGIN__ \
-D_FILE_OFFSET_BITS=64 \
\
-D_REENTRANT \
-D_THREAD_SAFE
Libs: -L${libdir} -lvlccore
Btw, I'm using the compiler as suggested in another thread:
Thanks a lot!wget http://ftp.jp.debian.org/debian/pool/ma ... -1_all.deb
sudo dpkg -i mingw-w64-dev_3.0~svn4933-1_all.deb
sudo apt-get install gcc-mingw-w64 g++-mingw-w64
lscn