X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_output%2Fsdl.c;h=efebbff04601d404233f822500abf6b8da7dc941;hb=57a4f916876060dc51583f40483522a0ad1de8bc;hp=c1c9f015007734860713e81ef8994952eba877da;hpb=76e8da0ff1691aad46f89810712c6eda6e548ee8;p=vlc diff --git a/modules/video_output/sdl.c b/modules/video_output/sdl.c index c1c9f01500..efebbff046 100644 --- a/modules/video_output/sdl.c +++ b/modules/video_output/sdl.c @@ -38,7 +38,14 @@ #include -#include +#include + +#ifndef WIN32 +# ifdef X_DISPLAY_MISSING +# error Xlib required due to XInitThreads +# endif +# include +#endif /***************************************************************************** * Module descriptor @@ -51,10 +58,6 @@ static void Close(vlc_object_t *); "Force the SDL renderer to use a specific chroma format instead of " \ "trying to improve performances by using the most efficient one.") -#define DRIVER_TEXT N_("SDL video driver name") -#define DRIVER_LONGTEXT N_(\ - "Force a specific SDL video output driver.") - vlc_module_begin() set_shortname("SDL") set_category(CAT_VIDEO) @@ -63,13 +66,11 @@ vlc_module_begin() set_capability("vout display", 60) add_shortcut("sdl") add_string("sdl-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT, true) -#ifdef HAVE_SETENV - add_string("sdl-video-driver", NULL, NULL, DRIVER_TEXT, DRIVER_LONGTEXT, true) -#endif + add_obsolete_string("sdl-video-driver") /* obsolete since 1.1.0 */ set_callbacks(Open, Close) #if defined(__i386__) || defined(__x86_64__) /* On i386, SDL is linked against svgalib */ - linked_with_a_crap_library_which_uses_atexit() + cannot_unload_broken_library() #endif vlc_module_end() @@ -78,7 +79,7 @@ vlc_module_end() * Local prototypes *****************************************************************************/ static picture_pool_t *Pool (vout_display_t *, unsigned); -static void Display(vout_display_t *, picture_t *); +static void PictureDisplay(vout_display_t *, picture_t *); static int Control(vout_display_t *, int, va_list); static void Manage(vout_display_t *); @@ -115,6 +116,11 @@ static int Open(vlc_object_t *object) vout_display_t *vd = (vout_display_t *)object; vout_display_sys_t *sys; +#ifndef WIN32 + if (!vlc_xlib_init (object)) + return VLC_EGENERIC; +#endif + /* XXX: check for conflicts with the SDL audio output */ vlc_mutex_lock(&sdl_lock); @@ -130,14 +136,6 @@ static int Open(vlc_object_t *object) return VLC_ENOMEM; } -#ifdef HAVE_SETENV - char *psz_driver = var_CreateGetNonEmptyString(vd, "sdl-video-driver"); - if (psz_driver) { - setenv("SDL_VIDEODRIVER", psz_driver, 1); - free(psz_driver); - } -#endif - /* */ int sdl_flags = SDL_INIT_VIDEO; #ifndef WIN32 @@ -194,6 +192,7 @@ static int Open(vlc_object_t *object) msg_Err(vd, "no video mode available"); goto error; } + vout_display_DeleteWindow(vd, NULL); sys->display = SDL_SetVideoMode(display_width, display_height, sys->display_bpp, sys->display_flags); @@ -339,7 +338,7 @@ static int Open(vlc_object_t *object) vd->pool = Pool; vd->prepare = NULL; - vd->display = Display; + vd->display = PictureDisplay; vd->control = Control; vd->manage = Manage; @@ -439,7 +438,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned count) /** * Display a picture */ -static void Display(vout_display_t *vd, picture_t *p_pic) +static void PictureDisplay(vout_display_t *vd, picture_t *p_pic) { vout_display_sys_t *sys = vd->sys;