I'm currently trying to run the libVLC + SDL2.0 example from the Wiki (https://wiki.videolan.org/LibVLC_Sample ... L/#SDL_2.0) on MacOS 10.9.2 . I can compile it, but if I try to run it I get a segfault at the call of SDL_RenderClear on line 76.
Code: Select all
// VLC wants to display a video frame.
static void display(void *data, void *id) {
struct context *c = (context *)data;
SDL_Rect rect;
rect.w = VIDEOWIDTH;
rect.h = VIDEOHEIGHT;
rect.x = (int)((1. + .5 * sin(0.03 * c->n)) * (WIDTH - VIDEOWIDTH) / 2);
rect.y = (int)((1. + .5 * cos(0.03 * c->n)) * (HEIGHT - VIDEOHEIGHT) / 2);
SDL_SetRenderDrawColor(c->renderer, 0, 80, 0, 255);
SDL_RenderClear(c->renderer);
SDL_RenderCopy(c->renderer, c->texture, NULL, &rect);
SDL_RenderPresent(c->renderer);
}
Code: Select all
g++ -o main -g -lvlc -I/usr/local/include -L/usr/local/lib `sdl2-config --cflags --libs` main.c
Code: Select all
g++ -o main -g -lvlc -I/usr/local/include -L/usr/local/lib -I/usr/local/include/SDL2 -D_THREAD_SAFE -L/usr/local/lib -lSDL2 main.c
http://pastebin.com/TY2JLLYJ
It seems to me that the OpenGL context can't be accessed by the vlc thread, but I don't know how else to use libVLC than using libvlc_video_set_callback.
I'm sorry if this is the wrong place, as the problem is very SDL2.0 specific, but I can't figure out what the problem is. Maybe someone else on MacOS 10.9.2 can try it out, as I don't know if it is my own stupidity, a platform problem or a problem with libVLC/SDL.
Thanks,
Wurope