--- d3dvideosink_mine.c	2012-03-06 23:44:57.376252982 +0100
+++ d3dvideosink.c	2012-03-06 23:36:39.405251925 +0100
@@ -63,7 +63,7 @@
 static GstD3DVideoSinkShared shared;
 /* Define a shared lock to synchronize the creation/destruction of the d3d device */
 static GStaticMutex shared_d3d_lock = G_STATIC_MUTEX_INIT;
-static GStaticMutex shared_d3d_dev_lock = G_STATIC_MUTEX_INIT;
+static G_GNUC_UNUSED GStaticMutex shared_d3d_dev_lock = G_STATIC_MUTEX_INIT;
 static GStaticMutex shared_d3d_hook_lock = G_STATIC_MUTEX_INIT;
 /* Hold a reference to our dll's HINSTANCE */
 static HINSTANCE g_hinstDll = NULL;
@@ -156,7 +156,7 @@
 static gboolean gst_d3dvideosink_initialize_direct3d (GstD3DVideoSink * sink);
 static gboolean gst_d3dvideosink_initialize_d3d_device (GstD3DVideoSink * sink);
 static gboolean gst_d3dvideosink_resize_swap_chain (GstD3DVideoSink * sink,
-    gint width, gint height);
+    gint width, gint height) G_GNUC_UNUSED;
 static gboolean gst_d3dvideosink_notify_device_init (GstD3DVideoSink * sink);
 static gboolean gst_d3dvideosink_notify_device_lost (GstD3DVideoSink * sink);
 static gboolean gst_d3dvideosink_notify_device_reset (GstD3DVideoSink * sink);
@@ -225,7 +225,7 @@
 static void
 gst_d3dvideosink_xoverlay_interface_init (GstXOverlayClass * iface)
 {
-  iface->set_xwindow_id = gst_d3dvideosink_set_window_handle;
+  iface->set_window_handle = gst_d3dvideosink_set_window_handle;
   iface->expose = gst_d3dvideosink_expose;
 }
 
@@ -270,8 +270,8 @@
 {
   GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
 
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&sink_template));
+  gst_element_class_add_static_pad_template (element_class,
+      &sink_template);
 
   gst_element_class_set_details_simple (element_class, "Direct3D video sink",
       "Sink/Video",
@@ -468,11 +468,13 @@
         GstStructure *stru = gst_caps_get_structure (c, i);
         if (!gst_structure_has_name (stru, "video/x-raw-rgb")) {
           gst_structure_get_fourcc (stru, "format", (guint32 *) & d3dfourcc);
-          switch (d3dfourcc) {
+          switch ((guint32) d3dfourcc) {
             case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
             case GST_MAKE_FOURCC ('I', '4', '2', '0'):
               d3dfourcc = (D3DFORMAT) MAKEFOURCC ('Y', 'V', '1', '2');
               break;
+            default:
+              break;
           }
           if (d3dfourcc && SUCCEEDED (IDirect3D9_CheckDeviceFormat (shared.d3d,
                       D3DADAPTER_DEFAULT,
@@ -529,7 +531,10 @@
     goto failed;
 
   CloseHandle (shared.hidden_window_created_signal);
-
+/*
+  if (!shared.d3ddev)
+     goto failed;
+*/
   GST_DEBUG ("Successfully created Direct3D hidden window, handle: %p",
       shared.hidden_window_handle);
 
@@ -771,7 +776,7 @@
     SetWindowLongPtr (hWnd, GWLP_USERDATA, (LONG_PTR) sink);
 
     /* signal application we created a window */
-	gst_x_overlay_got_xwindow_id (GST_X_OVERLAY (sink), (guintptr) hWnd);
+    gst_x_overlay_got_window_handle (GST_X_OVERLAY (sink), (guintptr) hWnd);
   }
 
 
@@ -1367,7 +1372,8 @@
 
   switch (transition) {
     case GST_STATE_CHANGE_NULL_TO_READY:
-      gst_d3dvideosink_initialize_direct3d (sink);
+      if (!gst_d3dvideosink_initialize_direct3d (sink))
+        return GST_STATE_CHANGE_FAILURE; 
       break;
     case GST_STATE_CHANGE_READY_TO_PAUSED:
       break;
@@ -1563,7 +1569,7 @@
   }
 }
 
-static void
+static G_GNUC_UNUSED void
 gst_d3dvideosink_wait_for_vsync (GstD3DVideoSink * sink)
 {
   if (sink->d3dpp.PresentationInterval == D3DPRESENT_INTERVAL_IMMEDIATE) {
