video_decoder/vdec_idct.o
misc_obj = misc/mtime.o \
+ misc/tests.o \
misc/rsc_files.o \
misc/netutils.o \
misc/playlist.o \
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.
/* 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"
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 ? */
void * vout_GetPlugin;
void * intf_GetPlugin;
void * yuv_GetPlugin;
+
+ int i_score;
} plugin_info_t;
typedef struct plugin_bank_s
+++ /dev/null
-/*****************************************************************************
- * 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 );
-
--- /dev/null
+/*****************************************************************************
+ * 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 );
+
{
/*****************************************************************************
- * 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 ) );
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();
}
/*****************************************************************************
- * 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;
}
/*****************************************************************************
- * 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( );
#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
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" */
{
/*****************************************************************************
- * 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 ) );
}
/*****************************************************************************
- * 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 )
/*****************************************************************************
- * 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 )
{
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 */
}
/*****************************************************************************
- * 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;
}
/*****************************************************************************
- * 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;
}
/*****************************************************************************
- * 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 );
}
/*****************************************************************************
- * 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 )
{
}
/*****************************************************************************
- * 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;
/* 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 ?
*
*/
} 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 ) );
}
/*****************************************************************************
- * 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 )
{
}
/*****************************************************************************
- * 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;
}
/*****************************************************************************
- * 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;
}
/*****************************************************************************
- * 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;
}
/*****************************************************************************
- * 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
* - 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 );
}
/*****************************************************************************
- * 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 )
{
}
/*****************************************************************************
- * 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 );
}
*****************************************************************************/
#include "defs.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include <stdlib.h> /* malloc(), free() */
+#include <unistd.h> /* 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"
#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";
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;
}
} 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;
}
/*****************************************************************************
- * 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 )
{
;
}
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
+#include "tests.h"
#include "plugins.h"
#include "interface.h"
#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
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;
}
} 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 ) );
}
/*****************************************************************************
- * 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 )
/*****************************************************************************
- * intf_SysManage: event loop
+ * intf_DummyManage: event loop
*****************************************************************************/
-void intf_SysManage( intf_thread_t *p_intf )
+void intf_DummyManage( intf_thread_t *p_intf )
{
;
}
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 */
}
/*****************************************************************************
- * 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 )
{
;
}
} 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 )
}
/*****************************************************************************
- * 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;
}
/*****************************************************************************
- * 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 );
}
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
+#include "tests.h"
#include "plugins.h"
#include "interface.h"
#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
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;
}
*****************************************************************************/
#include "defs.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include <stdlib.h> /* malloc(), free() */
+#include <unistd.h> /* 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"
#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";
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;
}
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 */
}
/*****************************************************************************
- * 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);
/*****************************************************************************
- * 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];
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 */
}
/*****************************************************************************
- * 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
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 );
}
/*****************************************************************************
- * 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;
}
/*****************************************************************************
- * 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 };
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
+#include "tests.h"
#include "plugins.h"
#include "interface.h"
#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
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;
}
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 )
}
/*****************************************************************************
- * 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 )
/*****************************************************************************
- * 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 */
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 ) );
}
/*****************************************************************************
- * 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 )
}
/*****************************************************************************
- * 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 )
}
/*****************************************************************************
- * 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 )
#include <stdlib.h> /* malloc(), free() */
+#ifndef __linux__
+#include <conio.h> /* for glide ? */
+#endif
+#include <glide.h>
+
#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"
#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
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;
}
} 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 ) );
}
/*****************************************************************************
- * 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 )
/*****************************************************************************
- * 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;
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 */
}
/*****************************************************************************
- * 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 );
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 );
}
#include <stdlib.h> /* malloc(), free() */
+#include <X11/Xlib.h>
+
#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"
#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";
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;
}
#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;
}
/*****************************************************************************
- * 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 );
}
/*****************************************************************************
- * 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 );
/*****************************************************************************
* 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 );
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 */
}
/*****************************************************************************
- * 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;
}
/*****************************************************************************
- * 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... */
{
}
/*****************************************************************************
- * 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
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 );
}
/*****************************************************************************
- * 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 */
{
}
/*****************************************************************************
- * 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];
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;
}
/*****************************************************************************
- * 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 );
/*****************************************************************************
- * 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 );
#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
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;
}
#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 */
}
/*****************************************************************************
- * 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;
}
/*****************************************************************************
- * 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... */
{
}
/*****************************************************************************
- * 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 );
}
/*****************************************************************************
- * 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
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 );
}
/*****************************************************************************
- * 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 */
{
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;
}
/*****************************************************************************
- * 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 );
/*****************************************************************************
- * 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 );
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 */
}
/*****************************************************************************
- * 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;
}
/*****************************************************************************
- * 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... */
{
}
/*****************************************************************************
- * 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
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 );
}
/*****************************************************************************
- * 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 */
{
}
/*****************************************************************************
- * 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];
#include <stdlib.h> /* malloc(), free() */
+#include <X11/Xlib.h>
+
#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"
#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";
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;
}
#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 */
}
/*****************************************************************************
- * 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 */
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
*/
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
+#include "tests.h"
#include "plugins.h"
#include "interface.h"
#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
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;
}
#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 */
}
/*****************************************************************************
- * 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 */
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
+#include "tests.h" /* TestMMX() */
#include "plugins.h"
#include "interface.h"
#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
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;
}
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 */
/* ... 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
*/
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 ) );
/* ... 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;
#include "common.h"
#include "threads.h"
#include "mtime.h"
+#include "tests.h" /* TestMMX() */
#include "plugins.h"
#include "playlist.h"
#include "input_vlan.h"
#define OPT_WIDTH 163
#define OPT_HEIGHT 164
#define OPT_COLOR 165
+#define OPT_YUV 166
#define OPT_NOVLANS 170
#define OPT_SERVER 171
{ "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' },
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. "
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 );
}
{
InitSignalHandler(); /* prepare signals for interception */
+ /*
+ * This is the main loop
+ */
intf_Run( p_main->p_intf );
intf_Destroy( p_main->p_intf );
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;
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 )
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':
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;
}
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
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" );
* 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;
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 )
{
--- /dev/null
+/*****************************************************************************
+ * tests.c: several test functions needed by the plugins
+ * Functions are prototyped in tests.h.
+ *****************************************************************************
+ * Copyright (C) 2000 VideoLAN
+ *
+ * Authors: Samuel Hocevar <sam@via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include "config.h"
+#include "common.h"
+
+#include "intf_msg.h"
+#include "tests.h"
+
+#include "main.h"
+
+/*****************************************************************************
+ * TestVersion: tests if the given string equals the current version
+ *****************************************************************************/
+int TestVersion( char * psz_version )
+{
+ return( !strcmp( psz_version, VERSION ) );
+}
+
+/*****************************************************************************
+ * TestProgram: tests if the given string equals the program name
+ *****************************************************************************/
+int TestProgram( char * psz_program )
+{
+ return( !strcmp( psz_program, p_main->psz_arg0 ) );
+}
+
+/*****************************************************************************
+ * TestMethod: tests if the given method was requested
+ *****************************************************************************/
+int TestMethod( char * psz_var, char * psz_method )
+{
+ return( !strcmp( psz_method, main_GetPszVariable( psz_var, "" ) ) );
+}
+
+/*****************************************************************************
+ * TestMMX: tests if the processor has MMX support.
+ *****************************************************************************
+ * This function is called if HAVE_MMX is enabled, to check whether the
+ * CPU really supports MMX.
+ *****************************************************************************/
+int TestMMX( void )
+{
+/* FIXME: under beos, gcc does not support the following inline assembly */
+#ifdef SYS_BEOS
+ return( 1 );
+#else
+
+ int i_reg, i_dummy = 0;
+
+ /* test for a 386 CPU */
+ asm volatile ( "pushfl
+ popl %%eax
+ movl %%eax, %%ecx
+ xorl $0x40000, %%eax
+ pushl %%eax
+ popfl
+ pushfl
+ popl %%eax
+ xorl %%ecx, %%eax
+ andl $0x40000, %%eax"
+ : "=a" ( i_reg ) );
+
+ if( !i_reg )
+ return( 0 );
+
+ /* test for a 486 CPU */
+ asm volatile ( "movl %%ecx, %%eax
+ xorl $0x200000, %%eax
+ pushl %%eax
+ popfl
+ pushfl
+ popl %%eax
+ xorl %%ecx, %%eax
+ pushl %%ecx
+ popfl
+ andl $0x200000, %%eax"
+ : "=a" ( i_reg ) );
+
+ if( !i_reg )
+ return( 0 );
+
+ /* the CPU supports the CPUID instruction - get its level */
+ asm volatile ( "cpuid"
+ : "=a" ( i_reg ),
+ "=b" ( i_dummy ),
+ "=c" ( i_dummy ),
+ "=d" ( i_dummy )
+ : "a" ( 0 ), /* level 0 */
+ "b" ( i_dummy ) ); /* buggy compiler shouldn't complain */
+
+ /* this shouldn't happen on a normal CPU */
+ if( !i_reg )
+ return( 0 );
+
+ /* test for the MMX flag */
+ asm volatile ( "cpuid
+ andl $0x00800000, %%edx" /* X86_FEATURE_MMX */
+ : "=a" ( i_dummy ),
+ "=b" ( i_dummy ),
+ "=c" ( i_dummy ),
+ "=d" ( i_reg )
+ : "a" ( 1 ), /* level 1 */
+ "b" ( i_dummy ) ); /* buggy compiler shouldn't complain */
+
+ if( !i_reg )
+ return( 0 );
+
+ return( 1 );
+
+#endif
+}
+
+
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");
/* ... 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;
{
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: