]> git.sesse.net Git - vlc/blobdiff - plugins/directx/vout_directx.c
* introduced a memalign wrapper that will align the memory manually if
[vlc] / plugins / directx / vout_directx.c
index f15268a2ee3cbdc054c395ae944a9ce5c2350226..c7ea2596306c0cd254ffd753b18d91d3f374711e 100644 (file)
@@ -2,7 +2,7 @@
  * vout_directx.c: Windows DirectX video output display method
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: vout_directx.c,v 1.26 2002/03/17 17:00:38 sam Exp $
+ * $Id: vout_directx.c,v 1.30 2002/04/05 01:05:22 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -133,8 +133,7 @@ static int vout_Create( vout_thread_t *p_vout )
     p_vout->p_sys->b_event_thread_die = 0;
     p_vout->p_sys->b_caps_overlay_clipping = 0;
     SetRectEmpty( &p_vout->p_sys->rect_display );
-    p_vout->p_sys->b_using_overlay =
-        !config_GetIntVariable( "nooverlay" );
+    p_vout->p_sys->b_using_overlay = !config_GetIntVariable( "nooverlay" );
 
     p_vout->p_sys->b_cursor = 1;
 
@@ -142,24 +141,8 @@ static int vout_Create( vout_thread_t *p_vout )
     p_vout->p_sys->i_lastmoved = mdate();
 
     /* Set main window's size */
-    if( p_vout->render.i_height * p_vout->render.i_aspect
-        >= p_vout->render.i_width * VOUT_ASPECT_FACTOR )
-    {
-        p_vout->p_sys->i_window_width = p_vout->render.i_height
-          * p_vout->render.i_aspect / VOUT_ASPECT_FACTOR;
-        p_vout->p_sys->i_window_height = p_vout->render.i_height;
-    }
-    else
-    {
-        p_vout->p_sys->i_window_width = p_vout->render.i_width;
-        p_vout->p_sys->i_window_height = p_vout->render.i_width
-          * VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
-    }
-
-#if 0
-    p_vout->p_sys->i_window_width = config_GetIntVariable( "width" );
-    p_vout->p_sys->i_window_height = config_GetIntVariable( "height" );
-#endif
+    p_vout->p_sys->i_window_width = p_vout->i_window_width;
+    p_vout->p_sys->i_window_height = p_vout->i_window_height;
 
     /* Set locks and condition variables */
     vlc_mutex_init( &p_vout->p_sys->event_thread_lock );
@@ -185,13 +168,13 @@ static int vout_Create( vout_thread_t *p_vout )
     }
 
     /* We need to wait for the actual creation of the thread and window */
+    vlc_mutex_lock( &p_vout->p_sys->event_thread_lock );
     if( p_vout->p_sys->i_event_thread_status == THREAD_CREATE )
     {
-        vlc_mutex_lock( &p_vout->p_sys->event_thread_lock );
         vlc_cond_wait ( &p_vout->p_sys->event_thread_wait,
                         &p_vout->p_sys->event_thread_lock );
-        vlc_mutex_unlock( &p_vout->p_sys->event_thread_lock );
     }
+    vlc_mutex_unlock( &p_vout->p_sys->event_thread_lock );
     if( p_vout->p_sys->i_event_thread_status != THREAD_READY )
     {
         intf_ErrMsg( "vout error: DirectXEventThread failed" );
@@ -301,7 +284,7 @@ static void vout_Destroy( vout_thread_t *p_vout )
     if( p_vout->p_sys->i_event_thread_status == THREAD_READY &&
         p_vout->p_sys->hwnd )
     {
-        PostMessage( p_vout->p_sys->hwnd, WM_CHAR, (WPARAM)'q', 0);
+        PostMessage( p_vout->p_sys->hwnd, WM_CHAR, (WPARAM)'^', 0);
         vlc_thread_join( p_vout->p_sys->event_thread_id );
     }
 
@@ -486,6 +469,7 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
     else /* using overlay */
     {
 
+#if 0
         /* Flip the overlay buffers */
         dxresult = IDirectDrawSurface3_Flip( p_pic->p_sys->p_front_surface,
                                              NULL, DDFLIP_WAIT );
@@ -504,6 +488,7 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
 
         if( dxresult != DD_OK )
             intf_WarnMsg( 8, "vout: couldn't flip overlay surface" );
+#endif
 
         if( !DirectXGetSurfaceDesc( p_pic ) )
         {
@@ -769,11 +754,11 @@ static int DirectXCreateSurface( vout_thread_t *p_vout,
         ddsd.dwFlags = DDSD_CAPS |
                        DDSD_HEIGHT |
                        DDSD_WIDTH |
-                       DDSD_BACKBUFFERCOUNT |
+                     //DDSD_BACKBUFFERCOUNT |
                        DDSD_PIXELFORMAT;
         ddsd.ddsCaps.dwCaps = DDSCAPS_OVERLAY |
-                              DDSCAPS_COMPLEX |
-                              DDSCAPS_FLIP |
+                            //DDSCAPS_COMPLEX |
+                            //DDSCAPS_FLIP |
                               DDSCAPS_VIDEOMEMORY;
         ddsd.dwHeight = p_vout->render.i_height;
         ddsd.dwWidth = p_vout->render.i_width;
@@ -1038,7 +1023,7 @@ static int NewPictureVec( vout_thread_t *p_vout, picture_t *p_pic,
         else p_vout->p_sys->b_using_overlay = 0;
     }
 
-    /* As we can't have overlays, will try to create plain RBG surfaces in
+    /* As we can't have overlays, we'll try to create plain RBG surfaces in
      * system memory. These surfaces will then be blitted onto the primary
      * surface (display) so they can be displayed */
     if( !p_vout->p_sys->b_using_overlay )
@@ -1211,7 +1196,7 @@ static int UpdatePictureStruct( vout_thread_t *p_vout, picture_t *p_pic,
             p_pic->V_PIXELS = p_pic->U_PIXELS
               + p_pic->p[U_PLANE].i_lines * p_pic->p[U_PLANE].i_pitch;
             p_pic->p[V_PLANE].i_lines = p_vout->output.i_height / 2;
-            p_pic->p[V_PLANE].i_pitch = p_pic->p[U_PLANE].i_pitch;
+            p_pic->p[V_PLANE].i_pitch = p_pic->p[Y_PLANE].i_pitch / 2;
             p_pic->p[V_PLANE].i_pixel_bytes = 1;
             p_pic->p[V_PLANE].b_margin = 0;
 
@@ -1324,7 +1309,7 @@ static int DirectXGetSurfaceDesc( picture_t *p_pic )
     p_pic->p_sys->ddsd.dwSize = sizeof(DDSURFACEDESC);
     dxresult = IDirectDrawSurface3_Lock( p_pic->p_sys->p_surface,
                                          NULL, &p_pic->p_sys->ddsd,
-                                         DDLOCK_NOSYSLOCK | DDLOCK_WAIT,
+                                         DDLOCK_NOSYSLOCK,
                                          NULL );
     if ( dxresult == DDERR_SURFACELOST )
     {