Commit 35e8bb43 authored by Vincent Seguin's avatar Vincent Seguin

Resize sous X11, gestion du screen saver.

Nettoyage de config.h
Nettoyage de vout et intf
parent 023206d0
.* .*
*.ts
core core
dep dep
gmon.out gmon.out
......
...@@ -209,10 +209,6 @@ misc_obj = misc/mtime.o \ ...@@ -209,10 +209,6 @@ misc_obj = misc/mtime.o \
misc/rsc_files.o \ misc/rsc_files.o \
misc/netutils.o misc/netutils.o
ifeq ($(VIDEO),X11)
misc_obj+= misc/xutils.o
endif
ifeq ($(ARCH),MMX) ifeq ($(ARCH),MMX)
ASM_OBJ = video_decoder_ref/idctmmx.o \ ASM_OBJ = video_decoder_ref/idctmmx.o \
video_output/yuv_mmx.o video_output/yuv_mmx.o
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
* + variable names should end with '_VAR' * + variable names should end with '_VAR'
* + environment variable default value should end with '_DEFAULT' * + environment variable default value should end with '_DEFAULT'
* + values having a special meaning with '_VAL' * + values having a special meaning with '_VAL'
* + complete environment strings with '_ENV'
* *
*/ */
...@@ -24,7 +23,9 @@ ...@@ -24,7 +23,9 @@
* Program information * Program information
*******************************************************************************/ *******************************************************************************/
/* Program options */ /* Program options - this part will produce a copyright message with compilation
* options informations, based on some definines set in the Makefile - do not
* edit */
#if defined(VIDEO_X11) #if defined(VIDEO_X11)
#define VIDEO_OPTIONS "X11" #define VIDEO_OPTIONS "X11"
#elif defined(VIDEO_FB) #elif defined(VIDEO_FB)
...@@ -42,8 +43,9 @@ ...@@ -42,8 +43,9 @@
#define PROGRAM_OPTIONS VIDEO_OPTIONS " " ARCH_OPTIONS #define PROGRAM_OPTIONS VIDEO_OPTIONS " " ARCH_OPTIONS
/* Program version and copyright message */ /* Program version and copyright message */
#define PROGRAM_VERSION "1.0-dev" #define PROGRAM_VERSION "DR 2.1"
#define COPYRIGHT_MESSAGE "VideoLAN Client v" PROGRAM_VERSION " (" __DATE__ ") - " PROGRAM_OPTIONS " - (c)1999-2000 VideoLAN\n" #define COPYRIGHT_MESSAGE "VideoLAN Client v" PROGRAM_VERSION " (" __DATE__ ") - " \
PROGRAM_OPTIONS " - (c)1999 VideoLAN"
/******************************************************************************* /*******************************************************************************
* General compilation options * General compilation options
...@@ -59,7 +61,8 @@ ...@@ -59,7 +61,8 @@
* and might cause problems with some very weird streams. */ * and might cause problems with some very weird streams. */
//#define MPEG2_COMPLIANT //#define MPEG2_COMPLIANT
/* Define for profiling support */ /* Define for profiling and statistics support - such informations, like FPS
* or pictures count won't be available if it not set */
#define STATS #define STATS
/* Define for unthreaded version of the program - ?? not yet implemented */ /* Define for unthreaded version of the program - ?? not yet implemented */
...@@ -72,11 +75,8 @@ ...@@ -72,11 +75,8 @@
/* General debugging support */ /* General debugging support */
#define DEBUG #define DEBUG
/* Extended debugging support - in this mode, debugging messages will have their /* Modules specific debugging - this will produce a lot of output, but can be
* date and context printed */ * usefull to track a bug */
#define DEBUG_CONTEXT
/* Modules specific debugging */
#define DEBUG_INTF #define DEBUG_INTF
#define DEBUG_INPUT #define DEBUG_INPUT
#define DEBUG_AUDIO #define DEBUG_AUDIO
...@@ -88,36 +88,46 @@ ...@@ -88,36 +88,46 @@
#define DEBUG_LOG "vlc-debug.log" #define DEBUG_LOG "vlc-debug.log"
#define DEBUG_LOG_ONLY #define DEBUG_LOG_ONLY
/******************************************************************************* /*******************************************************************************
* Common settings * General configuration
*******************************************************************************/ *******************************************************************************/
/* Automagically spawn input, audio and video threads ? */ /* Automagically spawn input, audio and video threads ? */
// ?? used ?
#define AUTO_SPAWN #define AUTO_SPAWN
/* Startup script */ /* When creating or destroying threads in blocking mode, delay to poll thread
#define INTF_INIT_SCRIPT_VAR "vlc_init" * status */
#define INTF_INIT_SCRIPT_DEFAULT "vlc.init" #define THREAD_SLEEP 10000
/* ?? */
#define THREAD_SLEEP 100000
/* /*
* X11/XLib settings * Decoders FIFO configuration
*/ */
/* Default font used when a wished font could not be loaded - note that this /* Size of the FIFO. FIFO_SIZE+1 must be a multiple of 2 */
* font should be universal, else the program will exit when it can't find #define FIFO_SIZE 1023
* a font */
#define X11_DEFAULT_FONT "fixed"
/*******************************************************************************
* Interface configuration
*******************************************************************************/
/* Environment variable used to store startup script name and default value */
#define INTF_INIT_SCRIPT_VAR "vlc_init"
#define INTF_INIT_SCRIPT_DEFAULT "vlc.init"
/* Base delay in micro second for interface sleeps */
#define INTF_IDLE_SLEEP 100000
/* /*
* Decoders FIFO configuration * X11 settings
*/ */
/* Size of the FIFO. FIFO_SIZE+1 must be a multiple of 2 */ /* Title of the X11 window */
#define FIFO_SIZE 1023 #define VOUT_TITLE "VideoLAN Client"
/* Environment variable used in place of DISPLAY if available */
#define ENV_VLC_DISPLAY "vlc_DISPLAY"
/******************************************************************************* /*******************************************************************************
* Input thread configuration * Input thread configuration
...@@ -218,9 +228,6 @@ ...@@ -218,9 +228,6 @@
* Default settings for video output threads * Default settings for video output threads
*/ */
/* Title of the window */
#define VOUT_TITLE "VideoLAN Client"
/* Default dimensions for display window - these dimensions are the standard /* Default dimensions for display window - these dimensions are the standard
* width and height for broadcasted MPEG-2 */ * width and height for broadcasted MPEG-2 */
#define VOUT_WIDTH 544 #define VOUT_WIDTH 544
...@@ -234,9 +241,6 @@ ...@@ -234,9 +241,6 @@
#define VOUT_GRAYSCALE_VAR "vlc_grayscale" #define VOUT_GRAYSCALE_VAR "vlc_grayscale"
#define VOUT_GRAYSCALE_DEFAULT 0 #define VOUT_GRAYSCALE_DEFAULT 0
/* Number of pictures required to computes the FPS rate */
#define VOUT_FPS_SAMPLES 5
/* /*
* Time settings * Time settings
*/ */
...@@ -254,6 +258,12 @@ ...@@ -254,6 +258,12 @@
/* ?? this constant will probably evolve to a calculated value */ /* ?? this constant will probably evolve to a calculated value */
#define VOUT_DISPLAY_DELAY 100000 #define VOUT_DISPLAY_DELAY 100000
/* Delay (in microseconds) between increments in idle levels */
#define VOUT_IDLE_DELAY 5000000
/* Number of pictures required to computes the FPS rate */
#define VOUT_FPS_SAMPLES 5
/* /*
* Framebuffer settings * Framebuffer settings
*/ */
...@@ -310,66 +320,7 @@ ...@@ -310,66 +320,7 @@
#define GDEC_IDLE_SLEEP 100000 #define GDEC_IDLE_SLEEP 100000
/******************************************************************************* /*******************************************************************************
* Interface (main) thread configuration * Messages and console interfaces configuration
*******************************************************************************/
/*
* Interface configuration
*/
/* Base delay in micro second for interface sleeps ?? */
#define INTF_IDLE_SLEEP 100000
/* Maximal number of arguments on a command line, including the function name */
#define INTF_MAX_ARGS 20
/* Maximal size of a command line in a script */
#define INTF_MAX_CMD_SIZE 240
/*
* X11 interface properties
*/
#define INTF_APP_CLASS "vlc"
#define INTF_APP_NAME "vlc"
/*
* X11 console properties
*/
/* Title of the X11 console interface window */
#define INTF_XCONSOLE_TITLE "VideoLAN Client: console"
/* Welcome message: this message is always displayed when a new console is
* openned */
#define INTF_XCONSOLE_WELCOME_MSG COPYRIGHT_MESSAGE "try `help' to have a list of available commands"
/* Background pixmap - if not defined, no pixmap is used */
#define INTF_XCONSOLE_BACKGROUND_PIXMAP "Resources/background.xpm"
/* Default X11 console interface window geometry. It should at least give a
* default size */
#define INTF_XCONSOLE_GEOMETRY "400x100"
/* Font used in console. If first font is not found, the fallback font is
* used. Therefore, the fallback font should be a universal one. */
#define INTF_XCONSOLE_FONT "-*-helvetica-medium-r-normal-*-18-*-*-*-*-*-iso8859-1"
/* Number of memorized lines in X11 console window text zone */
#define INTF_CONSOLE_MAX_TEXT 100
/* Maximal number of commands which can be saved in history list */
#define INTF_CONSOLE_MAX_HISTORY 20
/* Maximum width of a line in an X11 console window. If a larger line is
* printed, it will be wrapped. */
#define INTF_XCONSOLE_MAX_LINE_WIDTH 120
#define ENV_VLC_DISPLAY "vlc_DISPLAY"
#define INTF_MAIN_WIDTH 600
#define INTF_MAIN_HEIGHT 600
/*******************************************************************************
* Interface messages functions
*******************************************************************************/ *******************************************************************************/
/* Maximal size of the message queue - in case of overflow, all messages in the /* Maximal size of the message queue - in case of overflow, all messages in the
...@@ -386,6 +337,18 @@ ...@@ -386,6 +337,18 @@
* message function was called */ * message function was called */
#define INTF_MSG_DBG_FORMAT "## %s:%s(),%i: " #define INTF_MSG_DBG_FORMAT "## %s:%s(),%i: "
/* Maximal number of arguments on a command line, including the function name */
#define INTF_MAX_ARGS 20
/* Maximal size of a command line in a script */
#define INTF_MAX_CMD_SIZE 240
/* Number of memorized lines in console window text zone */
#define INTF_CONSOLE_MAX_TEXT 100
/* Maximal number of commands which can be saved in history list */
#define INTF_CONSOLE_MAX_HISTORY 20
/******************************************************************************* /*******************************************************************************
* Network and VLAN management * Network and VLAN management
*******************************************************************************/ *******************************************************************************/
......
...@@ -35,15 +35,17 @@ typedef struct vout_thread_s ...@@ -35,15 +35,17 @@ typedef struct vout_thread_s
float f_x_ratio; /* horizontal display ratio */ float f_x_ratio; /* horizontal display ratio */
float f_y_ratio; /* vertical display ratio */ float f_y_ratio; /* vertical display ratio */
/* New size for resizeable windows - they may be ignored or handled by
* vout_SysManage */
int i_new_width; /* new width */
int i_new_height; /* new height */
#ifdef STATS #ifdef STATS
/* Statistics */ /* Statistics - these numbers are not supposed to be accurate */
count_t c_loops; /* number of loops */ count_t c_loops; /* number of loops */
count_t c_idle_loops; /* number of idle loops */ count_t c_idle_loops; /* number of idle loops */
count_t c_pictures; /* number of pictures added to heap */ count_t c_fps_samples; /* picture counts */
mtime_t fps_sample[ VOUT_FPS_SAMPLES ]; /* FPS samples dates */
/* FPS */
mtime_t fps_sample[ VOUT_FPS_SAMPLES ]; /* samples dates */
int i_fps_index; /* index in samples */
#endif #endif
#ifdef DEBUG_VIDEO #ifdef DEBUG_VIDEO
...@@ -55,7 +57,6 @@ typedef struct vout_thread_s ...@@ -55,7 +57,6 @@ typedef struct vout_thread_s
p_vout_sys_t p_sys; /* system output method */ p_vout_sys_t p_sys; /* system output method */
/* Video heap */ /* Video heap */
int i_pictures; /* current heap size */
picture_t p_picture[VOUT_MAX_PICTURES]; /* pictures */ picture_t p_picture[VOUT_MAX_PICTURES]; /* pictures */
/* YUV translation tables, for 15,16 and 24/32 bpp displays. 16 bits and 32 /* YUV translation tables, for 15,16 and 24/32 bpp displays. 16 bits and 32
......
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
#include "vlc_thread.h" #include "vlc_thread.h"
#include "netutils.h" #include "netutils.h"
#include "debug.h" #include "debug.h"
#include "xutils.h"
#include "intf_msg.h" #include "intf_msg.h"
/* Input */ /* Input */
......
/*******************************************************************************
* xutils.h: X11 utilities
* (c)1999 VideoLAN
*******************************************************************************
* This library includes many usefull functions to perform simple operations
* using Xlib.
*******************************************************************************
* Required headers:
* <X11/Xlib.h>
*******************************************************************************/
/*******************************************************************************
* Prototypes
*******************************************************************************/
int XTryLoadFont( Display *p_display, char *psz_font, XFontStruct **p_font );
void XEnableScreenSaver( Display *p_display );
void XDisableScreenSaver( Display *p_display );
...@@ -116,7 +116,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -116,7 +116,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
intf_MsgDestroy(); intf_MsgDestroy();
return(errno); return(errno);
} }
intf_MsgImm( COPYRIGHT_MESSAGE ); /* print welcome message */ intf_MsgImm( COPYRIGHT_MESSAGE "\n" ); /* print welcome message */
/* /*
* Initialize shared resources and libraries * Initialize shared resources and libraries
......
...@@ -41,10 +41,6 @@ char *mstrtime( char *psz_buffer, mtime_t date ) ...@@ -41,10 +41,6 @@ char *mstrtime( char *psz_buffer, mtime_t date )
****************************************************************************** ******************************************************************************
* Uses the gettimeofday() function when possible (1 MHz resolution) or the * Uses the gettimeofday() function when possible (1 MHz resolution) or the
* ftime() function (1 kHz resolution). * ftime() function (1 kHz resolution).
******************************************************************************
* to-do list: ??
* implement the function when gettimeofday is not available
* this function should be decalred as inline
******************************************************************************/ ******************************************************************************/
mtime_t mdate( void ) mtime_t mdate( void )
{ {
...@@ -63,11 +59,6 @@ mtime_t mdate( void ) ...@@ -63,11 +59,6 @@ mtime_t mdate( void )
* This function uses select() and an system date function to wake up at a * This function uses select() and an system date function to wake up at a
* precise date. It should be used for process synchronization. If current date * precise date. It should be used for process synchronization. If current date
* is posterior to wished date, the function returns immediately. * is posterior to wished date, the function returns immediately.
******************************************************************************
* to-do list:
* implement the function when gettimeofday is not available
* optimize delay calculation
* ?? declare as inline
******************************************************************************/ ******************************************************************************/
void mwait( mtime_t date ) void mwait( mtime_t date )
{ {
......
/*******************************************************************************
* xutils.c: X11 utilities
* (c)1998 VideoLAN
*******************************************************************************
* This library includes many usefull functions to perform simple operations
* using Xlib.
*******************************************************************************/
/*******************************************************************************
* Preamble
*******************************************************************************/
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include "config.h"
#include "common.h"
#include "mtime.h"
#include "intf_msg.h"
#include "xutils.h"
/*******************************************************************************
* XTryLoadFont: try to load a font and a fallback font
*******************************************************************************
* This function try to load a font, and, on failure, a default fallback font
* (usually 'fixed'). This function returns 0 on success, >0 if it failed but
* the default font
*******************************************************************************/
int XTryLoadFont( Display *p_display, char *psz_font, XFontStruct **p_font )
{
*p_font = XLoadQueryFont( p_display, psz_font );
if( *p_font ) /* success */
{
return( 0 );
}
intf_DbgMsg("X11 error: can't load font `%s', using `%s' instead\n", p_font, X11_DEFAULT_FONT );
*p_font = XLoadQueryFont( p_display, X11_DEFAULT_FONT );
if( *p_font ) /* success */
{
return( 1 );
}
/* Fatal error */
intf_ErrMsg("X11 error: can't load fallback font `%s'\n", X11_DEFAULT_FONT );
return( -1 );
}
/*******************************************************************************
* XEnableScreenSaver: enable screen saver
*******************************************************************************
* This function enable the screen saver on a display after it had been
* disabled by XDisableScreenSaver. Both functions use a counter mechanism to
* know wether the screen saver can be activated or not: if n successive calls
* are made to XDisableScreenSaver, n successive calls to XEnableScreenSaver
* will be required before the screen saver could effectively be activated.
*******************************************************************************/
void XEnableScreenSaver( Display *p_display )
{
/* ?? */
}
/*******************************************************************************
* XDisableScreenSaver: disable screen saver
*******************************************************************************
* See XEnableScreenSaver
*******************************************************************************/
void XDisableScreenSaver( Display *p_display )
{
/* ?? */
}
...@@ -34,7 +34,7 @@ typedef struct vout_sys_s ...@@ -34,7 +34,7 @@ typedef struct vout_sys_s
/* Buffers informations */ /* Buffers informations */
int i_buffer_index; /* buffer index */ int i_buffer_index; /* buffer index */
ggi_directbuffer * pp_buffer[2]; /* buffers */ ggi_directbuffer * p_buffer[2]; /* buffers */
boolean_t b_must_acquire; /* must be acquired before writing */ boolean_t b_must_acquire; /* must be acquired before writing */
/* Characters size */ /* Characters size */
...@@ -87,7 +87,7 @@ int vout_SysInit( vout_thread_t *p_vout ) ...@@ -87,7 +87,7 @@ int vout_SysInit( vout_thread_t *p_vout )
p_vout->p_sys->i_buffer_index = 0; p_vout->p_sys->i_buffer_index = 0;
if( p_vout->p_sys->b_must_acquire ) if( p_vout->p_sys->b_must_acquire )
{ {
ggiResourceAcquire( p_vout->p_sys->pp_buffer[ 0 ]->resource, GGI_ACTYPE_WRITE ); ggiResourceAcquire( p_vout->p_sys->p_buffer[ 0 ]->resource, GGI_ACTYPE_WRITE );
} }
return( 0 ); return( 0 );
...@@ -103,7 +103,7 @@ void vout_SysEnd( vout_thread_t *p_vout ) ...@@ -103,7 +103,7 @@ void vout_SysEnd( vout_thread_t *p_vout )
/* Release buffer */ /* Release buffer */
if( p_vout->p_sys->b_must_acquire ) if( p_vout->p_sys->b_must_acquire )
{ {
ggiResourceRelease( p_vout->p_sys->pp_buffer[ p_vout->p_sys->i_buffer_index ]->resource ); ggiResourceRelease( p_vout->p_sys->p_buffer[ p_vout->p_sys->i_buffer_index ]->resource );
} }
} }
...@@ -144,21 +144,21 @@ void vout_SysDisplay( vout_thread_t *p_vout ) ...@@ -144,21 +144,21 @@ void vout_SysDisplay( vout_thread_t *p_vout )
/* Change display frame */ /* Change display frame */
if( p_vout->p_sys->b_must_acquire ) if( p_vout->p_sys->b_must_acquire )
{ {
ggiResourceRelease( p_vout->p_sys->pp_buffer[ p_vout->p_sys->i_buffer_index ]->resource ); ggiResourceRelease( p_vout->p_sys->p_buffer[ p_vout->p_sys->i_buffer_index ]->resource );
} }
ggiFlush( p_vout->p_sys->p_display ); // ?? ggiFlush( p_vout->p_sys->p_display ); // ??
ggiSetDisplayFrame( p_vout->p_sys->p_display, ggiSetDisplayFrame( p_vout->p_sys->p_display,
p_vout->p_sys->pp_buffer[ p_vout->p_sys->i_buffer_index ]->frame ); p_vout->p_sys->p_buffer[ p_vout->p_sys->i_buffer_index ]->frame );
/* Swap buffers and change write frame */ /* Swap buffers and change write frame */
p_vout->p_sys->i_buffer_index = ++p_vout->p_sys->i_buffer_index & 1; p_vout->p_sys->i_buffer_index = ++p_vout->p_sys->i_buffer_index & 1;
if( p_vout->p_sys->b_must_acquire ) if( p_vout->p_sys->b_must_acquire )
{ {
ggiResourceAcquire( p_vout->p_sys->pp_buffer[ p_vout->p_sys->i_buffer_index ]->resource, ggiResourceAcquire( p_vout->p_sys->p_buffer[ p_vout->p_sys->i_buffer_index ]->resource,
GGI_ACTYPE_WRITE ); GGI_ACTYPE_WRITE );
} }
ggiSetWriteFrame( p_vout->p_sys->p_display, ggiSetWriteFrame( p_vout->p_sys->p_display,
p_vout->p_sys->pp_buffer[ p_vout->p_sys->i_buffer_index ]->frame ); p_vout->p_sys->p_buffer[ p_vout->p_sys->i_buffer_index ]->frame );
} }
/******************************************************************************* /*******************************************************************************
...@@ -168,7 +168,7 @@ void vout_SysDisplay( vout_thread_t *p_vout ) ...@@ -168,7 +168,7 @@ void vout_SysDisplay( vout_thread_t *p_vout )
*******************************************************************************/ *******************************************************************************/
byte_t * vout_SysGetPicture( vout_thread_t *p_vout ) byte_t * vout_SysGetPicture( vout_thread_t *p_vout )
{ {
return( p_vout->p_sys->pp_buffer[ p_vout->p_sys->i_buffer_index ]->write ); return( p_vout->p_sys->p_buffer[ p_vout->p_sys->i_buffer_index ]->write );
} }
/******************************************************************************* /*******************************************************************************
...@@ -265,9 +265,9 @@ static int GGIOpenDisplay( vout_thread_t *p_vout ) ...@@ -265,9 +265,9 @@ static int GGIOpenDisplay( vout_thread_t *p_vout )
for( i_index = 0; i_index < 2; i_index++ ) for( i_index = 0; i_index < 2; i_index++ )
{ {
/* Get buffer address */ /* Get buffer address */
p_vout->p_sys->pp_buffer[ i_index ] = p_vout->p_sys->p_buffer[ i_index ] =
ggiDBGetBuffer( p_vout->p_sys->p_display, i_index ); ggiDBGetBuffer( p_vout->p_sys->p_display, i_index );
if( p_vout->p_sys->pp_buffer[ i_index ] == NULL ) if( p_vout->p_sys->p_buffer[ i_index ] == NULL )
{ {
intf_ErrMsg("error: double buffering is not possible\n"); intf_ErrMsg("error: double buffering is not possible\n");
ggiClose( p_vout->p_sys->p_display ); ggiClose( p_vout->p_sys->p_display );
...@@ -276,11 +276,11 @@ static int GGIOpenDisplay( vout_thread_t *p_vout ) ...@@ -276,11 +276,11 @@ static int GGIOpenDisplay( vout_thread_t *p_vout )
} }
/* Check buffer properties */ /* Check buffer properties */
if( ! (p_vout->p_sys->pp_buffer[ i_index ]->type & GGI_DB_SIMPLE_PLB) || if( ! (p_vout->p_sys->p_buffer[ i_index ]->type & GGI_DB_SIMPLE_PLB) ||
(p_vout->p_sys->pp_buffer[ i_index ]->page_size != 0) || (p_vout->p_sys->p_buffer[ i_index ]->page_size != 0) ||
(p_vout->p_sys->pp_buffer[ i_index ]->write == NULL ) || (p_vout->p_sys->p_buffer[ i_index ]->write == NULL ) ||
(p_vout->p_sys->pp_buffer[ i_index ]->noaccess != 0) || (p_vout->p_sys->p_buffer[ i_index ]->noaccess != 0) ||
(p_vout->p_sys->pp_buffer[ i_index ]->align != 0) ) (p_vout->p_sys->p_buffer[ i_index ]->align != 0) )
{ {
intf_ErrMsg("error: incorrect video memory type\n"); intf_ErrMsg("error: incorrect video memory type\n");
ggiClose( p_vout->p_sys->p_display ); ggiClose( p_vout->p_sys->p_display );
...@@ -289,7 +289,7 @@ static int GGIOpenDisplay( vout_thread_t *p_vout ) ...@@ -289,7 +289,7 @@ static int GGIOpenDisplay( vout_thread_t *p_vout )
} }
/* Check if buffer needs to be acquired before write */ /* Check if buffer needs to be acquired before write */
if( ggiResourceMustAcquire( p_vout->p_sys->pp_buffer[ i_index ]->resource ) ) if( ggiResourceMustAcquire( p_vout->p_sys->p_buffer[ i_index ]->resource ) )
{ {
p_vout->p_sys->b_must_acquire = 1; p_vout->p_sys->b_must_acquire = 1;
} }
...@@ -328,7 +328,7 @@ static int GGIOpenDisplay( vout_thread_t *p_vout ) ...@@ -328,7 +328,7 @@ static int GGIOpenDisplay( vout_thread_t *p_vout )
/* Set thread information */ /* Set thread information */
p_vout->i_width = mode.visible.x; p_vout->i_width = mode.visible.x;
p_vout->i_height = mode.visible.y; p_vout->i_height = mode.visible.y;
p_vout->i_bytes_per_line = p_vout->p_sys->pp_buffer[ 0 ]->buffer.plb.stride; p_vout->i_bytes_per_line = p_vout->p_sys->p_buffer[ 0 ]->buffer.plb.stride;
switch( mode.graphtype ) switch( mode.graphtype )
{ {
case GT_15BIT: case GT_15BIT:
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <string.h> #include <string.h>
#ifdef VIDEO_X11 #ifdef VIDEO_X11
#include <X11/Xlib.h> #include <X11/Xlib.h> /* for video_sys.h in X11 mode */
#endif #endif
#include "common.h" #include "common.h"
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
*******************************************************************************/ *******************************************************************************/
/* CLIP_BYTE: return value if between 0 and 255, else return nearest boundary /* CLIP_BYTE: return value if between 0 and 255, else return nearest boundary
* (0 or 255) */ * (0 or 255), used to build translations tables */
#define CLIP_BYTE( i_val ) ( (i_val < 0) ? 0 : ((i_val > 255) ? 255 : i_val) ) #define CLIP_BYTE( i_val ) ( (i_val < 0) ? 0 : ((i_val > 255) ? 255 : i_val) )
/* YUV_GRAYSCALE: parametric macro for YUV grayscale transformation. /* YUV_GRAYSCALE: parametric macro for YUV grayscale transformation.
...@@ -148,6 +148,7 @@ static void RenderYUVGrayPicture ( vout_thread_t *p_vout, picture_t *p_pi ...@@ -148,6 +148,7 @@ static void RenderYUVGrayPicture ( vout_thread_t *p_vout, picture_t *p_pi
static void RenderYUV16Picture ( vout_thread_t *p_vout, picture_t *p_pic ); static void RenderYUV16Picture ( vout_thread_t *p_vout, picture_t *p_pic );
static void RenderYUV32Picture ( vout_thread_t *p_vout, picture_t *p_pic ); static void RenderYUV32Picture ( vout_thread_t *p_vout, picture_t *p_pic );
static void RenderInfo ( vout_thread_t *p_vout ); static void RenderInfo ( vout_thread_t *p_vout );
static int RenderIdle ( vout_thread_t *p_vout, int i_level );
/******************************************************************************* /*******************************************************************************
* vout_CreateThread: creates a new video output thread * vout_CreateThread: creates a new video output thread
...@@ -221,7 +222,7 @@ vout_thread_t * vout_CreateThread ( ...@@ -221,7 +222,7 @@ vout_thread_t * vout_CreateThread (
#ifdef STATS #ifdef STATS
p_vout->c_loops = 0; p_vout->c_loops = 0;
p_vout->c_idle_loops = 0; p_vout->c_idle_loops = 0;
p_vout->c_pictures = 0; p_vout->c_fps_samples = 0;
#endif #endif
/* Create thread and set locks */ /* Create thread and set locks */
...@@ -297,23 +298,17 @@ void vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -297,23 +298,17 @@ void vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic )
char psz_date[MSTRTIME_MAX_SIZE]; /* buffer for date string */ char psz_date[MSTRTIME_MAX_SIZE]; /* buffer for date string */
#endif #endif
#ifdef DEBUG_VIDEO #ifdef DEBUG
/* Check if picture status is valid */ /* Check if picture status is valid */
if( p_pic->i_status != RESERVED_PICTURE ) if( p_pic->i_status != RESERVED_PICTURE )
{ {
intf_DbgMsg("error: picture %d has invalid status %d\n", intf_DbgMsg("error: picture %d has invalid status %d\n", p_pic, p_pic->i_status );
p_pic, p_pic->i_status );
} }
#endif #endif
/* Remove reservation flag */ /* Remove reservation flag */
p_pic->i_status = READY_PICTURE; p_pic->i_status = READY_PICTURE;
#ifdef STATS
/* Update stats */
p_vout->c_pictures++;
#endif
#ifdef DEBUG_VIDEO #ifdef DEBUG_VIDEO
/* Send picture informations */ /* Send picture informations */
intf_DbgMsg("picture %p: type=%d, %dx%d, date=%s\n", p_pic, p_pic->i_type, intf_DbgMsg("picture %p: type=%d, %dx%d, date=%s\n", p_pic, p_pic->i_type,
...@@ -457,12 +452,11 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type, ...@@ -457,12 +452,11 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
*******************************************************************************/ *******************************************************************************/
void vout_DestroyPicture( vout_thread_t *p_vout, picture_t *p_pic ) void vout_DestroyPicture( vout_thread_t *p_vout, picture_t *p_pic )
{ {
#ifdef DEBUG_VIDEO #ifdef DEBUG
/* Check if picture status is valid */ /* Check if picture status is valid */
if( p_pic->i_status != RESERVED_PICTURE ) if( p_pic->i_status != RESERVED_PICTURE )
{ {
intf_DbgMsg("error: picture %d has invalid status %d\n", intf_DbgMsg("error: picture %d has invalid status %d\n", p_pic, p_pic->i_status );
p_pic, p_pic->i_status );
} }
#endif #endif
...@@ -483,12 +477,11 @@ void vout_LinkPicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -483,12 +477,11 @@ void vout_LinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
{ {
vlc_mutex_lock( &p_vout->lock ); vlc_mutex_lock( &p_vout->lock );
p_pic->i_refcount++; p_pic->i_refcount++;
vlc_mutex_unlock( &p_vout->lock );
#ifdef DEBUG_VIDEO #ifdef DEBUG_VIDEO
intf_DbgMsg("picture %p\n", p_pic); intf_DbgMsg("picture %p\n", p_pic);
#endif #endif
vlc_mutex_unlock( &p_vout->lock );
} }
/******************************************************************************* /*******************************************************************************
...@@ -504,12 +497,11 @@ void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -504,12 +497,11 @@ void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
{ {
p_pic->i_status = DESTROYED_PICTURE; p_pic->i_status = DESTROYED_PICTURE;
} }
vlc_mutex_unlock( &p_vout->lock );
#ifdef DEBUG_VIDEO #ifdef DEBUG_VIDEO
intf_DbgMsg("picture %p\n", p_pic); intf_DbgMsg("picture %p\n", p_pic);
#endif #endif
vlc_mutex_unlock( &p_vout->lock );
} }
/* following functions are local */ /* following functions are local */
...@@ -530,19 +522,12 @@ static int InitThread( vout_thread_t *p_vout ) ...@@ -530,19 +522,12 @@ static int InitThread( vout_thread_t *p_vout )
*p_vout->pi_status = THREAD_START; *p_vout->pi_status = THREAD_START;
/* Initialize pictures */ /* Initialize pictures */
p_vout->i_pictures = 0;
for( i_index = 0; i_index < VOUT_MAX_PICTURES; i_index++) for( i_index = 0; i_index < VOUT_MAX_PICTURES; i_index++)
{ {
p_vout->p_picture[i_index].i_type = EMPTY_PICTURE; p_vout->p_picture[i_index].i_type = EMPTY_PICTURE;
p_vout->p_picture[i_index].i_status= FREE_PICTURE; p_vout->p_picture[i_index].i_status= FREE_PICTURE;
} }
#ifdef STATS
/* Initialize FPS index - since samples won't be used until a minimum of
* pictures, they don't need to be initialized */
p_vout->i_fps_index = 0;
#endif
/* Initialize output method - this function issues its own error messages */ /* Initialize output method - this function issues its own error messages */
if( vout_SysInit( p_vout ) ) if( vout_SysInit( p_vout ) )
{ {
...@@ -644,7 +629,7 @@ static int InitThread( vout_thread_t *p_vout ) ...@@ -644,7 +629,7 @@ static int InitThread( vout_thread_t *p_vout )
p_vout->b_active = 1; p_vout->b_active = 1;
*p_vout->pi_status = THREAD_READY; *p_vout->pi_status = THREAD_READY;
intf_DbgMsg("thread ready\n"); intf_DbgMsg("thread ready\n");
return(0); return( 0 );
} }
/******************************************************************************* /*******************************************************************************
...@@ -658,9 +643,12 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -658,9 +643,12 @@ static void RunThread( vout_thread_t *p_vout)
{ {
int i_picture; /* picture index */ int i_picture; /* picture index */
int i_err; /* error code */ int i_err; /* error code */
int i_idle_level = 0; /* idle level */
mtime_t current_date; /* current date */ mtime_t current_date; /* current date */
picture_t * p_pic; /* picture pointer */
mtime_t pic_date = 0; /* picture date */ mtime_t pic_date = 0; /* picture date */
mtime_t last_date = 0; /* last picture date */
boolean_t b_display; /* display flag */
picture_t * p_pic; /* picture pointer */
/* /*
* Initialize thread and free configuration * Initialize thread and free configuration
...@@ -693,6 +681,7 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -693,6 +681,7 @@ static void RunThread( vout_thread_t *p_vout)
pic_date = p_pic->date; pic_date = p_pic->date;
} }
} }
current_date = mdate();
/* /*
* Render picture if any * Render picture if any
...@@ -701,26 +690,15 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -701,26 +690,15 @@ static void RunThread( vout_thread_t *p_vout)
{ {
#ifdef STATS #ifdef STATS
/* Computes FPS rate */ /* Computes FPS rate */
p_vout->fps_sample[ p_vout->i_fps_index++ ] = pic_date; p_vout->fps_sample[ p_vout->c_fps_samples++ % VOUT_FPS_SAMPLES ] = pic_date;
if( p_vout->i_fps_index == VOUT_FPS_SAMPLES )
{
p_vout->i_fps_index = 0;
}
#endif #endif
current_date = mdate();
if( pic_date < current_date ) if( pic_date < current_date )
{ {
/* Picture is late: it will be destroyed and the thread will go /* Picture is late: it will be destroyed and the thread will sleep and
* immediately to next picture */ * go to next picture */
if( p_pic->i_refcount ) vlc_mutex_lock( &p_vout->lock );
{ p_pic->i_status = p_pic->i_refcount ? DISPLAYED_PICTURE : DESTROYED_PICTURE;
p_pic->i_status = DISPLAYED_PICTURE; vlc_mutex_unlock( &p_vout->lock );
}
else
{
p_pic->i_status = DESTROYED_PICTURE;
}
#ifdef DEBUG_VIDEO #ifdef DEBUG_VIDEO
intf_DbgMsg( "warning: late picture %p skipped\n", p_pic ); intf_DbgMsg( "warning: late picture %p skipped\n", p_pic );
#endif #endif
...@@ -736,22 +714,14 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -736,22 +714,14 @@ static void RunThread( vout_thread_t *p_vout)
else else
{ {
/* Picture has not yet been displayed, and has a valid display /* Picture has not yet been displayed, and has a valid display
* date : render it, then forget it */ * date : render it, then mark it as displayed */
RenderPicture( p_vout, p_pic ); if( p_vout->b_active )
if( p_pic->i_refcount )
{
p_pic->i_status = DISPLAYED_PICTURE;
}
else
{
p_pic->i_status = DESTROYED_PICTURE;
}
/* Print additional informations */
if( p_vout->b_info )
{ {
RenderInfo( p_vout ); RenderPicture( p_vout, p_pic );
} }
vlc_mutex_lock( &p_vout->lock );
p_pic->i_status = p_pic->i_refcount ? DISPLAYED_PICTURE : DESTROYED_PICTURE;
vlc_mutex_unlock( &p_vout->lock );
} }
} }
...@@ -770,22 +740,47 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -770,22 +740,47 @@ static void RunThread( vout_thread_t *p_vout)
{ {
if( p_pic ) if( p_pic )
{ {
/* A picture is ready to be displayed : sleep until its display date */ /* A picture is ready to be displayed : remove blank screen flag */
mwait( pic_date ); last_date = pic_date;
i_idle_level = 0;
b_display = 1;
if( !i_err ) /* Render additionnal informations */
if( p_vout->b_active && p_vout->b_info )
{ {
vout_SysDisplay( p_vout ); RenderInfo( p_vout );
} }
/* Sleep until its display date */
mwait( pic_date );
} }
else else
{ {
/* Sleep to wait for new pictures */ /* If last picture was a long time ago, increase idle level, reset
msleep( VOUT_IDLE_SLEEP ); * date and render idle screen */
if( !i_err && (current_date - last_date > VOUT_IDLE_DELAY) )
{
last_date = current_date;
b_display = p_vout->b_active && RenderIdle( p_vout, i_idle_level++ );
}
else
{
b_display = 0;
}
#ifdef STATS #ifdef STATS
/* Update counters */ /* Update counters */
p_vout->c_idle_loops++; p_vout->c_idle_loops++;
#endif #endif
/* Sleep to wait for new pictures */
msleep( VOUT_IDLE_SLEEP );
}
/* On awakening, send immediately picture to display */
if( b_display && p_vout->b_active )
{
vout_SysDisplay( p_vout );
} }
} }
...@@ -1135,37 +1130,91 @@ static void RenderYUV32Picture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1135,37 +1130,91 @@ static void RenderYUV32Picture( vout_thread_t *p_vout, picture_t *p_pic )
static void RenderInfo( vout_thread_t *p_vout ) static void RenderInfo( vout_thread_t *p_vout )
{ {
char psz_buffer[256]; /* string buffer */ char psz_buffer[256]; /* string buffer */
#ifdef DEBUG
int i_ready_pic = 0; /* ready pictures */
int i_reserved_pic = 0; /* reserved pictures */
int i_picture; /* picture index */
#endif
#ifdef STATS #ifdef STATS
/* Print FPS rate */ /* Print FPS rate in upper right corner */
if( p_vout->c_pictures > VOUT_FPS_SAMPLES ) if( p_vout->c_fps_samples > VOUT_FPS_SAMPLES )
{ {
sprintf( psz_buffer, "%.2f fps", (double) VOUT_FPS_SAMPLES * 1000000 / sprintf( psz_buffer, "%.2f fps", (double) VOUT_FPS_SAMPLES * 1000000 /
( p_vout->fps_sample[ (p_vout->i_fps_index + (VOUT_FPS_SAMPLES - 1)) % ( p_vout->fps_sample[ (p_vout->c_fps_samples - 1) % VOUT_FPS_SAMPLES ] -
VOUT_FPS_SAMPLES ] - p_vout->fps_sample[ p_vout->c_fps_samples % VOUT_FPS_SAMPLES ] ) );
p_vout->fps_sample[ p_vout->i_fps_index ] ) );
vout_SysPrint( p_vout, p_vout->i_width, 0, 1, -1, psz_buffer ); vout_SysPrint( p_vout, p_vout->i_width, 0, 1, -1, psz_buffer );
} }
/* Print statistics */ /* Print statistics in upper left corner */
sprintf( psz_buffer, "%ld pictures, %.1f %% idle loops", p_vout->c_pictures, sprintf( psz_buffer, "%ld frames (%.1f %% idle)", p_vout->c_fps_samples,
(double) p_vout->c_idle_loops * 100 / p_vout->c_loops ); p_vout->c_loops ?
(double ) p_vout->c_idle_loops * 100 / p_vout->c_loops : 100. );
vout_SysPrint( p_vout, 0, 0, -1, -1, psz_buffer ); vout_SysPrint( p_vout, 0, 0, -1, -1, psz_buffer );
#endif #endif
#ifdef DEBUG #ifdef DEBUG
/* Print heap size */ /* Print heap state in lower left corner */
sprintf( psz_buffer, "video heap size: %d (%.1f %%)", p_vout->i_pictures, for( i_picture = 0; i_picture < VOUT_MAX_PICTURES; i_picture++ )
(double) p_vout->i_pictures * 100 / VOUT_MAX_PICTURES ); {
switch( p_vout->p_picture[i_picture].i_status )
{
case RESERVED_PICTURE:
i_reserved_pic++;
break;
case READY_PICTURE:
i_ready_pic++;
break;
}
}
sprintf( psz_buffer, "video heap: %d/%d/%d", i_reserved_pic, i_ready_pic,
VOUT_MAX_PICTURES );
vout_SysPrint( p_vout, 0, p_vout->i_height, -1, 1, psz_buffer ); vout_SysPrint( p_vout, 0, p_vout->i_height, -1, 1, psz_buffer );
#endif #endif
#ifdef DEBUG_VIDEO #ifdef DEBUG_VIDEO
/* Print rendering statistics */ /* Print rendering statistics in lower right corner */
sprintf( psz_buffer, "picture rendering time: %lu us", sprintf( psz_buffer, "picture rendering time: %lu us",
(unsigned long) p_vout->picture_render_time ); (unsigned long) p_vout->picture_render_time );
vout_SysPrint( p_vout, p_vout->i_width, p_vout->i_height, 1, 1, psz_buffer ); vout_SysPrint( p_vout, p_vout->i_width, p_vout->i_height, 1, 1, psz_buffer );
#endif #endif
} }
/*******************************************************************************
* RenderIdle: render idle picture
*******************************************************************************
* This function will clear the display or print a logo. Level will vary from 0
* to a very high value that noone should never reach. It returns non 0 if
* something needs to be displayed and 0 if the previous picture can be kept.
*******************************************************************************/
static int RenderIdle( vout_thread_t *p_vout, int i_level )
{
byte_t *pi_pic; /* pointer to picture data */
/* Get frame pointer and clear display */
pi_pic = vout_SysGetPicture( p_vout );
switch( i_level )
{
case 0: /* level 0: clear screen */
memset( pi_pic, 0, p_vout->i_bytes_per_line * p_vout->i_height );
break;
case 1: /* level 1: "no stream" */
memset( pi_pic, 0, p_vout->i_bytes_per_line * p_vout->i_height );
vout_SysPrint( p_vout, p_vout->i_width / 2, p_vout->i_height / 2,
0, 0, "no stream" );
break;
case 50: /* level 50: copyright message */
memset( pi_pic, 0, p_vout->i_bytes_per_line * p_vout->i_height );
vout_SysPrint( p_vout, p_vout->i_width / 2, p_vout->i_height / 2,
0, 0, COPYRIGHT_MESSAGE );
break;
default: /* other levels: keep previous picture */
return( 0 );
break;
}
return( 1 );
}
...@@ -109,7 +109,8 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, Window root_window ...@@ -109,7 +109,8 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, Window root_window
/******************************************************************************* /*******************************************************************************
* vout_SysInit: initialize X11 video thread output method * vout_SysInit: initialize X11 video thread output method
******************************************************************************* *******************************************************************************
* This function create the XImages needed by the output thread. * This function create the XImages needed by the output thread. It is called
* at the beginning of the thread, but also each time the window is resized.
*******************************************************************************/ *******************************************************************************/
int vout_SysInit( vout_thread_t *p_vout ) int vout_SysInit( vout_thread_t *p_vout )
{ {
...@@ -160,6 +161,9 @@ int vout_SysInit( vout_thread_t *p_vout ) ...@@ -160,6 +161,9 @@ int vout_SysInit( vout_thread_t *p_vout )
} }
} }
/* Set bytes per line */
p_vout->i_bytes_per_line = p_vout->p_sys->p_ximage[0]->bytes_per_line;
/* Set buffer index to 0 */ /* Set buffer index to 0 */
p_vout->p_sys->i_buffer_index = 0; p_vout->p_sys->i_buffer_index = 0;
return( 0 ); return( 0 );
...@@ -168,7 +172,8 @@ int vout_SysInit( vout_thread_t *p_vout ) ...@@ -168,7 +172,8 @@ int vout_SysInit( vout_thread_t *p_vout )
/******************************************************************************* /*******************************************************************************
* vout_SysEnd: terminate X11 video thread output method * vout_SysEnd: terminate X11 video thread output method
******************************************************************************* *******************************************************************************
* Destroy the X11 XImages created by vout_SysInit. * Destroy the X11 XImages created by vout_SysInit. It is called at the end of
* the thread, but also each time the window is resized.
*******************************************************************************/ *******************************************************************************/
void vout_SysEnd( vout_thread_t *p_vout ) void vout_SysEnd( vout_thread_t *p_vout )
{ {
...@@ -208,10 +213,25 @@ void vout_SysDestroy( vout_thread_t *p_vout ) ...@@ -208,10 +213,25 @@ void vout_SysDestroy( vout_thread_t *p_vout )
*******************************************************************************/ *******************************************************************************/
int vout_SysManage( vout_thread_t *p_vout ) int vout_SysManage( vout_thread_t *p_vout )
{ {
//?? if( (p_vout->i_width != p_vout->i_new_width) ||
return 0; (p_vout->i_height != p_vout->i_new_height) )
{
/* Resize window */
XResizeWindow( p_vout->p_sys->p_display, p_vout->p_sys->window,
p_vout->i_new_width, p_vout->i_new_height );
/* Destroy then recreate XImages to change their size */
vout_SysEnd( p_vout );
p_vout->i_width = p_vout->i_new_width;
p_vout->i_height = p_vout->i_new_height;
// ?? bpl
vout_SysInit( p_vout );
/* Cancel current display */
return( 1 );
}
// ?? if resized: end/init again, return >0 return 0;
} }
/******************************************************************************* /*******************************************************************************
...@@ -379,14 +399,17 @@ static int X11OpenDisplay( vout_thread_t *p_vout, char *psz_display, Window root ...@@ -379,14 +399,17 @@ static int X11OpenDisplay( vout_thread_t *p_vout, char *psz_display, Window root
break; break;
} }
/* Create a window and set line length */ /* Create a window */
if( X11CreateWindow( p_vout ) ) if( X11CreateWindow( p_vout ) )
{ {
intf_ErrMsg("error: can't open a window\n"); intf_ErrMsg("error: can't open a window\n");
XCloseDisplay( p_vout->p_sys->p_display ); XCloseDisplay( p_vout->p_sys->p_display );
return( 1 ); return( 1 );
} }
p_vout->i_bytes_per_line = p_vout->i_width * p_vout->i_bytes_per_pixel;
/* Store additionnal vout informations */
p_vout->i_new_width = p_vout->i_width;
p_vout->i_new_height = p_vout->i_height;
/* Get font information */ /* Get font information */
if( X11GetFont( p_vout ) ) if( X11GetFont( p_vout ) )
...@@ -581,6 +604,8 @@ static void X11DestroyWindow( vout_thread_t *p_vout ) ...@@ -581,6 +604,8 @@ static void X11DestroyWindow( vout_thread_t *p_vout )
/******************************************************************************* /*******************************************************************************
* X11CreateImage: create an XImage * X11CreateImage: create an XImage
*******************************************************************************
* Create a simple XImage used as a buffer.
*******************************************************************************/ *******************************************************************************/
static int X11CreateImage( vout_thread_t *p_vout, XImage **pp_ximage ) static int X11CreateImage( vout_thread_t *p_vout, XImage **pp_ximage )
{ {
...@@ -588,6 +613,7 @@ static int X11CreateImage( vout_thread_t *p_vout, XImage **pp_ximage ) ...@@ -588,6 +613,7 @@ static int X11CreateImage( vout_thread_t *p_vout, XImage **pp_ximage )
int i_quantum; /* XImage quantum (see below) */ int i_quantum; /* XImage quantum (see below) */
/* Allocate memory for image */ /* Allocate memory for image */
p_vout->i_bytes_per_line = p_vout->i_width * p_vout->i_bytes_per_pixel;
pb_data = (byte_t *) malloc( p_vout->i_bytes_per_line * p_vout->i_height ); pb_data = (byte_t *) malloc( p_vout->i_bytes_per_line * p_vout->i_height );
if( !pb_data ) /* error */ if( !pb_data ) /* error */
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment