Simplify initialization of VADisplay.
authorgb <gb@5584edef-b1fe-4b99-b61b-dd2bab72e969>
Thu, 25 Mar 2010 12:39:54 +0000 (12:39 +0000)
committergb <gb@5584edef-b1fe-4b99-b61b-dd2bab72e969>
Thu, 25 Mar 2010 12:39:54 +0000 (12:39 +0000)
gst-libs/gst/vaapi/gstvaapidisplay.c
gst-libs/gst/vaapi/gstvaapidisplay_x11.c

index 1ef23e4..0193681 100644 (file)
@@ -280,8 +280,11 @@ gst_vaapi_display_create(GstVaapiDisplay *display)
         GstVaapiDisplayClass *klass = GST_VAAPI_DISPLAY_GET_CLASS(display);
         if (klass->open_display && !klass->open_display(display))
             return FALSE;
-        if (klass->get_display)
+        if (klass->get_display) {
             priv->display = klass->get_display(display);
+            if (!priv->display)
+                return FALSE;
+        }
         if (klass->get_size)
             klass->get_size(display, &priv->width, &priv->height);
         if (klass->get_size_mm)
index a1e3479..30f7152 100644 (file)
@@ -44,7 +44,6 @@ struct _GstVaapiDisplayX11Private {
     gchar      *display_name;
     Display    *x11_display;
     int         x11_screen;
-    VADisplay  *va_display;
 };
 
 enum {
@@ -149,8 +148,7 @@ gst_vaapi_display_x11_open_display(GstVaapiDisplay *display)
         return FALSE;
 
     priv->x11_screen = DefaultScreen(priv->x11_display);
-    priv->va_display = vaGetDisplay(priv->x11_display);
-    return priv->va_display != NULL;
+    return TRUE;
 }
 
 static void
@@ -169,14 +167,12 @@ gst_vaapi_display_x11_close_display(GstVaapiDisplay *display)
         g_free(priv->display_name);
         priv->display_name = NULL;
     }
-
-    priv->va_display = NULL;
 }
 
 static VADisplay
 gst_vaapi_display_x11_get_va_display(GstVaapiDisplay *display)
 {
-    return GST_VAAPI_DISPLAY_X11(display)->priv->va_display;
+    return vaGetDisplay(GST_VAAPI_DISPLAY_XDISPLAY(display));
 }
 
 static void