From: Sam Hocevar Date: Sun, 30 Jul 2000 01:59:50 +0000 (+0000) Subject: . autod�tection des plugins X-Git-Tag: 0.2.70~436 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=e13aed00cf01eefa9285cb030486ee0118ea0425;p=vlc . autod�tection des plugins . les aliases "gvlc" "fbvlc" "ggivlc" fonctionne comme il faut --- diff --git a/Makefile.in b/Makefile.in index 2d37bbc60e..88a627d0a0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -211,6 +211,7 @@ video_decoder_obj = video_decoder/video_decoder.o \ video_decoder/vdec_idct.o misc_obj = misc/mtime.o \ + misc/tests.o \ misc/rsc_files.o \ misc/netutils.o \ misc/playlist.o \ diff --git a/README b/README index 290ce66057..f4aef212f1 100644 --- a/README +++ b/README @@ -45,7 +45,7 @@ information about MPEG and DVD playing. Have a look at the documentation section, as well as the bookmarks. 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. diff --git a/include/config.h.in b/include/config.h.in index 2f5972e676..24c9aafb51 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -272,6 +272,9 @@ /* Environment variable containing the display method */ #define VOUT_METHOD_VAR "vlc_vout" +/* Environment variable containing the YUV method */ +#define YUV_METHOD_VAR "vlc_yuv" + /* The fallback method */ #define VOUT_DEFAULT_METHOD "x11" diff --git a/include/main.h b/include/main.h index b55bc743fc..9bd0b97ed3 100644 --- a/include/main.h +++ b/include/main.h @@ -38,6 +38,7 @@ typedef struct int i_argc; /* command line arguments count */ char ** ppsz_argv; /* command line arguments */ char ** ppsz_env; /* environment variables */ + char * psz_arg0; /* program name (whithout path) */ /* Generic settings */ boolean_t b_audio; /* is audio output allowed ? */ diff --git a/include/plugins.h b/include/plugins.h index 818e34970b..de1c34a923 100644 --- a/include/plugins.h +++ b/include/plugins.h @@ -43,6 +43,8 @@ typedef struct plugin_info_s void * vout_GetPlugin; void * intf_GetPlugin; void * yuv_GetPlugin; + + int i_score; } plugin_info_t; typedef struct plugin_bank_s diff --git a/include/plugins_export.h b/include/plugins_export.h deleted file mode 100644 index 04abe770ff..0000000000 --- a/include/plugins_export.h +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************** - * plugins_export.h : exporting plugins structure - ***************************************************************************** - * Copyright (C) 1999, 2000 VideoLAN - * - * Authors: - * - * 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. - *****************************************************************************/ - -/***************************************************************************** - * Prototypes - *****************************************************************************/ - -/* audio output */ -int aout_SysOpen ( aout_thread_t *p_aout ); -int aout_SysReset ( aout_thread_t *p_aout ); -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 ); - diff --git a/include/tests.h b/include/tests.h new file mode 100644 index 0000000000..c9104a3769 --- /dev/null +++ b/include/tests.h @@ -0,0 +1,30 @@ +/***************************************************************************** + * tests.h: several test functions needed by the plugins + ***************************************************************************** + * Copyright (C) 1996, 1997, 1998, 1999, 2000 VideoLAN + * + * Authors: + * + * 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. + *****************************************************************************/ + +/***************************************************************************** + * Prototypes + *****************************************************************************/ +int TestProgram( char * psz_program ); +int TestMethod( char * psz_var, char * psz_method ); +int TestVersion( char * psz_version ); +int TestMMX( void ); + diff --git a/plugins/beos/aout_beos.cpp b/plugins/beos/aout_beos.cpp index 0a2cdd1b82..3f16f91f50 100644 --- a/plugins/beos/aout_beos.cpp +++ b/plugins/beos/aout_beos.cpp @@ -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 */ p_aout->p_sys = (aout_sys_t*) malloc( sizeof( aout_sys_t ) ); @@ -136,41 +136,41 @@ int aout_SysOpen( aout_thread_t *p_aout ) 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 ); } /***************************************************************************** - * 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 ); } /***************************************************************************** - * 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 ); } /***************************************************************************** - * 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 ); } /***************************************************************************** - * 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(); @@ -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 *****************************************************************************/ -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; @@ -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->StopPlaying( ); diff --git a/plugins/beos/beos.cpp b/plugins/beos/beos.cpp index 0b92042925..b86b2b5582 100644 --- a/plugins/beos/beos.cpp +++ b/plugins/beos/beos.cpp @@ -40,14 +40,39 @@ extern "C" #include "video.h" #include "video_output.h" -#include "plugins_export.h" - /***************************************************************************** * Exported prototypes *****************************************************************************/ -void aout_GetPlugin( p_aout_thread_t p_aout ); -void vout_GetPlugin( p_vout_thread_t p_vout ); -void intf_GetPlugin( p_intf_thread_t p_intf ); +static void aout_GetPlugin( p_aout_thread_t p_aout ); +static void vout_GetPlugin( p_vout_thread_t p_vout ); +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 @@ -65,49 +90,43 @@ plugin_info_t * GetConfig( void ) p_info->intf_GetPlugin = intf_GetPlugin; p_info->yuv_GetPlugin = NULL; - return( p_info ); -} + /* the beos plugin always works under BeOS :) */ + p_info->i_score = 0x800; -/***************************************************************************** - * Test: tests if the plugin can be launched - *****************************************************************************/ -int Test( void ) -{ - /* the BeOS plugin always works under BeOS :) */ - return( 1 ); + return( p_info ); } /***************************************************************************** * 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_reset = aout_SysReset; - p_aout->p_sys_setformat = aout_SysSetFormat; - p_aout->p_sys_setchannels = aout_SysSetChannels; - p_aout->p_sys_setrate = aout_SysSetRate; - p_aout->p_sys_getbufinfo = aout_SysGetBufInfo; - p_aout->p_sys_playsamples = aout_SysPlaySamples; - p_aout->p_sys_close = aout_SysClose; + p_aout->p_sys_open = aout_BeOpen; + p_aout->p_sys_reset = aout_BeReset; + p_aout->p_sys_setformat = aout_BeSetFormat; + p_aout->p_sys_setchannels = aout_BeSetChannels; + p_aout->p_sys_setrate = aout_BeSetRate; + p_aout->p_sys_getbufinfo = aout_BeGetBufInfo; + p_aout->p_sys_playsamples = aout_BePlaySamples; + 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_init = vout_SysInit; - p_vout->p_sys_end = vout_SysEnd; - p_vout->p_sys_destroy = vout_SysDestroy; - p_vout->p_sys_manage = vout_SysManage; - p_vout->p_sys_display = vout_SysDisplay; + p_vout->p_sys_create = vout_BeCreate; + p_vout->p_sys_init = vout_BeInit; + p_vout->p_sys_end = vout_BeEnd; + p_vout->p_sys_destroy = vout_BeDestroy; + p_vout->p_sys_manage = vout_BeManage; + 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_destroy = intf_SysDestroy; - p_intf->p_sys_manage = intf_SysManage; + p_intf->p_sys_create = intf_BeCreate; + p_intf->p_sys_destroy = intf_BeDestroy; + p_intf->p_sys_manage = intf_BeManage; } } /* extern "C" */ diff --git a/plugins/beos/intf_beos.cpp b/plugins/beos/intf_beos.cpp index 51c13eb6fa..7118410190 100644 --- a/plugins/beos/intf_beos.cpp +++ b/plugins/beos/intf_beos.cpp @@ -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 */ p_intf->p_sys = (intf_sys_t*) malloc( sizeof( intf_sys_t ) ); @@ -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) */ if( p_intf->p_input ) @@ -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 ) { diff --git a/plugins/beos/vout_beos.cpp b/plugins/beos/vout_beos.cpp index 979ea3f6d4..dfb1224852 100644 --- a/plugins/beos/vout_beos.cpp +++ b/plugins/beos/vout_beos.cpp @@ -340,11 +340,11 @@ static int BeosOpenDisplay ( 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. *****************************************************************************/ -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 ) { /* Allocate structure */ @@ -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; u32 i_page_size; @@ -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; @@ -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 *****************************************************************************/ -void vout_SysDestroy( vout_thread_t *p_vout ) +void vout_BeDestroy( vout_thread_t *p_vout ) { BeosCloseDisplay( 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 * 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 ) { @@ -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 * 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; diff --git a/plugins/dsp/aout_dsp.c b/plugins/dsp/aout_dsp.c index 157ce257e4..5828a87c81 100644 --- a/plugins/dsp/aout_dsp.c +++ b/plugins/dsp/aout_dsp.c @@ -22,10 +22,10 @@ /* TODO: * - * - an aout_sysGetFormats() function + * - an aout_DspGetFormats() function * - dsp inline/static * - 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 } 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 * 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 */ p_aout->p_sys = malloc( sizeof( aout_sys_t ) ); @@ -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 ) { @@ -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 * contained in the dsp structure, and if this value could not be set, the * 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; @@ -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... *****************************************************************************/ -int aout_SysSetChannels( aout_thread_t *p_aout ) +int aout_DspSetChannels( aout_thread_t *p_aout ) { boolean_t b_stereo = p_aout->b_stereo; @@ -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 * dsp structure, but if the dsp doesn't support this value, the function uses * the value returned by ioctl... *****************************************************************************/ -int aout_SysSetRate( aout_thread_t *p_aout ) +int aout_DspSetRate( aout_thread_t *p_aout ) { long l_rate; @@ -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 : * - int fragments : number of available fragments (partially usend ones not @@ -209,7 +209,7 @@ int aout_SysSetRate( aout_thread_t *p_aout ) * - int bytes : available space in bytes (includes partially used fragments) * 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 ); @@ -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 *****************************************************************************/ -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 ) { @@ -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 ); } diff --git a/plugins/dsp/dsp.c b/plugins/dsp/dsp.c index 05376bb6ee..78bccbf10f 100644 --- a/plugins/dsp/dsp.c +++ b/plugins/dsp/dsp.c @@ -25,12 +25,17 @@ *****************************************************************************/ #include "defs.h" +#include +#include +#include #include /* malloc(), free() */ +#include /* close() */ #include "config.h" #include "common.h" /* boolean_t, byte_t */ #include "threads.h" #include "mtime.h" +#include "tests.h" #include "plugins.h" #include "interface.h" @@ -38,18 +43,30 @@ #include "video.h" #include "video_output.h" -#include "plugins_export.h" +#include "main.h" /***************************************************************************** * 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 *****************************************************************************/ plugin_info_t * GetConfig( void ) { + int i_fd; plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) ); p_info->psz_name = "OSS /dev/dsp"; @@ -61,31 +78,40 @@ plugin_info_t * GetConfig( void ) p_info->intf_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; + } -/***************************************************************************** - * Test: tests if the plugin can be launched - *****************************************************************************/ -int Test( void ) -{ - /* TODO: check if suitable */ - return( 1 ); + /* If this plugin was requested, score it higher */ + if( TestMethod( AOUT_METHOD_VAR, "dsp" ) ) + { + p_info->i_score += 0x200; + } + + return( p_info ); } /***************************************************************************** * 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_reset = aout_SysReset; - p_aout->p_sys_setformat = aout_SysSetFormat; - p_aout->p_sys_setchannels = aout_SysSetChannels; - p_aout->p_sys_setrate = aout_SysSetRate; - p_aout->p_sys_getbufinfo = aout_SysGetBufInfo; - p_aout->p_sys_playsamples = aout_SysPlaySamples; - p_aout->p_sys_close = aout_SysClose; + p_aout->p_sys_open = aout_DspOpen; + p_aout->p_sys_reset = aout_DspReset; + p_aout->p_sys_setformat = aout_DspSetFormat; + p_aout->p_sys_setchannels = aout_DspSetChannels; + p_aout->p_sys_setrate = aout_DspSetRate; + p_aout->p_sys_getbufinfo = aout_DspGetBufInfo; + p_aout->p_sys_playsamples = aout_DspPlaySamples; + p_aout->p_sys_close = aout_DspClose; } diff --git a/plugins/dummy/aout_dummy.c b/plugins/dummy/aout_dummy.c index ae0563369d..8aa1cdc810 100644 --- a/plugins/dummy/aout_dummy.c +++ b/plugins/dummy/aout_dummy.c @@ -48,9 +48,9 @@ typedef struct aout_sys_s } 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 */ p_aout->i_format = AOUT_DEFAULT_FORMAT; @@ -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 ); } /***************************************************************************** - * 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 ); } /***************************************************************************** - * 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 ); } /***************************************************************************** - * 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 ); } /***************************************************************************** - * 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 */ } /***************************************************************************** - * 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 ) { ; } diff --git a/plugins/dummy/dummy.c b/plugins/dummy/dummy.c index 28a091da7a..6113b3e7df 100644 --- a/plugins/dummy/dummy.c +++ b/plugins/dummy/dummy.c @@ -31,6 +31,7 @@ #include "common.h" /* boolean_t, byte_t */ #include "threads.h" #include "mtime.h" +#include "tests.h" #include "plugins.h" #include "interface.h" @@ -38,14 +39,39 @@ #include "video.h" #include "video_output.h" -#include "plugins_export.h" - /***************************************************************************** * Exported prototypes *****************************************************************************/ -void aout_GetPlugin( p_aout_thread_t p_aout ); -void vout_GetPlugin( p_vout_thread_t p_vout ); -void intf_GetPlugin( p_intf_thread_t p_intf ); +static void aout_GetPlugin( p_aout_thread_t p_aout ); +static void vout_GetPlugin( p_vout_thread_t p_vout ); +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 @@ -63,48 +89,55 @@ plugin_info_t * GetConfig( void ) p_info->intf_GetPlugin = intf_GetPlugin; p_info->yuv_GetPlugin = NULL; - return( p_info ); -} + /* The dummy plugin always works, but should have low priority */ + p_info->i_score = 0x1; -/***************************************************************************** - * Test: tests if the plugin can be launched - *****************************************************************************/ -int Test( void ) -{ - /* the dummy plugin always works */ - return( 1 ); + /* If this plugin was requested, score it higher */ + if( TestMethod( VOUT_METHOD_VAR, "dummy" ) ) + { + p_info->i_score += 0x200; + } + + /* 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 *****************************************************************************/ -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_reset = aout_SysReset; - p_aout->p_sys_setformat = aout_SysSetFormat; - p_aout->p_sys_setchannels = aout_SysSetChannels; - p_aout->p_sys_setrate = aout_SysSetRate; - p_aout->p_sys_getbufinfo = aout_SysGetBufInfo; - p_aout->p_sys_playsamples = aout_SysPlaySamples; - p_aout->p_sys_close = aout_SysClose; + p_aout->p_sys_open = aout_DummyOpen; + p_aout->p_sys_reset = aout_DummyReset; + p_aout->p_sys_setformat = aout_DummySetFormat; + p_aout->p_sys_setchannels = aout_DummySetChannels; + p_aout->p_sys_setrate = aout_DummySetRate; + p_aout->p_sys_getbufinfo = aout_DummyGetBufInfo; + p_aout->p_sys_playsamples = aout_DummyPlaySamples; + 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_init = vout_SysInit; - p_vout->p_sys_end = vout_SysEnd; - p_vout->p_sys_destroy = vout_SysDestroy; - p_vout->p_sys_manage = vout_SysManage; - p_vout->p_sys_display = vout_SysDisplay; + p_vout->p_sys_create = vout_DummyCreate; + p_vout->p_sys_init = vout_DummyInit; + p_vout->p_sys_end = vout_DummyEnd; + p_vout->p_sys_destroy = vout_DummyDestroy; + p_vout->p_sys_manage = vout_DummyManage; + 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_destroy = intf_SysDestroy; - p_intf->p_sys_manage = intf_SysManage; + p_intf->p_sys_create = intf_DummyCreate; + p_intf->p_sys_destroy = intf_DummyDestroy; + p_intf->p_sys_manage = intf_DummyManage; } diff --git a/plugins/dummy/intf_dummy.c b/plugins/dummy/intf_dummy.c index 0e04a90801..911c0eec3e 100644 --- a/plugins/dummy/intf_dummy.c +++ b/plugins/dummy/intf_dummy.c @@ -53,9 +53,9 @@ typedef struct intf_sys_s } 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 */ p_intf->p_sys = malloc( sizeof( intf_sys_t ) ); @@ -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) */ if( p_intf->p_input ) @@ -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 ) { ; } diff --git a/plugins/dummy/vout_dummy.c b/plugins/dummy/vout_dummy.c index fda4744a2d..10937363bd 100644 --- a/plugins/dummy/vout_dummy.c +++ b/plugins/dummy/vout_dummy.c @@ -66,11 +66,11 @@ static int DummyOpenDisplay ( 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. *****************************************************************************/ -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 ) { /* Allocate structure */ @@ -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 ); } /***************************************************************************** - * 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 *****************************************************************************/ -void vout_SysDestroy( vout_thread_t *p_vout ) +void vout_DummyDestroy( vout_thread_t *p_vout ) { DummyCloseDisplay( p_vout ); 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 * 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 ); } /***************************************************************************** - * vout_SysDisplay: displays previously rendered output + * vout_DummyDisplay: displays previously rendered output ***************************************************************************** * This function send the currently rendered image to dummy image, waits until * 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 ) { ; } diff --git a/plugins/esd/aout_esd.c b/plugins/esd/aout_esd.c index c7a42bfcda..62b188b2fa 100644 --- a/plugins/esd/aout_esd.c +++ b/plugins/esd/aout_esd.c @@ -64,15 +64,16 @@ typedef struct aout_sys_s } 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 */ int i_bits = ESD_BITS16; int i_mode = ESD_STREAM; int i_func = ESD_PLAY; + fprintf(stderr, "aout-esd !!\n"); /* Allocate structure */ p_aout->p_sys = malloc( sizeof( aout_sys_t ) ); if( p_aout->p_sys == NULL ) @@ -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 ); } /***************************************************************************** - * 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 ); } /***************************************************************************** - * 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 ); } /***************************************************************************** - * 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 ); } /***************************************************************************** - * 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 */ 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 *****************************************************************************/ -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; @@ -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 ); } diff --git a/plugins/esd/esd.c b/plugins/esd/esd.c index afde0602e2..ee35ec897d 100644 --- a/plugins/esd/esd.c +++ b/plugins/esd/esd.c @@ -31,6 +31,7 @@ #include "common.h" /* boolean_t, byte_t */ #include "threads.h" #include "mtime.h" +#include "tests.h" #include "plugins.h" #include "interface.h" @@ -38,12 +39,21 @@ #include "video.h" #include "video_output.h" -#include "plugins_export.h" - /***************************************************************************** * 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 @@ -61,31 +71,31 @@ plugin_info_t * GetConfig( void ) p_info->intf_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; -/***************************************************************************** - * Test: tests if the plugin can be launched - *****************************************************************************/ -int Test( void ) -{ - /* TODO: check if suitable */ - return( 1 ); + /* If this plugin was requested, score it higher */ + if( TestMethod( AOUT_METHOD_VAR, "esd" ) ) + { + p_info->i_score += 0x200; + } + + return( p_info ); } /***************************************************************************** * 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_reset = aout_SysReset; - p_aout->p_sys_setformat = aout_SysSetFormat; - p_aout->p_sys_setchannels = aout_SysSetChannels; - p_aout->p_sys_setrate = aout_SysSetRate; - p_aout->p_sys_getbufinfo = aout_SysGetBufInfo; - p_aout->p_sys_playsamples = aout_SysPlaySamples; - p_aout->p_sys_close = aout_SysClose; + p_aout->p_sys_open = aout_EsdOpen; + p_aout->p_sys_reset = aout_EsdReset; + p_aout->p_sys_setformat = aout_EsdSetFormat; + p_aout->p_sys_setchannels = aout_EsdSetChannels; + p_aout->p_sys_setrate = aout_EsdSetRate; + p_aout->p_sys_getbufinfo = aout_EsdGetBufInfo; + p_aout->p_sys_playsamples = aout_EsdPlaySamples; + p_aout->p_sys_close = aout_EsdClose; } diff --git a/plugins/fb/fb.c b/plugins/fb/fb.c index 836d82a332..4f6a571fbc 100644 --- a/plugins/fb/fb.c +++ b/plugins/fb/fb.c @@ -25,12 +25,17 @@ *****************************************************************************/ #include "defs.h" +#include +#include +#include #include /* malloc(), free() */ +#include /* close() */ #include "config.h" #include "common.h" /* boolean_t, byte_t */ #include "threads.h" #include "mtime.h" +#include "tests.h" #include "plugins.h" #include "interface.h" @@ -38,19 +43,36 @@ #include "video.h" #include "video_output.h" -#include "plugins_export.h" +#include "main.h" /***************************************************************************** * Exported prototypes *****************************************************************************/ -void vout_GetPlugin( p_vout_thread_t p_vout ); -void intf_GetPlugin( p_intf_thread_t p_intf ); +static void vout_GetPlugin( p_vout_thread_t p_vout ); +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 *****************************************************************************/ plugin_info_t * GetConfig( void ) { + int i_fd; plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) ); p_info->psz_name = "Linux framebuffer"; @@ -62,39 +84,54 @@ plugin_info_t * GetConfig( void ) p_info->intf_GetPlugin = intf_GetPlugin; 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; + } -/***************************************************************************** - * Test: tests if the plugin can be launched - *****************************************************************************/ -int Test( void ) -{ - /* TODO: detect the framebuffer ioctl()s in the kernel */ - return( 1 ); + 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 ); } /***************************************************************************** * 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_init = vout_SysInit; - p_vout->p_sys_end = vout_SysEnd; - p_vout->p_sys_destroy = vout_SysDestroy; - p_vout->p_sys_manage = vout_SysManage; - p_vout->p_sys_display = vout_SysDisplay; + p_vout->p_sys_create = vout_FBCreate; + p_vout->p_sys_init = vout_FBInit; + p_vout->p_sys_end = vout_FBEnd; + p_vout->p_sys_destroy = vout_FBDestroy; + p_vout->p_sys_manage = vout_FBManage; + p_vout->p_sys_display = vout_FBDisplay; /* 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_destroy = intf_SysDestroy; - p_intf->p_sys_manage = intf_SysManage; + p_intf->p_sys_create = intf_FBCreate; + p_intf->p_sys_destroy = intf_FBDestroy; + p_intf->p_sys_manage = intf_FBManage; } diff --git a/plugins/fb/intf_fb.c b/plugins/fb/intf_fb.c index 348b3cc155..87c57b9967 100644 --- a/plugins/fb/intf_fb.c +++ b/plugins/fb/intf_fb.c @@ -82,9 +82,9 @@ static void FBTextMode ( 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 vt_mode vt_mode; /* vt current mode */ @@ -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 */ tcsetattr(0, 0, &p_intf->p_sys->old_termios); @@ -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]; diff --git a/plugins/fb/vout_fb.c b/plugins/fb/vout_fb.c index 15c1e77242..27b13a14e5 100644 --- a/plugins/fb/vout_fb.c +++ b/plugins/fb/vout_fb.c @@ -75,11 +75,11 @@ static int FBOpenDisplay ( 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. *****************************************************************************/ -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 ) { /* Allocate structure */ @@ -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 ); } /***************************************************************************** - * 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 *****************************************************************************/ -void vout_SysDestroy( vout_thread_t *p_vout ) +void vout_FBDestroy( vout_thread_t *p_vout ) { FBCloseDisplay( p_vout ); 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 * 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 @@ -145,10 +145,10 @@ int vout_SysManage( vout_thread_t *p_vout ) p_vout->i_changes &= ~VOUT_SIZE_CHANGE; /* 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. */ - if( vout_SysInit( p_vout ) ) + if( vout_FBInit( p_vout ) ) { intf_ErrMsg("error: can't resize display\n"); return( 1 ); @@ -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 * 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 */ 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 ) } /***************************************************************************** - * 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 * anything, but could later send information on which colors it was unable * 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 ) { struct fb_cmap cmap = { 0, 256, red, green, blue, transp }; diff --git a/plugins/ggi/ggi.c b/plugins/ggi/ggi.c index 2ff0e107fe..3dd6a7819f 100644 --- a/plugins/ggi/ggi.c +++ b/plugins/ggi/ggi.c @@ -31,6 +31,7 @@ #include "common.h" /* boolean_t, byte_t */ #include "threads.h" #include "mtime.h" +#include "tests.h" #include "plugins.h" #include "interface.h" @@ -38,13 +39,27 @@ #include "video.h" #include "video_output.h" -#include "plugins_export.h" - /***************************************************************************** * Exported prototypes *****************************************************************************/ -void vout_GetPlugin( p_vout_thread_t p_vout ); -void intf_GetPlugin( p_intf_thread_t p_intf ); +static void vout_GetPlugin( p_vout_thread_t p_vout ); +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 @@ -62,36 +77,42 @@ plugin_info_t * GetConfig( void ) p_info->intf_GetPlugin = intf_GetPlugin; 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; -/***************************************************************************** - * Test: tests if the plugin can be launched - *****************************************************************************/ -int Test( void ) -{ - /* TODO: detect GGI_DISPLAY or whatever */ - return( 1 ); + if( TestProgram( "ggivlc" ) ) + { + p_info->i_score += 0x180; + } + + /* If this plugin was requested, score it higher */ + if( TestMethod( VOUT_METHOD_VAR, "ggi" ) ) + { + p_info->i_score += 0x200; + } + + return( p_info ); } /***************************************************************************** * 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_init = vout_SysInit; - p_vout->p_sys_end = vout_SysEnd; - p_vout->p_sys_destroy = vout_SysDestroy; - p_vout->p_sys_manage = vout_SysManage; - p_vout->p_sys_display = vout_SysDisplay; + p_vout->p_sys_create = vout_GGICreate; + p_vout->p_sys_init = vout_GGIInit; + p_vout->p_sys_end = vout_GGIEnd; + p_vout->p_sys_destroy = vout_GGIDestroy; + p_vout->p_sys_manage = vout_GGIManage; + 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_destroy = intf_SysDestroy; - p_intf->p_sys_manage = intf_SysManage; + p_intf->p_sys_create = intf_GGICreate; + p_intf->p_sys_destroy = intf_GGIDestroy; + p_intf->p_sys_manage = intf_GGIManage; } diff --git a/plugins/ggi/intf_ggi.c b/plugins/ggi/intf_ggi.c index c22d50752d..46f4217d4c 100644 --- a/plugins/ggi/intf_ggi.c +++ b/plugins/ggi/intf_ggi.c @@ -71,9 +71,9 @@ typedef struct intf_sys_s 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 */ if( !p_main->b_video ) @@ -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) */ if( p_intf->p_input ) @@ -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 */ diff --git a/plugins/ggi/vout_ggi.c b/plugins/ggi/vout_ggi.c index e3cdd9fff3..b1cdd7ff47 100644 --- a/plugins/ggi/vout_ggi.c +++ b/plugins/ggi/vout_ggi.c @@ -65,13 +65,13 @@ static int GGIOpenDisplay ( vout_thread_t *p_vout, char *psz_display, void 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 * vout properties to choose the correct mode, and change them according to the * 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 */ 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, } /***************************************************************************** - * vout_SysInit: initialize GGI video thread output method + * vout_GGIInit: initialize GGI video thread output method ***************************************************************************** * 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 */ if( p_vout->p_sys->b_must_acquire ) @@ -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 */ if( p_vout->p_sys->b_must_acquire ) @@ -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 ); 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 * 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 ?? */ 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 * 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 */ if( p_vout->p_sys->b_must_acquire ) diff --git a/plugins/glide/glide.c b/plugins/glide/glide.c index cf9ed83569..d7fc8273bc 100644 --- a/plugins/glide/glide.c +++ b/plugins/glide/glide.c @@ -27,10 +27,16 @@ #include /* malloc(), free() */ +#ifndef __linux__ +#include /* for glide ? */ +#endif +#include + #include "config.h" #include "common.h" /* boolean_t, byte_t */ #include "threads.h" #include "mtime.h" +#include "tests.h" #include "plugins.h" #include "interface.h" @@ -38,13 +44,27 @@ #include "video.h" #include "video_output.h" -#include "plugins_export.h" - /***************************************************************************** * Exported prototypes *****************************************************************************/ -void vout_GetPlugin( p_vout_thread_t p_vout ); -void intf_GetPlugin( p_intf_thread_t p_intf ); +static void vout_GetPlugin( p_vout_thread_t p_vout ); +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 @@ -62,36 +82,44 @@ plugin_info_t * GetConfig( void ) p_info->intf_GetPlugin = intf_GetPlugin; 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; -/***************************************************************************** - * Test: tests if the plugin can be launched - *****************************************************************************/ -int Test( void ) -{ - /* TODO: detect a 3dfx card */ - return( 1 ); + if( TestProgram( "glidevlc" ) ) + { + p_info->i_score += 0x180; + } + + /* If this plugin was requested, score it higher */ + if( TestMethod( VOUT_METHOD_VAR, "glide" ) ) + { + p_info->i_score += 0x200; + } + + return( p_info ); } /***************************************************************************** * 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_init = vout_SysInit; - p_vout->p_sys_end = vout_SysEnd; - p_vout->p_sys_destroy = vout_SysDestroy; - p_vout->p_sys_manage = vout_SysManage; - p_vout->p_sys_display = vout_SysDisplay; + p_vout->p_sys_create = vout_GlideCreate; + p_vout->p_sys_init = vout_GlideInit; + p_vout->p_sys_end = vout_GlideEnd; + p_vout->p_sys_destroy = vout_GlideDestroy; + p_vout->p_sys_manage = vout_GlideManage; + 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_destroy = intf_SysDestroy; - p_intf->p_sys_manage = intf_SysManage; + p_intf->p_sys_create = intf_GlideCreate; + p_intf->p_sys_destroy = intf_GlideDestroy; + p_intf->p_sys_manage = intf_GlideManage; } diff --git a/plugins/glide/intf_glide.c b/plugins/glide/intf_glide.c index acd1ea761c..c3fbd1a23b 100644 --- a/plugins/glide/intf_glide.c +++ b/plugins/glide/intf_glide.c @@ -54,9 +54,9 @@ typedef struct intf_sys_s } 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 */ p_intf->p_sys = malloc( sizeof( intf_sys_t ) ); @@ -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) */ if( p_intf->p_input ) @@ -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; diff --git a/plugins/glide/vout_glide.c b/plugins/glide/vout_glide.c index 6d6ff9c761..de5282a286 100644 --- a/plugins/glide/vout_glide.c +++ b/plugins/glide/vout_glide.c @@ -74,11 +74,11 @@ static int GlideOpenDisplay ( 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. *****************************************************************************/ -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 ) { /* Allocate structure */ @@ -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 ); } /***************************************************************************** - * 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 *****************************************************************************/ -void vout_SysDestroy( vout_thread_t *p_vout ) +void vout_GlideDestroy( vout_thread_t *p_vout ) { GlideCloseDisplay( p_vout ); 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 * 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; } /***************************************************************************** - * vout_SysDisplay: displays previously rendered output + * vout_GlideDisplay: displays previously rendered output ***************************************************************************** * This function send the currently rendered image to Glide image, waits until * 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 ); @@ -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 ); 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 ); } diff --git a/plugins/gnome/gnome.c b/plugins/gnome/gnome.c index fe626e5657..02d9384179 100644 --- a/plugins/gnome/gnome.c +++ b/plugins/gnome/gnome.c @@ -27,10 +27,13 @@ #include /* malloc(), free() */ +#include + #include "config.h" #include "common.h" /* boolean_t, byte_t */ #include "threads.h" #include "mtime.h" +#include "tests.h" #include "plugins.h" #include "interface.h" @@ -38,19 +41,36 @@ #include "video.h" #include "video_output.h" -#include "plugins_export.h" +#include "main.h" /***************************************************************************** * Exported prototypes *****************************************************************************/ -void vout_GetPlugin( p_vout_thread_t p_vout ); -void intf_GetPlugin( p_intf_thread_t p_intf ); +static void vout_GetPlugin( p_vout_thread_t p_vout ); +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 *****************************************************************************/ plugin_info_t * GetConfig( void ) { + Display *p_display; plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) ); p_info->psz_name = "Gnome"; @@ -62,39 +82,54 @@ plugin_info_t * GetConfig( void ) p_info->intf_GetPlugin = intf_GetPlugin; 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; + } -/***************************************************************************** - * Test: tests if the plugin can be launched - *****************************************************************************/ -int Test( void ) -{ - /* TODO: detect an X display or Gnome libs */ - return( 1 ); + return( p_info ); } /***************************************************************************** * 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_init = vout_SysInit; - p_vout->p_sys_end = vout_SysEnd; - p_vout->p_sys_destroy = vout_SysDestroy; - p_vout->p_sys_manage = vout_SysManage; - p_vout->p_sys_display = vout_SysDisplay; + p_vout->p_sys_create = vout_GnomeCreate; + p_vout->p_sys_init = vout_GnomeInit; + p_vout->p_sys_end = vout_GnomeEnd; + p_vout->p_sys_destroy = vout_GnomeDestroy; + p_vout->p_sys_manage = vout_GnomeManage; + p_vout->p_sys_display = vout_GnomeDisplay; /* 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_destroy = intf_SysDestroy; - p_intf->p_sys_manage = intf_SysManage; + p_intf->p_sys_create = intf_GnomeCreate; + p_intf->p_sys_destroy = intf_GnomeDestroy; + p_intf->p_sys_manage = intf_GnomeManage; } diff --git a/plugins/gnome/intf_gnome.c b/plugins/gnome/intf_gnome.c index 0ed936a984..6fb1207032 100644 --- a/plugins/gnome/intf_gnome.c +++ b/plugins/gnome/intf_gnome.c @@ -62,9 +62,9 @@ #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; @@ -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 */ GnomeEnableScreenSaver( 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 */ GnomeManageWindow( p_intf ); diff --git a/plugins/gnome/vout_gnome.c b/plugins/gnome/vout_gnome.c index eec5edac45..c9335b16d0 100644 --- a/plugins/gnome/vout_gnome.c +++ b/plugins/gnome/vout_gnome.c @@ -79,7 +79,8 @@ typedef struct vout_sys_s /***************************************************************************** * 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 int X11CreateWindow ( 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, 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 * vout properties to choose the window size, and change them according to the * 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 ) { /* Allocate structure */ @@ -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 * 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; @@ -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 * 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... */ { @@ -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 *****************************************************************************/ -void vout_SysDestroy( vout_thread_t *p_vout ) +void vout_GnomeDestroy( vout_thread_t *p_vout ) { X11CloseDisplay( p_vout ); 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 * X11 events and allows window resizing. It returns a non null value on * 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 @@ -247,10 +248,10 @@ int vout_SysManage( vout_thread_t *p_vout ) p_vout->i_width, p_vout->i_height ); /* 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. */ - if( vout_SysInit( p_vout ) ) + if( vout_GnomeInit( p_vout ) ) { intf_ErrMsg("error: can't resize display\n"); return( 1 ); @@ -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 * 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 */ { @@ -299,14 +300,14 @@ 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 * anything, but could later send information on which colors it was unable * to set. *****************************************************************************/ -void vout_SetPalette( p_vout_thread_t p_vout, - u16 *red, u16 *green, u16 *blue, u16 *transp ) +void vout_GnomeSetPalette( p_vout_thread_t p_vout, + u16 *red, u16 *green, u16 *blue, u16 *transp ) { int i; XColor color[255]; diff --git a/plugins/mga/intf_mga.c b/plugins/mga/intf_mga.c index 895f98b350..3cc607ec68 100644 --- a/plugins/mga/intf_mga.c +++ b/plugins/mga/intf_mga.c @@ -90,9 +90,9 @@ static void X11DisableScreenSaver ( 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; @@ -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 */ X11EnableScreenSaver( 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 */ X11ManageWindow( p_intf ); diff --git a/plugins/mga/mga.c b/plugins/mga/mga.c index 10b480157b..b824b78d56 100644 --- a/plugins/mga/mga.c +++ b/plugins/mga/mga.c @@ -38,13 +38,27 @@ #include "video.h" #include "video_output.h" -#include "plugins_export.h" - /***************************************************************************** * Exported prototypes *****************************************************************************/ -void vout_GetPlugin( p_vout_thread_t p_vout ); -void intf_GetPlugin( p_intf_thread_t p_intf ); +static void vout_GetPlugin( p_vout_thread_t p_vout ); +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 @@ -62,36 +76,30 @@ plugin_info_t * GetConfig( void ) p_info->intf_GetPlugin = intf_GetPlugin; p_info->yuv_GetPlugin = NULL; - return( p_info ); -} + /* The MGA module does not work yet */ + p_info->i_score = 0x0; -/***************************************************************************** - * Test: tests if the plugin can be launched - *****************************************************************************/ -int Test( void ) -{ - /* TODO: detect an MGA card ? */ - return( 1 ); + return( p_info ); } /***************************************************************************** * 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_init = vout_SysInit; - p_vout->p_sys_end = vout_SysEnd; - p_vout->p_sys_destroy = vout_SysDestroy; - p_vout->p_sys_manage = vout_SysManage; - p_vout->p_sys_display = vout_SysDisplay; + p_vout->p_sys_create = vout_MGACreate; + p_vout->p_sys_init = vout_MGAInit; + p_vout->p_sys_end = vout_MGAEnd; + p_vout->p_sys_destroy = vout_MGADestroy; + p_vout->p_sys_manage = vout_MGAManage; + 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_destroy = intf_SysDestroy; - p_intf->p_sys_manage = intf_SysManage; + p_intf->p_sys_create = intf_MGACreate; + p_intf->p_sys_destroy = intf_MGADestroy; + p_intf->p_sys_manage = intf_MGAManage; } diff --git a/plugins/mga/vout_mga.c b/plugins/mga/vout_mga.c index a8a59d1929..2e3f4e5286 100644 --- a/plugins/mga/vout_mga.c +++ b/plugins/mga/vout_mga.c @@ -55,13 +55,13 @@ #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 * vout properties to choose the window size, and change them according to the * 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 ) { /* Allocate structure */ @@ -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 * 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; @@ -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. *****************************************************************************/ -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... */ { @@ -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 *****************************************************************************/ -void vout_SysDestroy( vout_thread_t *p_vout ) +void vout_MGADestroy( vout_thread_t *p_vout ) { X11CloseDisplay( 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 * X11 events and allows window resizing. It returns a non null value on * 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 @@ -280,10 +280,10 @@ int vout_SysManage( vout_thread_t *p_vout ) p_vout->i_width, p_vout->i_height ); /* 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. */ - if( vout_SysInit( p_vout ) ) + if( vout_MGAInit( p_vout ) ) { intf_ErrMsg("error: can't resize display\n"); return( 1 ); @@ -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 * 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 */ { diff --git a/plugins/x11/intf_x11.c b/plugins/x11/intf_x11.c index fb544424f8..6be9c9cbeb 100644 --- a/plugins/x11/intf_x11.c +++ b/plugins/x11/intf_x11.c @@ -91,9 +91,9 @@ static void X11DisableScreenSaver ( 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; @@ -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 */ X11EnableScreenSaver( 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 */ X11ManageWindow( p_intf ); diff --git a/plugins/x11/vout_x11.c b/plugins/x11/vout_x11.c index 20031ddd86..7b95b33f1f 100644 --- a/plugins/x11/vout_x11.c +++ b/plugins/x11/vout_x11.c @@ -91,13 +91,13 @@ static void X11DestroyShmImage ( vout_thread_t *p_vout, XImage *p_ximage, 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 * vout properties to choose the window size, and change them according to the * 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 ) { /* Allocate structure */ @@ -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 * 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; @@ -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. *****************************************************************************/ -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... */ { @@ -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 *****************************************************************************/ -void vout_SysDestroy( vout_thread_t *p_vout ) +void vout_X11Destroy( vout_thread_t *p_vout ) { X11CloseDisplay( p_vout ); 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 * X11 events and allows window resizing. It returns a non null value on * 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 @@ -248,10 +248,10 @@ int vout_SysManage( vout_thread_t *p_vout ) p_vout->i_width, p_vout->i_height ); /* 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. */ - if( vout_SysInit( p_vout ) ) + if( vout_X11Init( p_vout ) ) { intf_ErrMsg("error: can't resize display\n"); return( 1 ); @@ -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 * 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 */ { @@ -301,14 +301,14 @@ 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 * anything, but could later send information on which colors it was unable * to set. *****************************************************************************/ -void vout_SetPalette( p_vout_thread_t p_vout, - u16 *red, u16 *green, u16 *blue, u16 *transp ) +void vout_X11SetPalette( p_vout_thread_t p_vout, + u16 *red, u16 *green, u16 *blue, u16 *transp ) { int i; XColor color[255]; diff --git a/plugins/x11/x11.c b/plugins/x11/x11.c index 3a104d331a..87d69be63c 100644 --- a/plugins/x11/x11.c +++ b/plugins/x11/x11.c @@ -27,10 +27,13 @@ #include /* malloc(), free() */ +#include + #include "config.h" #include "common.h" /* boolean_t, byte_t */ #include "threads.h" #include "mtime.h" +#include "tests.h" #include "plugins.h" #include "interface.h" @@ -38,19 +41,36 @@ #include "video.h" #include "video_output.h" -#include "plugins_export.h" +#include "main.h" /***************************************************************************** * Exported prototypes *****************************************************************************/ -void vout_GetPlugin( p_vout_thread_t p_vout ); -void intf_GetPlugin( p_intf_thread_t p_intf ); +static void vout_GetPlugin( p_vout_thread_t p_vout ); +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 *****************************************************************************/ plugin_info_t * GetConfig( void ) { + Display *p_display; plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) ); p_info->psz_name = "X Window System"; @@ -62,39 +82,54 @@ plugin_info_t * GetConfig( void ) p_info->intf_GetPlugin = intf_GetPlugin; 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; + } -/***************************************************************************** - * Test: tests if the plugin can be launched - *****************************************************************************/ -int Test( void ) -{ - /* TODO: detect an X display */ - return( 1 ); + return( p_info ); } /***************************************************************************** * 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_init = vout_SysInit; - p_vout->p_sys_end = vout_SysEnd; - p_vout->p_sys_destroy = vout_SysDestroy; - p_vout->p_sys_manage = vout_SysManage; - p_vout->p_sys_display = vout_SysDisplay; + p_vout->p_sys_create = vout_X11Create; + p_vout->p_sys_init = vout_X11Init; + p_vout->p_sys_end = vout_X11End; + p_vout->p_sys_destroy = vout_X11Destroy; + p_vout->p_sys_manage = vout_X11Manage; + p_vout->p_sys_display = vout_X11Display; /* 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_destroy = intf_SysDestroy; - p_intf->p_sys_manage = intf_SysManage; + p_intf->p_sys_create = intf_X11Create; + p_intf->p_sys_destroy = intf_X11Destroy; + p_intf->p_sys_manage = intf_X11Manage; } diff --git a/plugins/yuv/video_yuv.c b/plugins/yuv/video_yuv.c index 20a43e2b64..8171ea570d 100644 --- a/plugins/yuv/video_yuv.c +++ b/plugins/yuv/video_yuv.c @@ -45,21 +45,13 @@ #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 ***************************************************************************** * This function will allocate memory to store translation tables, depending * 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 */ @@ -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 - * set functions pointers. + * Free memory allocated by yuv_CCreate. *****************************************************************************/ -int yuv_SysReset( vout_thread_t *p_vout ) +void yuv_CEnd( vout_thread_t *p_vout ) { - yuv_SysEnd( p_vout ); - return( yuv_SysInit( p_vout ) ); + free( p_vout->yuv.p_base ); + 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 ); - free( p_vout->yuv.p_buffer ); - free( p_vout->yuv.p_offset ); + yuv_CEnd( p_vout ); + return( yuv_CInit( p_vout ) ); } /* following functions are local */ diff --git a/plugins/yuv/video_yuv16.c b/plugins/yuv/video_yuv16.c index 7fec51175f..c971a21da6 100644 --- a/plugins/yuv/video_yuv16.c +++ b/plugins/yuv/video_yuv16.c @@ -73,6 +73,8 @@ void ConvertY4Gray16( YUV_ARGS_16BPP ) SetOffset( i_width, i_height, i_pic_width, i_pic_height, &b_horizontal_scaling, &i_vertical_scaling, p_offset_start ); + p_y = p_v; + i_height /= 4; /* * Perform conversion */ diff --git a/plugins/yuv/yuv.c b/plugins/yuv/yuv.c index e5350bf01e..7122662508 100644 --- a/plugins/yuv/yuv.c +++ b/plugins/yuv/yuv.c @@ -31,6 +31,7 @@ #include "common.h" /* boolean_t, byte_t */ #include "threads.h" #include "mtime.h" +#include "tests.h" #include "plugins.h" #include "interface.h" @@ -38,12 +39,15 @@ #include "video.h" #include "video_output.h" -#include "plugins_export.h" - /***************************************************************************** * 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 @@ -61,25 +65,26 @@ plugin_info_t * GetConfig( void ) p_info->intf_GetPlugin = NULL; p_info->yuv_GetPlugin = yuv_GetPlugin; - return( p_info ); -} + /* The C YUV functions should always work */ + p_info->i_score = 0x100; -/***************************************************************************** - * Test: tests if the plugin can be launched - *****************************************************************************/ -int Test( void ) -{ - return( 1 ); + /* If this plugin was requested, score it higher */ + if( TestMethod( YUV_METHOD_VAR, "nommx" ) ) + { + p_info->i_score += 0x200; + } + + return( p_info ); } /***************************************************************************** * 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_reset = yuv_SysReset; - p_vout->p_yuv_end = yuv_SysEnd; + p_vout->p_yuv_init = yuv_CInit; + p_vout->p_yuv_reset = yuv_CReset; + p_vout->p_yuv_end = yuv_CEnd; } diff --git a/plugins/yuvmmx/video_yuv.c b/plugins/yuvmmx/video_yuv.c index 20a43e2b64..4937a19f2c 100644 --- a/plugins/yuvmmx/video_yuv.c +++ b/plugins/yuvmmx/video_yuv.c @@ -45,21 +45,13 @@ #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 ***************************************************************************** * This function will allocate memory to store translation tables, depending * 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 */ @@ -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 - * set functions pointers. + * Free memory allocated by yuv_MMXCreate. *****************************************************************************/ -int yuv_SysReset( vout_thread_t *p_vout ) +void yuv_MMXEnd( vout_thread_t *p_vout ) { - yuv_SysEnd( p_vout ); - return( yuv_SysInit( p_vout ) ); + free( p_vout->yuv.p_base ); + 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 ); - free( p_vout->yuv.p_buffer ); - free( p_vout->yuv.p_offset ); + yuv_MMXEnd( p_vout ); + return( yuv_MMXInit( p_vout ) ); } /* following functions are local */ diff --git a/plugins/yuvmmx/yuvmmx.c b/plugins/yuvmmx/yuvmmx.c index 19fbb21e42..955ef4a91a 100644 --- a/plugins/yuvmmx/yuvmmx.c +++ b/plugins/yuvmmx/yuvmmx.c @@ -31,6 +31,7 @@ #include "common.h" /* boolean_t, byte_t */ #include "threads.h" #include "mtime.h" +#include "tests.h" /* TestMMX() */ #include "plugins.h" #include "interface.h" @@ -38,12 +39,15 @@ #include "video.h" #include "video_output.h" -#include "plugins_export.h" - /***************************************************************************** * 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 @@ -61,25 +65,32 @@ plugin_info_t * GetConfig( void ) p_info->intf_GetPlugin = NULL; p_info->yuv_GetPlugin = yuv_GetPlugin; - return( p_info ); -} + if( TestMMX() ) + { + p_info->i_score = 0x200; + } + else + { + p_info->i_score = 0x0; + } -/***************************************************************************** - * Test: tests if the plugin can be launched - *****************************************************************************/ -int Test( void ) -{ - return( 1 ); + /* If this plugin was requested, score it higher */ + if( TestMethod( YUV_METHOD_VAR, "mmx" ) ) + { + p_info->i_score += 0x200; + } + + return( p_info ); } /***************************************************************************** * 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_reset = yuv_SysReset; - p_vout->p_yuv_end = yuv_SysEnd; + p_vout->p_yuv_init = yuv_MMXInit; + p_vout->p_yuv_reset = yuv_MMXReset; + p_vout->p_yuv_end = yuv_MMXEnd; } diff --git a/src/audio_output/audio_output.c b/src/audio_output/audio_output.c index 7f08657e79..3b1df4eef2 100644 --- a/src/audio_output/audio_output.c +++ b/src/audio_output/audio_output.c @@ -82,8 +82,9 @@ aout_thread_t *aout_CreateThread( int *pi_status ) aout_thread_t * p_aout; /* thread descriptor */ typedef void ( aout_getplugin_t ) ( aout_thread_t * p_aout ); int i_index; + int i_best_index = 0, i_best_score = 0; #if 0 - int i_status; /* thread status */ + int i_status; /* thread status */ #endif /* Allocate descriptor */ @@ -102,13 +103,27 @@ aout_thread_t *aout_CreateThread( int *pi_status ) /* ... and if this plugin provides the functions we want ... */ if( p_main->p_bank->p_info[ i_index ]->aout_GetPlugin != NULL ) { - /* ... then get these functions */ - ( (aout_getplugin_t *) - p_main->p_bank->p_info[ i_index ]->aout_GetPlugin )( p_aout ); + /* ... and if this plugin has a good score ... */ + if( p_main->p_bank->p_info[ i_index ]->i_score > i_best_score ) + { + /* ... 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 */ diff --git a/src/interface/interface.c b/src/interface/interface.c index 15ed2a7a6f..ee4370453e 100644 --- a/src/interface/interface.c +++ b/src/interface/interface.c @@ -93,6 +93,7 @@ intf_thread_t* intf_Create( void ) intf_thread_t * p_intf; typedef void ( intf_getplugin_t ) ( intf_thread_t * p_intf ); int i_index; + int i_best_index = 0, i_best_score = 0; /* Allocate structure */ p_intf = malloc( sizeof( intf_thread_t ) ); @@ -111,13 +112,27 @@ intf_thread_t* intf_Create( void ) /* ... and if this plugin provides the functions we want ... */ if( p_main->p_bank->p_info[ i_index ]->intf_GetPlugin != NULL ) { - /* ... then get these functions */ - ( (intf_getplugin_t *) - p_main->p_bank->p_info[ i_index ]->intf_GetPlugin )( p_intf ); + /* ... and if this plugin has a good score ... */ + if( p_main->p_bank->p_info[ i_index ]->i_score > i_best_score ) + { + /* ... 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 */ p_intf->b_die = 0; p_intf->p_vout = NULL; diff --git a/src/interface/main.c b/src/interface/main.c index bd50e63cbe..e8dacdebb9 100644 --- a/src/interface/main.c +++ b/src/interface/main.c @@ -39,6 +39,7 @@ #include "common.h" #include "threads.h" #include "mtime.h" +#include "tests.h" /* TestMMX() */ #include "plugins.h" #include "playlist.h" #include "input_vlan.h" @@ -73,6 +74,7 @@ #define OPT_WIDTH 163 #define OPT_HEIGHT 164 #define OPT_COLOR 165 +#define OPT_YUV 166 #define OPT_NOVLANS 170 #define OPT_SERVER 171 @@ -107,6 +109,7 @@ static const struct option longopts[] = { "height", 1, 0, OPT_HEIGHT }, { "grayscale", 0, 0, 'g' }, { "color", 0, 0, OPT_COLOR }, + { "yuv", 1, 0, OPT_YUV }, /* DVD options */ { "dvdaudio", 1, 0, 'a' }, @@ -160,17 +163,17 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) p_main = &main_data; /* set up the global variable */ -#ifdef SYS_BEOS /* * System specific initialization code */ +#ifdef SYS_BEOS beos_Create(); #endif -#ifdef HAVE_MMX /* * Test if our code is likely to run on this CPU */ +#ifdef HAVE_MMX if( !TestMMX() ) { fprintf( stderr, "Sorry, this program needs an MMX processor. " @@ -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 */ { intf_MsgDestroy(); - fprintf( stderr, "error: can't read configuration (%s)\n", - strerror(errno) ); return( errno ); } @@ -259,6 +260,9 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) { InitSignalHandler(); /* prepare signals for interception */ + /* + * This is the main loop + */ intf_Run( p_main->p_intf ); intf_Destroy( p_main->p_intf ); @@ -419,6 +423,7 @@ static void SetDefaultConfiguration( void ) static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) { int c, i_opt; + char * p_pointer; /* Set default configuration and copy arguments */ p_main->i_argc = i_argc; @@ -428,6 +433,20 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) 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 */ opterr = 0; 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[] ) case OPT_COLOR: /* --color */ main_PutIntVariable( VOUT_GRAYSCALE_VAR, 0 ); break; + case OPT_YUV: /* --yuv */ + main_PutPszVariable( YUV_METHOD_VAR, optarg ); + break; /* DVD options */ case 'a': @@ -541,11 +563,13 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) static void Usage( int i_fashion ) { /* 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 ) { - intf_Msg( "Try `vlc --help' for more information.\n" ); + intf_Msg( "Try `%s --help' for more information.\n", + p_main->psz_arg0 ); return; } @@ -672,82 +696,3 @@ static void SignalHandler( int i_signal ) 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 diff --git a/src/misc/plugins.c b/src/misc/plugins.c index cf8c4de790..25c3cbe2d3 100644 --- a/src/misc/plugins.c +++ b/src/misc/plugins.c @@ -89,9 +89,12 @@ void bank_Init( plugin_bank_t * p_bank ) SEEK_PLUGIN( "beos" ); SEEK_PLUGIN( "x11" ); SEEK_PLUGIN( "dsp" ); + SEEK_PLUGIN( "esd" ); SEEK_PLUGIN( "gnome" ); SEEK_PLUGIN( "ggi" ); SEEK_PLUGIN( "fb" ); + SEEK_PLUGIN( "glide" ); + SEEK_PLUGIN( "mga" ); SEEK_PLUGIN( "yuvmmx" ); SEEK_PLUGIN( "yuv" ); SEEK_PLUGIN( "dummy" ); @@ -108,51 +111,6 @@ void bank_Destroy( plugin_bank_t * p_bank ) * 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 ) { int i_count, i_length; @@ -208,6 +166,53 @@ char * TestPlugin ( plugin_id_t *p_plugin_id, char * psz_name ) 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 void TrashPlugin ( plugin_id_t plugin_id ) { diff --git a/src/misc/tests.c b/src/misc/tests.c new file mode 100644 index 0000000000..c1fe1eb22b --- /dev/null +++ b/src/misc/tests.c @@ -0,0 +1,139 @@ +/***************************************************************************** + * tests.c: several test functions needed by the plugins + * Functions are prototyped in tests.h. + ***************************************************************************** + * Copyright (C) 2000 VideoLAN + * + * Authors: Samuel Hocevar + * + * 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 +} + + diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index 5293f2e111..41136f4c69 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -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 ); int i_status; /* thread status */ int i_index; /* index for array initialization */ + int i_best_index = 0, i_best_score = 0; /* Allocate descriptor */ intf_DbgMsg("\n"); @@ -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 ... */ if( p_main->p_bank->p_info[ i_index ]->vout_GetPlugin != NULL ) { - /* ... then get these functions */ - ( (vout_getplugin_t *) - p_main->p_bank->p_info[ i_index ]->vout_GetPlugin )( p_vout ); + /* ... and if this plugin has a good score ... */ + if( p_main->p_bank->p_info[ i_index ]->i_score > i_best_score ) + { + /* ... 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 * later */ p_vout->b_die = 0; diff --git a/src/video_parser/vpar_synchro.c b/src/video_parser/vpar_synchro.c index b1b732df35..cacf3c993c 100644 --- a/src/video_parser/vpar_synchro.c +++ b/src/video_parser/vpar_synchro.c @@ -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(); + //return (i_coding_type == I_CODING_TYPE); + switch( i_coding_type ) { case I_CODING_TYPE: