]> git.sesse.net Git - vlc/commitdiff
* modules/video_output/x11/glx.c, modules/video_output/opengl.c: some fixes.
authorGildas Bazin <gbazin@videolan.org>
Thu, 22 Jul 2004 22:14:42 +0000 (22:14 +0000)
committerGildas Bazin <gbazin@videolan.org>
Thu, 22 Jul 2004 22:14:42 +0000 (22:14 +0000)
modules/video_output/opengl.c
modules/video_output/x11/glx.c

index 0203ad054869bd2fed01bbc98df46d53c08624da..35770e78bd887a905dca99997eb5bfbc1a4386c5 100644 (file)
@@ -53,10 +53,11 @@ static int  CreateVout   ( vlc_object_t * );
 static void DestroyVout  ( vlc_object_t * );
 static int  Init         ( vout_thread_t * );
 static void End          ( vout_thread_t * );
-static void Render       ( vout_thread_t *p_vout, picture_t *p_pic );
+static int  Manage       ( vout_thread_t * );
+static void Render       ( vout_thread_t *, picture_t * );
 static void DisplayVideo ( vout_thread_t *, picture_t * );
 
-static inline int GetAlignedSize( int i_size );
+static inline int GetAlignedSize( int );
 
 /*****************************************************************************
  * Module descriptor
@@ -85,7 +86,6 @@ struct vout_sys_t
     GLuint      texture;
 
     int         i_effect; //XXX
-
 };
 
 /*****************************************************************************
@@ -126,6 +126,10 @@ static int CreateVout( vlc_object_t *p_this )
     p_sys->p_vout->i_window_width = p_vout->i_window_width;
     p_sys->p_vout->i_window_height = p_vout->i_window_height;
     p_sys->p_vout->b_fullscreen = p_vout->b_fullscreen;
+    p_sys->p_vout->render.i_width = p_vout->render.i_width;
+    p_sys->p_vout->render.i_height = p_vout->render.i_height;
+    p_sys->p_vout->render.i_aspect = p_vout->render.i_aspect;
+    p_sys->p_vout->i_window_height = p_vout->i_window_height;
 
     p_sys->p_vout->p_module =
         module_Need( p_sys->p_vout, "opengl provider", NULL, 0 );
@@ -139,6 +143,7 @@ static int CreateVout( vlc_object_t *p_this )
 
     p_vout->pf_init = Init;
     p_vout->pf_end = End;
+    p_vout->pf_manage = Manage;
     p_vout->pf_render = Render;
     p_vout->pf_display = DisplayVideo;
 
@@ -260,6 +265,18 @@ static void DestroyVout( vlc_object_t *p_this )
     free( p_sys );
 }
 
+/*****************************************************************************
+ * Manage: handle Sys events
+ *****************************************************************************
+ * This function should be called regularly by video output thread. It returns
+ * a non null value if an error occured.
+ *****************************************************************************/
+static int Manage( vout_thread_t *p_vout )
+{
+    vout_sys_t *p_sys = p_vout->p_sys;
+    return p_sys->p_vout->pf_manage( p_sys->p_vout );
+}
+
 /*****************************************************************************
  * Render: render previously calculated output
  *****************************************************************************/
index d89222cf311b7f7720b8700bddc8b0023012662c..1c4fde69f93da83a4b8b70a68a32755c9df1542b 100644 (file)
@@ -171,6 +171,7 @@ static int CheckGLX( vlc_object_t *p_this, vlc_bool_t *b_glx13 )
     if( !p_display )
     {
         msg_Err( p_this, "Cannot open display" );
+        XCloseDisplay( p_display );
         return VLC_EGENERIC;
     }
 
@@ -178,11 +179,13 @@ static int CheckGLX( vlc_object_t *p_this, vlc_bool_t *b_glx13 )
     if( !XQueryExtension( p_display, "GLX", &i_opcode, &i_evt, &i_err ) )
     {
         msg_Err( p_this, "GLX extension not supported" );
+        XCloseDisplay( p_display );
         return VLC_EGENERIC;
     }
     if( !glXQueryExtension( p_display, &i_err, &i_evt ) )
     {
         msg_Err( p_this, "glXQueryExtension failed" );
+        XCloseDisplay( p_display );
         return VLC_EGENERIC;
     }
 
@@ -190,6 +193,7 @@ static int CheckGLX( vlc_object_t *p_this, vlc_bool_t *b_glx13 )
     if (!glXQueryVersion( p_display, &i_maj, &i_min ) )
     {
         msg_Err( p_this, "glXQueryVersion failed" );
+        XCloseDisplay( p_display );
         return VLC_EGENERIC;
     }
     if( i_maj <= 0 || ((i_maj == 1) && (i_min < 3)) )
@@ -203,6 +207,7 @@ static int CheckGLX( vlc_object_t *p_this, vlc_bool_t *b_glx13 )
         msg_Dbg( p_this, "Using GLX 1.3 API" );
     }
 
+    XCloseDisplay( p_display );
     return VLC_SUCCESS;
 }