]> git.sesse.net Git - vlc/blobdiff - modules/video_output/sdl.c
Use var_InheritString for --decklink-video-connection.
[vlc] / modules / video_output / sdl.c
index b67b755712718dc44cd5fe2fd98ccbdf4c53f50f..efebbff04601d404233f822500abf6b8da7dc941 100644 (file)
 
 #include <SDL.h>
 
+#ifndef WIN32
+# ifdef X_DISPLAY_MISSING
+#  error Xlib required due to XInitThreads
+# endif
+# include <vlc_xlib.h>
+#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,9 +66,7 @@ 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 */
@@ -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;