*******************************************************************************/
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
* 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
/* 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 );
*******************************************************************************/
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
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
p_vout->b_die = 1;
/* If status is NULL, wait until thread has been destroyed */
- if( pi_status )
+ if( pi_status == NULL )
{
do
{
* 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
*******************************************************************************
* 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 );
}
/*******************************************************************************
*******************************************************************************/
void vout_SysDestroy( vout_thread_t *p_vout )
{
+ XCloseDisplay( p_vout->p_sys->p_display );
free( p_vout->p_sys );
}