]> git.sesse.net Git - vlc/commitdiff
Correction de quelques erreurs dans l'interface et vout.
authorVincent Seguin <seguin@videolan.org>
Tue, 11 Jan 2000 11:05:46 +0000 (11:05 +0000)
committerVincent Seguin <seguin@videolan.org>
Tue, 11 Jan 2000 11:05:46 +0000 (11:05 +0000)
Changement du type vlc_thread_func en vlc_thread_func_t dans le d�codeur.
Utilisation de 2 displays au lieu d'un au cas ou la Xlib ne serait pas thread-safe.
Ajout de droits corrects au fichier de log.

Le bug li� � XShm � la fin est 'normal' (li� au serveur X, pas � moi) : il
disparaitra � condition qu'au moins une image soit affich�e.

Le plantage sauvage de la Xlib � la fin du programme est li� � display.c.

include/video_output.h
include/video_sys.h
src/interface/intf_msg.c
src/video_output/video_output.c
src/video_output/video_x11.c

index e7ce10f9ae1b65485058a5d6d4a105da94b1f9a1..d6ab9cb46144aab2bd476b9b0861c39fe3e68d28 100644 (file)
@@ -79,7 +79,7 @@ typedef struct vout_thread_s
  *******************************************************************************/
 vout_thread_t * vout_CreateThread               ( 
 #if defined(VIDEO_X11)
-                                                  Display *p_display, Window root_window, 
+                                                  char *psz_display, Window root_window, 
 #elif defined(VIDEO_FB)
                                                   //??void
 #endif
index fe95c454440f319d39b3f0750777a9f3afe26f29..a360229998f7228e45c8f0a86e6ea0a52e9441a6 100644 (file)
@@ -7,7 +7,7 @@
  * Prototypes
  *******************************************************************************/
 #if defined(VIDEO_X11)
-int          vout_SysCreate  ( p_vout_thread_t p_vout, Display *p_display, Window root_window );
+int          vout_SysCreate  ( p_vout_thread_t p_vout, char *psz_display, Window root_window );
 #elif defined(VIDEO_FB)
 int          vout_SysCreate  ( p_vout_thread_t p_vout );
 #endif
index 6a5780a885ddb20af7218fc3806666370d56bfed..3b0e11e3827dee60c724495f6a36b8e5a83fda4e 100644 (file)
@@ -127,7 +127,9 @@ p_intf_msg_t intf_MsgCreate( void )
        /* Log file initialization - on failure, file pointer will be null,
         * and no log will be issued, but this is not considered as an 
         * error */
-       p_msg->i_log_file = open( DEBUG_LOG, O_CREAT | O_APPEND | O_SYNC | O_WRONLY );
+       p_msg->i_log_file = open( DEBUG_LOG, 
+                                  O_CREAT | O_APPEND | O_SYNC | O_WRONLY,
+                                  0777 );
 #endif
     }
     return( p_msg );
index 73f49d8b162e61767a3868291e3dc0ab6553cb5a..2b1e008d7337b72220820b61a1b4f78368065827 100644 (file)
@@ -58,7 +58,7 @@ static void     RenderPicture   ( vout_thread_t *p_vout, picture_t *p_pic );
  *******************************************************************************/
 vout_thread_t * vout_CreateThread               ( 
 #if defined(VIDEO_X11)
-                                                  Display *p_display, Window root_window, 
+                                                  char *psz_display, Window root_window, 
 #elif defined(VIDEO_FB)
                                                   //??
 #endif
@@ -77,7 +77,7 @@ vout_thread_t * vout_CreateThread               (
     intf_DbgMsg( "0x%x\n", p_vout );
     if( vout_SysCreate( p_vout
 #if defined(VIDEO_X11)
-                        , p_display, root_window 
+                        , psz_display, root_window 
 #elif defined(VIDEO_FB)
                         //??
 #endif
@@ -146,7 +146,7 @@ void vout_DestroyThread( vout_thread_t *p_vout, int *pi_status )
     p_vout->b_die = 1;
 
     /* If status is NULL, wait until thread has been destroyed */
-    if( pi_status )
+    if( pi_status == NULL )
     {
         do
         {
index 0bfbb41e313a2fccb02b2c8d42d5ec31504e2f37..4798ea7d0f8045c4ddf473b1aee3b61faa14cd24 100644 (file)
  * Preamble
  *******************************************************************************/
 
-#include "vlc.h"
-/*
 #include <errno.h>
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <netinet/in.h>
 #include <sys/shm.h>
-#include <sys/soundcard.h>
-#include <sys/uio.h>
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
-#include <X11/Xatom.h>
 #include <X11/extensions/XShm.h>
 
 #include "config.h"
 #include "common.h"
 #include "mtime.h"
 #include "vlc_thread.h"
-#include "xutils.h"
-
-#include "input.h"
-#include "input_vlan.h"
-
-#include "audio_output.h"
-
 #include "video.h"
 #include "video_output.h"
-#include "video_x11.h"
-
-#include "xconsole.h"
-#include "interface.h"
+#include "video_sys.h"
 #include "intf_msg.h"
-*/
 
 /*******************************************************************************
  * vout_sys_t: video output X11 method descriptor
@@ -101,17 +83,28 @@ static void X11DestroyShmImage      ( vout_thread_t *p_vout, XImage *p_ximage,
  *******************************************************************************
  * This function allocate and initialize a X11 vout method.
  *******************************************************************************/
-int vout_SysCreate( vout_thread_t *p_vout, Display *p_display, Window root_window )
+int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, Window root_window )
 {
     p_vout->p_sys = malloc( sizeof( vout_sys_t ) );    
-    if( p_vout->p_sys != NULL )
+    if( p_vout->p_sys == NULL )
+    {   
+        return( 1 );
+        
+    }    
+
+    /* Since XLib is usually not thread-safe, we can't use the same display
+     * pointer than the interface or another thread. However, the window
+     * id is still valid */
+    p_vout->p_sys->p_display = XOpenDisplay( psz_display );
+    if( !p_vout->p_sys->p_display )                               /* error */
     {
-        p_vout->p_sys->p_display   = p_display;
-       p_vout->p_sys->root_window = root_window;
-        return( 0 );        
+        intf_ErrMsg("vout error: can't open display %s\n", psz_display );
+        free( p_vout->p_sys );
+        return( 1 );               
     }
-
-    return( 1 );
+        
+    p_vout->p_sys->root_window = root_window;
+    return( 0 );
 }
 
 /*******************************************************************************
@@ -158,6 +151,7 @@ void vout_SysEnd( vout_thread_t *p_vout )
  *******************************************************************************/
 void vout_SysDestroy( vout_thread_t *p_vout )
 {
+    XCloseDisplay( p_vout->p_sys->p_display );    
     free( p_vout->p_sys );
 }