diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-09-26 21:36:03 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-09-26 21:36:03 +0200 |
commit | e8db95ccb2ac16055e0af1177f69127da40f52de (patch) | |
tree | 9174a60b8ab5468689cf2688e313ce9783585f17 | |
parent | ae1e2d5bf8a59095d1a978be51b7eec793d19da2 (diff) | |
download | osc-graphics-e8db95ccb2ac16055e0af1177f69127da40f52de.tar.gz |
declare liblo and libvlc callbacks with extern "C"
C might use other calling conventions than C++
-rw-r--r-- | layer_video.cpp | 53 | ||||
-rw-r--r-- | osc_server.cpp | 7 |
2 files changed, 40 insertions, 20 deletions
diff --git a/layer_video.cpp b/layer_video.cpp index bf6aa01..7860dfb 100644 --- a/layer_video.cpp +++ b/layer_video.cpp @@ -15,28 +15,15 @@ Layer::CtorInfo LayerVideo::ctor_info = {"video", "s" /* url */}; libvlc_instance_t *LayerVideo::vlcinst = NULL; -static void * -lock_cb(void *data, void **p_pixels) -{ - LayerVideo *video = (LayerVideo *)data; - - *p_pixels = video->lock_surf(); - - return NULL; /* picture identifier, not needed here */ -} - -static void -unlock_cb(void *data, void *id __attribute__((unused)), void *const *p_pixels) -{ - LayerVideo *video = (LayerVideo *)data; +/* + * libvlc callbacks + */ +extern "C" { - video->unlock_surf(); -} +static void *lock_cb(void *data, void **p_pixels); +static void unlock_cb(void *data, void *id, void *const *p_pixels); +static void display_cb(void *data, void *id); -static void -display_cb(void *data __attribute__((unused)), void *id __attribute__((unused))) -{ - /* VLC wants to display the video */ } LayerVideo::LayerVideo(const char *name, SDL_Rect geo, float opacity, @@ -122,6 +109,32 @@ media_get_video_size(libvlc_media_t *media, #endif +static void * +lock_cb(void *data, void **p_pixels) +{ + LayerVideo *video = (LayerVideo *)data; + + *p_pixels = video->lock_surf(); + + return NULL; /* picture identifier, not needed here */ +} + +static void +unlock_cb(void *data, void *id __attribute__((unused)), + void *const *p_pixels) +{ + LayerVideo *video = (LayerVideo *)data; + + video->unlock_surf(); +} + +static void +display_cb(void *data __attribute__((unused)), + void *id __attribute__((unused))) +{ + /* VLC wants to display the video */ +} + void LayerVideo::url(const char *url) { diff --git a/osc_server.cpp b/osc_server.cpp index ea7c939..119d276 100644 --- a/osc_server.cpp +++ b/osc_server.cpp @@ -10,6 +10,11 @@ #include "osc_server.h" +/* + * liblo callbacks + */ +extern "C" { + static void error_handler(int num, const char *msg, const char *path); static int generic_handler(const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data); @@ -24,6 +29,8 @@ static int method_generic_handler(const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data); +} + extern LayerList layers; static void |