]> git.sesse.net Git - vlc/blobdiff - plugins/sdl/vout_sdl.c
* Ported Glide and MGA plugins to the new module API. MGA never worked,
[vlc] / plugins / sdl / vout_sdl.c
index 2d732f78862ae586a3ede7d54807687def701028..73a8a24137383c4201a7810f59a8f287ca9177c9 100644 (file)
@@ -22,6 +22,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
+#define MODULE_NAME sdl
+#include "modules_inner.h"
+
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
@@ -100,7 +103,7 @@ static void SDLCloseDisplay     ( vout_thread_t *p_vout );
  * Functions exported as capabilities. They are declared as static so that
  * we don't pollute the namespace too much.
  *****************************************************************************/
-void vout_getfunctions( function_list_t * p_function_list )
+void _M( vout_getfunctions )( function_list_t * p_function_list )
 {
     p_function_list->pf_probe = vout_Probe;
     p_function_list->functions.vout.pf_create     = vout_Create;
@@ -154,12 +157,6 @@ static int vout_Create( vout_thread_t *p_vout )
         return( 1 );
     }
 
-    /* Force the software yuv even if it is not used */
-    /* If we don't do this, p_vout is not correctly initialized
-       and it's impossible to switch between soft/hard yuv */
-    /* FIXME: this is a broken way to do !! fix this !! */
-    p_vout->b_need_render = 1;
-
     p_vout->p_sys->b_cursor = 1; /* TODO should be done with a main_GetInt.. */
     p_vout->p_sys->b_fullscreen = main_GetIntVariable( VOUT_FULLSCREEN_VAR,
                                 VOUT_FULLSCREEN_DEFAULT );
@@ -175,7 +172,7 @@ static int vout_Create( vout_thread_t *p_vout )
 
     if( SDLOpenDisplay(p_vout) )
     {
-        intf_ErrMsg( "vout error: can't initialize SDL (%s)", SDL_GetError() );
+        intf_ErrMsg( "vout error: can't set up SDL (%s)", SDL_GetError() );
         free( p_vout->p_sys );
         return( 1 );
     }
@@ -216,6 +213,19 @@ static int vout_Create( vout_thread_t *p_vout )
  *****************************************************************************/
 static int vout_Init( vout_thread_t *p_vout )
 {
+    /* This hack is hugly, but hey, you are, too. */
+
+    SDL_Overlay *   p_overlay;
+
+    p_overlay = SDL_CreateYUVOverlay( VOUT_WIDTH_DEFAULT, VOUT_HEIGHT_DEFAULT,
+                                      SDL_YV12_OVERLAY, 
+                                      p_vout->p_sys->p_display );
+    intf_Msg( "vout: YUV acceleration %s",
+              p_overlay->hw_overlay ? "activated" : "unavailable !" ); 
+    p_vout->b_need_render = !p_overlay->hw_overlay;
+
+    SDL_FreeYUVOverlay( p_overlay );
+
     return( 0 );
 }
 
@@ -262,16 +272,21 @@ static int vout_Manage( vout_thread_t *p_vout )
             p_vout->i_changes |= VOUT_SIZE_CHANGE;
             break;
 
+        case SDL_MOUSEBUTTONUP:
+            switch( event.button.button )
+            {
+            case SDL_BUTTON_RIGHT:
+                p_main->p_intf->b_menu_change = 1;
+                break;
+            }
+            break;
+
         case SDL_MOUSEBUTTONDOWN:
             switch( event.button.button )
             {
             case SDL_BUTTON_MIDDLE:
                 p_vout->i_changes |= VOUT_CURSOR_CHANGE;
                 break;
-
-            case SDL_BUTTON_RIGHT:
-                p_main->p_intf->b_menu_change = 1;
-                break;
             }
             break;
 
@@ -337,7 +352,7 @@ static int vout_Manage( vout_thread_t *p_vout )
         SDLCloseDisplay( p_vout );
         if( SDLOpenDisplay( p_vout ) )
         {
-          intf_ErrMsg( "error: can't open DISPLAY default display" );
+          intf_ErrMsg( "vout error: can't reopen display after resize" );
           return( 1 );
         }
         p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
@@ -354,7 +369,7 @@ static int vout_Manage( vout_thread_t *p_vout )
         SDLCloseDisplay( p_vout );
         if( SDLOpenDisplay( p_vout ) )
         {
-          intf_ErrMsg( "error: can't open DISPLAY default display" );
+          intf_ErrMsg( "error: can't reopen display after YUV change" );
           return( 1 );
         }
         p_vout->i_changes &= ~VOUT_YUV_CHANGE;
@@ -533,13 +548,13 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
     else
         flags |= SDL_SWSURFACE; /* save video memory */
 
-    bpp = SDL_VideoModeOK(p_vout->p_sys->i_width,
-                          p_vout->p_sys->i_height,
-                          p_vout->i_screen_depth, flags);
+    bpp = SDL_VideoModeOK( p_vout->p_sys->i_width,
+                           p_vout->p_sys->i_height,
+                           p_vout->i_screen_depth, flags );
 
     if(bpp == 0)
     {
-        intf_ErrMsg( "error: can't open DISPLAY default display" );
+        intf_ErrMsg( "vout error: no video mode available" );
         return( 1 );
     }
 
@@ -549,7 +564,7 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
 
     if( p_vout->p_sys->p_display == NULL )
     {
-        intf_ErrMsg( "error: can't open DISPLAY default display" );
+        intf_ErrMsg( "vout error: cannot set video mode" );
         return( 1 );
     }
 
@@ -560,9 +575,9 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
     else
         SDL_ShowCursor( 1 );
 
-    SDL_WM_SetCaption( VOUT_TITLE , VOUT_TITLE );
+    SDL_WM_SetCaption( VOUT_TITLE " (SDL output)",
+                       VOUT_TITLE " (SDL output)" );
     SDL_EventState(SDL_KEYUP , SDL_IGNORE);                /* ignore keys up */
-    SDL_EventState(SDL_MOUSEBUTTONUP, SDL_IGNORE);          
 
     if( p_vout->b_need_render )
     {