Commit e13aed00 authored by Sam Hocevar's avatar Sam Hocevar

. autod�tection des plugins

 . les aliases "gvlc" "fbvlc" "ggivlc" fonctionne comme il faut
parent 4af2fd10
...@@ -211,6 +211,7 @@ video_decoder_obj = video_decoder/video_decoder.o \ ...@@ -211,6 +211,7 @@ video_decoder_obj = video_decoder/video_decoder.o \
video_decoder/vdec_idct.o video_decoder/vdec_idct.o
misc_obj = misc/mtime.o \ misc_obj = misc/mtime.o \
misc/tests.o \
misc/rsc_files.o \ misc/rsc_files.o \
misc/netutils.o \ misc/netutils.o \
misc/playlist.o \ misc/playlist.o \
......
...@@ -45,7 +45,7 @@ information about MPEG and DVD playing. Have a look at the documentation ...@@ -45,7 +45,7 @@ information about MPEG and DVD playing. Have a look at the documentation
section, as well as the bookmarks. section, as well as the bookmarks.
You can also try the OpenDVD site at http://www.opendvd.org/ or the You can also try the OpenDVD site at http://www.opendvd.org/ or the
the LiVid project at http://www.linuxvideo.org/. They have lots of the LiViD project at http://www.linuxvideo.org/. They have lots of
information, too. information, too.
......
...@@ -272,6 +272,9 @@ ...@@ -272,6 +272,9 @@
/* Environment variable containing the display method */ /* Environment variable containing the display method */
#define VOUT_METHOD_VAR "vlc_vout" #define VOUT_METHOD_VAR "vlc_vout"
/* Environment variable containing the YUV method */
#define YUV_METHOD_VAR "vlc_yuv"
/* The fallback method */ /* The fallback method */
#define VOUT_DEFAULT_METHOD "x11" #define VOUT_DEFAULT_METHOD "x11"
......
...@@ -38,6 +38,7 @@ typedef struct ...@@ -38,6 +38,7 @@ typedef struct
int i_argc; /* command line arguments count */ int i_argc; /* command line arguments count */
char ** ppsz_argv; /* command line arguments */ char ** ppsz_argv; /* command line arguments */
char ** ppsz_env; /* environment variables */ char ** ppsz_env; /* environment variables */
char * psz_arg0; /* program name (whithout path) */
/* Generic settings */ /* Generic settings */
boolean_t b_audio; /* is audio output allowed ? */ boolean_t b_audio; /* is audio output allowed ? */
......
...@@ -43,6 +43,8 @@ typedef struct plugin_info_s ...@@ -43,6 +43,8 @@ typedef struct plugin_info_s
void * vout_GetPlugin; void * vout_GetPlugin;
void * intf_GetPlugin; void * intf_GetPlugin;
void * yuv_GetPlugin; void * yuv_GetPlugin;
int i_score;
} plugin_info_t; } plugin_info_t;
typedef struct plugin_bank_s typedef struct plugin_bank_s
......
/***************************************************************************** /*****************************************************************************
* plugins_export.h : exporting plugins structure * tests.h: several test functions needed by the plugins
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1996, 1997, 1998, 1999, 2000 VideoLAN
* *
* Authors: * Authors:
* *
...@@ -23,36 +23,8 @@ ...@@ -23,36 +23,8 @@
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
int TestProgram( char * psz_program );
/* audio output */ int TestMethod( char * psz_var, char * psz_method );
int aout_SysOpen ( aout_thread_t *p_aout ); int TestVersion( char * psz_version );
int aout_SysReset ( aout_thread_t *p_aout ); int TestMMX( void );
int aout_SysSetFormat ( aout_thread_t *p_aout );
int aout_SysSetChannels ( aout_thread_t *p_aout );
int aout_SysSetRate ( aout_thread_t *p_aout );
long aout_SysGetBufInfo ( aout_thread_t *p_aout, long l_buffer_info );
void aout_SysPlaySamples ( aout_thread_t *p_aout, byte_t *buffer,
int i_size );
void aout_SysClose ( aout_thread_t *p_aout );
/* video output */
int vout_SysCreate ( vout_thread_t *p_vout, char *psz_display,
int i_root_window, void *p_data );
int vout_SysInit ( p_vout_thread_t p_vout );
void vout_SysEnd ( p_vout_thread_t p_vout );
void vout_SysDestroy ( p_vout_thread_t p_vout );
int vout_SysManage ( p_vout_thread_t p_vout );
void vout_SysDisplay ( p_vout_thread_t p_vout );
void vout_SetPalette ( p_vout_thread_t p_vout,
u16 *red, u16 *green, u16 *blue, u16 *transp );
/* interface */
int intf_SysCreate ( p_intf_thread_t p_intf );
void intf_SysDestroy ( p_intf_thread_t p_intf );
void intf_SysManage ( p_intf_thread_t p_intf );
/* YUV transformations */
int yuv_SysInit ( p_vout_thread_t p_vout );
int yuv_SysReset ( p_vout_thread_t p_vout );
void yuv_SysEnd ( p_vout_thread_t p_vout );
...@@ -75,9 +75,9 @@ extern "C" ...@@ -75,9 +75,9 @@ extern "C"
{ {
/***************************************************************************** /*****************************************************************************
* aout_SysOpen: opens a BPushGameSound * aout_BeOpen: opens a BPushGameSound
*****************************************************************************/ *****************************************************************************/
int aout_SysOpen( aout_thread_t *p_aout ) int aout_BeOpen( aout_thread_t *p_aout )
{ {
/* Allocate structure */ /* Allocate structure */
p_aout->p_sys = (aout_sys_t*) malloc( sizeof( aout_sys_t ) ); p_aout->p_sys = (aout_sys_t*) malloc( sizeof( aout_sys_t ) );
...@@ -136,41 +136,41 @@ int aout_SysOpen( aout_thread_t *p_aout ) ...@@ -136,41 +136,41 @@ int aout_SysOpen( aout_thread_t *p_aout )
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* aout_SysReset: resets the dsp * aout_BeReset: resets the dsp
*****************************************************************************/ *****************************************************************************/
int aout_SysReset( aout_thread_t *p_aout ) int aout_BeReset( aout_thread_t *p_aout )
{ {
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* aout_SysSetFormat: sets the dsp output format * aout_BeSetFormat: sets the dsp output format
*****************************************************************************/ *****************************************************************************/
int aout_SysSetFormat( aout_thread_t *p_aout ) int aout_BeSetFormat( aout_thread_t *p_aout )
{ {
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* aout_SysSetChannels: sets the dsp's stereo or mono mode * aout_BeSetChannels: sets the dsp's stereo or mono mode
*****************************************************************************/ *****************************************************************************/
int aout_SysSetChannels( aout_thread_t *p_aout ) int aout_BeSetChannels( aout_thread_t *p_aout )
{ {
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* aout_SysSetRate: sets the dsp's audio output rate * aout_BeSetRate: sets the dsp's audio output rate
*****************************************************************************/ *****************************************************************************/
int aout_SysSetRate( aout_thread_t *p_aout ) int aout_BeSetRate( aout_thread_t *p_aout )
{ {
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* aout_SysGetBufInfo: buffer status query * aout_BeGetBufInfo: buffer status query
*****************************************************************************/ *****************************************************************************/
long aout_SysGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit ) long aout_BeGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
{ {
long i_hard_pos = 4 * p_aout->p_sys->p_sound->CurrentPosition(); long i_hard_pos = 4 * p_aout->p_sys->p_sound->CurrentPosition();
...@@ -189,11 +189,11 @@ long aout_SysGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit ) ...@@ -189,11 +189,11 @@ long aout_SysGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
} }
/***************************************************************************** /*****************************************************************************
* aout_SysPlaySamples: plays a sound samples buffer * aout_BePlaySamples: plays a sound samples buffer
***************************************************************************** *****************************************************************************
* This function writes a buffer of i_length bytes in the dsp * This function writes a buffer of i_length bytes in the dsp
*****************************************************************************/ *****************************************************************************/
void aout_SysPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size ) void aout_BePlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size )
{ {
long i_newbuf_pos; long i_newbuf_pos;
...@@ -223,9 +223,9 @@ void aout_SysPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size ) ...@@ -223,9 +223,9 @@ void aout_SysPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size )
} }
/***************************************************************************** /*****************************************************************************
* aout_SysClose: closes the dsp audio device * aout_BeClose: closes the dsp audio device
*****************************************************************************/ *****************************************************************************/
void aout_SysClose( aout_thread_t *p_aout ) void aout_BeClose( aout_thread_t *p_aout )
{ {
p_aout->p_sys->p_sound->UnlockCyclic(); p_aout->p_sys->p_sound->UnlockCyclic();
p_aout->p_sys->p_sound->StopPlaying( ); p_aout->p_sys->p_sound->StopPlaying( );
......
...@@ -40,14 +40,39 @@ extern "C" ...@@ -40,14 +40,39 @@ extern "C"
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "plugins_export.h"
/***************************************************************************** /*****************************************************************************
* Exported prototypes * Exported prototypes
*****************************************************************************/ *****************************************************************************/
void aout_GetPlugin( p_aout_thread_t p_aout ); static void aout_GetPlugin( p_aout_thread_t p_aout );
void vout_GetPlugin( p_vout_thread_t p_vout ); static void vout_GetPlugin( p_vout_thread_t p_vout );
void intf_GetPlugin( p_intf_thread_t p_intf ); static void intf_GetPlugin( p_intf_thread_t p_intf );
/* Audio output */
int aout_BeOpen ( aout_thread_t *p_aout );
int aout_BeReset ( aout_thread_t *p_aout );
int aout_BeSetFormat ( aout_thread_t *p_aout );
int aout_BeSetChannels ( aout_thread_t *p_aout );
int aout_BeSetRate ( aout_thread_t *p_aout );
long aout_BeGetBufInfo ( aout_thread_t *p_aout, long l_buffer_info );
void aout_BePlaySamples ( aout_thread_t *p_aout, byte_t *buffer,
int i_size );
void aout_BeClose ( aout_thread_t *p_aout );
/* Video output */
int vout_BeCreate ( vout_thread_t *p_vout, char *psz_display,
int i_root_window, void *p_data );
int vout_BeInit ( p_vout_thread_t p_vout );
void vout_BeEnd ( p_vout_thread_t p_vout );
void vout_BeDestroy ( p_vout_thread_t p_vout );
int vout_BeManage ( p_vout_thread_t p_vout );
void vout_BeDisplay ( p_vout_thread_t p_vout );
void vout_BeSetPalette ( p_vout_thread_t p_vout,
u16 *red, u16 *green, u16 *blue, u16 *transp );
/* Interface */
int intf_BeCreate ( p_intf_thread_t p_intf );
void intf_BeDestroy ( p_intf_thread_t p_intf );
void intf_BeManage ( p_intf_thread_t p_intf );
/***************************************************************************** /*****************************************************************************
* GetConfig: get the plugin structure and configuration * GetConfig: get the plugin structure and configuration
...@@ -65,49 +90,43 @@ plugin_info_t * GetConfig( void ) ...@@ -65,49 +90,43 @@ plugin_info_t * GetConfig( void )
p_info->intf_GetPlugin = intf_GetPlugin; p_info->intf_GetPlugin = intf_GetPlugin;
p_info->yuv_GetPlugin = NULL; p_info->yuv_GetPlugin = NULL;
return( p_info ); /* the beos plugin always works under BeOS :) */
} p_info->i_score = 0x800;
/***************************************************************************** return( p_info );
* Test: tests if the plugin can be launched
*****************************************************************************/
int Test( void )
{
/* the BeOS plugin always works under BeOS :) */
return( 1 );
} }
/***************************************************************************** /*****************************************************************************
* Following functions are only called through the p_info structure * Following functions are only called through the p_info structure
*****************************************************************************/ *****************************************************************************/
void aout_GetPlugin( p_aout_thread_t p_aout ) static void aout_GetPlugin( p_aout_thread_t p_aout )
{ {
p_aout->p_sys_open = aout_SysOpen; p_aout->p_sys_open = aout_BeOpen;
p_aout->p_sys_reset = aout_SysReset; p_aout->p_sys_reset = aout_BeReset;
p_aout->p_sys_setformat = aout_SysSetFormat; p_aout->p_sys_setformat = aout_BeSetFormat;
p_aout->p_sys_setchannels = aout_SysSetChannels; p_aout->p_sys_setchannels = aout_BeSetChannels;
p_aout->p_sys_setrate = aout_SysSetRate; p_aout->p_sys_setrate = aout_BeSetRate;
p_aout->p_sys_getbufinfo = aout_SysGetBufInfo; p_aout->p_sys_getbufinfo = aout_BeGetBufInfo;
p_aout->p_sys_playsamples = aout_SysPlaySamples; p_aout->p_sys_playsamples = aout_BePlaySamples;
p_aout->p_sys_close = aout_SysClose; p_aout->p_sys_close = aout_BeClose;
} }
void vout_GetPlugin( p_vout_thread_t p_vout ) static void vout_GetPlugin( p_vout_thread_t p_vout )
{ {
p_vout->p_sys_create = vout_SysCreate; p_vout->p_sys_create = vout_BeCreate;
p_vout->p_sys_init = vout_SysInit; p_vout->p_sys_init = vout_BeInit;
p_vout->p_sys_end = vout_SysEnd; p_vout->p_sys_end = vout_BeEnd;
p_vout->p_sys_destroy = vout_SysDestroy; p_vout->p_sys_destroy = vout_BeDestroy;
p_vout->p_sys_manage = vout_SysManage; p_vout->p_sys_manage = vout_BeManage;
p_vout->p_sys_display = vout_SysDisplay; p_vout->p_sys_display = vout_BeDisplay;
} }
void intf_GetPlugin( p_intf_thread_t p_intf ) static void intf_GetPlugin( p_intf_thread_t p_intf )
{ {
p_intf->p_sys_create = intf_SysCreate; p_intf->p_sys_create = intf_BeCreate;
p_intf->p_sys_destroy = intf_SysDestroy; p_intf->p_sys_destroy = intf_BeDestroy;
p_intf->p_sys_manage = intf_SysManage; p_intf->p_sys_manage = intf_BeManage;
} }
} /* extern "C" */ } /* extern "C" */
...@@ -125,9 +125,9 @@ extern "C" ...@@ -125,9 +125,9 @@ extern "C"
{ {
/***************************************************************************** /*****************************************************************************
* intf_SysCreate: initialize dummy interface * intf_BeCreate: initialize dummy interface
*****************************************************************************/ *****************************************************************************/
int intf_SysCreate( intf_thread_t *p_intf ) int intf_BeCreate( intf_thread_t *p_intf )
{ {
/* Allocate instance and initialize some members */ /* Allocate instance and initialize some members */
p_intf->p_sys = (intf_sys_t*) malloc( sizeof( intf_sys_t ) ); p_intf->p_sys = (intf_sys_t*) malloc( sizeof( intf_sys_t ) );
...@@ -162,9 +162,9 @@ int intf_SysCreate( intf_thread_t *p_intf ) ...@@ -162,9 +162,9 @@ int intf_SysCreate( intf_thread_t *p_intf )
} }
/***************************************************************************** /*****************************************************************************
* intf_SysDestroy: destroy dummy interface * intf_BeDestroy: destroy dummy interface
*****************************************************************************/ *****************************************************************************/
void intf_SysDestroy( intf_thread_t *p_intf ) void intf_BeDestroy( intf_thread_t *p_intf )
{ {
/* Close input thread, if any (blocking) */ /* Close input thread, if any (blocking) */
if( p_intf->p_input ) if( p_intf->p_input )
...@@ -188,9 +188,9 @@ void intf_SysDestroy( intf_thread_t *p_intf ) ...@@ -188,9 +188,9 @@ void intf_SysDestroy( intf_thread_t *p_intf )
/***************************************************************************** /*****************************************************************************
* intf_SysManage: event loop * intf_BeManage: event loop
*****************************************************************************/ *****************************************************************************/
void intf_SysManage( intf_thread_t *p_intf ) void intf_BeManage( intf_thread_t *p_intf )
{ {
if( p_intf->p_sys->i_key != -1 ) if( p_intf->p_sys->i_key != -1 )
{ {
......
...@@ -340,11 +340,11 @@ static int BeosOpenDisplay ( vout_thread_t *p_vout ); ...@@ -340,11 +340,11 @@ static int BeosOpenDisplay ( vout_thread_t *p_vout );
static void BeosCloseDisplay ( vout_thread_t *p_vout ); static void BeosCloseDisplay ( vout_thread_t *p_vout );
/***************************************************************************** /*****************************************************************************
* vout_SysCreate: allocates dummy video thread output method * vout_BeCreate: allocates dummy video thread output method
***************************************************************************** *****************************************************************************
* This function allocates and initializes a dummy vout method. * This function allocates and initializes a dummy vout method.
*****************************************************************************/ *****************************************************************************/
int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int vout_BeCreate( vout_thread_t *p_vout, char *psz_display,
int i_root_window, void *p_data ) int i_root_window, void *p_data )
{ {
/* Allocate structure */ /* Allocate structure */
...@@ -371,9 +371,9 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, ...@@ -371,9 +371,9 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display,
} }
/***************************************************************************** /*****************************************************************************
* vout_SysInit: initialize dummy video thread output method * vout_BeInit: initialize dummy video thread output method
*****************************************************************************/ *****************************************************************************/
int vout_SysInit( vout_thread_t *p_vout ) int vout_BeInit( vout_thread_t *p_vout )
{ {
VideoWindow * p_win = p_vout->p_sys->p_window; VideoWindow * p_win = p_vout->p_sys->p_window;
u32 i_page_size; u32 i_page_size;
...@@ -406,9 +406,9 @@ int vout_SysInit( vout_thread_t *p_vout ) ...@@ -406,9 +406,9 @@ int vout_SysInit( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* vout_SysEnd: terminate dummy video thread output method * vout_BeEnd: terminate dummy video thread output method
*****************************************************************************/ *****************************************************************************/
void vout_SysEnd( vout_thread_t *p_vout ) void vout_BeEnd( vout_thread_t *p_vout )
{ {
VideoWindow * p_win = p_vout->p_sys->p_window; VideoWindow * p_win = p_vout->p_sys->p_window;
...@@ -422,11 +422,11 @@ void vout_SysEnd( vout_thread_t *p_vout ) ...@@ -422,11 +422,11 @@ void vout_SysEnd( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* vout_SysDestroy: destroy dummy video thread output method * vout_BeDestroy: destroy dummy video thread output method
***************************************************************************** *****************************************************************************
* Terminate an output method created by DummyCreateOutputMethod * Terminate an output method created by DummyCreateOutputMethod
*****************************************************************************/ *****************************************************************************/
void vout_SysDestroy( vout_thread_t *p_vout ) void vout_BeDestroy( vout_thread_t *p_vout )
{ {
BeosCloseDisplay( p_vout ); BeosCloseDisplay( p_vout );
...@@ -434,12 +434,12 @@ void vout_SysDestroy( vout_thread_t *p_vout ) ...@@ -434,12 +434,12 @@ void vout_SysDestroy( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* vout_SysManage: handle dummy events * vout_BeManage: handle dummy events
***************************************************************************** *****************************************************************************
* This function should be called regularly by video output thread. It manages * This function should be called regularly by video output thread. It manages
* console events. It returns a non null value on error. * console events. It returns a non null value on error.
*****************************************************************************/ *****************************************************************************/
int vout_SysManage( vout_thread_t *p_vout ) int vout_BeManage( vout_thread_t *p_vout )
{ {
if( p_vout->i_changes & VOUT_SIZE_CHANGE ) if( p_vout->i_changes & VOUT_SIZE_CHANGE )
{ {
...@@ -468,12 +468,12 @@ int vout_SysManage( vout_thread_t *p_vout ) ...@@ -468,12 +468,12 @@ int vout_SysManage( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* vout_SysDisplay: displays previously rendered output * vout_BeDisplay: displays previously rendered output
***************************************************************************** *****************************************************************************
* This function send the currently rendered image to dummy image, waits until * This function send the currently rendered image to dummy image, waits until
* it is displayed and switch the two rendering buffers, preparing next frame. * it is displayed and switch the two rendering buffers, preparing next frame.
*****************************************************************************/ *****************************************************************************/
void vout_SysDisplay( vout_thread_t *p_vout ) void vout_BeDisplay( vout_thread_t *p_vout )
{ {
VideoWindow * p_win = p_vout->p_sys->p_window; VideoWindow * p_win = p_vout->p_sys->p_window;
......
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
/* TODO: /* TODO:
* *
* - an aout_sysGetFormats() function * - an aout_DspGetFormats() function
* - dsp inline/static * - dsp inline/static
* - make this library portable (see mpg123) * - make this library portable (see mpg123)
* - macroify aout_sysPlaySamples &/| aout_sysGetBufInfo ? * - macroify aout_DspPlaySamples &/| aout_DspGetBufInfo ?
* *
*/ */
...@@ -74,12 +74,12 @@ typedef struct aout_sys_s ...@@ -74,12 +74,12 @@ typedef struct aout_sys_s
} aout_sys_t; } aout_sys_t;
/***************************************************************************** /*****************************************************************************
* aout_SysOpen: opens the audio device (the digital sound processor) * aout_DspOpen: opens the audio device (the digital sound processor)
***************************************************************************** *****************************************************************************
* - This function opens the dsp as an usual non-blocking write-only file, and * - This function opens the dsp as an usual non-blocking write-only file, and
* modifies the p_aout->p_sys->i_fd with the file's descriptor. * modifies the p_aout->p_sys->i_fd with the file's descriptor.
*****************************************************************************/ *****************************************************************************/
int aout_SysOpen( aout_thread_t *p_aout ) int aout_DspOpen( aout_thread_t *p_aout )
{ {
/* Allocate structure */ /* Allocate structure */
p_aout->p_sys = malloc( sizeof( aout_sys_t ) ); p_aout->p_sys = malloc( sizeof( aout_sys_t ) );
...@@ -106,9 +106,9 @@ int aout_SysOpen( aout_thread_t *p_aout ) ...@@ -106,9 +106,9 @@ int aout_SysOpen( aout_thread_t *p_aout )
} }
/***************************************************************************** /*****************************************************************************
* aout_SysReset: resets the dsp * aout_DspReset: resets the dsp
*****************************************************************************/ *****************************************************************************/
int aout_SysReset( aout_thread_t *p_aout ) int aout_DspReset( aout_thread_t *p_aout )
{ {
if ( ioctl( p_aout->i_fd, SNDCTL_DSP_RESET, NULL ) < 0 ) if ( ioctl( p_aout->i_fd, SNDCTL_DSP_RESET, NULL ) < 0 )
{ {
...@@ -120,13 +120,13 @@ int aout_SysReset( aout_thread_t *p_aout ) ...@@ -120,13 +120,13 @@ int aout_SysReset( aout_thread_t *p_aout )
} }
/***************************************************************************** /*****************************************************************************
* aout_SysSetFormat: sets the dsp output format * aout_DspSetFormat: sets the dsp output format
***************************************************************************** *****************************************************************************
* This functions tries to initialize the dsp output format with the value * This functions tries to initialize the dsp output format with the value
* contained in the dsp structure, and if this value could not be set, the * contained in the dsp structure, and if this value could not be set, the
* default value returned by ioctl is set. * default value returned by ioctl is set.
*****************************************************************************/ *****************************************************************************/
int aout_SysSetFormat( aout_thread_t *p_aout ) int aout_DspSetFormat( aout_thread_t *p_aout )
{ {
int i_format; int i_format;
...@@ -147,11 +147,11 @@ int aout_SysSetFormat( aout_thread_t *p_aout ) ...@@ -147,11 +147,11 @@ int aout_SysSetFormat( aout_thread_t *p_aout )
} }
/***************************************************************************** /*****************************************************************************
* aout_SysSetChannels: sets the dsp's stereo or mono mode * aout_DspSetChannels: sets the dsp's stereo or mono mode
***************************************************************************** *****************************************************************************
* This function acts just like the previous one... * This function acts just like the previous one...
*****************************************************************************/ *****************************************************************************/
int aout_SysSetChannels( aout_thread_t *p_aout ) int aout_DspSetChannels( aout_thread_t *p_aout )
{ {
boolean_t b_stereo = p_aout->b_stereo; boolean_t b_stereo = p_aout->b_stereo;
...@@ -172,13 +172,13 @@ int aout_SysSetChannels( aout_thread_t *p_aout ) ...@@ -172,13 +172,13 @@ int aout_SysSetChannels( aout_thread_t *p_aout )
} }
/***************************************************************************** /*****************************************************************************
* aout_SysSetRate: sets the dsp's audio output rate * aout_DspSetRate: sets the dsp's audio output rate
***************************************************************************** *****************************************************************************
* This function tries to initialize the dsp with the rate contained in the * This function tries to initialize the dsp with the rate contained in the
* dsp structure, but if the dsp doesn't support this value, the function uses * dsp structure, but if the dsp doesn't support this value, the function uses
* the value returned by ioctl... * the value returned by ioctl...
*****************************************************************************/ *****************************************************************************/
int aout_SysSetRate( aout_thread_t *p_aout ) int aout_DspSetRate( aout_thread_t *p_aout )
{ {
long l_rate; long l_rate;
...@@ -199,7 +199,7 @@ int aout_SysSetRate( aout_thread_t *p_aout ) ...@@ -199,7 +199,7 @@ int aout_SysSetRate( aout_thread_t *p_aout )
} }
/***************************************************************************** /*****************************************************************************
* aout_SysGetBufInfo: buffer status query * aout_DspGetBufInfo: buffer status query
***************************************************************************** *****************************************************************************
* This function fills in the audio_buf_info structure : * This function fills in the audio_buf_info structure :
* - int fragments : number of available fragments (partially usend ones not * - int fragments : number of available fragments (partially usend ones not
...@@ -209,7 +209,7 @@ int aout_SysSetRate( aout_thread_t *p_aout ) ...@@ -209,7 +209,7 @@ int aout_SysSetRate( aout_thread_t *p_aout )
* - int bytes : available space in bytes (includes partially used fragments) * - int bytes : available space in bytes (includes partially used fragments)
* Note! 'bytes' could be more than fragments*fragsize * Note! 'bytes' could be more than fragments*fragsize
*****************************************************************************/ *****************************************************************************/
long aout_SysGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit ) long aout_DspGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
{ {
ioctl( p_aout->i_fd, SNDCTL_DSP_GETOSPACE, &p_aout->p_sys->audio_buf ); ioctl( p_aout->i_fd, SNDCTL_DSP_GETOSPACE, &p_aout->p_sys->audio_buf );
...@@ -220,11 +220,11 @@ long aout_SysGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit ) ...@@ -220,11 +220,11 @@ long aout_SysGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
} }
/***************************************************************************** /*****************************************************************************
* aout_SysPlaySamples: plays a sound samples buffer * aout_DspPlaySamples: plays a sound samples buffer
***************************************************************************** *****************************************************************************
* This function writes a buffer of i_length bytes in the dsp * This function writes a buffer of i_length bytes in the dsp
*****************************************************************************/ *****************************************************************************/
void aout_SysPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size ) void aout_DspPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size )
{ {
if( p_aout->b_active ) if( p_aout->b_active )
{ {
...@@ -233,9 +233,9 @@ void aout_SysPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size ) ...@@ -233,9 +233,9 @@ void aout_SysPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size )
} }
/***************************************************************************** /*****************************************************************************
* aout_SysClose: closes the dsp audio device * aout_DspClose: closes the dsp audio device
*****************************************************************************/ *****************************************************************************/
void aout_SysClose( aout_thread_t *p_aout ) void aout_DspClose( aout_thread_t *p_aout )
{ {
close( p_aout->i_fd ); close( p_aout->i_fd );
} }
......
...@@ -25,12 +25,17 @@ ...@@ -25,12 +25,17 @@
*****************************************************************************/ *****************************************************************************/
#include "defs.h" #include "defs.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h> /* malloc(), free() */ #include <stdlib.h> /* malloc(), free() */
#include <unistd.h> /* close() */
#include "config.h" #include "config.h"
#include "common.h" /* boolean_t, byte_t */ #include "common.h" /* boolean_t, byte_t */
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "tests.h"
#include "plugins.h" #include "plugins.h"
#include "interface.h" #include "interface.h"
...@@ -38,18 +43,30 @@ ...@@ -38,18 +43,30 @@
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "plugins_export.h" #include "main.h"
/***************************************************************************** /*****************************************************************************
* Exported prototypes * Exported prototypes
*****************************************************************************/ *****************************************************************************/
void aout_GetPlugin( p_aout_thread_t p_aout ); static void aout_GetPlugin( p_aout_thread_t p_aout );
/* Audio output */
int aout_DspOpen ( aout_thread_t *p_aout );
int aout_DspReset ( aout_thread_t *p_aout );
int aout_DspSetFormat ( aout_thread_t *p_aout );
int aout_DspSetChannels ( aout_thread_t *p_aout );
int aout_DspSetRate ( aout_thread_t *p_aout );
long aout_DspGetBufInfo ( aout_thread_t *p_aout, long l_buffer_info );
void aout_DspPlaySamples ( aout_thread_t *p_aout, byte_t *buffer,
int i_size );
void aout_DspClose ( aout_thread_t *p_aout );
/***************************************************************************** /*****************************************************************************
* GetConfig: get the plugin structure and configuration * GetConfig: get the plugin structure and configuration
*****************************************************************************/ *****************************************************************************/
plugin_info_t * GetConfig( void ) plugin_info_t * GetConfig( void )
{ {
int i_fd;
plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) ); plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
p_info->psz_name = "OSS /dev/dsp"; p_info->psz_name = "OSS /dev/dsp";
...@@ -61,31 +78,40 @@ plugin_info_t * GetConfig( void ) ...@@ -61,31 +78,40 @@ plugin_info_t * GetConfig( void )
p_info->intf_GetPlugin = NULL; p_info->intf_GetPlugin = NULL;
p_info->yuv_GetPlugin = NULL; p_info->yuv_GetPlugin = NULL;
return( p_info ); /* Test if the device can be opened */
} if ( (i_fd = open( main_GetPszVariable( AOUT_DSP_VAR, AOUT_DSP_DEFAULT ),
O_WRONLY )) < 0 )
{
p_info->i_score = 0;
}
else
{
close( i_fd );
p_info->i_score = 0x100;
}
/***************************************************************************** /* If this plugin was requested, score it higher */
* Test: tests if the plugin can be launched if( TestMethod( AOUT_METHOD_VAR, "dsp" ) )
*****************************************************************************/ {
int Test( void ) p_info->i_score += 0x200;
{ }
/* TODO: check if suitable */
return( 1 ); return( p_info );
} }
/***************************************************************************** /*****************************************************************************
* Following functions are only called through the p_info structure * Following functions are only called through the p_info structure
*****************************************************************************/ *****************************************************************************/
void aout_GetPlugin( p_aout_thread_t p_aout ) static void aout_GetPlugin( p_aout_thread_t p_aout )
{ {
p_aout->p_sys_open = aout_SysOpen; p_aout->p_sys_open = aout_DspOpen;
p_aout->p_sys_reset = aout_SysReset; p_aout->p_sys_reset = aout_DspReset;
p_aout->p_sys_setformat = aout_SysSetFormat; p_aout->p_sys_setformat = aout_DspSetFormat;
p_aout->p_sys_setchannels = aout_SysSetChannels; p_aout->p_sys_setchannels = aout_DspSetChannels;
p_aout->p_sys_setrate = aout_SysSetRate; p_aout->p_sys_setrate = aout_DspSetRate;
p_aout->p_sys_getbufinfo = aout_SysGetBufInfo; p_aout->p_sys_getbufinfo = aout_DspGetBufInfo;
p_aout->p_sys_playsamples = aout_SysPlaySamples; p_aout->p_sys_playsamples = aout_DspPlaySamples;
p_aout->p_sys_close = aout_SysClose; p_aout->p_sys_close = aout_DspClose;
} }
...@@ -48,9 +48,9 @@ typedef struct aout_sys_s ...@@ -48,9 +48,9 @@ typedef struct aout_sys_s
} aout_sys_t; } aout_sys_t;
/***************************************************************************** /*****************************************************************************
* aout_SysOpen: opens a dummy audio device * aout_DummyOpen: opens a dummy audio device
*****************************************************************************/ *****************************************************************************/
int aout_SysOpen( aout_thread_t *p_aout ) int aout_DummyOpen( aout_thread_t *p_aout )
{ {
/* Initialize some variables */ /* Initialize some variables */
p_aout->i_format = AOUT_DEFAULT_FORMAT; p_aout->i_format = AOUT_DEFAULT_FORMAT;
...@@ -61,57 +61,57 @@ int aout_SysOpen( aout_thread_t *p_aout ) ...@@ -61,57 +61,57 @@ int aout_SysOpen( aout_thread_t *p_aout )
} }
/***************************************************************************** /*****************************************************************************
* aout_SysReset: fake reset * aout_DummyReset: fake reset
*****************************************************************************/ *****************************************************************************/
int aout_SysReset( aout_thread_t *p_aout ) int aout_DummyReset( aout_thread_t *p_aout )
{ {
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* aout_SysSetFormat: pretends to set the dsp output format * aout_DummySetFormat: pretends to set the dsp output format
*****************************************************************************/ *****************************************************************************/
int aout_SysSetFormat( aout_thread_t *p_aout ) int aout_DummySetFormat( aout_thread_t *p_aout )
{ {
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* aout_SysSetChannels: pretends to set stereo or mono mode * aout_DummySetChannels: pretends to set stereo or mono mode
*****************************************************************************/ *****************************************************************************/
int aout_SysSetChannels( aout_thread_t *p_aout ) int aout_DummySetChannels( aout_thread_t *p_aout )
{ {
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* aout_SysSetRate: pretends to set audio output rate * aout_DummySetRate: pretends to set audio output rate
*****************************************************************************/ *****************************************************************************/
int aout_SysSetRate( aout_thread_t *p_aout ) int aout_DummySetRate( aout_thread_t *p_aout )
{ {
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* aout_SysGetBufInfo: returns available bytes in buffer * aout_DummyGetBufInfo: returns available bytes in buffer
*****************************************************************************/ *****************************************************************************/
long aout_SysGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit ) long aout_DummyGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
{ {
return( 2 * l_buffer_limit ); /* value big enough to sleep */ return( 2 * l_buffer_limit ); /* value big enough to sleep */
} }
/***************************************************************************** /*****************************************************************************
* aout_SysPlaySamples: pretends to play a sound * aout_DummyPlaySamples: pretends to play a sound
*****************************************************************************/ *****************************************************************************/
void aout_SysPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size ) void aout_DummyPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size )
{ {
; ;
} }
/***************************************************************************** /*****************************************************************************
* aout_SysClose: closes the dummy audio device * aout_DummyClose: closes the dummy audio device
*****************************************************************************/ *****************************************************************************/
void aout_SysClose( aout_thread_t *p_aout ) void aout_DummyClose( aout_thread_t *p_aout )
{ {
; ;
} }
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "common.h" /* boolean_t, byte_t */ #include "common.h" /* boolean_t, byte_t */
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "tests.h"
#include "plugins.h" #include "plugins.h"
#include "interface.h" #include "interface.h"
...@@ -38,14 +39,39 @@ ...@@ -38,14 +39,39 @@
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "plugins_export.h"
/***************************************************************************** /*****************************************************************************
* Exported prototypes * Exported prototypes
*****************************************************************************/ *****************************************************************************/
void aout_GetPlugin( p_aout_thread_t p_aout ); static void aout_GetPlugin( p_aout_thread_t p_aout );
void vout_GetPlugin( p_vout_thread_t p_vout ); static void vout_GetPlugin( p_vout_thread_t p_vout );
void intf_GetPlugin( p_intf_thread_t p_intf ); static void intf_GetPlugin( p_intf_thread_t p_intf );
/* Audio output */
int aout_DummyOpen ( aout_thread_t *p_aout );
int aout_DummyReset ( aout_thread_t *p_aout );
int aout_DummySetFormat ( aout_thread_t *p_aout );
int aout_DummySetChannels ( aout_thread_t *p_aout );
int aout_DummySetRate ( aout_thread_t *p_aout );
long aout_DummyGetBufInfo ( aout_thread_t *p_aout, long l_buffer_info );
void aout_DummyPlaySamples ( aout_thread_t *p_aout, byte_t *buffer,
int i_size );
void aout_DummyClose ( aout_thread_t *p_aout );
/* Video output */
int vout_DummyCreate ( vout_thread_t *p_vout, char *psz_display,
int i_root_window, void *p_data );
int vout_DummyInit ( p_vout_thread_t p_vout );
void vout_DummyEnd ( p_vout_thread_t p_vout );
void vout_DummyDestroy ( p_vout_thread_t p_vout );
int vout_DummyManage ( p_vout_thread_t p_vout );
void vout_DummyDisplay ( p_vout_thread_t p_vout );
void vout_DummySetPalette ( p_vout_thread_t p_vout,
u16 *red, u16 *green, u16 *blue, u16 *transp );
/* Interface */
int intf_DummyCreate ( p_intf_thread_t p_intf );
void intf_DummyDestroy ( p_intf_thread_t p_intf );
void intf_DummyManage ( p_intf_thread_t p_intf );
/***************************************************************************** /*****************************************************************************
* GetConfig: get the plugin structure and configuration * GetConfig: get the plugin structure and configuration
...@@ -63,48 +89,55 @@ plugin_info_t * GetConfig( void ) ...@@ -63,48 +89,55 @@ plugin_info_t * GetConfig( void )
p_info->intf_GetPlugin = intf_GetPlugin; p_info->intf_GetPlugin = intf_GetPlugin;
p_info->yuv_GetPlugin = NULL; p_info->yuv_GetPlugin = NULL;
return( p_info ); /* The dummy plugin always works, but should have low priority */
} p_info->i_score = 0x1;
/***************************************************************************** /* If this plugin was requested, score it higher */
* Test: tests if the plugin can be launched if( TestMethod( VOUT_METHOD_VAR, "dummy" ) )
*****************************************************************************/ {
int Test( void ) p_info->i_score += 0x200;
{ }
/* the dummy plugin always works */
return( 1 ); /* If this plugin was requested, score it higher */
if( TestMethod( AOUT_METHOD_VAR, "dummy" ) )
{
p_info->i_score += 0x200;
}
return( p_info );
} }
/***************************************************************************** /*****************************************************************************
* Following functions are only called through the p_info structure * Following functions are only called through the p_info structure
*****************************************************************************/ *****************************************************************************/
void aout_GetPlugin( p_aout_thread_t p_aout ) static void aout_GetPlugin( p_aout_thread_t p_aout )
{ {
p_aout->p_sys_open = aout_SysOpen; p_aout->p_sys_open = aout_DummyOpen;
p_aout->p_sys_reset = aout_SysReset; p_aout->p_sys_reset = aout_DummyReset;
p_aout->p_sys_setformat = aout_SysSetFormat; p_aout->p_sys_setformat = aout_DummySetFormat;
p_aout->p_sys_setchannels = aout_SysSetChannels; p_aout->p_sys_setchannels = aout_DummySetChannels;
p_aout->p_sys_setrate = aout_SysSetRate; p_aout->p_sys_setrate = aout_DummySetRate;
p_aout->p_sys_getbufinfo = aout_SysGetBufInfo; p_aout->p_sys_getbufinfo = aout_DummyGetBufInfo;
p_aout->p_sys_playsamples = aout_SysPlaySamples; p_aout->p_sys_playsamples = aout_DummyPlaySamples;
p_aout->p_sys_close = aout_SysClose; p_aout->p_sys_close = aout_DummyClose;
} }
void vout_GetPlugin( p_vout_thread_t p_vout ) static void vout_GetPlugin( p_vout_thread_t p_vout )
{ {
p_vout->p_sys_create = vout_SysCreate; p_vout->p_sys_create = vout_DummyCreate;
p_vout->p_sys_init = vout_SysInit; p_vout->p_sys_init = vout_DummyInit;
p_vout->p_sys_end = vout_SysEnd; p_vout->p_sys_end = vout_DummyEnd;
p_vout->p_sys_destroy = vout_SysDestroy; p_vout->p_sys_destroy = vout_DummyDestroy;
p_vout->p_sys_manage = vout_SysManage; p_vout->p_sys_manage = vout_DummyManage;
p_vout->p_sys_display = vout_SysDisplay; p_vout->p_sys_display = vout_DummyDisplay;
} }
void intf_GetPlugin( p_intf_thread_t p_intf ) static void intf_GetPlugin( p_intf_thread_t p_intf )
{ {
p_intf->p_sys_create = intf_SysCreate; p_intf->p_sys_create = intf_DummyCreate;
p_intf->p_sys_destroy = intf_SysDestroy; p_intf->p_sys_destroy = intf_DummyDestroy;
p_intf->p_sys_manage = intf_SysManage; p_intf->p_sys_manage = intf_DummyManage;
} }
...@@ -53,9 +53,9 @@ typedef struct intf_sys_s ...@@ -53,9 +53,9 @@ typedef struct intf_sys_s
} intf_sys_t; } intf_sys_t;
/***************************************************************************** /*****************************************************************************
* intf_SysCreate: initialize dummy interface * intf_DummyCreate: initialize dummy interface
*****************************************************************************/ *****************************************************************************/
int intf_SysCreate( intf_thread_t *p_intf ) int intf_DummyCreate( intf_thread_t *p_intf )
{ {
/* Allocate instance and initialize some members */ /* Allocate instance and initialize some members */
p_intf->p_sys = malloc( sizeof( intf_sys_t ) ); p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
...@@ -78,9 +78,9 @@ int intf_SysCreate( intf_thread_t *p_intf ) ...@@ -78,9 +78,9 @@ int intf_SysCreate( intf_thread_t *p_intf )
} }
/***************************************************************************** /*****************************************************************************
* intf_SysDestroy: destroy dummy interface * intf_DummyDestroy: destroy dummy interface
*****************************************************************************/ *****************************************************************************/
void intf_SysDestroy( intf_thread_t *p_intf ) void intf_DummyDestroy( intf_thread_t *p_intf )
{ {
/* Close input thread, if any (blocking) */ /* Close input thread, if any (blocking) */
if( p_intf->p_input ) if( p_intf->p_input )
...@@ -100,9 +100,9 @@ void intf_SysDestroy( intf_thread_t *p_intf ) ...@@ -100,9 +100,9 @@ void intf_SysDestroy( intf_thread_t *p_intf )
/***************************************************************************** /*****************************************************************************
* intf_SysManage: event loop * intf_DummyManage: event loop
*****************************************************************************/ *****************************************************************************/
void intf_SysManage( intf_thread_t *p_intf ) void intf_DummyManage( intf_thread_t *p_intf )
{ {
; ;
} }
......
...@@ -66,11 +66,11 @@ static int DummyOpenDisplay ( vout_thread_t *p_vout ); ...@@ -66,11 +66,11 @@ static int DummyOpenDisplay ( vout_thread_t *p_vout );
static void DummyCloseDisplay ( vout_thread_t *p_vout ); static void DummyCloseDisplay ( vout_thread_t *p_vout );
/***************************************************************************** /*****************************************************************************
* vout_SysCreate: allocates dummy video thread output method * vout_DummyCreate: allocates dummy video thread output method
***************************************************************************** *****************************************************************************
* This function allocates and initializes a dummy vout method. * This function allocates and initializes a dummy vout method.
*****************************************************************************/ *****************************************************************************/
int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int vout_DummyCreate( vout_thread_t *p_vout, char *psz_display,
int i_root_window, void *p_data ) int i_root_window, void *p_data )
{ {
/* Allocate structure */ /* Allocate structure */
...@@ -93,50 +93,50 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, ...@@ -93,50 +93,50 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display,
} }
/***************************************************************************** /*****************************************************************************
* vout_SysInit: initialize dummy video thread output method * vout_DummyInit: initialize dummy video thread output method
*****************************************************************************/ *****************************************************************************/
int vout_SysInit( vout_thread_t *p_vout ) int vout_DummyInit( vout_thread_t *p_vout )
{ {
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* vout_SysEnd: terminate dummy video thread output method * vout_DummyEnd: terminate dummy video thread output method
*****************************************************************************/ *****************************************************************************/
void vout_SysEnd( vout_thread_t *p_vout ) void vout_DummyEnd( vout_thread_t *p_vout )
{ {
; ;
} }
/***************************************************************************** /*****************************************************************************
* vout_SysDestroy: destroy dummy video thread output method * vout_DummyDestroy: destroy dummy video thread output method
***************************************************************************** *****************************************************************************
* Terminate an output method created by DummyCreateOutputMethod * Terminate an output method created by DummyCreateOutputMethod
*****************************************************************************/ *****************************************************************************/
void vout_SysDestroy( vout_thread_t *p_vout ) void vout_DummyDestroy( vout_thread_t *p_vout )
{ {
DummyCloseDisplay( p_vout ); DummyCloseDisplay( p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
} }
/***************************************************************************** /*****************************************************************************
* vout_SysManage: handle dummy events * vout_DummyManage: handle dummy events
***************************************************************************** *****************************************************************************
* This function should be called regularly by video output thread. It manages * This function should be called regularly by video output thread. It manages
* console events. It returns a non null value on error. * console events. It returns a non null value on error.
*****************************************************************************/ *****************************************************************************/
int vout_SysManage( vout_thread_t *p_vout ) int vout_DummyManage( vout_thread_t *p_vout )
{ {
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* vout_SysDisplay: displays previously rendered output * vout_DummyDisplay: displays previously rendered output
***************************************************************************** *****************************************************************************
* This function send the currently rendered image to dummy image, waits until * This function send the currently rendered image to dummy image, waits until
* it is displayed and switch the two rendering buffers, preparing next frame. * it is displayed and switch the two rendering buffers, preparing next frame.
*****************************************************************************/ *****************************************************************************/
void vout_SysDisplay( vout_thread_t *p_vout ) void vout_DummyDisplay( vout_thread_t *p_vout )
{ {
; ;
} }
......
...@@ -64,15 +64,16 @@ typedef struct aout_sys_s ...@@ -64,15 +64,16 @@ typedef struct aout_sys_s
} aout_sys_t; } aout_sys_t;
/***************************************************************************** /*****************************************************************************
* aout_SysOpen: opens an esd socket * aout_EsdOpen: opens an esd socket
*****************************************************************************/ *****************************************************************************/
int aout_SysOpen( aout_thread_t *p_aout ) int aout_EsdOpen( aout_thread_t *p_aout )
{ {
/* mpg123 does it this way */ /* mpg123 does it this way */
int i_bits = ESD_BITS16; int i_bits = ESD_BITS16;
int i_mode = ESD_STREAM; int i_mode = ESD_STREAM;
int i_func = ESD_PLAY; int i_func = ESD_PLAY;
fprintf(stderr, "aout-esd !!\n");
/* Allocate structure */ /* Allocate structure */
p_aout->p_sys = malloc( sizeof( aout_sys_t ) ); p_aout->p_sys = malloc( sizeof( aout_sys_t ) );
if( p_aout->p_sys == NULL ) if( p_aout->p_sys == NULL )
...@@ -112,52 +113,52 @@ int aout_SysOpen( aout_thread_t *p_aout ) ...@@ -112,52 +113,52 @@ int aout_SysOpen( aout_thread_t *p_aout )
} }
/***************************************************************************** /*****************************************************************************
* aout_SysReset: resets the dsp * aout_EsdReset: resets the dsp
*****************************************************************************/ *****************************************************************************/
int aout_SysReset( aout_thread_t *p_aout ) int aout_EsdReset( aout_thread_t *p_aout )
{ {
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* aout_SysSetFormat: sets the dsp output format * aout_EsdSetFormat: sets the dsp output format
*****************************************************************************/ *****************************************************************************/
int aout_SysSetFormat( aout_thread_t *p_aout ) int aout_EsdSetFormat( aout_thread_t *p_aout )
{ {
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* aout_SysSetChannels: sets the dsp's stereo or mono mode * aout_EsdSetChannels: sets the dsp's stereo or mono mode
*****************************************************************************/ *****************************************************************************/
int aout_SysSetChannels( aout_thread_t *p_aout ) int aout_EsdSetChannels( aout_thread_t *p_aout )
{ {
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* aout_SysSetRate: sets the dsp's audio output rate * aout_EsdSetRate: sets the dsp's audio output rate
*****************************************************************************/ *****************************************************************************/
int aout_SysSetRate( aout_thread_t *p_aout ) int aout_EsdSetRate( aout_thread_t *p_aout )
{ {
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* aout_SysGetBufInfo: buffer status query * aout_EsdGetBufInfo: buffer status query
*****************************************************************************/ *****************************************************************************/
long aout_SysGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit ) long aout_EsdGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
{ {
/* arbitrary value that should be changed */ /* arbitrary value that should be changed */
return( l_buffer_limit ); return( l_buffer_limit );
} }
/***************************************************************************** /*****************************************************************************
* aout_SysPlaySamples: plays a sound samples buffer * aout_EsdPlaySamples: plays a sound samples buffer
***************************************************************************** *****************************************************************************
* This function writes a buffer of i_length bytes in the dsp * This function writes a buffer of i_length bytes in the dsp
*****************************************************************************/ *****************************************************************************/
void aout_SysPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size ) void aout_EsdPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size )
{ {
int amount; int amount;
...@@ -182,9 +183,9 @@ void aout_SysPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size ) ...@@ -182,9 +183,9 @@ void aout_SysPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size )
} }
/***************************************************************************** /*****************************************************************************
* aout_SysClose: closes the dsp audio device * aout_EsdClose: closes the dsp audio device
*****************************************************************************/ *****************************************************************************/
void aout_SysClose( aout_thread_t *p_aout ) void aout_EsdClose( aout_thread_t *p_aout )
{ {
close( p_aout->i_fd ); close( p_aout->i_fd );
} }
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "common.h" /* boolean_t, byte_t */ #include "common.h" /* boolean_t, byte_t */
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "tests.h"
#include "plugins.h" #include "plugins.h"
#include "interface.h" #include "interface.h"
...@@ -38,12 +39,21 @@ ...@@ -38,12 +39,21 @@
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "plugins_export.h"
/***************************************************************************** /*****************************************************************************
* Exported prototypes * Exported prototypes
*****************************************************************************/ *****************************************************************************/
void aout_GetPlugin( p_aout_thread_t p_aout ); static void aout_GetPlugin( p_aout_thread_t p_aout );
/* Audio output */
int aout_EsdOpen ( aout_thread_t *p_aout );
int aout_EsdReset ( aout_thread_t *p_aout );
int aout_EsdSetFormat ( aout_thread_t *p_aout );
int aout_EsdSetChannels ( aout_thread_t *p_aout );
int aout_EsdSetRate ( aout_thread_t *p_aout );
long aout_EsdGetBufInfo ( aout_thread_t *p_aout, long l_buffer_info );
void aout_EsdPlaySamples ( aout_thread_t *p_aout, byte_t *buffer,
int i_size );
void aout_EsdClose ( aout_thread_t *p_aout );
/***************************************************************************** /*****************************************************************************
* GetConfig: get the plugin structure and configuration * GetConfig: get the plugin structure and configuration
...@@ -61,31 +71,31 @@ plugin_info_t * GetConfig( void ) ...@@ -61,31 +71,31 @@ plugin_info_t * GetConfig( void )
p_info->intf_GetPlugin = NULL; p_info->intf_GetPlugin = NULL;
p_info->yuv_GetPlugin = NULL; p_info->yuv_GetPlugin = NULL;
return( p_info ); /* esound should always work, but score it lower than DSP */
} p_info->i_score = 0x100;
/***************************************************************************** /* If this plugin was requested, score it higher */
* Test: tests if the plugin can be launched if( TestMethod( AOUT_METHOD_VAR, "esd" ) )
*****************************************************************************/ {
int Test( void ) p_info->i_score += 0x200;
{ }
/* TODO: check if suitable */
return( 1 ); return( p_info );
} }
/***************************************************************************** /*****************************************************************************
* Following functions are only called through the p_info structure * Following functions are only called through the p_info structure
*****************************************************************************/ *****************************************************************************/
void aout_GetPlugin( p_aout_thread_t p_aout ) static void aout_GetPlugin( p_aout_thread_t p_aout )
{ {
p_aout->p_sys_open = aout_SysOpen; p_aout->p_sys_open = aout_EsdOpen;
p_aout->p_sys_reset = aout_SysReset; p_aout->p_sys_reset = aout_EsdReset;
p_aout->p_sys_setformat = aout_SysSetFormat; p_aout->p_sys_setformat = aout_EsdSetFormat;
p_aout->p_sys_setchannels = aout_SysSetChannels; p_aout->p_sys_setchannels = aout_EsdSetChannels;
p_aout->p_sys_setrate = aout_SysSetRate; p_aout->p_sys_setrate = aout_EsdSetRate;
p_aout->p_sys_getbufinfo = aout_SysGetBufInfo; p_aout->p_sys_getbufinfo = aout_EsdGetBufInfo;
p_aout->p_sys_playsamples = aout_SysPlaySamples; p_aout->p_sys_playsamples = aout_EsdPlaySamples;
p_aout->p_sys_close = aout_SysClose; p_aout->p_sys_close = aout_EsdClose;
} }
...@@ -25,12 +25,17 @@ ...@@ -25,12 +25,17 @@
*****************************************************************************/ *****************************************************************************/
#include "defs.h" #include "defs.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h> /* malloc(), free() */ #include <stdlib.h> /* malloc(), free() */
#include <unistd.h> /* close() */
#include "config.h" #include "config.h"
#include "common.h" /* boolean_t, byte_t */ #include "common.h" /* boolean_t, byte_t */
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "tests.h"
#include "plugins.h" #include "plugins.h"
#include "interface.h" #include "interface.h"
...@@ -38,19 +43,36 @@ ...@@ -38,19 +43,36 @@
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "plugins_export.h" #include "main.h"
/***************************************************************************** /*****************************************************************************
* Exported prototypes * Exported prototypes
*****************************************************************************/ *****************************************************************************/
void vout_GetPlugin( p_vout_thread_t p_vout ); static void vout_GetPlugin( p_vout_thread_t p_vout );
void intf_GetPlugin( p_intf_thread_t p_intf ); static void intf_GetPlugin( p_intf_thread_t p_intf );
/* Video output */
int vout_FBCreate ( vout_thread_t *p_vout, char *psz_display,
int i_root_window, void *p_data );
int vout_FBInit ( p_vout_thread_t p_vout );
void vout_FBEnd ( p_vout_thread_t p_vout );
void vout_FBDestroy ( p_vout_thread_t p_vout );
int vout_FBManage ( p_vout_thread_t p_vout );
void vout_FBDisplay ( p_vout_thread_t p_vout );
void vout_FBSetPalette ( p_vout_thread_t p_vout,
u16 *red, u16 *green, u16 *blue, u16 *transp );
/* Interface */
int intf_FBCreate ( p_intf_thread_t p_intf );
void intf_FBDestroy ( p_intf_thread_t p_intf );
void intf_FBManage ( p_intf_thread_t p_intf );
/***************************************************************************** /*****************************************************************************
* GetConfig: get the plugin structure and configuration * GetConfig: get the plugin structure and configuration
*****************************************************************************/ *****************************************************************************/
plugin_info_t * GetConfig( void ) plugin_info_t * GetConfig( void )
{ {
int i_fd;
plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) ); plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
p_info->psz_name = "Linux framebuffer"; p_info->psz_name = "Linux framebuffer";
...@@ -62,39 +84,54 @@ plugin_info_t * GetConfig( void ) ...@@ -62,39 +84,54 @@ plugin_info_t * GetConfig( void )
p_info->intf_GetPlugin = intf_GetPlugin; p_info->intf_GetPlugin = intf_GetPlugin;
p_info->yuv_GetPlugin = NULL; p_info->yuv_GetPlugin = NULL;
return( p_info ); /* Test if the device can be opened */
} if ( (i_fd = open( main_GetPszVariable( VOUT_FB_DEV_VAR,
VOUT_FB_DEV_DEFAULT ),
O_RDWR )) < 0 )
{
p_info->i_score = 0;
}
else
{
close( i_fd );
p_info->i_score = 0x100;
}
if( TestProgram( "fbvlc" ) )
{
p_info->i_score += 0x180;
}
/* If this plugin was requested, score it higher */
if( TestMethod( VOUT_METHOD_VAR, "fb" ) )
{
p_info->i_score += 0x200;
}
/***************************************************************************** return( p_info );
* Test: tests if the plugin can be launched
*****************************************************************************/
int Test( void )
{
/* TODO: detect the framebuffer ioctl()s in the kernel */
return( 1 );
} }
/***************************************************************************** /*****************************************************************************
* Following functions are only called through the p_info structure * Following functions are only called through the p_info structure
*****************************************************************************/ *****************************************************************************/
void vout_GetPlugin( p_vout_thread_t p_vout ) static void vout_GetPlugin( p_vout_thread_t p_vout )
{ {
p_vout->p_sys_create = vout_SysCreate; p_vout->p_sys_create = vout_FBCreate;
p_vout->p_sys_init = vout_SysInit; p_vout->p_sys_init = vout_FBInit;
p_vout->p_sys_end = vout_SysEnd; p_vout->p_sys_end = vout_FBEnd;
p_vout->p_sys_destroy = vout_SysDestroy; p_vout->p_sys_destroy = vout_FBDestroy;
p_vout->p_sys_manage = vout_SysManage; p_vout->p_sys_manage = vout_FBManage;
p_vout->p_sys_display = vout_SysDisplay; p_vout->p_sys_display = vout_FBDisplay;
/* optional functions */ /* optional functions */
p_vout->p_set_palette = vout_SetPalette; p_vout->p_set_palette = vout_FBSetPalette;
} }
void intf_GetPlugin( p_intf_thread_t p_intf ) static void intf_GetPlugin( p_intf_thread_t p_intf )
{ {
p_intf->p_sys_create = intf_SysCreate; p_intf->p_sys_create = intf_FBCreate;
p_intf->p_sys_destroy = intf_SysDestroy; p_intf->p_sys_destroy = intf_FBDestroy;
p_intf->p_sys_manage = intf_SysManage; p_intf->p_sys_manage = intf_FBManage;
} }
...@@ -82,9 +82,9 @@ static void FBTextMode ( int i_tty_dev ); ...@@ -82,9 +82,9 @@ static void FBTextMode ( int i_tty_dev );
static void FBGfxMode ( int i_tty_dev ); static void FBGfxMode ( int i_tty_dev );
/***************************************************************************** /*****************************************************************************
* intf_SysCreate: initialize and create window * intf_FBCreate: initialize and create window
*****************************************************************************/ *****************************************************************************/
int intf_SysCreate( intf_thread_t *p_intf ) int intf_FBCreate( intf_thread_t *p_intf )
{ {
struct sigaction sig_tty; /* sigaction for tty change */ struct sigaction sig_tty; /* sigaction for tty change */
struct vt_mode vt_mode; /* vt current mode */ struct vt_mode vt_mode; /* vt current mode */
...@@ -194,9 +194,9 @@ int intf_SysCreate( intf_thread_t *p_intf ) ...@@ -194,9 +194,9 @@ int intf_SysCreate( intf_thread_t *p_intf )
} }
/***************************************************************************** /*****************************************************************************
* intf_SysDestroy: destroy interface window * intf_FBDestroy: destroy interface window
*****************************************************************************/ *****************************************************************************/
void intf_SysDestroy( intf_thread_t *p_intf ) void intf_FBDestroy( intf_thread_t *p_intf )
{ {
/* resets the keyboard state */ /* resets the keyboard state */
tcsetattr(0, 0, &p_intf->p_sys->old_termios); tcsetattr(0, 0, &p_intf->p_sys->old_termios);
...@@ -222,9 +222,9 @@ void intf_SysDestroy( intf_thread_t *p_intf ) ...@@ -222,9 +222,9 @@ void intf_SysDestroy( intf_thread_t *p_intf )
/***************************************************************************** /*****************************************************************************
* intf_SysManage: event loop * intf_FBManage: event loop
*****************************************************************************/ *****************************************************************************/
void intf_SysManage( intf_thread_t *p_intf ) void intf_FBManage( intf_thread_t *p_intf )
{ {
unsigned char buf[16]; unsigned char buf[16];
......
...@@ -75,11 +75,11 @@ static int FBOpenDisplay ( vout_thread_t *p_vout ); ...@@ -75,11 +75,11 @@ static int FBOpenDisplay ( vout_thread_t *p_vout );
static void FBCloseDisplay ( vout_thread_t *p_vout ); static void FBCloseDisplay ( vout_thread_t *p_vout );
/***************************************************************************** /*****************************************************************************
* vout_SysCreate: allocates FB video thread output method * vout_FBCreate: allocates FB video thread output method
***************************************************************************** *****************************************************************************
* This function allocates and initializes a FB vout method. * This function allocates and initializes a FB vout method.
*****************************************************************************/ *****************************************************************************/
int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int vout_FBCreate( vout_thread_t *p_vout, char *psz_display,
int i_root_window, void *p_data ) int i_root_window, void *p_data )
{ {
/* Allocate structure */ /* Allocate structure */
...@@ -102,39 +102,39 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, ...@@ -102,39 +102,39 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display,
} }
/***************************************************************************** /*****************************************************************************
* vout_SysInit: initialize framebuffer video thread output method * vout_FBInit: initialize framebuffer video thread output method
*****************************************************************************/ *****************************************************************************/
int vout_SysInit( vout_thread_t *p_vout ) int vout_FBInit( vout_thread_t *p_vout )
{ {
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* vout_SysEnd: terminate FB video thread output method * vout_FBEnd: terminate FB video thread output method
*****************************************************************************/ *****************************************************************************/
void vout_SysEnd( vout_thread_t *p_vout ) void vout_FBEnd( vout_thread_t *p_vout )
{ {
; ;
} }
/***************************************************************************** /*****************************************************************************
* vout_SysDestroy: destroy FB video thread output method * vout_FBDestroy: destroy FB video thread output method
***************************************************************************** *****************************************************************************
* Terminate an output method created by vout_CreateOutputMethod * Terminate an output method created by vout_CreateOutputMethod
*****************************************************************************/ *****************************************************************************/
void vout_SysDestroy( vout_thread_t *p_vout ) void vout_FBDestroy( vout_thread_t *p_vout )
{ {
FBCloseDisplay( p_vout ); FBCloseDisplay( p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
} }
/***************************************************************************** /*****************************************************************************
* vout_SysManage: handle FB events * vout_FBManage: handle FB events
***************************************************************************** *****************************************************************************
* This function should be called regularly by video output thread. It manages * This function should be called regularly by video output thread. It manages
* console events. It returns a non null value on error. * console events. It returns a non null value on error.
*****************************************************************************/ *****************************************************************************/
int vout_SysManage( vout_thread_t *p_vout ) int vout_FBManage( vout_thread_t *p_vout )
{ {
/* /*
* Size change * Size change
...@@ -145,10 +145,10 @@ int vout_SysManage( vout_thread_t *p_vout ) ...@@ -145,10 +145,10 @@ int vout_SysManage( vout_thread_t *p_vout )
p_vout->i_changes &= ~VOUT_SIZE_CHANGE; p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
/* Destroy XImages to change their size */ /* Destroy XImages to change their size */
vout_SysEnd( p_vout ); vout_FBEnd( p_vout );
/* Recreate XImages. If SysInit failed, the thread can't go on. */ /* Recreate XImages. If SysInit failed, the thread can't go on. */
if( vout_SysInit( p_vout ) ) if( vout_FBInit( p_vout ) )
{ {
intf_ErrMsg("error: can't resize display\n"); intf_ErrMsg("error: can't resize display\n");
return( 1 ); return( 1 );
...@@ -166,12 +166,12 @@ int vout_SysManage( vout_thread_t *p_vout ) ...@@ -166,12 +166,12 @@ int vout_SysManage( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* vout_SysDisplay: displays previously rendered output * vout_FBDisplay: displays previously rendered output
***************************************************************************** *****************************************************************************
* This function send the currently rendered image to FB image, waits until * This function send the currently rendered image to FB image, waits until
* it is displayed and switch the two rendering buffers, preparing next frame. * it is displayed and switch the two rendering buffers, preparing next frame.
*****************************************************************************/ *****************************************************************************/
void vout_SysDisplay( vout_thread_t *p_vout ) void vout_FBDisplay( vout_thread_t *p_vout )
{ {
/* swap the two Y offsets */ /* swap the two Y offsets */
p_vout->p_sys->var_info.yoffset = p_vout->i_buffer_index ? p_vout->p_sys->var_info.yres : 0; p_vout->p_sys->var_info.yoffset = p_vout->i_buffer_index ? p_vout->p_sys->var_info.yres : 0;
...@@ -184,13 +184,13 @@ void vout_SysDisplay( vout_thread_t *p_vout ) ...@@ -184,13 +184,13 @@ void vout_SysDisplay( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* vout_SetPalette: sets an 8 bpp palette * vout_FBSetPalette: sets an 8 bpp palette
***************************************************************************** *****************************************************************************
* This function sets the palette given as an argument. It does not return * This function sets the palette given as an argument. It does not return
* anything, but could later send information on which colors it was unable * anything, but could later send information on which colors it was unable
* to set. * to set.
*****************************************************************************/ *****************************************************************************/
void vout_SetPalette( p_vout_thread_t p_vout, void vout_FBSetPalette( p_vout_thread_t p_vout,
u16 *red, u16 *green, u16 *blue, u16 *transp ) u16 *red, u16 *green, u16 *blue, u16 *transp )
{ {
struct fb_cmap cmap = { 0, 256, red, green, blue, transp }; struct fb_cmap cmap = { 0, 256, red, green, blue, transp };
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "common.h" /* boolean_t, byte_t */ #include "common.h" /* boolean_t, byte_t */
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "tests.h"
#include "plugins.h" #include "plugins.h"
#include "interface.h" #include "interface.h"
...@@ -38,13 +39,27 @@ ...@@ -38,13 +39,27 @@
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "plugins_export.h"
/***************************************************************************** /*****************************************************************************
* Exported prototypes * Exported prototypes
*****************************************************************************/ *****************************************************************************/
void vout_GetPlugin( p_vout_thread_t p_vout ); static void vout_GetPlugin( p_vout_thread_t p_vout );
void intf_GetPlugin( p_intf_thread_t p_intf ); static void intf_GetPlugin( p_intf_thread_t p_intf );
/* Video output */
int vout_GGICreate ( vout_thread_t *p_vout, char *psz_display,
int i_root_window, void *p_data );
int vout_GGIInit ( p_vout_thread_t p_vout );
void vout_GGIEnd ( p_vout_thread_t p_vout );
void vout_GGIDestroy ( p_vout_thread_t p_vout );
int vout_GGIManage ( p_vout_thread_t p_vout );
void vout_GGIDisplay ( p_vout_thread_t p_vout );
void vout_GGISetPalette ( p_vout_thread_t p_vout,
u16 *red, u16 *green, u16 *blue, u16 *transp );
/* Interface */
int intf_GGICreate ( p_intf_thread_t p_intf );
void intf_GGIDestroy ( p_intf_thread_t p_intf );
void intf_GGIManage ( p_intf_thread_t p_intf );
/***************************************************************************** /*****************************************************************************
* GetConfig: get the plugin structure and configuration * GetConfig: get the plugin structure and configuration
...@@ -62,36 +77,42 @@ plugin_info_t * GetConfig( void ) ...@@ -62,36 +77,42 @@ plugin_info_t * GetConfig( void )
p_info->intf_GetPlugin = intf_GetPlugin; p_info->intf_GetPlugin = intf_GetPlugin;
p_info->yuv_GetPlugin = NULL; p_info->yuv_GetPlugin = NULL;
return( p_info ); /* if the GGI libraries are there, assume we can enter the
} * initialization part at least, even if we fail afterwards */
p_info->i_score = 0x100;
/***************************************************************************** if( TestProgram( "ggivlc" ) )
* Test: tests if the plugin can be launched {
*****************************************************************************/ p_info->i_score += 0x180;
int Test( void ) }
{
/* TODO: detect GGI_DISPLAY or whatever */ /* If this plugin was requested, score it higher */
return( 1 ); if( TestMethod( VOUT_METHOD_VAR, "ggi" ) )
{
p_info->i_score += 0x200;
}
return( p_info );
} }
/***************************************************************************** /*****************************************************************************
* Following functions are only called through the p_info structure * Following functions are only called through the p_info structure
*****************************************************************************/ *****************************************************************************/
void vout_GetPlugin( p_vout_thread_t p_vout ) static void vout_GetPlugin( p_vout_thread_t p_vout )
{ {
p_vout->p_sys_create = vout_SysCreate; p_vout->p_sys_create = vout_GGICreate;
p_vout->p_sys_init = vout_SysInit; p_vout->p_sys_init = vout_GGIInit;
p_vout->p_sys_end = vout_SysEnd; p_vout->p_sys_end = vout_GGIEnd;
p_vout->p_sys_destroy = vout_SysDestroy; p_vout->p_sys_destroy = vout_GGIDestroy;
p_vout->p_sys_manage = vout_SysManage; p_vout->p_sys_manage = vout_GGIManage;
p_vout->p_sys_display = vout_SysDisplay; p_vout->p_sys_display = vout_GGIDisplay;
} }
void intf_GetPlugin( p_intf_thread_t p_intf ) static void intf_GetPlugin( p_intf_thread_t p_intf )
{ {
p_intf->p_sys_create = intf_SysCreate; p_intf->p_sys_create = intf_GGICreate;
p_intf->p_sys_destroy = intf_SysDestroy; p_intf->p_sys_destroy = intf_GGIDestroy;
p_intf->p_sys_manage = intf_SysManage; p_intf->p_sys_manage = intf_GGIManage;
} }
...@@ -71,9 +71,9 @@ typedef struct intf_sys_s ...@@ -71,9 +71,9 @@ typedef struct intf_sys_s
ggi_visual_t vout_SysGetVisual( vout_thread_t *p_vout ); ggi_visual_t vout_SysGetVisual( vout_thread_t *p_vout );
/***************************************************************************** /*****************************************************************************
* intf_SysCreate: initialize and create GII interface * intf_GGICreate: initialize and create GII interface
*****************************************************************************/ *****************************************************************************/
int intf_SysCreate( intf_thread_t *p_intf ) int intf_GGICreate( intf_thread_t *p_intf )
{ {
/* Check that b_video is set */ /* Check that b_video is set */
if( !p_main->b_video ) if( !p_main->b_video )
...@@ -111,9 +111,9 @@ int intf_SysCreate( intf_thread_t *p_intf ) ...@@ -111,9 +111,9 @@ int intf_SysCreate( intf_thread_t *p_intf )
} }
/***************************************************************************** /*****************************************************************************
* intf_SysDestroy: destroy interface * intf_GGIDestroy: destroy interface
*****************************************************************************/ *****************************************************************************/
void intf_SysDestroy( intf_thread_t *p_intf ) void intf_GGIDestroy( intf_thread_t *p_intf )
{ {
/* Close input thread, if any (blocking) */ /* Close input thread, if any (blocking) */
if( p_intf->p_input ) if( p_intf->p_input )
...@@ -133,9 +133,9 @@ void intf_SysDestroy( intf_thread_t *p_intf ) ...@@ -133,9 +133,9 @@ void intf_SysDestroy( intf_thread_t *p_intf )
/***************************************************************************** /*****************************************************************************
* intf_SysManage: event loop * intf_GGIManage: event loop
*****************************************************************************/ *****************************************************************************/
void intf_SysManage( intf_thread_t *p_intf ) void intf_GGIManage( intf_thread_t *p_intf )
{ {
int i_key; /* unicode key */ int i_key; /* unicode key */
......
...@@ -65,13 +65,13 @@ static int GGIOpenDisplay ( vout_thread_t *p_vout, char *psz_display, void ...@@ -65,13 +65,13 @@ static int GGIOpenDisplay ( vout_thread_t *p_vout, char *psz_display, void
static void GGICloseDisplay ( vout_thread_t *p_vout ); static void GGICloseDisplay ( vout_thread_t *p_vout );
/***************************************************************************** /*****************************************************************************
* vout_SysCreate: allocate GGI video thread output method * vout_GGICreate: allocate GGI video thread output method
***************************************************************************** *****************************************************************************
* This function allocate and initialize a GGI vout method. It uses some of the * This function allocate and initialize a GGI vout method. It uses some of the
* vout properties to choose the correct mode, and change them according to the * vout properties to choose the correct mode, and change them according to the
* mode actually used. * mode actually used.
*****************************************************************************/ *****************************************************************************/
int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window, void *p_data ) int vout_GGICreate( vout_thread_t *p_vout, char *psz_display, int i_root_window, void *p_data )
{ {
/* Allocate structure */ /* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
...@@ -92,11 +92,11 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window, ...@@ -92,11 +92,11 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window,
} }
/***************************************************************************** /*****************************************************************************
* vout_SysInit: initialize GGI video thread output method * vout_GGIInit: initialize GGI video thread output method
***************************************************************************** *****************************************************************************
* This function initialize the GGI display device. * This function initialize the GGI display device.
*****************************************************************************/ *****************************************************************************/
int vout_SysInit( vout_thread_t *p_vout ) int vout_GGIInit( vout_thread_t *p_vout )
{ {
/* Acquire first buffer */ /* Acquire first buffer */
if( p_vout->p_sys->b_must_acquire ) if( p_vout->p_sys->b_must_acquire )
...@@ -108,11 +108,11 @@ int vout_SysInit( vout_thread_t *p_vout ) ...@@ -108,11 +108,11 @@ int vout_SysInit( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* vout_SysEnd: terminate Sys video thread output method * vout_GGIEnd: terminate Sys video thread output method
***************************************************************************** *****************************************************************************
* Terminate an output method created by vout_SysCreate * Terminate an output method created by vout_GGICreate
*****************************************************************************/ *****************************************************************************/
void vout_SysEnd( vout_thread_t *p_vout ) void vout_GGIEnd( 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 )
...@@ -122,35 +122,35 @@ void vout_SysEnd( vout_thread_t *p_vout ) ...@@ -122,35 +122,35 @@ void vout_SysEnd( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* vout_SysDestroy: destroy Sys video thread output method * vout_GGIDestroy: destroy Sys video thread output method
***************************************************************************** *****************************************************************************
* Terminate an output method created by vout_SysCreate * Terminate an output method created by vout_GGICreate
*****************************************************************************/ *****************************************************************************/
void vout_SysDestroy( vout_thread_t *p_vout ) void vout_GGIDestroy( vout_thread_t *p_vout )
{ {
GGICloseDisplay( p_vout ); GGICloseDisplay( p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
} }
/***************************************************************************** /*****************************************************************************
* vout_SysManage: handle Sys events * vout_GGIManage: handle Sys events
***************************************************************************** *****************************************************************************
* This function should be called regularly by video output thread. It returns * This function should be called regularly by video output thread. It returns
* a non null value if an error occured. * a non null value if an error occured.
*****************************************************************************/ *****************************************************************************/
int vout_SysManage( vout_thread_t *p_vout ) int vout_GGIManage( vout_thread_t *p_vout )
{ {
/* FIXME: 8bpp: change palette ?? */ /* FIXME: 8bpp: change palette ?? */
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* vout_SysDisplay: displays previously rendered output * vout_GGIDisplay: displays previously rendered output
***************************************************************************** *****************************************************************************
* This function send the currently rendered image to the display, wait until * This function send the currently rendered image to the display, wait until
* it is displayed and switch the two rendering buffer, preparing next frame. * it is displayed and switch the two rendering buffer, preparing next frame.
*****************************************************************************/ *****************************************************************************/
void vout_SysDisplay( vout_thread_t *p_vout ) void vout_GGIDisplay( 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 )
......
...@@ -27,10 +27,16 @@ ...@@ -27,10 +27,16 @@
#include <stdlib.h> /* malloc(), free() */ #include <stdlib.h> /* malloc(), free() */
#ifndef __linux__
#include <conio.h> /* for glide ? */
#endif
#include <glide.h>
#include "config.h" #include "config.h"
#include "common.h" /* boolean_t, byte_t */ #include "common.h" /* boolean_t, byte_t */
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "tests.h"
#include "plugins.h" #include "plugins.h"
#include "interface.h" #include "interface.h"
...@@ -38,13 +44,27 @@ ...@@ -38,13 +44,27 @@
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "plugins_export.h"
/***************************************************************************** /*****************************************************************************
* Exported prototypes * Exported prototypes
*****************************************************************************/ *****************************************************************************/
void vout_GetPlugin( p_vout_thread_t p_vout ); static void vout_GetPlugin( p_vout_thread_t p_vout );
void intf_GetPlugin( p_intf_thread_t p_intf ); static void intf_GetPlugin( p_intf_thread_t p_intf );
/* Video output */
int vout_GlideCreate ( vout_thread_t *p_vout, char *psz_display,
int i_root_window, void *p_data );
int vout_GlideInit ( p_vout_thread_t p_vout );
void vout_GlideEnd ( p_vout_thread_t p_vout );
void vout_GlideDestroy ( p_vout_thread_t p_vout );
int vout_GlideManage ( p_vout_thread_t p_vout );
void vout_GlideDisplay ( p_vout_thread_t p_vout );
void vout_GlideSetPalette ( p_vout_thread_t p_vout,
u16 *red, u16 *green, u16 *blue, u16 *transp );
/* Interface */
int intf_GlideCreate ( p_intf_thread_t p_intf );
void intf_GlideDestroy ( p_intf_thread_t p_intf );
void intf_GlideManage ( p_intf_thread_t p_intf );
/***************************************************************************** /*****************************************************************************
* GetConfig: get the plugin structure and configuration * GetConfig: get the plugin structure and configuration
...@@ -62,36 +82,44 @@ plugin_info_t * GetConfig( void ) ...@@ -62,36 +82,44 @@ plugin_info_t * GetConfig( void )
p_info->intf_GetPlugin = intf_GetPlugin; p_info->intf_GetPlugin = intf_GetPlugin;
p_info->yuv_GetPlugin = NULL; p_info->yuv_GetPlugin = NULL;
return( p_info ); /* We could do a grSstQueryBoards( GrHwConfiguration *hwConfig ) at
} * this point, but if the user didn't configure his 3dfx card, we
* have great chances to segfault here. So we'd better assume
* everything is fine and worry only if we really need to use Glide */
p_info->i_score = 0x100;
/***************************************************************************** if( TestProgram( "glidevlc" ) )
* Test: tests if the plugin can be launched {
*****************************************************************************/ p_info->i_score += 0x180;
int Test( void ) }
{
/* TODO: detect a 3dfx card */ /* If this plugin was requested, score it higher */
return( 1 ); if( TestMethod( VOUT_METHOD_VAR, "glide" ) )
{
p_info->i_score += 0x200;
}
return( p_info );
} }
/***************************************************************************** /*****************************************************************************
* Following functions are only called through the p_info structure * Following functions are only called through the p_info structure
*****************************************************************************/ *****************************************************************************/
void vout_GetPlugin( p_vout_thread_t p_vout ) static void vout_GetPlugin( p_vout_thread_t p_vout )
{ {
p_vout->p_sys_create = vout_SysCreate; p_vout->p_sys_create = vout_GlideCreate;
p_vout->p_sys_init = vout_SysInit; p_vout->p_sys_init = vout_GlideInit;
p_vout->p_sys_end = vout_SysEnd; p_vout->p_sys_end = vout_GlideEnd;
p_vout->p_sys_destroy = vout_SysDestroy; p_vout->p_sys_destroy = vout_GlideDestroy;
p_vout->p_sys_manage = vout_SysManage; p_vout->p_sys_manage = vout_GlideManage;
p_vout->p_sys_display = vout_SysDisplay; p_vout->p_sys_display = vout_GlideDisplay;
} }
void intf_GetPlugin( p_intf_thread_t p_intf ) static void intf_GetPlugin( p_intf_thread_t p_intf )
{ {
p_intf->p_sys_create = intf_SysCreate; p_intf->p_sys_create = intf_GlideCreate;
p_intf->p_sys_destroy = intf_SysDestroy; p_intf->p_sys_destroy = intf_GlideDestroy;
p_intf->p_sys_manage = intf_SysManage; p_intf->p_sys_manage = intf_GlideManage;
} }
...@@ -54,9 +54,9 @@ typedef struct intf_sys_s ...@@ -54,9 +54,9 @@ typedef struct intf_sys_s
} intf_sys_t; } intf_sys_t;
/***************************************************************************** /*****************************************************************************
* intf_SysCreate: initialize 3dfx interface * intf_GlideCreate: initialize 3dfx interface
*****************************************************************************/ *****************************************************************************/
int intf_SysCreate( intf_thread_t *p_intf ) int intf_GlideCreate( intf_thread_t *p_intf )
{ {
/* Allocate instance and initialize some members */ /* Allocate instance and initialize some members */
p_intf->p_sys = malloc( sizeof( intf_sys_t ) ); p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
...@@ -79,9 +79,9 @@ int intf_SysCreate( intf_thread_t *p_intf ) ...@@ -79,9 +79,9 @@ int intf_SysCreate( intf_thread_t *p_intf )
} }
/***************************************************************************** /*****************************************************************************
* intf_SysDestroy: destroy 3dfx interface * intf_GlideDestroy: destroy 3dfx interface
*****************************************************************************/ *****************************************************************************/
void intf_SysDestroy( intf_thread_t *p_intf ) void intf_GlideDestroy( intf_thread_t *p_intf )
{ {
/* Close input thread, if any (blocking) */ /* Close input thread, if any (blocking) */
if( p_intf->p_input ) if( p_intf->p_input )
...@@ -101,9 +101,9 @@ void intf_SysDestroy( intf_thread_t *p_intf ) ...@@ -101,9 +101,9 @@ void intf_SysDestroy( intf_thread_t *p_intf )
/***************************************************************************** /*****************************************************************************
* intf_SysManage: event loop * intf_GlideManage: event loop
*****************************************************************************/ *****************************************************************************/
void intf_SysManage( intf_thread_t *p_intf ) void intf_GlideManage( intf_thread_t *p_intf )
{ {
unsigned int buf; unsigned int buf;
......
...@@ -74,11 +74,11 @@ static int GlideOpenDisplay ( vout_thread_t *p_vout ); ...@@ -74,11 +74,11 @@ static int GlideOpenDisplay ( vout_thread_t *p_vout );
static void GlideCloseDisplay ( vout_thread_t *p_vout ); static void GlideCloseDisplay ( vout_thread_t *p_vout );
/***************************************************************************** /*****************************************************************************
* vout_SysCreate: allocates Glide video thread output method * vout_GlideCreate: allocates Glide video thread output method
***************************************************************************** *****************************************************************************
* This function allocates and initializes a Glide vout method. * This function allocates and initializes a Glide vout method.
*****************************************************************************/ *****************************************************************************/
int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int vout_GlideCreate( vout_thread_t *p_vout, char *psz_display,
int i_root_window, void *p_data ) int i_root_window, void *p_data )
{ {
/* Allocate structure */ /* Allocate structure */
...@@ -101,50 +101,50 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, ...@@ -101,50 +101,50 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display,
} }
/***************************************************************************** /*****************************************************************************
* vout_SysInit: initialize Glide video thread output method * vout_GlideInit: initialize Glide video thread output method
*****************************************************************************/ *****************************************************************************/
int vout_SysInit( vout_thread_t *p_vout ) int vout_GlideInit( vout_thread_t *p_vout )
{ {
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* vout_SysEnd: terminate Glide video thread output method * vout_GlideEnd: terminate Glide video thread output method
*****************************************************************************/ *****************************************************************************/
void vout_SysEnd( vout_thread_t *p_vout ) void vout_GlideEnd( vout_thread_t *p_vout )
{ {
; ;
} }
/***************************************************************************** /*****************************************************************************
* vout_SysDestroy: destroy Glide video thread output method * vout_GlideDestroy: destroy Glide video thread output method
***************************************************************************** *****************************************************************************
* Terminate an output method created by vout_CreateOutputMethod * Terminate an output method created by vout_CreateOutputMethod
*****************************************************************************/ *****************************************************************************/
void vout_SysDestroy( vout_thread_t *p_vout ) void vout_GlideDestroy( vout_thread_t *p_vout )
{ {
GlideCloseDisplay( p_vout ); GlideCloseDisplay( p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
} }
/***************************************************************************** /*****************************************************************************
* vout_SysManage: handle Glide events * vout_GlideManage: handle Glide events
***************************************************************************** *****************************************************************************
* This function should be called regularly by video output thread. It manages * This function should be called regularly by video output thread. It manages
* console events. It returns a non null value on error. * console events. It returns a non null value on error.
*****************************************************************************/ *****************************************************************************/
int vout_SysManage( vout_thread_t *p_vout ) int vout_GlideManage( vout_thread_t *p_vout )
{ {
return 0; return 0;
} }
/***************************************************************************** /*****************************************************************************
* vout_SysDisplay: displays previously rendered output * vout_GlideDisplay: displays previously rendered output
***************************************************************************** *****************************************************************************
* This function send the currently rendered image to Glide image, waits until * This function send the currently rendered image to Glide image, waits until
* it is displayed and switch the two rendering buffers, preparing next frame. * it is displayed and switch the two rendering buffers, preparing next frame.
*****************************************************************************/ *****************************************************************************/
void vout_SysDisplay( vout_thread_t *p_vout ) void vout_GlideDisplay( vout_thread_t *p_vout )
{ {
grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER ); grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER );
...@@ -188,7 +188,8 @@ static int GlideOpenDisplay( vout_thread_t *p_vout ) ...@@ -188,7 +188,8 @@ static int GlideOpenDisplay( vout_thread_t *p_vout )
p_vout->p_sys->p_video = malloc( p_vout->p_sys->i_page_size * 2 ); p_vout->p_sys->p_video = malloc( p_vout->p_sys->i_page_size * 2 );
if( (int)p_vout->p_sys->p_video == -1 ) if( (int)p_vout->p_sys->p_video == -1 )
{ {
intf_ErrMsg( "vout error: can't map video memory (%s)\n", strerror(errno) ); intf_ErrMsg( "vout error: can't map video memory (%s)\n",
strerror(errno) );
return( 1 ); return( 1 );
} }
......
...@@ -27,10 +27,13 @@ ...@@ -27,10 +27,13 @@
#include <stdlib.h> /* malloc(), free() */ #include <stdlib.h> /* malloc(), free() */
#include <X11/Xlib.h>
#include "config.h" #include "config.h"
#include "common.h" /* boolean_t, byte_t */ #include "common.h" /* boolean_t, byte_t */
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "tests.h"
#include "plugins.h" #include "plugins.h"
#include "interface.h" #include "interface.h"
...@@ -38,19 +41,36 @@ ...@@ -38,19 +41,36 @@
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "plugins_export.h" #include "main.h"
/***************************************************************************** /*****************************************************************************
* Exported prototypes * Exported prototypes
*****************************************************************************/ *****************************************************************************/
void vout_GetPlugin( p_vout_thread_t p_vout ); static void vout_GetPlugin( p_vout_thread_t p_vout );
void intf_GetPlugin( p_intf_thread_t p_intf ); static void intf_GetPlugin( p_intf_thread_t p_intf );
/* Video output */
int vout_GnomeCreate ( vout_thread_t *p_vout, char *psz_display,
int i_root_window, void *p_data );
int vout_GnomeInit ( p_vout_thread_t p_vout );
void vout_GnomeEnd ( p_vout_thread_t p_vout );
void vout_GnomeDestroy ( p_vout_thread_t p_vout );
int vout_GnomeManage ( p_vout_thread_t p_vout );
void vout_GnomeDisplay ( p_vout_thread_t p_vout );
void vout_GnomeSetPalette ( p_vout_thread_t p_vout, u16 *red,
u16 *green, u16 *blue, u16 *transp );
/* Interface */
int intf_GnomeCreate ( p_intf_thread_t p_intf );
void intf_GnomeDestroy ( p_intf_thread_t p_intf );
void intf_GnomeManage ( p_intf_thread_t p_intf );
/***************************************************************************** /*****************************************************************************
* GetConfig: get the plugin structure and configuration * GetConfig: get the plugin structure and configuration
*****************************************************************************/ *****************************************************************************/
plugin_info_t * GetConfig( void ) plugin_info_t * GetConfig( void )
{ {
Display *p_display;
plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) ); plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
p_info->psz_name = "Gnome"; p_info->psz_name = "Gnome";
...@@ -62,39 +82,54 @@ plugin_info_t * GetConfig( void ) ...@@ -62,39 +82,54 @@ plugin_info_t * GetConfig( void )
p_info->intf_GetPlugin = intf_GetPlugin; p_info->intf_GetPlugin = intf_GetPlugin;
p_info->yuv_GetPlugin = NULL; p_info->yuv_GetPlugin = NULL;
return( p_info ); /* Check that we can open the X display */
} if( (p_display = XOpenDisplay( XDisplayName(
main_GetPszVariable( VOUT_DISPLAY_VAR, NULL ) ) ))
== NULL )
{
p_info->i_score = 0;
}
else
{
XCloseDisplay( p_display );
p_info->i_score = 0x200;
}
if( TestProgram( "gvlc" ) )
{
p_info->i_score += 0x180;
}
/* If this plugin was requested, score it higher */
if( TestMethod( VOUT_METHOD_VAR, "gnome" ) )
{
p_info->i_score += 0x200;
}
/***************************************************************************** return( p_info );
* Test: tests if the plugin can be launched
*****************************************************************************/
int Test( void )
{
/* TODO: detect an X display or Gnome libs */
return( 1 );
} }
/***************************************************************************** /*****************************************************************************
* Following functions are only called through the p_info structure * Following functions are only called through the p_info structure
*****************************************************************************/ *****************************************************************************/
void vout_GetPlugin( p_vout_thread_t p_vout ) static void vout_GetPlugin( p_vout_thread_t p_vout )
{ {
p_vout->p_sys_create = vout_SysCreate; p_vout->p_sys_create = vout_GnomeCreate;
p_vout->p_sys_init = vout_SysInit; p_vout->p_sys_init = vout_GnomeInit;
p_vout->p_sys_end = vout_SysEnd; p_vout->p_sys_end = vout_GnomeEnd;
p_vout->p_sys_destroy = vout_SysDestroy; p_vout->p_sys_destroy = vout_GnomeDestroy;
p_vout->p_sys_manage = vout_SysManage; p_vout->p_sys_manage = vout_GnomeManage;
p_vout->p_sys_display = vout_SysDisplay; p_vout->p_sys_display = vout_GnomeDisplay;
/* optional functions */ /* optional functions */
p_vout->p_set_palette = vout_SetPalette; p_vout->p_set_palette = vout_GnomeSetPalette;
} }
void intf_GetPlugin( p_intf_thread_t p_intf ) static void intf_GetPlugin( p_intf_thread_t p_intf )
{ {
p_intf->p_sys_create = intf_SysCreate; p_intf->p_sys_create = intf_GnomeCreate;
p_intf->p_sys_destroy = intf_SysDestroy; p_intf->p_sys_destroy = intf_GnomeDestroy;
p_intf->p_sys_manage = intf_SysManage; p_intf->p_sys_manage = intf_GnomeManage;
} }
...@@ -62,9 +62,9 @@ ...@@ -62,9 +62,9 @@
#include "intf_gnome_support.h" #include "intf_gnome_support.h"
/***************************************************************************** /*****************************************************************************
* intf_SysCreate: initialize and create window * intf_GnomeCreate: initialize and create window
*****************************************************************************/ *****************************************************************************/
int intf_SysCreate( intf_thread_t *p_intf ) int intf_GnomeCreate( intf_thread_t *p_intf )
{ {
char *psz_display; char *psz_display;
...@@ -143,9 +143,9 @@ int intf_SysCreate( intf_thread_t *p_intf ) ...@@ -143,9 +143,9 @@ int intf_SysCreate( intf_thread_t *p_intf )
} }
/***************************************************************************** /*****************************************************************************
* intf_SysDestroy: destroy interface window * intf_GnomeDestroy: destroy interface window
*****************************************************************************/ *****************************************************************************/
void intf_SysDestroy( intf_thread_t *p_intf ) void intf_GnomeDestroy( intf_thread_t *p_intf )
{ {
/* Enable screen saver */ /* Enable screen saver */
GnomeEnableScreenSaver( p_intf ); GnomeEnableScreenSaver( p_intf );
...@@ -181,9 +181,9 @@ void intf_SysDestroy( intf_thread_t *p_intf ) ...@@ -181,9 +181,9 @@ void intf_SysDestroy( intf_thread_t *p_intf )
} }
/***************************************************************************** /*****************************************************************************
* intf_SysManage: event loop * intf_GnomeManage: event loop
*****************************************************************************/ *****************************************************************************/
void intf_SysManage( intf_thread_t *p_intf ) void intf_GnomeManage( intf_thread_t *p_intf )
{ {
/* Manage main window */ /* Manage main window */
GnomeManageWindow( p_intf ); GnomeManageWindow( p_intf );
......
...@@ -79,7 +79,8 @@ typedef struct vout_sys_s ...@@ -79,7 +79,8 @@ typedef struct vout_sys_s
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
static int X11OpenDisplay ( vout_thread_t *p_vout, char *psz_display, Window root_window, void *p_data ); static int X11OpenDisplay ( vout_thread_t *p_vout, char *psz_display,
Window root_window, void *p_data );
static void X11CloseDisplay ( vout_thread_t *p_vout ); static void X11CloseDisplay ( vout_thread_t *p_vout );
static int X11CreateWindow ( vout_thread_t *p_vout ); static int X11CreateWindow ( vout_thread_t *p_vout );
static void X11DestroyWindow ( vout_thread_t *p_vout ); static void X11DestroyWindow ( vout_thread_t *p_vout );
...@@ -91,13 +92,13 @@ static void X11DestroyShmImage ( vout_thread_t *p_vout, XImage *p_ximage, ...@@ -91,13 +92,13 @@ static void X11DestroyShmImage ( vout_thread_t *p_vout, XImage *p_ximage,
XShmSegmentInfo *p_shm_info ); XShmSegmentInfo *p_shm_info );
/***************************************************************************** /*****************************************************************************
* vout_SysCreate: allocate X11 video thread output method * vout_GnomeCreate: allocate X11 video thread output method
***************************************************************************** *****************************************************************************
* This function allocate and initialize a X11 vout method. It uses some of the * This function allocate and initialize a X11 vout method. It uses some of the
* vout properties to choose the window size, and change them according to the * vout properties to choose the window size, and change them according to the
* actual properties of the display. * actual properties of the display.
*****************************************************************************/ *****************************************************************************/
int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int vout_GnomeCreate( vout_thread_t *p_vout, char *psz_display,
int i_root_window, void *p_data ) int i_root_window, void *p_data )
{ {
/* Allocate structure */ /* Allocate structure */
...@@ -123,12 +124,12 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, ...@@ -123,12 +124,12 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display,
} }
/***************************************************************************** /*****************************************************************************
* vout_SysInit: initialize X11 video thread output method * vout_GnomeInit: initialize X11 video thread output method
***************************************************************************** *****************************************************************************
* This function create the XImages needed by the output thread. It is called * 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. * at the beginning of the thread, but also each time the window is resized.
*****************************************************************************/ *****************************************************************************/
int vout_SysInit( vout_thread_t *p_vout ) int vout_GnomeInit( vout_thread_t *p_vout )
{ {
int i_err; int i_err;
...@@ -185,12 +186,12 @@ int vout_SysInit( vout_thread_t *p_vout ) ...@@ -185,12 +186,12 @@ int vout_SysInit( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* vout_SysEnd: terminate X11 video thread output method * vout_GnomeEnd: terminate X11 video thread output method
***************************************************************************** *****************************************************************************
* Destroy the X11 XImages created by vout_SysInit. It is called at the end of * 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. * the thread, but also each time the window is resized.
*****************************************************************************/ *****************************************************************************/
void vout_SysEnd( vout_thread_t *p_vout ) void vout_GnomeEnd( vout_thread_t *p_vout )
{ {
if( p_vout->p_sys->b_shm ) /* Shm XImages... */ if( p_vout->p_sys->b_shm ) /* Shm XImages... */
{ {
...@@ -207,24 +208,24 @@ void vout_SysEnd( vout_thread_t *p_vout ) ...@@ -207,24 +208,24 @@ void vout_SysEnd( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* vout_SysDestroy: destroy X11 video thread output method * vout_GnomeDestroy: destroy X11 video thread output method
***************************************************************************** *****************************************************************************
* Terminate an output method created by vout_CreateOutputMethod * Terminate an output method created by vout_CreateOutputMethod
*****************************************************************************/ *****************************************************************************/
void vout_SysDestroy( vout_thread_t *p_vout ) void vout_GnomeDestroy( vout_thread_t *p_vout )
{ {
X11CloseDisplay( p_vout ); X11CloseDisplay( p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
} }
/***************************************************************************** /*****************************************************************************
* vout_SysManage: handle X11 events * vout_GnomeManage: handle X11 events
***************************************************************************** *****************************************************************************
* This function should be called regularly by video output thread. It manages * This function should be called regularly by video output thread. It manages
* X11 events and allows window resizing. It returns a non null value on * X11 events and allows window resizing. It returns a non null value on
* error. * error.
*****************************************************************************/ *****************************************************************************/
int vout_SysManage( vout_thread_t *p_vout ) int vout_GnomeManage( vout_thread_t *p_vout )
{ {
/* /*
* Color/Grayscale or gamma change: in 8bpp, just change the colormap * Color/Grayscale or gamma change: in 8bpp, just change the colormap
...@@ -247,10 +248,10 @@ int vout_SysManage( vout_thread_t *p_vout ) ...@@ -247,10 +248,10 @@ int vout_SysManage( vout_thread_t *p_vout )
p_vout->i_width, p_vout->i_height ); p_vout->i_width, p_vout->i_height );
/* Destroy XImages to change their size */ /* Destroy XImages to change their size */
vout_SysEnd( p_vout ); vout_GnomeEnd( p_vout );
/* Recreate XImages. If SysInit failed, the thread can't go on. */ /* Recreate XImages. If SysInit failed, the thread can't go on. */
if( vout_SysInit( p_vout ) ) if( vout_GnomeInit( p_vout ) )
{ {
intf_ErrMsg("error: can't resize display\n"); intf_ErrMsg("error: can't resize display\n");
return( 1 ); return( 1 );
...@@ -266,12 +267,12 @@ int vout_SysManage( vout_thread_t *p_vout ) ...@@ -266,12 +267,12 @@ int vout_SysManage( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* vout_SysDisplay: displays previously rendered output * vout_GnomeDisplay: displays previously rendered output
***************************************************************************** *****************************************************************************
* This function send the currently rendered image to X11 server, wait until * This function send the currently rendered image to X11 server, wait until
* it is displayed and switch the two rendering buffer, preparing next frame. * it is displayed and switch the two rendering buffer, preparing next frame.
*****************************************************************************/ *****************************************************************************/
void vout_SysDisplay( vout_thread_t *p_vout ) void vout_GnomeDisplay( vout_thread_t *p_vout )
{ {
if( p_vout->p_sys->b_shm) /* XShm is used */ if( p_vout->p_sys->b_shm) /* XShm is used */
{ {
...@@ -299,13 +300,13 @@ void vout_SysDisplay( vout_thread_t *p_vout ) ...@@ -299,13 +300,13 @@ void vout_SysDisplay( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* vout_SetPalette: sets an 8 bpp palette * vout_GnomeSetPalette: sets an 8 bpp palette
***************************************************************************** *****************************************************************************
* This function sets the palette given as an argument. It does not return * This function sets the palette given as an argument. It does not return
* anything, but could later send information on which colors it was unable * anything, but could later send information on which colors it was unable
* to set. * to set.
*****************************************************************************/ *****************************************************************************/
void vout_SetPalette( p_vout_thread_t p_vout, void vout_GnomeSetPalette( p_vout_thread_t p_vout,
u16 *red, u16 *green, u16 *blue, u16 *transp ) u16 *red, u16 *green, u16 *blue, u16 *transp )
{ {
int i; int i;
......
...@@ -90,9 +90,9 @@ static void X11DisableScreenSaver ( intf_thread_t *p_intf ); ...@@ -90,9 +90,9 @@ static void X11DisableScreenSaver ( intf_thread_t *p_intf );
static void X11TogglePointer ( intf_thread_t *p_intf ); static void X11TogglePointer ( intf_thread_t *p_intf );
/***************************************************************************** /*****************************************************************************
* intf_SysCreate: initialize and create window * intf_MGACreate: initialize and create window
*****************************************************************************/ *****************************************************************************/
int intf_SysCreate( intf_thread_t *p_intf ) int intf_MGACreate( intf_thread_t *p_intf )
{ {
char *psz_display; char *psz_display;
...@@ -150,9 +150,9 @@ int intf_SysCreate( intf_thread_t *p_intf ) ...@@ -150,9 +150,9 @@ int intf_SysCreate( intf_thread_t *p_intf )
} }
/***************************************************************************** /*****************************************************************************
* intf_SysDestroy: destroy interface window * intf_MGADestroy: destroy interface window
*****************************************************************************/ *****************************************************************************/
void intf_SysDestroy( intf_thread_t *p_intf ) void intf_MGADestroy( intf_thread_t *p_intf )
{ {
/* Enable screen saver */ /* Enable screen saver */
X11EnableScreenSaver( p_intf ); X11EnableScreenSaver( p_intf );
...@@ -179,9 +179,9 @@ void intf_SysDestroy( intf_thread_t *p_intf ) ...@@ -179,9 +179,9 @@ void intf_SysDestroy( intf_thread_t *p_intf )
/***************************************************************************** /*****************************************************************************
* intf_SysManage: event loop * intf_MGAManage: event loop
*****************************************************************************/ *****************************************************************************/
void intf_SysManage( intf_thread_t *p_intf ) void intf_MGAManage( intf_thread_t *p_intf )
{ {
/* Manage main window */ /* Manage main window */
X11ManageWindow( p_intf ); X11ManageWindow( p_intf );
......
...@@ -38,13 +38,27 @@ ...@@ -38,13 +38,27 @@
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "plugins_export.h"
/***************************************************************************** /*****************************************************************************
* Exported prototypes * Exported prototypes
*****************************************************************************/ *****************************************************************************/
void vout_GetPlugin( p_vout_thread_t p_vout ); static void vout_GetPlugin( p_vout_thread_t p_vout );
void intf_GetPlugin( p_intf_thread_t p_intf ); static void intf_GetPlugin( p_intf_thread_t p_intf );
/* Video output */
int vout_MGACreate ( vout_thread_t *p_vout, char *psz_display,
int i_root_window, void *p_data );
int vout_MGAInit ( p_vout_thread_t p_vout );
void vout_MGAEnd ( p_vout_thread_t p_vout );
void vout_MGADestroy ( p_vout_thread_t p_vout );
int vout_MGAManage ( p_vout_thread_t p_vout );
void vout_MGADisplay ( p_vout_thread_t p_vout );
void vout_SetPalette ( p_vout_thread_t p_vout,
u16 *red, u16 *green, u16 *blue, u16 *transp );
/* Interface */
int intf_MGACreate ( p_intf_thread_t p_intf );
void intf_MGADestroy ( p_intf_thread_t p_intf );
void intf_MGAManage ( p_intf_thread_t p_intf );
/***************************************************************************** /*****************************************************************************
* GetConfig: get the plugin structure and configuration * GetConfig: get the plugin structure and configuration
...@@ -62,36 +76,30 @@ plugin_info_t * GetConfig( void ) ...@@ -62,36 +76,30 @@ plugin_info_t * GetConfig( void )
p_info->intf_GetPlugin = intf_GetPlugin; p_info->intf_GetPlugin = intf_GetPlugin;
p_info->yuv_GetPlugin = NULL; p_info->yuv_GetPlugin = NULL;
return( p_info ); /* The MGA module does not work yet */
} p_info->i_score = 0x0;
/***************************************************************************** return( p_info );
* Test: tests if the plugin can be launched
*****************************************************************************/
int Test( void )
{
/* TODO: detect an MGA card ? */
return( 1 );
} }
/***************************************************************************** /*****************************************************************************
* Following functions are only called through the p_info structure * Following functions are only called through the p_info structure
*****************************************************************************/ *****************************************************************************/
void vout_GetPlugin( p_vout_thread_t p_vout ) static void vout_GetPlugin( p_vout_thread_t p_vout )
{ {
p_vout->p_sys_create = vout_SysCreate; p_vout->p_sys_create = vout_MGACreate;
p_vout->p_sys_init = vout_SysInit; p_vout->p_sys_init = vout_MGAInit;
p_vout->p_sys_end = vout_SysEnd; p_vout->p_sys_end = vout_MGAEnd;
p_vout->p_sys_destroy = vout_SysDestroy; p_vout->p_sys_destroy = vout_MGADestroy;
p_vout->p_sys_manage = vout_SysManage; p_vout->p_sys_manage = vout_MGAManage;
p_vout->p_sys_display = vout_SysDisplay; p_vout->p_sys_display = vout_MGADisplay;
} }
void intf_GetPlugin( p_intf_thread_t p_intf ) static void intf_GetPlugin( p_intf_thread_t p_intf )
{ {
p_intf->p_sys_create = intf_SysCreate; p_intf->p_sys_create = intf_MGACreate;
p_intf->p_sys_destroy = intf_SysDestroy; p_intf->p_sys_destroy = intf_MGADestroy;
p_intf->p_sys_manage = intf_SysManage; p_intf->p_sys_manage = intf_MGAManage;
} }
...@@ -55,13 +55,13 @@ ...@@ -55,13 +55,13 @@
#include "vout_mga.h" #include "vout_mga.h"
/***************************************************************************** /*****************************************************************************
* vout_SysCreate: allocate X11 video thread output method * vout_MGACreate: allocate X11 video thread output method
***************************************************************************** *****************************************************************************
* This function allocate and initialize a X11 vout method. It uses some of the * This function allocate and initialize a X11 vout method. It uses some of the
* vout properties to choose the window size, and change them according to the * vout properties to choose the window size, and change them according to the
* actual properties of the display. * actual properties of the display.
*****************************************************************************/ *****************************************************************************/
int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int vout_MGACreate( vout_thread_t *p_vout, char *psz_display,
int i_root_window, void *p_data ) int i_root_window, void *p_data )
{ {
/* Allocate structure */ /* Allocate structure */
...@@ -105,12 +105,12 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, ...@@ -105,12 +105,12 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display,
} }
/***************************************************************************** /*****************************************************************************
* vout_SysInit: initialize X11 video thread output method * vout_MGAInit: initialize X11 video thread output method
***************************************************************************** *****************************************************************************
* This function create the XImages needed by the output thread. It is called * 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. * at the beginning of the thread, but also each time the window is resized.
*****************************************************************************/ *****************************************************************************/
int vout_SysInit( vout_thread_t *p_vout ) int vout_MGAInit( vout_thread_t *p_vout )
{ {
int i_err; int i_err;
...@@ -213,12 +213,12 @@ int vout_SysInit( vout_thread_t *p_vout ) ...@@ -213,12 +213,12 @@ int vout_SysInit( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* vout_SysEnd: terminate X11 video thread output method * vout_MGAEnd: terminate X11 video thread output method
***************************************************************************** *****************************************************************************
* Destroy the X11 XImages created by vout_SysInit. It is called at the end of * Destroy the X11 XImages created by vout_MGAInit. It is called at the end of
* the thread, but also each time the window is resized. * the thread, but also each time the window is resized.
*****************************************************************************/ *****************************************************************************/
void vout_SysEnd( vout_thread_t *p_vout ) void vout_MGAEnd( vout_thread_t *p_vout )
{ {
if( p_vout->p_sys->b_shm ) /* Shm XImages... */ if( p_vout->p_sys->b_shm ) /* Shm XImages... */
{ {
...@@ -235,11 +235,11 @@ void vout_SysEnd( vout_thread_t *p_vout ) ...@@ -235,11 +235,11 @@ void vout_SysEnd( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* vout_SysDestroy: destroy X11 video thread output method * vout_MGADestroy: destroy X11 video thread output method
***************************************************************************** *****************************************************************************
* Terminate an output method created by vout_CreateOutputMethod * Terminate an output method created by vout_CreateOutputMethod
*****************************************************************************/ *****************************************************************************/
void vout_SysDestroy( vout_thread_t *p_vout ) void vout_MGADestroy( vout_thread_t *p_vout )
{ {
X11CloseDisplay( p_vout ); X11CloseDisplay( p_vout );
...@@ -251,13 +251,13 @@ void vout_SysDestroy( vout_thread_t *p_vout ) ...@@ -251,13 +251,13 @@ void vout_SysDestroy( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* vout_SysManage: handle X11 events * vout_MGAManage: handle X11 events
***************************************************************************** *****************************************************************************
* This function should be called regularly by video output thread. It manages * This function should be called regularly by video output thread. It manages
* X11 events and allows window resizing. It returns a non null value on * X11 events and allows window resizing. It returns a non null value on
* error. * error.
*****************************************************************************/ *****************************************************************************/
int vout_SysManage( vout_thread_t *p_vout ) int vout_MGAManage( vout_thread_t *p_vout )
{ {
/* /*
* Color/Grayscale or gamma change: in 8bpp, just change the colormap * Color/Grayscale or gamma change: in 8bpp, just change the colormap
...@@ -280,10 +280,10 @@ int vout_SysManage( vout_thread_t *p_vout ) ...@@ -280,10 +280,10 @@ int vout_SysManage( vout_thread_t *p_vout )
p_vout->i_width, p_vout->i_height ); p_vout->i_width, p_vout->i_height );
/* Destroy XImages to change their size */ /* Destroy XImages to change their size */
vout_SysEnd( p_vout ); vout_MGAEnd( p_vout );
/* Recreate XImages. If SysInit failed, the thread can't go on. */ /* Recreate XImages. If SysInit failed, the thread can't go on. */
if( vout_SysInit( p_vout ) ) if( vout_MGAInit( p_vout ) )
{ {
intf_ErrMsg("error: can't resize display\n"); intf_ErrMsg("error: can't resize display\n");
return( 1 ); return( 1 );
...@@ -299,12 +299,12 @@ int vout_SysManage( vout_thread_t *p_vout ) ...@@ -299,12 +299,12 @@ int vout_SysManage( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* vout_SysDisplay: displays previously rendered output * vout_MGADisplay: displays previously rendered output
***************************************************************************** *****************************************************************************
* This function send the currently rendered image to X11 server, wait until * This function send the currently rendered image to X11 server, wait until
* it is displayed and switch the two rendering buffer, preparing next frame. * it is displayed and switch the two rendering buffer, preparing next frame.
*****************************************************************************/ *****************************************************************************/
void vout_SysDisplay( vout_thread_t *p_vout ) void vout_MGADisplay( vout_thread_t *p_vout )
{ {
if( p_vout->p_sys->b_shm) /* XShm is used */ if( p_vout->p_sys->b_shm) /* XShm is used */
{ {
......
...@@ -91,9 +91,9 @@ static void X11DisableScreenSaver ( intf_thread_t *p_intf ); ...@@ -91,9 +91,9 @@ static void X11DisableScreenSaver ( intf_thread_t *p_intf );
static void X11TogglePointer ( intf_thread_t *p_intf ); static void X11TogglePointer ( intf_thread_t *p_intf );
/***************************************************************************** /*****************************************************************************
* intf_SysCreate: initialize and create window * intf_X11Create: initialize and create window
*****************************************************************************/ *****************************************************************************/
int intf_SysCreate( intf_thread_t *p_intf ) int intf_X11Create( intf_thread_t *p_intf )
{ {
char *psz_display; char *psz_display;
...@@ -153,9 +153,9 @@ int intf_SysCreate( intf_thread_t *p_intf ) ...@@ -153,9 +153,9 @@ int intf_SysCreate( intf_thread_t *p_intf )
} }
/***************************************************************************** /*****************************************************************************
* intf_SysDestroy: destroy interface window * intf_X11Destroy: destroy interface window
*****************************************************************************/ *****************************************************************************/
void intf_SysDestroy( intf_thread_t *p_intf ) void intf_X11Destroy( intf_thread_t *p_intf )
{ {
/* Enable screen saver */ /* Enable screen saver */
X11EnableScreenSaver( p_intf ); X11EnableScreenSaver( p_intf );
...@@ -182,9 +182,9 @@ void intf_SysDestroy( intf_thread_t *p_intf ) ...@@ -182,9 +182,9 @@ void intf_SysDestroy( intf_thread_t *p_intf )
/***************************************************************************** /*****************************************************************************
* intf_SysManage: event loop * intf_X11Manage: event loop
*****************************************************************************/ *****************************************************************************/
void intf_SysManage( intf_thread_t *p_intf ) void intf_X11Manage( intf_thread_t *p_intf )
{ {
/* Manage main window */ /* Manage main window */
X11ManageWindow( p_intf ); X11ManageWindow( p_intf );
......
...@@ -91,13 +91,13 @@ static void X11DestroyShmImage ( vout_thread_t *p_vout, XImage *p_ximage, ...@@ -91,13 +91,13 @@ static void X11DestroyShmImage ( vout_thread_t *p_vout, XImage *p_ximage,
XShmSegmentInfo *p_shm_info ); XShmSegmentInfo *p_shm_info );
/***************************************************************************** /*****************************************************************************
* vout_SysCreate: allocate X11 video thread output method * vout_X11Create: allocate X11 video thread output method
***************************************************************************** *****************************************************************************
* This function allocate and initialize a X11 vout method. It uses some of the * This function allocate and initialize a X11 vout method. It uses some of the
* vout properties to choose the window size, and change them according to the * vout properties to choose the window size, and change them according to the
* actual properties of the display. * actual properties of the display.
*****************************************************************************/ *****************************************************************************/
int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int vout_X11Create( vout_thread_t *p_vout, char *psz_display,
int i_root_window, void *p_data ) int i_root_window, void *p_data )
{ {
/* Allocate structure */ /* Allocate structure */
...@@ -123,12 +123,12 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, ...@@ -123,12 +123,12 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display,
} }
/***************************************************************************** /*****************************************************************************
* vout_SysInit: initialize X11 video thread output method * vout_X11Init: initialize X11 video thread output method
***************************************************************************** *****************************************************************************
* This function create the XImages needed by the output thread. It is called * 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. * at the beginning of the thread, but also each time the window is resized.
*****************************************************************************/ *****************************************************************************/
int vout_SysInit( vout_thread_t *p_vout ) int vout_X11Init( vout_thread_t *p_vout )
{ {
int i_err; int i_err;
...@@ -185,12 +185,12 @@ int vout_SysInit( vout_thread_t *p_vout ) ...@@ -185,12 +185,12 @@ int vout_SysInit( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* vout_SysEnd: terminate X11 video thread output method * vout_X11End: terminate X11 video thread output method
***************************************************************************** *****************************************************************************
* Destroy the X11 XImages created by vout_SysInit. It is called at the end of * Destroy the X11 XImages created by vout_X11Init. It is called at the end of
* the thread, but also each time the window is resized. * the thread, but also each time the window is resized.
*****************************************************************************/ *****************************************************************************/
void vout_SysEnd( vout_thread_t *p_vout ) void vout_X11End( vout_thread_t *p_vout )
{ {
if( p_vout->p_sys->b_shm ) /* Shm XImages... */ if( p_vout->p_sys->b_shm ) /* Shm XImages... */
{ {
...@@ -207,24 +207,24 @@ void vout_SysEnd( vout_thread_t *p_vout ) ...@@ -207,24 +207,24 @@ void vout_SysEnd( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* vout_SysDestroy: destroy X11 video thread output method * vout_X11Destroy: destroy X11 video thread output method
***************************************************************************** *****************************************************************************
* Terminate an output method created by vout_CreateOutputMethod * Terminate an output method created by vout_CreateOutputMethod
*****************************************************************************/ *****************************************************************************/
void vout_SysDestroy( vout_thread_t *p_vout ) void vout_X11Destroy( vout_thread_t *p_vout )
{ {
X11CloseDisplay( p_vout ); X11CloseDisplay( p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
} }
/***************************************************************************** /*****************************************************************************
* vout_SysManage: handle X11 events * vout_X11Manage: handle X11 events
***************************************************************************** *****************************************************************************
* This function should be called regularly by video output thread. It manages * This function should be called regularly by video output thread. It manages
* X11 events and allows window resizing. It returns a non null value on * X11 events and allows window resizing. It returns a non null value on
* error. * error.
*****************************************************************************/ *****************************************************************************/
int vout_SysManage( vout_thread_t *p_vout ) int vout_X11Manage( vout_thread_t *p_vout )
{ {
/* /*
* Color/Grayscale or gamma change: in 8bpp, just change the colormap * Color/Grayscale or gamma change: in 8bpp, just change the colormap
...@@ -248,10 +248,10 @@ int vout_SysManage( vout_thread_t *p_vout ) ...@@ -248,10 +248,10 @@ int vout_SysManage( vout_thread_t *p_vout )
p_vout->i_width, p_vout->i_height ); p_vout->i_width, p_vout->i_height );
/* Destroy XImages to change their size */ /* Destroy XImages to change their size */
vout_SysEnd( p_vout ); vout_X11End( p_vout );
/* Recreate XImages. If SysInit failed, the thread can't go on. */ /* Recreate XImages. If SysInit failed, the thread can't go on. */
if( vout_SysInit( p_vout ) ) if( vout_X11Init( p_vout ) )
{ {
intf_ErrMsg("error: can't resize display\n"); intf_ErrMsg("error: can't resize display\n");
return( 1 ); return( 1 );
...@@ -268,12 +268,12 @@ int vout_SysManage( vout_thread_t *p_vout ) ...@@ -268,12 +268,12 @@ int vout_SysManage( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* vout_SysDisplay: displays previously rendered output * vout_X11Display: displays previously rendered output
***************************************************************************** *****************************************************************************
* This function send the currently rendered image to X11 server, wait until * This function send the currently rendered image to X11 server, wait until
* it is displayed and switch the two rendering buffer, preparing next frame. * it is displayed and switch the two rendering buffer, preparing next frame.
*****************************************************************************/ *****************************************************************************/
void vout_SysDisplay( vout_thread_t *p_vout ) void vout_X11Display( vout_thread_t *p_vout )
{ {
if( p_vout->p_sys->b_shm) /* XShm is used */ if( p_vout->p_sys->b_shm) /* XShm is used */
{ {
...@@ -301,13 +301,13 @@ void vout_SysDisplay( vout_thread_t *p_vout ) ...@@ -301,13 +301,13 @@ void vout_SysDisplay( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* vout_SetPalette: sets an 8 bpp palette * vout_X11SetPalette: sets an 8 bpp palette
***************************************************************************** *****************************************************************************
* This function sets the palette given as an argument. It does not return * This function sets the palette given as an argument. It does not return
* anything, but could later send information on which colors it was unable * anything, but could later send information on which colors it was unable
* to set. * to set.
*****************************************************************************/ *****************************************************************************/
void vout_SetPalette( p_vout_thread_t p_vout, void vout_X11SetPalette( p_vout_thread_t p_vout,
u16 *red, u16 *green, u16 *blue, u16 *transp ) u16 *red, u16 *green, u16 *blue, u16 *transp )
{ {
int i; int i;
......
...@@ -27,10 +27,13 @@ ...@@ -27,10 +27,13 @@
#include <stdlib.h> /* malloc(), free() */ #include <stdlib.h> /* malloc(), free() */
#include <X11/Xlib.h>
#include "config.h" #include "config.h"
#include "common.h" /* boolean_t, byte_t */ #include "common.h" /* boolean_t, byte_t */
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "tests.h"
#include "plugins.h" #include "plugins.h"
#include "interface.h" #include "interface.h"
...@@ -38,19 +41,36 @@ ...@@ -38,19 +41,36 @@
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "plugins_export.h" #include "main.h"
/***************************************************************************** /*****************************************************************************
* Exported prototypes * Exported prototypes
*****************************************************************************/ *****************************************************************************/
void vout_GetPlugin( p_vout_thread_t p_vout ); static void vout_GetPlugin( p_vout_thread_t p_vout );
void intf_GetPlugin( p_intf_thread_t p_intf ); static void intf_GetPlugin( p_intf_thread_t p_intf );
/* Video output */
int vout_X11Create ( vout_thread_t *p_vout, char *psz_display,
int i_root_window, void *p_data );
int vout_X11Init ( p_vout_thread_t p_vout );
void vout_X11End ( p_vout_thread_t p_vout );
void vout_X11Destroy ( p_vout_thread_t p_vout );
int vout_X11Manage ( p_vout_thread_t p_vout );
void vout_X11Display ( p_vout_thread_t p_vout );
void vout_X11SetPalette ( p_vout_thread_t p_vout,
u16 *red, u16 *green, u16 *blue, u16 *transp );
/* Interface */
int intf_X11Create ( p_intf_thread_t p_intf );
void intf_X11Destroy ( p_intf_thread_t p_intf );
void intf_X11Manage ( p_intf_thread_t p_intf );
/***************************************************************************** /*****************************************************************************
* GetConfig: get the plugin structure and configuration * GetConfig: get the plugin structure and configuration
*****************************************************************************/ *****************************************************************************/
plugin_info_t * GetConfig( void ) plugin_info_t * GetConfig( void )
{ {
Display *p_display;
plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) ); plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
p_info->psz_name = "X Window System"; p_info->psz_name = "X Window System";
...@@ -62,39 +82,54 @@ plugin_info_t * GetConfig( void ) ...@@ -62,39 +82,54 @@ plugin_info_t * GetConfig( void )
p_info->intf_GetPlugin = intf_GetPlugin; p_info->intf_GetPlugin = intf_GetPlugin;
p_info->yuv_GetPlugin = NULL; p_info->yuv_GetPlugin = NULL;
return( p_info ); /* check that we can open the X display */
} if( (p_display = XOpenDisplay( XDisplayName(
main_GetPszVariable( VOUT_DISPLAY_VAR, NULL ) ) ))
== NULL )
{
p_info->i_score = 0x0;
}
else
{
XCloseDisplay( p_display );
p_info->i_score = 0x200;
}
if( TestProgram( "xvlc" ) )
{
p_info->i_score += 0x180;
}
/* If this plugin was requested, score it higher */
if( TestMethod( VOUT_METHOD_VAR, "x11" ) )
{
p_info->i_score += 0x200;
}
/***************************************************************************** return( p_info );
* Test: tests if the plugin can be launched
*****************************************************************************/
int Test( void )
{
/* TODO: detect an X display */
return( 1 );
} }
/***************************************************************************** /*****************************************************************************
* Following functions are only called through the p_info structure * Following functions are only called through the p_info structure
*****************************************************************************/ *****************************************************************************/
void vout_GetPlugin( p_vout_thread_t p_vout ) static void vout_GetPlugin( p_vout_thread_t p_vout )
{ {
p_vout->p_sys_create = vout_SysCreate; p_vout->p_sys_create = vout_X11Create;
p_vout->p_sys_init = vout_SysInit; p_vout->p_sys_init = vout_X11Init;
p_vout->p_sys_end = vout_SysEnd; p_vout->p_sys_end = vout_X11End;
p_vout->p_sys_destroy = vout_SysDestroy; p_vout->p_sys_destroy = vout_X11Destroy;
p_vout->p_sys_manage = vout_SysManage; p_vout->p_sys_manage = vout_X11Manage;
p_vout->p_sys_display = vout_SysDisplay; p_vout->p_sys_display = vout_X11Display;
/* optional functions */ /* optional functions */
p_vout->p_set_palette = vout_SetPalette; p_vout->p_set_palette = vout_X11SetPalette;
} }
void intf_GetPlugin( p_intf_thread_t p_intf ) static void intf_GetPlugin( p_intf_thread_t p_intf )
{ {
p_intf->p_sys_create = intf_SysCreate; p_intf->p_sys_create = intf_X11Create;
p_intf->p_sys_destroy = intf_SysDestroy; p_intf->p_sys_destroy = intf_X11Destroy;
p_intf->p_sys_manage = intf_SysManage; p_intf->p_sys_manage = intf_X11Manage;
} }
...@@ -45,21 +45,13 @@ ...@@ -45,21 +45,13 @@
#include "intf_msg.h" #include "intf_msg.h"
/*****************************************************************************
* Constants
*****************************************************************************/
int yuv_SysInit ( vout_thread_t *p_vout );
int yuv_SysReset ( vout_thread_t *p_vout );
void yuv_SysEnd ( vout_thread_t *p_vout );
/***************************************************************************** /*****************************************************************************
* vout_InitYUV: allocate and initialize translations tables * vout_InitYUV: allocate and initialize translations tables
***************************************************************************** *****************************************************************************
* This function will allocate memory to store translation tables, depending * This function will allocate memory to store translation tables, depending
* of the screen depth. * of the screen depth.
*****************************************************************************/ *****************************************************************************/
int yuv_SysInit( vout_thread_t *p_vout ) int yuv_CInit( vout_thread_t *p_vout )
{ {
size_t tables_size; /* tables size, in bytes */ size_t tables_size; /* tables size, in bytes */
...@@ -113,27 +105,27 @@ int yuv_SysInit( vout_thread_t *p_vout ) ...@@ -113,27 +105,27 @@ int yuv_SysInit( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* yuv_SysReset: re-initialize translations tables * yuv_CEnd: destroy translations tables
***************************************************************************** *****************************************************************************
* This function will initialize the tables allocated by vout_CreateTables and * Free memory allocated by yuv_CCreate.
* set functions pointers.
*****************************************************************************/ *****************************************************************************/
int yuv_SysReset( vout_thread_t *p_vout ) void yuv_CEnd( vout_thread_t *p_vout )
{ {
yuv_SysEnd( p_vout ); free( p_vout->yuv.p_base );
return( yuv_SysInit( p_vout ) ); free( p_vout->yuv.p_buffer );
free( p_vout->yuv.p_offset );
} }
/***************************************************************************** /*****************************************************************************
* yuv_SysEnd: destroy translations tables * yuv_CReset: re-initialize translations tables
***************************************************************************** *****************************************************************************
* Free memory allocated by yuv_SysCreate. * This function will initialize the tables allocated by vout_CreateTables and
* set functions pointers.
*****************************************************************************/ *****************************************************************************/
void yuv_SysEnd( vout_thread_t *p_vout ) int yuv_CReset( vout_thread_t *p_vout )
{ {
free( p_vout->yuv.p_base ); yuv_CEnd( p_vout );
free( p_vout->yuv.p_buffer ); return( yuv_CInit( p_vout ) );
free( p_vout->yuv.p_offset );
} }
/* following functions are local */ /* following functions are local */
......
...@@ -73,6 +73,8 @@ void ConvertY4Gray16( YUV_ARGS_16BPP ) ...@@ -73,6 +73,8 @@ void ConvertY4Gray16( YUV_ARGS_16BPP )
SetOffset( i_width, i_height, i_pic_width, i_pic_height, SetOffset( i_width, i_height, i_pic_width, i_pic_height,
&b_horizontal_scaling, &i_vertical_scaling, p_offset_start ); &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
p_y = p_v;
i_height /= 4;
/* /*
* Perform conversion * Perform conversion
*/ */
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "common.h" /* boolean_t, byte_t */ #include "common.h" /* boolean_t, byte_t */
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "tests.h"
#include "plugins.h" #include "plugins.h"
#include "interface.h" #include "interface.h"
...@@ -38,12 +39,15 @@ ...@@ -38,12 +39,15 @@
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "plugins_export.h"
/***************************************************************************** /*****************************************************************************
* Exported prototypes * Exported prototypes
*****************************************************************************/ *****************************************************************************/
void yuv_GetPlugin( p_vout_thread_t p_vout ); static void yuv_GetPlugin( p_vout_thread_t p_vout );
/* YUV transformations */
int yuv_CInit ( p_vout_thread_t p_vout );
int yuv_CReset ( p_vout_thread_t p_vout );
void yuv_CEnd ( p_vout_thread_t p_vout );
/***************************************************************************** /*****************************************************************************
* GetConfig: get the plugin structure and configuration * GetConfig: get the plugin structure and configuration
...@@ -61,25 +65,26 @@ plugin_info_t * GetConfig( void ) ...@@ -61,25 +65,26 @@ plugin_info_t * GetConfig( void )
p_info->intf_GetPlugin = NULL; p_info->intf_GetPlugin = NULL;
p_info->yuv_GetPlugin = yuv_GetPlugin; p_info->yuv_GetPlugin = yuv_GetPlugin;
return( p_info ); /* The C YUV functions should always work */
} p_info->i_score = 0x100;
/***************************************************************************** /* If this plugin was requested, score it higher */
* Test: tests if the plugin can be launched if( TestMethod( YUV_METHOD_VAR, "nommx" ) )
*****************************************************************************/ {
int Test( void ) p_info->i_score += 0x200;
{ }
return( 1 );
return( p_info );
} }
/***************************************************************************** /*****************************************************************************
* Following functions are only called through the p_info structure * Following functions are only called through the p_info structure
*****************************************************************************/ *****************************************************************************/
void yuv_GetPlugin( p_vout_thread_t p_vout ) static void yuv_GetPlugin( p_vout_thread_t p_vout )
{ {
p_vout->p_yuv_init = yuv_SysInit; p_vout->p_yuv_init = yuv_CInit;
p_vout->p_yuv_reset = yuv_SysReset; p_vout->p_yuv_reset = yuv_CReset;
p_vout->p_yuv_end = yuv_SysEnd; p_vout->p_yuv_end = yuv_CEnd;
} }
...@@ -45,21 +45,13 @@ ...@@ -45,21 +45,13 @@
#include "intf_msg.h" #include "intf_msg.h"
/*****************************************************************************
* Constants
*****************************************************************************/
int yuv_SysInit ( vout_thread_t *p_vout );
int yuv_SysReset ( vout_thread_t *p_vout );
void yuv_SysEnd ( vout_thread_t *p_vout );
/***************************************************************************** /*****************************************************************************
* vout_InitYUV: allocate and initialize translations tables * vout_InitYUV: allocate and initialize translations tables
***************************************************************************** *****************************************************************************
* This function will allocate memory to store translation tables, depending * This function will allocate memory to store translation tables, depending
* of the screen depth. * of the screen depth.
*****************************************************************************/ *****************************************************************************/
int yuv_SysInit( vout_thread_t *p_vout ) int yuv_MMXInit( vout_thread_t *p_vout )
{ {
size_t tables_size; /* tables size, in bytes */ size_t tables_size; /* tables size, in bytes */
...@@ -113,27 +105,27 @@ int yuv_SysInit( vout_thread_t *p_vout ) ...@@ -113,27 +105,27 @@ int yuv_SysInit( vout_thread_t *p_vout )
} }
/***************************************************************************** /*****************************************************************************
* yuv_SysReset: re-initialize translations tables * yuv_MMXEnd: destroy translations tables
***************************************************************************** *****************************************************************************
* This function will initialize the tables allocated by vout_CreateTables and * Free memory allocated by yuv_MMXCreate.
* set functions pointers.
*****************************************************************************/ *****************************************************************************/
int yuv_SysReset( vout_thread_t *p_vout ) void yuv_MMXEnd( vout_thread_t *p_vout )
{ {
yuv_SysEnd( p_vout ); free( p_vout->yuv.p_base );
return( yuv_SysInit( p_vout ) ); free( p_vout->yuv.p_buffer );
free( p_vout->yuv.p_offset );
} }
/***************************************************************************** /*****************************************************************************
* yuv_SysEnd: destroy translations tables * yuv_MMXReset: re-initialize translations tables
***************************************************************************** *****************************************************************************
* Free memory allocated by yuv_SysCreate. * This function will initialize the tables allocated by vout_CreateTables and
* set functions pointers.
*****************************************************************************/ *****************************************************************************/
void yuv_SysEnd( vout_thread_t *p_vout ) int yuv_MMXReset( vout_thread_t *p_vout )
{ {
free( p_vout->yuv.p_base ); yuv_MMXEnd( p_vout );
free( p_vout->yuv.p_buffer ); return( yuv_MMXInit( p_vout ) );
free( p_vout->yuv.p_offset );
} }
/* following functions are local */ /* following functions are local */
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "common.h" /* boolean_t, byte_t */ #include "common.h" /* boolean_t, byte_t */
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "tests.h" /* TestMMX() */
#include "plugins.h" #include "plugins.h"
#include "interface.h" #include "interface.h"
...@@ -38,12 +39,15 @@ ...@@ -38,12 +39,15 @@
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "plugins_export.h"
/***************************************************************************** /*****************************************************************************
* Exported prototypes * Exported prototypes
*****************************************************************************/ *****************************************************************************/
void yuv_GetPlugin( p_vout_thread_t p_vout ); static void yuv_GetPlugin( p_vout_thread_t p_vout );
/* YUV transformations */
int yuv_MMXInit ( p_vout_thread_t p_vout );
int yuv_MMXReset ( p_vout_thread_t p_vout );
void yuv_MMXEnd ( p_vout_thread_t p_vout );
/***************************************************************************** /*****************************************************************************
* GetConfig: get the plugin structure and configuration * GetConfig: get the plugin structure and configuration
...@@ -61,25 +65,32 @@ plugin_info_t * GetConfig( void ) ...@@ -61,25 +65,32 @@ plugin_info_t * GetConfig( void )
p_info->intf_GetPlugin = NULL; p_info->intf_GetPlugin = NULL;
p_info->yuv_GetPlugin = yuv_GetPlugin; p_info->yuv_GetPlugin = yuv_GetPlugin;
return( p_info ); if( TestMMX() )
} {
p_info->i_score = 0x200;
}
else
{
p_info->i_score = 0x0;
}
/***************************************************************************** /* If this plugin was requested, score it higher */
* Test: tests if the plugin can be launched if( TestMethod( YUV_METHOD_VAR, "mmx" ) )
*****************************************************************************/ {
int Test( void ) p_info->i_score += 0x200;
{ }
return( 1 );
return( p_info );
} }
/***************************************************************************** /*****************************************************************************
* Following functions are only called through the p_info structure * Following functions are only called through the p_info structure
*****************************************************************************/ *****************************************************************************/
void yuv_GetPlugin( p_vout_thread_t p_vout ) static void yuv_GetPlugin( p_vout_thread_t p_vout )
{ {
p_vout->p_yuv_init = yuv_SysInit; p_vout->p_yuv_init = yuv_MMXInit;
p_vout->p_yuv_reset = yuv_SysReset; p_vout->p_yuv_reset = yuv_MMXReset;
p_vout->p_yuv_end = yuv_SysEnd; p_vout->p_yuv_end = yuv_MMXEnd;
} }
...@@ -82,6 +82,7 @@ aout_thread_t *aout_CreateThread( int *pi_status ) ...@@ -82,6 +82,7 @@ aout_thread_t *aout_CreateThread( int *pi_status )
aout_thread_t * p_aout; /* thread descriptor */ aout_thread_t * p_aout; /* thread descriptor */
typedef void ( aout_getplugin_t ) ( aout_thread_t * p_aout ); typedef void ( aout_getplugin_t ) ( aout_thread_t * p_aout );
int i_index; int i_index;
int i_best_index = 0, i_best_score = 0;
#if 0 #if 0
int i_status; /* thread status */ int i_status; /* thread status */
#endif #endif
...@@ -102,13 +103,27 @@ aout_thread_t *aout_CreateThread( int *pi_status ) ...@@ -102,13 +103,27 @@ aout_thread_t *aout_CreateThread( int *pi_status )
/* ... and if this plugin provides the functions we want ... */ /* ... and if this plugin provides the functions we want ... */
if( p_main->p_bank->p_info[ i_index ]->aout_GetPlugin != NULL ) if( p_main->p_bank->p_info[ i_index ]->aout_GetPlugin != NULL )
{ {
/* ... then get these functions */ /* ... and if this plugin has a good score ... */
( (aout_getplugin_t *) if( p_main->p_bank->p_info[ i_index ]->i_score > i_best_score )
p_main->p_bank->p_info[ i_index ]->aout_GetPlugin )( p_aout ); {
/* ... then take it */
i_best_score = p_main->p_bank->p_info[ i_index ]->i_score;
i_best_index = i_index;
}
} }
} }
} }
if( i_best_score == 0 )
{
free( p_aout );
return( NULL );
}
/* Get the plugin functions */
( (aout_getplugin_t *)
p_main->p_bank->p_info[ i_best_index ]->aout_GetPlugin )( p_aout );
/* /*
* Initialize audio device * Initialize audio device
*/ */
......
...@@ -93,6 +93,7 @@ intf_thread_t* intf_Create( void ) ...@@ -93,6 +93,7 @@ intf_thread_t* intf_Create( void )
intf_thread_t * p_intf; intf_thread_t * p_intf;
typedef void ( intf_getplugin_t ) ( intf_thread_t * p_intf ); typedef void ( intf_getplugin_t ) ( intf_thread_t * p_intf );
int i_index; int i_index;
int i_best_index = 0, i_best_score = 0;
/* Allocate structure */ /* Allocate structure */
p_intf = malloc( sizeof( intf_thread_t ) ); p_intf = malloc( sizeof( intf_thread_t ) );
...@@ -111,13 +112,27 @@ intf_thread_t* intf_Create( void ) ...@@ -111,13 +112,27 @@ intf_thread_t* intf_Create( void )
/* ... and if this plugin provides the functions we want ... */ /* ... and if this plugin provides the functions we want ... */
if( p_main->p_bank->p_info[ i_index ]->intf_GetPlugin != NULL ) if( p_main->p_bank->p_info[ i_index ]->intf_GetPlugin != NULL )
{ {
/* ... then get these functions */ /* ... and if this plugin has a good score ... */
( (intf_getplugin_t *) if( p_main->p_bank->p_info[ i_index ]->i_score > i_best_score )
p_main->p_bank->p_info[ i_index ]->intf_GetPlugin )( p_intf ); {
/* ... then take it */
i_best_score = p_main->p_bank->p_info[ i_index ]->i_score;
i_best_index = i_index;
}
} }
} }
} }
if( i_best_score == 0 )
{
free( p_intf );
return( NULL );
}
/* Get the plugin functions */
( (intf_getplugin_t *)
p_main->p_bank->p_info[ i_best_index ]->intf_GetPlugin )( p_intf );
/* Initialize structure */ /* Initialize structure */
p_intf->b_die = 0; p_intf->b_die = 0;
p_intf->p_vout = NULL; p_intf->p_vout = NULL;
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "common.h" #include "common.h"
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "tests.h" /* TestMMX() */
#include "plugins.h" #include "plugins.h"
#include "playlist.h" #include "playlist.h"
#include "input_vlan.h" #include "input_vlan.h"
...@@ -73,6 +74,7 @@ ...@@ -73,6 +74,7 @@
#define OPT_WIDTH 163 #define OPT_WIDTH 163
#define OPT_HEIGHT 164 #define OPT_HEIGHT 164
#define OPT_COLOR 165 #define OPT_COLOR 165
#define OPT_YUV 166
#define OPT_NOVLANS 170 #define OPT_NOVLANS 170
#define OPT_SERVER 171 #define OPT_SERVER 171
...@@ -107,6 +109,7 @@ static const struct option longopts[] = ...@@ -107,6 +109,7 @@ static const struct option longopts[] =
{ "height", 1, 0, OPT_HEIGHT }, { "height", 1, 0, OPT_HEIGHT },
{ "grayscale", 0, 0, 'g' }, { "grayscale", 0, 0, 'g' },
{ "color", 0, 0, OPT_COLOR }, { "color", 0, 0, OPT_COLOR },
{ "yuv", 1, 0, OPT_YUV },
/* DVD options */ /* DVD options */
{ "dvdaudio", 1, 0, 'a' }, { "dvdaudio", 1, 0, 'a' },
...@@ -160,17 +163,17 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -160,17 +163,17 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
p_main = &main_data; /* set up the global variable */ p_main = &main_data; /* set up the global variable */
#ifdef SYS_BEOS
/* /*
* System specific initialization code * System specific initialization code
*/ */
#ifdef SYS_BEOS
beos_Create(); beos_Create();
#endif #endif
#ifdef HAVE_MMX
/* /*
* Test if our code is likely to run on this CPU * Test if our code is likely to run on this CPU
*/ */
#ifdef HAVE_MMX
if( !TestMMX() ) if( !TestMMX() )
{ {
fprintf( stderr, "Sorry, this program needs an MMX processor. " fprintf( stderr, "Sorry, this program needs an MMX processor. "
...@@ -196,8 +199,6 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -196,8 +199,6 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
if( GetConfiguration( i_argc, ppsz_argv, ppsz_env ) ) /* parse cmd line */ if( GetConfiguration( i_argc, ppsz_argv, ppsz_env ) ) /* parse cmd line */
{ {
intf_MsgDestroy(); intf_MsgDestroy();
fprintf( stderr, "error: can't read configuration (%s)\n",
strerror(errno) );
return( errno ); return( errno );
} }
...@@ -259,6 +260,9 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -259,6 +260,9 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
{ {
InitSignalHandler(); /* prepare signals for interception */ InitSignalHandler(); /* prepare signals for interception */
/*
* This is the main loop
*/
intf_Run( p_main->p_intf ); intf_Run( p_main->p_intf );
intf_Destroy( p_main->p_intf ); intf_Destroy( p_main->p_intf );
...@@ -419,6 +423,7 @@ static void SetDefaultConfiguration( void ) ...@@ -419,6 +423,7 @@ static void SetDefaultConfiguration( void )
static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
{ {
int c, i_opt; int c, i_opt;
char * p_pointer;
/* Set default configuration and copy arguments */ /* Set default configuration and copy arguments */
p_main->i_argc = i_argc; p_main->i_argc = i_argc;
...@@ -428,6 +433,20 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -428,6 +433,20 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
intf_MsgImm( COPYRIGHT_MESSAGE "\n" ); intf_MsgImm( COPYRIGHT_MESSAGE "\n" );
/* Get the executable name */
p_main->psz_arg0 = p_pointer = ppsz_argv[ 0 ];
while( *p_pointer )
{
if( *p_pointer == '/' )
{
p_main->psz_arg0 = ++p_pointer;
}
else
{
++p_pointer;
}
}
/* Parse command line options */ /* Parse command line options */
opterr = 0; opterr = 0;
while( ( c = getopt_long( i_argc, ppsz_argv, psz_shortopts, longopts, 0 ) ) != EOF ) while( ( c = getopt_long( i_argc, ppsz_argv, psz_shortopts, longopts, 0 ) ) != EOF )
...@@ -485,6 +504,9 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -485,6 +504,9 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
case OPT_COLOR: /* --color */ case OPT_COLOR: /* --color */
main_PutIntVariable( VOUT_GRAYSCALE_VAR, 0 ); main_PutIntVariable( VOUT_GRAYSCALE_VAR, 0 );
break; break;
case OPT_YUV: /* --yuv */
main_PutPszVariable( YUV_METHOD_VAR, optarg );
break;
/* DVD options */ /* DVD options */
case 'a': case 'a':
...@@ -541,11 +563,13 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -541,11 +563,13 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
static void Usage( int i_fashion ) static void Usage( int i_fashion )
{ {
/* Usage */ /* Usage */
intf_Msg( "Usage: vlc [options] [parameters] [file]...\n" ); intf_Msg( "Usage: %s [options] [parameters] [file]...\n",
p_main->psz_arg0 );
if( i_fashion == USAGE ) if( i_fashion == USAGE )
{ {
intf_Msg( "Try `vlc --help' for more information.\n" ); intf_Msg( "Try `%s --help' for more information.\n",
p_main->psz_arg0 );
return; return;
} }
...@@ -672,82 +696,3 @@ static void SignalHandler( int i_signal ) ...@@ -672,82 +696,3 @@ static void SignalHandler( int i_signal )
p_main->p_intf->b_die = 1; p_main->p_intf->b_die = 1;
} }
#ifdef HAVE_MMX
/*****************************************************************************
* TestMMX: tests if the processor has MMX support.
*****************************************************************************
* This function is called if HAVE_MMX is enabled, to check whether the
* CPU really supports MMX.
*****************************************************************************/
static int TestMMX( void )
{
/* FIXME: under beos, gcc does not support the following inline assembly */
#ifdef SYS_BEOS
return( 1 );
#else
int i_reg, i_dummy = 0;
/* test for a 386 CPU */
asm volatile ( "pushfl
popl %%eax
movl %%eax, %%ecx
xorl $0x40000, %%eax
pushl %%eax
popfl
pushfl
popl %%eax
xorl %%ecx, %%eax
andl $0x40000, %%eax"
: "=a" ( i_reg ) );
if( !i_reg )
return( 0 );
/* test for a 486 CPU */
asm volatile ( "movl %%ecx, %%eax
xorl $0x200000, %%eax
pushl %%eax
popfl
pushfl
popl %%eax
xorl %%ecx, %%eax
pushl %%ecx
popfl
andl $0x200000, %%eax"
: "=a" ( i_reg ) );
if( !i_reg )
return( 0 );
/* the CPU supports the CPUID instruction - get its level */
asm volatile ( "cpuid"
: "=a" ( i_reg ),
"=b" ( i_dummy ),
"=c" ( i_dummy ),
"=d" ( i_dummy )
: "a" ( 0 ), /* level 0 */
"b" ( i_dummy ) ); /* buggy compiler shouldn't complain */
/* this shouldn't happen on a normal CPU */
if( !i_reg )
return( 0 );
/* test for the MMX flag */
asm volatile ( "cpuid
andl $0x00800000, %%edx" /* X86_FEATURE_MMX */
: "=a" ( i_dummy ),
"=b" ( i_dummy ),
"=c" ( i_dummy ),
"=d" ( i_reg )
: "a" ( 1 ), /* level 1 */
"b" ( i_dummy ) ); /* buggy compiler shouldn't complain */
if( !i_reg )
return( 0 );
return( 1 );
#endif
}
#endif
...@@ -89,9 +89,12 @@ void bank_Init( plugin_bank_t * p_bank ) ...@@ -89,9 +89,12 @@ void bank_Init( plugin_bank_t * p_bank )
SEEK_PLUGIN( "beos" ); SEEK_PLUGIN( "beos" );
SEEK_PLUGIN( "x11" ); SEEK_PLUGIN( "x11" );
SEEK_PLUGIN( "dsp" ); SEEK_PLUGIN( "dsp" );
SEEK_PLUGIN( "esd" );
SEEK_PLUGIN( "gnome" ); SEEK_PLUGIN( "gnome" );
SEEK_PLUGIN( "ggi" ); SEEK_PLUGIN( "ggi" );
SEEK_PLUGIN( "fb" ); SEEK_PLUGIN( "fb" );
SEEK_PLUGIN( "glide" );
SEEK_PLUGIN( "mga" );
SEEK_PLUGIN( "yuvmmx" ); SEEK_PLUGIN( "yuvmmx" );
SEEK_PLUGIN( "yuv" ); SEEK_PLUGIN( "yuv" );
SEEK_PLUGIN( "dummy" ); SEEK_PLUGIN( "dummy" );
...@@ -108,51 +111,6 @@ void bank_Destroy( plugin_bank_t * p_bank ) ...@@ -108,51 +111,6 @@ void bank_Destroy( plugin_bank_t * p_bank )
* Following functions are local * Following functions are local
*/ */
int AllocatePlugin( plugin_id_t plugin_id, plugin_bank_t * p_bank,
char * psz_filename )
{
typedef plugin_info_t * ( get_config_t ) ( void );
get_config_t * p_func;
int i;
for( i = 0 ; i < p_bank->i_plugin_count ; i++ )
{
if( p_bank->p_info[ i ] == NULL )
{
break;
}
}
/* no room to store that plugin, quit */
if( i == p_bank->i_plugin_count )
{
intf_ErrMsg( "plugin bank error: reached max plugin count (%i), "
"increase MAX_PLUGIN_COUNT\n", p_bank->i_plugin_count );
return( -1 );
}
/* system-specific dynamic symbol loading */
GET_PLUGIN( p_func, plugin_id, "GetConfig" );
/* if it failed, just quit */
if( !p_func )
{
return( -1 );
}
/* run the plugin function to initialize the structure */
p_bank->p_info[ i ] = p_func( );
p_bank->p_info[ i ]->plugin_id = plugin_id;
/* Tell the world we found it */
intf_Msg( "Found plugin: %s (version %s)\n", p_bank->p_info[ i ]->psz_name,
p_bank->p_info[ i ]->psz_version );
/* return nicely */
return( 0 );
}
char * TestPlugin ( plugin_id_t *p_plugin_id, char * psz_name ) char * TestPlugin ( plugin_id_t *p_plugin_id, char * psz_name )
{ {
int i_count, i_length; int i_count, i_length;
...@@ -208,6 +166,53 @@ char * TestPlugin ( plugin_id_t *p_plugin_id, char * psz_name ) ...@@ -208,6 +166,53 @@ char * TestPlugin ( plugin_id_t *p_plugin_id, char * psz_name )
return( NULL ); return( NULL );
} }
int AllocatePlugin( plugin_id_t plugin_id, plugin_bank_t * p_bank,
char * psz_filename )
{
typedef plugin_info_t * ( get_config_t ) ( void );
get_config_t * p_func;
int i;
for( i = 0 ; i < p_bank->i_plugin_count ; i++ )
{
if( p_bank->p_info[ i ] == NULL )
{
break;
}
}
/* no room to store that plugin, quit */
if( i == p_bank->i_plugin_count )
{
intf_ErrMsg( "plugin bank error: reached max plugin count (%i), "
"increase MAX_PLUGIN_COUNT\n", p_bank->i_plugin_count );
return( -1 );
}
/* system-specific dynamic symbol loading */
GET_PLUGIN( p_func, plugin_id, "GetConfig" );
/* if it failed, just quit */
if( !p_func )
{
return( -1 );
}
/* run the plugin function to initialize the structure */
p_bank->p_info[ i ] = p_func( );
p_bank->p_info[ i ]->plugin_id = plugin_id;
/* Tell the world we found it */
intf_Msg( "Plugin %i: %s %s [0x%x]\n", i,
p_bank->p_info[ i ]->psz_name,
p_bank->p_info[ i ]->psz_version,
p_bank->p_info[ i ]->i_score );
/* return nicely */
return( 0 );
}
#if 0 #if 0
void TrashPlugin ( plugin_id_t plugin_id ) void TrashPlugin ( plugin_id_t plugin_id )
{ {
......
/*****************************************************************************
* tests.c: several test functions needed by the plugins
* Functions are prototyped in tests.h.
*****************************************************************************
* Copyright (C) 2000 VideoLAN
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include "config.h"
#include "common.h"
#include "intf_msg.h"
#include "tests.h"
#include "main.h"
/*****************************************************************************
* TestVersion: tests if the given string equals the current version
*****************************************************************************/
int TestVersion( char * psz_version )
{
return( !strcmp( psz_version, VERSION ) );
}
/*****************************************************************************
* TestProgram: tests if the given string equals the program name
*****************************************************************************/
int TestProgram( char * psz_program )
{
return( !strcmp( psz_program, p_main->psz_arg0 ) );
}
/*****************************************************************************
* TestMethod: tests if the given method was requested
*****************************************************************************/
int TestMethod( char * psz_var, char * psz_method )
{
return( !strcmp( psz_method, main_GetPszVariable( psz_var, "" ) ) );
}
/*****************************************************************************
* TestMMX: tests if the processor has MMX support.
*****************************************************************************
* This function is called if HAVE_MMX is enabled, to check whether the
* CPU really supports MMX.
*****************************************************************************/
int TestMMX( void )
{
/* FIXME: under beos, gcc does not support the following inline assembly */
#ifdef SYS_BEOS
return( 1 );
#else
int i_reg, i_dummy = 0;
/* test for a 386 CPU */
asm volatile ( "pushfl
popl %%eax
movl %%eax, %%ecx
xorl $0x40000, %%eax
pushl %%eax
popfl
pushfl
popl %%eax
xorl %%ecx, %%eax
andl $0x40000, %%eax"
: "=a" ( i_reg ) );
if( !i_reg )
return( 0 );
/* test for a 486 CPU */
asm volatile ( "movl %%ecx, %%eax
xorl $0x200000, %%eax
pushl %%eax
popfl
pushfl
popl %%eax
xorl %%ecx, %%eax
pushl %%ecx
popfl
andl $0x200000, %%eax"
: "=a" ( i_reg ) );
if( !i_reg )
return( 0 );
/* the CPU supports the CPUID instruction - get its level */
asm volatile ( "cpuid"
: "=a" ( i_reg ),
"=b" ( i_dummy ),
"=c" ( i_dummy ),
"=d" ( i_dummy )
: "a" ( 0 ), /* level 0 */
"b" ( i_dummy ) ); /* buggy compiler shouldn't complain */
/* this shouldn't happen on a normal CPU */
if( !i_reg )
return( 0 );
/* test for the MMX flag */
asm volatile ( "cpuid
andl $0x00800000, %%edx" /* X86_FEATURE_MMX */
: "=a" ( i_dummy ),
"=b" ( i_dummy ),
"=c" ( i_dummy ),
"=d" ( i_reg )
: "a" ( 1 ), /* level 1 */
"b" ( i_dummy ) ); /* buggy compiler shouldn't complain */
if( !i_reg )
return( 0 );
return( 1 );
#endif
}
...@@ -94,6 +94,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window, ...@@ -94,6 +94,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
typedef void ( vout_getplugin_t ) ( vout_thread_t * p_vout ); typedef void ( vout_getplugin_t ) ( vout_thread_t * p_vout );
int i_status; /* thread status */ int i_status; /* thread status */
int i_index; /* index for array initialization */ int i_index; /* index for array initialization */
int i_best_index = 0, i_best_score = 0;
/* Allocate descriptor */ /* Allocate descriptor */
intf_DbgMsg("\n"); intf_DbgMsg("\n");
...@@ -115,13 +116,27 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window, ...@@ -115,13 +116,27 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
/* ... and if this plugin provides the functions we want ... */ /* ... and if this plugin provides the functions we want ... */
if( p_main->p_bank->p_info[ i_index ]->vout_GetPlugin != NULL ) if( p_main->p_bank->p_info[ i_index ]->vout_GetPlugin != NULL )
{ {
/* ... then get these functions */ /* ... and if this plugin has a good score ... */
( (vout_getplugin_t *) if( p_main->p_bank->p_info[ i_index ]->i_score > i_best_score )
p_main->p_bank->p_info[ i_index ]->vout_GetPlugin )( p_vout ); {
/* ... then take it */
i_best_score = p_main->p_bank->p_info[ i_index ]->i_score;
i_best_index = i_index;
}
} }
} }
} }
if( i_best_score == 0 )
{
free( p_vout );
return( NULL );
}
/* Get the plugin functions */
( (vout_getplugin_t *)
p_main->p_bank->p_info[ i_best_index ]->vout_GetPlugin )( p_vout );
/* Initialize thread properties - thread id and locks will be initialized /* Initialize thread properties - thread id and locks will be initialized
* later */ * later */
p_vout->b_die = 0; p_vout->b_die = 0;
......
...@@ -197,6 +197,8 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type, ...@@ -197,6 +197,8 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
{ {
mtime_t i_delay = p_vpar->synchro.i_last_pts - mdate(); mtime_t i_delay = p_vpar->synchro.i_last_pts - mdate();
//return (i_coding_type == I_CODING_TYPE);
switch( i_coding_type ) switch( i_coding_type )
{ {
case I_CODING_TYPE: case I_CODING_TYPE:
......
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