]> git.sesse.net Git - vlc/blobdiff - modules/video_output/msw/direct3d.c
Check malloc return value when needed and don't print an error when such error happend.
[vlc] / modules / video_output / msw / direct3d.c
index 5d2a21b649f1d4cae70a28faf91cf44103dc967a..19c8efc133c4a03bfd5c4f000f910279db567d56 100644 (file)
@@ -40,6 +40,7 @@
 #endif
 
 #include <vlc/vlc.h>
+#include <vlc_plugin.h>
 #include <vlc_interface.h>
 #include <vlc_playlist.h>
 #include <vlc_vout.h>
@@ -83,7 +84,7 @@ static void Direct3DVoutRenderScene     ( vout_thread_t *, picture_t * );
  * Module descriptor
  *****************************************************************************/
 
-static vlc_bool_t _got_vista_or_above;
+static bool _got_vista_or_above;
 
 static int get_capability_for_osversion(void)
 {
@@ -95,12 +96,12 @@ static int get_capability_for_osversion(void)
         if( winVer.dwMajorVersion > 5 )
         {
             /* Windows Vista or above, make this module the default */
-        _got_vista_or_above = VLC_TRUE;
+        _got_vista_or_above = true;
             return 150;
         }
     }
     /* Windows XP or lower, make sure this module isn't the default */
-    _got_vista_or_above = VLC_FALSE;
+    _got_vista_or_above = false;
     return 50;
 }
 
@@ -108,7 +109,7 @@ vlc_module_begin();
     set_shortname( "Direct3D" );
     set_category( CAT_VIDEO );
     set_subcategory( SUBCAT_VIDEO_VOUT );
-    set_description( _("DirectX 3D video output") );
+    set_description( N_("DirectX 3D video output") );
     set_capability( "video output", get_capability_for_osversion() );
     add_shortcut( "direct3d" );
     set_callbacks( OpenVideo, CloseVideo );
@@ -152,10 +153,7 @@ static int OpenVideo( vlc_object_t *p_this )
     /* Allocate structure */
     p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
     if( p_vout->p_sys == NULL )
-    {
-        msg_Err( p_vout, "out of memory" );
         return VLC_ENOMEM;
-    }
     memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) );
 
     if( VLC_SUCCESS != Direct3DVoutCreate( p_vout ) )
@@ -174,7 +172,7 @@ static int OpenVideo( vlc_object_t *p_this )
     p_vout->p_sys->hwnd = p_vout->p_sys->hvideownd = NULL;
     p_vout->p_sys->hparent = p_vout->p_sys->hfswnd = NULL;
     p_vout->p_sys->i_changes = 0;
-    vlc_mutex_init( p_vout, &p_vout->p_sys->lock );
+    vlc_mutex_init( &p_vout->p_sys->lock );
     SetRectEmpty( &p_vout->p_sys->rect_display );
     SetRectEmpty( &p_vout->p_sys->rect_parent );
 
@@ -183,6 +181,8 @@ static int OpenVideo( vlc_object_t *p_this )
 
     p_vout->p_sys->b_cursor_hidden = 0;
     p_vout->p_sys->i_lastmoved = mdate();
+    p_vout->p_sys->i_mouse_hide_timeout =
+        var_GetInteger(p_vout, "mouse-hide-timeout") * 1000;
 
     var_Create( p_vout, "video-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
     var_Create( p_vout, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
@@ -203,7 +203,7 @@ static int OpenVideo( vlc_object_t *p_this )
         vlc_object_create( p_vout, sizeof(event_thread_t) );
     p_vout->p_sys->p_event->p_vout = p_vout;
     if( vlc_thread_create( p_vout->p_sys->p_event, "Vout Events Thread",
-                           E_(EventThread), 0, 1 ) )
+                           EventThread, 0, 1 ) )
     {
         msg_Err( p_vout, "cannot create Vout EventThread" );
         vlc_object_release( p_vout->p_sys->p_event );
@@ -333,7 +333,7 @@ static int Init( vout_thread_t *p_vout )
     p_vout->output.i_height = p_vout->render.i_height;
     p_vout->output.i_aspect = p_vout->render.i_aspect;
     p_vout->fmt_out = p_vout->fmt_in;
-    E_(UpdateRects)( p_vout, VLC_TRUE );
+    UpdateRects( p_vout, true );
 
     /*  create picture pool */
     p_vout->output.i_chroma = 0;
@@ -451,7 +451,7 @@ static int Manage( vout_thread_t *p_vout )
         p_vout->fmt_out.i_sar_num = p_vout->fmt_in.i_sar_num;
         p_vout->fmt_out.i_sar_den = p_vout->fmt_in.i_sar_den;
         p_vout->output.i_aspect = p_vout->fmt_in.i_aspect;
-        E_(UpdateRects)( p_vout, VLC_TRUE );
+        UpdateRects( p_vout, true );
     }
 
     /* We used to call the Win32 PeekMessage function here to read the window
@@ -475,7 +475,8 @@ static int Manage( vout_thread_t *p_vout )
      * Pointer change
      */
     if( p_vout->b_fullscreen && !p_vout->p_sys->b_cursor_hidden &&
-        (mdate() - p_vout->p_sys->i_lastmoved) > 5000000 )
+        (mdate() - p_vout->p_sys->i_lastmoved) >
+            p_vout->p_sys->i_mouse_hide_timeout )
     {
         POINT point;
         HWND hwnd;
@@ -523,7 +524,7 @@ static int Manage( vout_thread_t *p_vout )
                           SWP_NOSIZE | SWP_NOMOVE );
         }
 
-        p_vout->p_sys->b_on_top_change = VLC_FALSE;
+        p_vout->p_sys->b_on_top_change = false;
     }
 
     /* Check if the event thread is still running */
@@ -1086,7 +1087,7 @@ static int Direct3DVoutCreatePictures( vout_thread_t *p_vout, size_t i_num_pics
         }
         p_pic->i_status = DESTROYED_PICTURE;
         p_pic->i_type   = DIRECT_PICTURE;
-        p_pic->b_slow   = VLC_TRUE;
+        p_pic->b_slow   = true;
         p_pic->pf_lock  = Direct3DVoutLockSurface;
         p_pic->pf_unlock = Direct3DVoutUnlockSurface;
         PP_OUTPUTPICTURE[c] = p_pic;
@@ -1376,8 +1377,8 @@ static void Direct3DVoutRenderScene( vout_thread_t *p_vout, picture_t *p_pic )
     }
 
     /* Setup vertices */
-    f_width  = (float)(p_vout->output.i_width);
-    f_height = (float)(p_vout->output.i_height);
+    f_width  = (float)(p_vout->output.i_width) + 1;
+    f_height = (float)(p_vout->output.i_height) + 1;
 
     p_vertices[0].x       = 0.0f;       // left
     p_vertices[0].y       = 0.0f;       // top