Commit 95967459 authored by Sam Hocevar's avatar Sam Hocevar

  Beginning of Interface II
 ---------------------------

 * Plugins have completely disappeared, we now only use the new module API.
 * All intf and vout modules are now independant. So far, only the Gnome
   intf module and the SDL vout module have been ported. configure.in has
   been modified to reflect the changes (x11 and dummy aren't compiled by
   default anymore, while SDL and Gnome are).

  Note that this is _not_ Interface II, it's just a step forward. For
  instance, it lacks the whole message passing scheme.

  Things that should work:

 * Right-clicking on the SDL video output window brings the Gnome menu.
 * Pause, Play, Exit, About work from the menu or from the interface window.
 * The old SDL keys still work.

   Things that are broken or may be broken:

 * Xlib calls are not locked yet, which may lead to "Unexpected async reply"
   errors, and make the vlc segfault.
 * Sound only works for the first file.
 * The SDL vout_sdl.c file is absolutely ugly and kludgey.
 * The vlc immediately quits when no filename is given as an argument. Not
   a real bug, but still annoying.
 * The Gnome menu does not work in fullscreen mode.

   Things that will come soon, maybe tomorrow:

 * Complete navigation buttons (fast forward, slow, etc.).
 * File/Open menu to add files to the playlist.
 * Return of the X11 video output for those of us who do not have SDL.
 * Textmode interface for those of us who do not have Gnome.
 * aout and vout autospawn (maybe).
parent e4aec3d8
...@@ -185,6 +185,7 @@ INTERFACE = src/interface/main.o \ ...@@ -185,6 +185,7 @@ INTERFACE = src/interface/main.o \
src/interface/intf_cmd.o \ src/interface/intf_cmd.o \
src/interface/intf_ctrl.o \ src/interface/intf_ctrl.o \
src/interface/intf_plst.o \ src/interface/intf_plst.o \
src/interface/intf_channels.o \
src/interface/intf_console.o src/interface/intf_console.o
INPUT = src/input/input_ext-dec.o \ INPUT = src/input/input_ext-dec.o \
...@@ -238,8 +239,7 @@ MISC = src/misc/mtime.o \ ...@@ -238,8 +239,7 @@ MISC = src/misc/mtime.o \
src/misc/tests.o \ src/misc/tests.o \
src/misc/rsc_files.o \ src/misc/rsc_files.o \
src/misc/modules.o \ src/misc/modules.o \
src/misc/netutils.o \ src/misc/netutils.o
src/misc/plugins.o
C_OBJ = $(INTERFACE) \ C_OBJ = $(INTERFACE) \
...@@ -314,7 +314,6 @@ PLUGIN_GGI = plugins/ggi/ggi.o \ ...@@ -314,7 +314,6 @@ PLUGIN_GGI = plugins/ggi/ggi.o \
plugins/ggi/vout_ggi.o plugins/ggi/vout_ggi.o
PLUGIN_SDL = plugins/sdl/sdl.o \ PLUGIN_SDL = plugins/sdl/sdl.o \
plugins/sdl/intf_sdl.o \
plugins/sdl/vout_sdl.o \ plugins/sdl/vout_sdl.o \
plugins/sdl/aout_sdl.o plugins/sdl/aout_sdl.o
...@@ -324,10 +323,9 @@ PLUGIN_GLIDE = plugins/glide/glide.o \ ...@@ -324,10 +323,9 @@ PLUGIN_GLIDE = plugins/glide/glide.o \
PLUGIN_GNOME = plugins/gnome/gnome.o \ PLUGIN_GNOME = plugins/gnome/gnome.o \
plugins/gnome/intf_gnome.o \ plugins/gnome/intf_gnome.o \
plugins/gnome/intf_gnome_callbacks.o \ plugins/gnome/gnome_callbacks.o \
plugins/gnome/intf_gnome_interface.o \ plugins/gnome/gnome_interface.o \
plugins/gnome/intf_gnome_support.o \ plugins/gnome/gnome_support.o
plugins/gnome/vout_gnome.o
PLUGIN_MGA = plugins/mga/mga.o \ PLUGIN_MGA = plugins/mga/mga.o \
plugins/mga/intf_mga.o \ plugins/mga/intf_mga.o \
......
...@@ -22,7 +22,7 @@ ac_help="$ac_help ...@@ -22,7 +22,7 @@ ac_help="$ac_help
ac_help="$ac_help ac_help="$ac_help
--disable-optimizations Disable compiler optimizations (default enabled)" --disable-optimizations Disable compiler optimizations (default enabled)"
ac_help="$ac_help ac_help="$ac_help
--disable-dummy dummy audio and video support (default enabled)" --enable-dummy dummy audio and video support (default disabled)"
ac_help="$ac_help ac_help="$ac_help
--disable-null Null module (default enabled)" --disable-null Null module (default enabled)"
ac_help="$ac_help ac_help="$ac_help
...@@ -34,13 +34,13 @@ ac_help="$ac_help ...@@ -34,13 +34,13 @@ ac_help="$ac_help
ac_help="$ac_help ac_help="$ac_help
--with-ggi[=name] GGI support (default disabled)" --with-ggi[=name] GGI support (default disabled)"
ac_help="$ac_help ac_help="$ac_help
--with-sdl[=name] SDL support (default disabled)" --with-sdl[=name] SDL support (default enabled)"
ac_help="$ac_help ac_help="$ac_help
--with-glide[=name] Glide (3dfx) support (default disabled)" --with-glide[=name] Glide (3dfx) support (default disabled)"
ac_help="$ac_help ac_help="$ac_help
--enable-gnome Gnome support (default disabled)" --disable-gnome Gnome support (default enabled)"
ac_help="$ac_help ac_help="$ac_help
--disable-x11 X11 support (default enabled)" --enable-x11 X11 support (default disabled)"
ac_help="$ac_help ac_help="$ac_help
--enable-alsa Alsa sound drivers support (Only for linux) (default disabled)" --enable-alsa Alsa sound drivers support (Only for linux) (default disabled)"
...@@ -3419,10 +3419,9 @@ else ...@@ -3419,10 +3419,9 @@ else
# Check whether --enable-dummy or --disable-dummy was given. # Check whether --enable-dummy or --disable-dummy was given.
if test "${enable_dummy+set}" = set; then if test "${enable_dummy+set}" = set; then
enableval="$enable_dummy" enableval="$enable_dummy"
: if test x$enable_dummy = xyes; then PLUGINS=${PLUGINS}"dummy "; fi
fi fi
if test x$enable_dummy != xno; then PLUGINS=${PLUGINS}"dummy "; fi
# Check whether --enable-null or --disable-null was given. # Check whether --enable-null or --disable-null was given.
if test "${enable_null+set}" = set; then if test "${enable_null+set}" = set; then
enableval="$enable_null" enableval="$enable_null"
...@@ -3473,6 +3472,11 @@ if test "${with_sdl+set}" = set; then ...@@ -3473,6 +3472,11 @@ if test "${with_sdl+set}" = set; then
fi fi
fi fi
if test "x$withval" == "x";
then
PLUGINS=${PLUGINS}"sdl "
LIB_SDL="-lSDL"
fi
# Check whether --with-glide or --without-glide was given. # Check whether --with-glide or --without-glide was given.
if test "${with_glide+set}" = set; then if test "${with_glide+set}" = set; then
withval="$with_glide" withval="$with_glide"
...@@ -3488,32 +3492,33 @@ fi ...@@ -3488,32 +3492,33 @@ fi
# Check whether --enable-gnome or --disable-gnome was given. # Check whether --enable-gnome or --disable-gnome was given.
if test "${enable_gnome+set}" = set; then if test "${enable_gnome+set}" = set; then
enableval="$enable_gnome" enableval="$enable_gnome"
if test x$enable_gnome = xyes; then PLUGINS=${PLUGINS}"gnome "; ALIASES=${ALIASES}"gvlc "; fi :
fi fi
if test x$enable_gnome != xno; then PLUGINS=${PLUGINS}"gnome "; ALIASES=${ALIASES}"gvlc "; fi
# Check whether --enable-x11 or --disable-x11 was given. # Check whether --enable-x11 or --disable-x11 was given.
if test "${enable_x11+set}" = set; then if test "${enable_x11+set}" = set; then
enableval="$enable_x11" enableval="$enable_x11"
: if test x$enable_x11 = xyes; then PLUGINS=${PLUGINS}"x11 "; fi
fi fi
if test x$enable_x11 != xno; then PLUGINS=${PLUGINS}"x11 "; fi
# Check whether --enable-alsa or --disable-alsa was given. # Check whether --enable-alsa or --disable-alsa was given.
if test "${enable_alsa+set}" = set; then if test "${enable_alsa+set}" = set; then
enableval="$enable_alsa" enableval="$enable_alsa"
if test x$enable_alsa = xyes; then ac_safe=`echo "sys/asoundlib.h" | sed 'y%./+-%__p_%'` if test x$enable_alsa = xyes; then ac_safe=`echo "sys/asoundlib.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sys/asoundlib.h""... $ac_c" 1>&6 echo $ac_n "checking for sys/asoundlib.h""... $ac_c" 1>&6
echo "configure:3507: checking for sys/asoundlib.h" >&5 echo "configure:3512: checking for sys/asoundlib.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 3512 "configure" #line 3517 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/asoundlib.h> #include <sys/asoundlib.h>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3517: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:3522: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
...@@ -3530,7 +3535,7 @@ fi ...@@ -3530,7 +3535,7 @@ fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
echo $ac_n "checking for main in -lasound""... $ac_c" 1>&6 echo $ac_n "checking for main in -lasound""... $ac_c" 1>&6
echo "configure:3534: checking for main in -lasound" >&5 echo "configure:3539: checking for main in -lasound" >&5
ac_lib_var=`echo asound'_'main | sed 'y%./+-%__p_%'` ac_lib_var=`echo asound'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
...@@ -3538,14 +3543,14 @@ else ...@@ -3538,14 +3543,14 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lasound $LIBS" LIBS="-lasound $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 3542 "configure" #line 3547 "configure"
#include "confdefs.h" #include "confdefs.h"
int main() { int main() {
main() main()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:3549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:3554: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
......
...@@ -138,8 +138,8 @@ dnl default case ...@@ -138,8 +138,8 @@ dnl default case
else else
AC_ARG_ENABLE(dummy, AC_ARG_ENABLE(dummy,
[ --disable-dummy dummy audio and video support (default enabled)]) [ --enable-dummy dummy audio and video support (default disabled)],
if test x$enable_dummy != xno; then PLUGINS=${PLUGINS}"dummy "; fi [if test x$enable_dummy = xyes; then PLUGINS=${PLUGINS}"dummy "; fi])
AC_ARG_ENABLE(null, AC_ARG_ENABLE(null,
[ --disable-null Null module (default enabled)]) [ --disable-null Null module (default enabled)])
if test x$enable_null != xno; then PLUGINS=${PLUGINS}"null "; fi if test x$enable_null != xno; then PLUGINS=${PLUGINS}"null "; fi
...@@ -162,7 +162,7 @@ AC_ARG_WITH(ggi, ...@@ -162,7 +162,7 @@ AC_ARG_WITH(ggi,
LIB_GGI="-lggi" LIB_GGI="-lggi"
fi ]) fi ])
AC_ARG_WITH(sdl, AC_ARG_WITH(sdl,
[ --with-sdl[=name] SDL support (default disabled)], [ --with-sdl[=name] SDL support (default enabled)],
[ PLUGINS=${PLUGINS}"sdl "; [ PLUGINS=${PLUGINS}"sdl ";
if test "x$withval" != "xyes"; if test "x$withval" != "xyes";
then then
...@@ -170,6 +170,11 @@ AC_ARG_WITH(sdl, ...@@ -170,6 +170,11 @@ AC_ARG_WITH(sdl,
else else
LIB_SDL="-lSDL" LIB_SDL="-lSDL"
fi ]) fi ])
if test "x$withval" == "x";
then
PLUGINS=${PLUGINS}"sdl "
LIB_SDL="-lSDL"
fi
AC_ARG_WITH(glide, AC_ARG_WITH(glide,
[ --with-glide[=name] Glide (3dfx) support (default disabled)], [ --with-glide[=name] Glide (3dfx) support (default disabled)],
[ PLUGINS=${PLUGINS}"glide "; [ PLUGINS=${PLUGINS}"glide ";
...@@ -180,11 +185,12 @@ AC_ARG_WITH(glide, ...@@ -180,11 +185,12 @@ AC_ARG_WITH(glide,
LIB_GLIDE="-lglide2x" LIB_GLIDE="-lglide2x"
fi ]) fi ])
AC_ARG_ENABLE(gnome, AC_ARG_ENABLE(gnome,
[ --enable-gnome Gnome support (default disabled)], [ --disable-gnome Gnome support (default enabled)])
[if test x$enable_gnome = xyes; then PLUGINS=${PLUGINS}"gnome "; ALIASES=${ALIASES}"gvlc "; fi]) if test x$enable_gnome != xno; then PLUGINS=${PLUGINS}"gnome "; ALIASES=${ALIASES}"gvlc "; fi
AC_ARG_ENABLE(x11, AC_ARG_ENABLE(x11,
[ --disable-x11 X11 support (default enabled)]) [ --enable-x11 X11 support (default disabled)],
if test x$enable_x11 != xno; then PLUGINS=${PLUGINS}"x11 "; fi [if test x$enable_x11 = xyes; then PLUGINS=${PLUGINS}"x11 "; fi])
AC_ARG_ENABLE(alsa, AC_ARG_ENABLE(alsa,
[ --enable-alsa Alsa sound drivers support (Only for linux) (default disabled)], [ --enable-alsa Alsa sound drivers support (Only for linux) (default disabled)],
[if test x$enable_alsa = xyes; then AC_CHECK_HEADER(sys/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false") if test $have_alsa = true; then PLUGINS=${PLUGINS}"alsa "; fi; fi]) [if test x$enable_alsa = xyes; then AC_CHECK_HEADER(sys/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false") if test $have_alsa = true; then PLUGINS=${PLUGINS}"alsa "; fi; fi])
......
...@@ -128,6 +128,9 @@ ...@@ -128,6 +128,9 @@
* Interface configuration * Interface configuration
*****************************************************************************/ *****************************************************************************/
/* Environment variable containing the display method */
#define INTF_METHOD_VAR "vlc_intf"
/* Environment variable used to store startup script name and default value */ /* Environment variable used to store startup script name and default value */
#define INTF_INIT_SCRIPT_VAR "vlcrc" #define INTF_INIT_SCRIPT_VAR "vlcrc"
#define INTF_INIT_SCRIPT_DEFAULT ".vlcrc" #define INTF_INIT_SCRIPT_DEFAULT ".vlcrc"
......
...@@ -43,11 +43,6 @@ ...@@ -43,11 +43,6 @@
* This structe describes all interface-specific data of the main (interface) * This structe describes all interface-specific data of the main (interface)
* thread. * thread.
*****************************************************************************/ *****************************************************************************/
typedef int ( intf_sys_create_t ) ( p_intf_thread_t p_intf );
typedef void ( intf_sys_destroy_t ) ( p_intf_thread_t p_intf );
typedef void ( intf_sys_manage_t ) ( p_intf_thread_t p_intf );
typedef struct _keyparam typedef struct _keyparam
{ {
int key; int key;
...@@ -72,10 +67,14 @@ typedef struct intf_thread_s ...@@ -72,10 +67,14 @@ typedef struct intf_thread_s
p_intf_sys_t p_sys; /* system interface */ p_intf_sys_t p_sys; /* system interface */
p_intf_key p_keys; p_intf_key p_keys;
/* Plugin */ /* Plugin used and shortcuts to access its capabilities */
intf_sys_create_t * p_sys_create; /* create interface thread */ struct module_s * p_module;
intf_sys_manage_t * p_sys_manage; /* main loop */ int ( *pf_open ) ( struct intf_thread_s * );
intf_sys_destroy_t * p_sys_destroy; /* destroy interface */ void ( *pf_close ) ( struct intf_thread_s * );
void ( *pf_run ) ( struct intf_thread_s * );
/* Interface callback */
void ( *pf_manage ) ( struct intf_thread_s * );
/* XXX: Channels array - new API */ /* XXX: Channels array - new API */
//p_intf_channel_t * p_channel[INTF_MAX_CHANNELS];/* channel descriptions */ //p_intf_channel_t * p_channel[INTF_MAX_CHANNELS];/* channel descriptions */
...@@ -84,24 +83,24 @@ typedef struct intf_thread_s ...@@ -84,24 +83,24 @@ typedef struct intf_thread_s
p_intf_channel_t p_channel; /* description of channels */ p_intf_channel_t p_channel; /* description of channels */
/* Main threads - NULL if not active */ /* Main threads - NULL if not active */
p_vout_thread_t p_vout;
p_input_thread_t p_input; p_input_thread_t p_input;
/* Specific functions */ /* Specific functions */
keyparm (*p_intf_get_key)(struct intf_thread_s *p_intf, int r_key) ; keyparm (*p_intf_get_key)(struct intf_thread_s *p_intf, int r_key) ;
/* XXX: new message passing stuff will go here */
vlc_mutex_t change_lock;
boolean_t b_menu_change;
boolean_t b_menu;
/* Warning messages level */
int i_warning_level;
} intf_thread_t; } intf_thread_t;
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
intf_thread_t * intf_Create ( void ); intf_thread_t * intf_Create ( void );
void intf_Run ( intf_thread_t * p_intf );
void intf_Destroy ( intf_thread_t * p_intf ); void intf_Destroy ( intf_thread_t * p_intf );
int intf_SelectChannel ( intf_thread_t * p_intf, int i_channel );
int intf_ProcessKey ( intf_thread_t * p_intf, int i_key ); int intf_ProcessKey ( intf_thread_t * p_intf, int i_key );
void intf_AssignKey( intf_thread_t *p_intf, int r_key, int f_key, int param); void intf_AssignKey( intf_thread_t *p_intf, int r_key, int f_key, int param);
......
...@@ -39,7 +39,9 @@ typedef struct ...@@ -39,7 +39,9 @@ typedef struct
char ** ppsz_argv; /* command line arguments */ char ** ppsz_argv; /* command line arguments */
char ** ppsz_env; /* environment variables */ char ** ppsz_env; /* environment variables */
char * psz_arg0; /* program name (whithout path) */ char * psz_arg0; /* program name (whithout path) */
int i_cpu_capabilities; /* CPU extensions */ int i_cpu_capabilities; /* CPU extensions */
int i_warning_level; /* warning messages level */
/* Generic settings */ /* Generic settings */
boolean_t b_audio; /* is audio output allowed ? */ boolean_t b_audio; /* is audio output allowed ? */
...@@ -48,13 +50,13 @@ typedef struct ...@@ -48,13 +50,13 @@ typedef struct
boolean_t b_dvd; /* DVD mode ? */ boolean_t b_dvd; /* DVD mode ? */
/* Unique threads */ /* Unique threads */
p_vout_thread_t p_vout; /* video output thread */
p_aout_thread_t p_aout; /* audio output thread */ p_aout_thread_t p_aout; /* audio output thread */
p_intf_thread_t p_intf; /* main interface thread */ p_intf_thread_t p_intf; /* main interface thread */
/* Shared data - these structures are accessed directly from p_main by /* Shared data - these structures are accessed directly from p_main by
* several modules */ * several modules */
struct module_bank_s * p_module_bank; /* module bank */ struct module_bank_s * p_bank; /* module bank */
p_plugin_bank_t p_bank; /* plugin bank */
p_playlist_t p_playlist; /* playlist */ p_playlist_t p_playlist; /* playlist */
p_intf_msg_t p_msg; /* messages interface data */ p_intf_msg_t p_msg; /* messages interface data */
p_input_vlan_t p_vlan; /* vlan library data */ p_input_vlan_t p_vlan; /* vlan library data */
......
...@@ -65,6 +65,14 @@ typedef struct function_list_s ...@@ -65,6 +65,14 @@ typedef struct function_list_s
union union
{ {
/* Interface plugin */
struct
{
int ( * pf_open ) ( struct intf_thread_s * );
void ( * pf_close )( struct intf_thread_s * );
void ( * pf_run ) ( struct intf_thread_s * );
} intf;
/* Input plugin */ /* Input plugin */
struct struct
{ {
...@@ -98,6 +106,19 @@ typedef struct function_list_s ...@@ -98,6 +106,19 @@ typedef struct function_list_s
void ( * pf_close ) ( struct aout_thread_s * ); void ( * pf_close ) ( struct aout_thread_s * );
} aout; } aout;
/* Video output plugin */
struct
{
int ( * pf_create ) ( struct vout_thread_s * );
int ( * pf_init ) ( struct vout_thread_s * );
void ( * pf_end ) ( struct vout_thread_s * );
void ( * pf_destroy ) ( struct vout_thread_s * );
int ( * pf_manage ) ( struct vout_thread_s * );
void ( * pf_display ) ( struct vout_thread_s * );
void ( * pf_setpalette ) ( struct vout_thread_s *, u16 *red,
u16 *green, u16 *blue, u16 *transp );
} vout;
/* Motion compensation plugin */ /* Motion compensation plugin */
struct struct
{ {
......
...@@ -112,18 +112,6 @@ typedef struct vout_buffer_s ...@@ -112,18 +112,6 @@ typedef struct vout_buffer_s
* is represented by a video output thread, and described using the following * is represented by a video output thread, and described using the following
* structure. * structure.
*****************************************************************************/ *****************************************************************************/
typedef int (vout_sys_create_t) ( p_vout_thread_t p_vout,
char *psz_display,
int i_root_window, void *p_data );
typedef int (vout_sys_init_t) ( p_vout_thread_t p_vout );
typedef void (vout_sys_end_t) ( p_vout_thread_t p_vout );
typedef void (vout_sys_destroy_t) ( p_vout_thread_t p_vout );
typedef int (vout_sys_manage_t) ( p_vout_thread_t p_vout );
typedef void (vout_sys_display_t) ( p_vout_thread_t p_vout );
typedef void (vout_set_palette_t) ( p_vout_thread_t p_vout, u16 *red,
u16 *green, u16 *blue, u16 *transp );
typedef struct vout_thread_s typedef struct vout_thread_s
{ {
/* Thread properties and lock */ /* Thread properties and lock */
...@@ -165,15 +153,16 @@ typedef struct vout_thread_s ...@@ -165,15 +153,16 @@ typedef struct vout_thread_s
u32 i_gray_pixel; /* gray */ u32 i_gray_pixel; /* gray */
u32 i_blue_pixel; /* blue */ u32 i_blue_pixel; /* blue */
/* Plugins */ /* Plugin used and shortcuts to access its capabilities */
vout_sys_create_t * p_sys_create; /* allocate output method */ struct module_s * p_module;
vout_sys_init_t * p_sys_init; /* initialize output method */ int ( *pf_create ) ( struct vout_thread_s * );
vout_sys_end_t * p_sys_end; /* terminate output method */ int ( *pf_init ) ( struct vout_thread_s * );
vout_sys_destroy_t * p_sys_destroy; /* destroy output method */ void ( *pf_end ) ( struct vout_thread_s * );
vout_sys_manage_t * p_sys_manage; /* handle events */ void ( *pf_destroy ) ( struct vout_thread_s * );
vout_sys_display_t * p_sys_display; /* display rendered image */ int ( *pf_manage ) ( struct vout_thread_s * );
void ( *pf_display ) ( struct vout_thread_s * );
vout_set_palette_t * p_set_palette; /* set 8bpp palette */ void ( *pf_setpalette ) ( struct vout_thread_s *, u16 *red,
u16 *green, u16 *blue, u16 *transp );
/* Pictures and rendering properties */ /* Pictures and rendering properties */
boolean_t b_grayscale; /* color or grayscale display */ boolean_t b_grayscale; /* color or grayscale display */
...@@ -243,17 +232,16 @@ typedef struct vout_thread_s ...@@ -243,17 +232,16 @@ typedef struct vout_thread_s
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window, vout_thread_t * vout_CreateThread ( int *pi_status );
int i_width, int i_height, int *pi_status, void vout_DestroyThread ( vout_thread_t *p_vout, int *pi_status );
int i_method, void *p_data ); picture_t * vout_CreatePicture ( vout_thread_t *p_vout, int i_type,
void vout_DestroyThread ( vout_thread_t *p_vout, int *pi_status ); int i_width, int i_height );
picture_t * vout_CreatePicture ( vout_thread_t *p_vout, int i_type, void vout_DestroyPicture ( vout_thread_t *p_vout, picture_t *p_pic );
int i_width, int i_height ); void vout_DisplayPicture ( vout_thread_t *p_vout, picture_t *p_pic );
void vout_DestroyPicture ( vout_thread_t *p_vout, picture_t *p_pic ); void vout_DatePicture ( vout_thread_t *p_vout, picture_t *p_pic, mtime_t date );
void vout_DisplayPicture ( vout_thread_t *p_vout, picture_t *p_pic ); void vout_LinkPicture ( vout_thread_t *p_vout, picture_t *p_pic );
void vout_DatePicture ( vout_thread_t *p_vout, picture_t *p_pic, mtime_t date ); void vout_UnlinkPicture ( vout_thread_t *p_vout, picture_t *p_pic );
void vout_LinkPicture ( vout_thread_t *p_vout, picture_t *p_pic );
void vout_UnlinkPicture ( vout_thread_t *p_vout, picture_t *p_pic );
subpicture_t * vout_CreateSubPicture ( vout_thread_t *p_vout, int i_type, int i_size ); subpicture_t * vout_CreateSubPicture ( vout_thread_t *p_vout, int i_type, int i_size );
void vout_DestroySubPicture ( vout_thread_t *p_vout, subpicture_t *p_subpic ); void vout_DestroySubPicture ( vout_thread_t *p_vout, subpicture_t *p_subpic );
void vout_DisplaySubPicture ( vout_thread_t *p_vout, subpicture_t *p_subpic ); void vout_DisplaySubPicture ( vout_thread_t *p_vout, subpicture_t *p_subpic );
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
***************************************************************************** *****************************************************************************
* Copyright (C) 2000 VideoLAN * Copyright (C) 2000 VideoLAN
* *
* Authors: * Authors: Samuel Hocevar <sam@zoy.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
#define MODULE_NAME gnome
/***************************************************************************** /*****************************************************************************
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
...@@ -27,109 +29,86 @@ ...@@ -27,109 +29,86 @@
#include <stdlib.h> /* malloc(), free() */ #include <stdlib.h> /* malloc(), free() */
#include <X11/Xlib.h>
#include "config.h" #include "config.h"
#include "common.h" /* boolean_t, byte_t */ #include "common.h" /* boolean_t, byte_t */
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "tests.h" #include "tests.h"
#include "plugins.h"
#include "interface.h" #include "interface.h"
#include "audio_output.h"
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "main.h" #include "modules.h"
#include "modules_inner.h"
/***************************************************************************** /*****************************************************************************
* Exported prototypes * Building configuration tree
*****************************************************************************/ *****************************************************************************/
static void vout_GetPlugin( p_vout_thread_t p_vout ); MODULE_CONFIG_START
static void intf_GetPlugin( p_intf_thread_t p_intf ); ADD_WINDOW( "Configuration for Gnome module" )
ADD_COMMENT( "For now, the Gnome module cannot be configured" )
/* Video output */ MODULE_CONFIG_END
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 * Capabilities defined in the other files.
******************************************************************************/
extern void intf_getfunctions( function_list_t * p_function_list );
/*****************************************************************************
* InitModule: get the module structure and configuration.
*****************************************************************************
* We have to fill psz_name, psz_longname and psz_version. These variables
* will be strdup()ed later by the main application because the module can
* be unloaded later to save memory, and we want to be able to access this
* data even after the module has been unloaded.
*****************************************************************************/ *****************************************************************************/
plugin_info_t * GetConfig( void ) int InitModule( module_t * p_module )
{ {
Display *p_display; p_module->psz_name = MODULE_STRING;
plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) ); p_module->psz_longname = "Gnome interface module";
p_module->psz_version = VERSION;
p_info->psz_name = "Gnome";
p_info->psz_version = VERSION;
p_info->psz_author = "the VideoLAN team <vlc@videolan.org>";
p_info->aout_GetPlugin = NULL;
p_info->vout_GetPlugin = vout_GetPlugin;
p_info->intf_GetPlugin = intf_GetPlugin;
p_info->yuv_GetPlugin = NULL;
/* 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_module->i_capabilities = MODULE_CAPABILITY_NULL
{ | MODULE_CAPABILITY_INTF;
p_info->i_score += 0x180;
}
/* If this plugin was requested, score it higher */ return( 0 );
if( TestMethod( VOUT_METHOD_VAR, "gnome" ) ) }
/*****************************************************************************
* ActivateModule: set the module to an usable state.
*****************************************************************************
* This function fills the capability functions and the configuration
* structure. Once ActivateModule() has been called, the i_usage can
* be set to 0 and calls to NeedModule() be made to increment it. To unload
* the module, one has to wait until i_usage == 0 and call DeactivateModule().
*****************************************************************************/
int ActivateModule( module_t * p_module )
{
p_module->p_functions = malloc( sizeof( module_functions_t ) );
if( p_module->p_functions == NULL )
{ {
p_info->i_score += 0x200; return( -1 );
} }
return( p_info ); intf_getfunctions( &p_module->p_functions->intf );
p_module->p_config = p_config;
return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* Following functions are only called through the p_info structure * DeactivateModule: make sure the module can be unloaded.
*****************************************************************************
* This function must only be called when i_usage == 0. If it successfully
* returns, i_usage can be set to -1 and the module unloaded. Be careful to
* lock usage_lock during the whole process.
*****************************************************************************/ *****************************************************************************/
int DeactivateModule( module_t * p_module )
static void vout_GetPlugin( p_vout_thread_t p_vout )
{ {
p_vout->p_sys_create = vout_GnomeCreate; free( p_module->p_functions );
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_GnomeSetPalette;
}
static void intf_GetPlugin( p_intf_thread_t p_intf ) return( 0 );
{
p_intf->p_sys_create = intf_GnomeCreate;
p_intf->p_sys_destroy = intf_GnomeDestroy;
p_intf->p_sys_manage = intf_GnomeManage;
} }
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
#include <gnome.h> #include <gnome.h>
#include "intf_gnome_callbacks.h" #include "gnome_callbacks.h"
#include "intf_gnome_interface.h" #include "gnome_interface.h"
#include "intf_gnome_support.h" #include "gnome_support.h"
static GnomeUIInfo file_menu_menu_uiinfo[] = static GnomeUIInfo file_menu_menu_uiinfo[] =
{ {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <gnome.h> #include <gnome.h>
#include "intf_gnome_support.h" #include "gnome_support.h"
/* This is an internally used function to create pixmaps. */ /* This is an internally used function to create pixmaps. */
static GtkWidget* create_dummy_pixmap (GtkWidget *widget, static GtkWidget* create_dummy_pixmap (GtkWidget *widget,
......
/***************************************************************************** /*****************************************************************************
* intf_gnome_thread.h: Gnome thread * gnome_sys.h: private Gnome interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: gnome_sys.h,v 1.1 2001/02/11 01:15:10 sam Exp $
* *
* Authors: * Authors:
* *
...@@ -17,18 +18,14 @@ ...@@ -17,18 +18,14 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
/***************************************************************************** /*****************************************************************************
* intf_sys_t: description and status of Gnome interface * intf_sys_t: description and status of Gnome interface
*****************************************************************************/ *****************************************************************************/
typedef struct gnome_thread_s typedef struct intf_sys_s
{ {
vlc_thread_t thread_id; /* id for thread functions */
boolean_t b_die; /* `die' flag */
boolean_t b_error; /* `error' flag */
/* special actions */ /* special actions */
vlc_mutex_t change_lock; /* the change lock */ vlc_mutex_t change_lock; /* the change lock */
...@@ -43,16 +40,18 @@ typedef struct gnome_thread_s ...@@ -43,16 +40,18 @@ typedef struct gnome_thread_s
boolean_t b_playlist_changed; /* playlist display toggled ? */ boolean_t b_playlist_changed; /* playlist display toggled ? */
boolean_t b_playlist; /* display playlist ? */ boolean_t b_playlist; /* display playlist ? */
/* intf_Manage callback timeout */
int i_timeout;
/* windows and widgets */ /* windows and widgets */
GtkWidget * p_window; /* main window */ GtkWidget * p_window; /* main window */
GtkWidget * p_popup; /* popup menu */ GtkWidget * p_popup; /* popup menu */
GtkWidget * p_playlist; /* playlist */ GtkWidget * p_playlist; /* playlist */
GtkWidget * p_about; /* about window */ GtkWidget * p_about; /* about window */
} gnome_thread_t; /* XXX: ugly kludge */
void ( *pf_gtk_callback ) ( void );
void ( *pf_gdk_callback ) ( void );
/***************************************************************************** } intf_sys_t;
* Local prototypes
*****************************************************************************/
void GnomeThread ( gnome_thread_t *p_gnome );
This diff is collapsed.
/*****************************************************************************
* intf_gnome.h: Gnome interface
*****************************************************************************
* 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
* Boston, MA 02111-1307, USA.
*****************************************************************************/
/*****************************************************************************
* intf_sys_t: description and status of Gnome interface
*****************************************************************************/
typedef struct intf_sys_s
{
/* X11 generic properties */
Display * p_display; /* X11 display pointer */
int i_screen; /* X11 screen */
Atom wm_protocols;
Atom wm_delete_window;
/* Main window properties */
Window window; /* main window */
GC gc; /* graphic context for main window */
int i_width; /* width of main window */
int i_height; /* height of main window */
Colormap colormap; /* colormap used (8bpp only) */
/* Screen saver properties */
int i_ss_count; /* enabling/disabling count */
int i_ss_timeout; /* timeout */
int i_ss_interval; /* interval between changes */
int i_ss_blanking; /* blanking mode */
int i_ss_exposure; /* exposure mode */
/* Mouse pointer properties */
boolean_t b_mouse; /* is the mouse pointer displayed ? */
/* Gnome part properties */
gnome_thread_t * p_gnome;
} intf_sys_t;
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int GnomeCreateWindow ( intf_thread_t *p_intf );
static void GnomeDestroyWindow ( intf_thread_t *p_intf );
static void GnomeManageInterface ( intf_thread_t *p_intf );
static gint GnomeManageMain ( gpointer p_data );
static void GnomeManageWindow ( intf_thread_t *p_intf );
static void GnomeEnableScreenSaver ( intf_thread_t *p_intf );
static void GnomeDisableScreenSaver ( intf_thread_t *p_intf );
static void GnomeTogglePointer ( intf_thread_t *p_intf );
This diff is collapsed.
/*****************************************************************************
* intf_sdl.c: SDL interface plugin
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_sdl.c,v 1.32 2001/02/08 13:52:35 massiot Exp $
*
* 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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <SDL/SDL.h> /* for all the SDL stuff */
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "plugins.h"
#include "stream_control.h"
#include "input_ext-intf.h"
#include "video.h"
#include "video_output.h"
#include "interface.h"
#include "intf_msg.h"
#include "keystrokes.h"
#include "main.h"
/* local prototype */
void intf_SDL_Keymap( intf_thread_t * p_intf );
/*****************************************************************************
* intf_SDLCreate: initialize and create SDL interface
*****************************************************************************/
int intf_SDLCreate( intf_thread_t *p_intf )
{
/* Check that b_video is set */
if( !p_main->b_video )
{
intf_ErrMsg( "error: SDL interface requires a video output thread" );
return( 1 );
}
/* Spawn video output thread */
p_intf->p_vout = vout_CreateThread( main_GetPszVariable( VOUT_DISPLAY_VAR,
NULL), 0,
main_GetIntVariable( VOUT_WIDTH_VAR,
VOUT_WIDTH_DEFAULT ),
main_GetIntVariable( VOUT_HEIGHT_VAR,
VOUT_HEIGHT_DEFAULT ),
NULL, 0, NULL );
if( p_intf->p_vout == NULL ) /* error */
{
intf_ErrMsg( "error: can't create video output thread" );
free( p_intf->p_sys );
return( 1 );
}
intf_SDL_Keymap( p_intf );
return( 0 );
}
/*****************************************************************************
* intf_SDLDestroy: destroy interface
*****************************************************************************/
void intf_SDLDestroy( intf_thread_t *p_intf )
{
/* Close input thread, if any (blocking) */
if( p_intf->p_input )
{
input_DestroyThread( p_intf->p_input, NULL );
}
/* Close video output thread, if any (blocking) */
if( p_intf->p_vout )
{
vout_DestroyThread( p_intf->p_vout, NULL );
}
}
/*****************************************************************************
* intf_SDLManage: event loop
*****************************************************************************/
void intf_SDLManage( intf_thread_t *p_intf )
{
SDL_Event event; /* SDL event */
Uint8 i_key;
int i_rate;
while ( SDL_PollEvent(&event) )
{
switch (event.type)
{
case SDL_VIDEORESIZE: /* Resizing of window */
intf_Msg( "intf: video display resized (%dx%d)", event.resize.w
, event.resize.h );
vlc_mutex_lock( &p_intf->p_vout->change_lock );
p_intf->p_vout->i_width = event.resize.w;
p_intf->p_vout->i_height = event.resize.h;
p_intf->p_vout->i_changes |= VOUT_SIZE_CHANGE;
vlc_mutex_unlock( &p_intf->p_vout->change_lock );
break;
case SDL_KEYDOWN: /* if a key is pressed */
i_key = event.key.keysym.sym;
switch(i_key)
{
case SDLK_f: /* switch to fullscreen */
vlc_mutex_lock( &p_intf->p_vout->change_lock );
p_intf->p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
vlc_mutex_unlock( &p_intf->p_vout->change_lock );
break;
case SDLK_y: /* switch to hard YUV */
vlc_mutex_lock( &p_intf->p_vout->change_lock );
p_intf->p_vout->i_changes |= VOUT_YUV_CHANGE;
vlc_mutex_unlock( &p_intf->p_vout->change_lock );
break;
/* FIXME : this is temporary */
case SDLK_p:
if( p_intf->p_input->stream.control.i_status == PLAYING_S )
{
input_Pause( p_intf->p_input );
}
else
{
input_Play( p_intf->p_input );
}
break;
case SDLK_a:
i_rate = p_intf->p_input->stream.control.i_rate/2;
if ( i_rate >= MINIMAL_RATE )
{
input_Forward( p_intf->p_input, i_rate );
}
break;
case SDLK_z:
i_rate = p_intf->p_input->stream.control.i_rate*2;
if ( i_rate <= MAXIMAL_RATE )
{
/* Compensation of int truncature */
if ( i_rate > 500 && i_rate < 1000 )
i_rate = 1000;
input_Forward( p_intf->p_input, i_rate );
}
break;
case SDLK_j:
/* Jump forwards */
input_Seek( p_intf->p_input,
p_intf->p_input->stream.i_tell
+ p_intf->p_input->stream.i_size / 20 );
/* gabuzomeu */
break;
case SDLK_b:
/* Jump backwards */
input_Seek( p_intf->p_input,
p_intf->p_input->stream.i_tell
- p_intf->p_input->stream.i_size / 20 );
break;
default:
if( intf_ProcessKey( p_intf, (char )i_key ) )
{
intf_DbgMsg( "unhandled key '%c' (%i)", (char)i_key, i_key );
}
break;
}
break;
case SDL_MOUSEBUTTONDOWN:
if( event.button.button == SDL_BUTTON_MIDDLE )
{
vlc_mutex_lock( &p_intf->p_vout->change_lock );
p_intf->p_vout->i_changes |= VOUT_CURSOR_CHANGE;
vlc_mutex_unlock( &p_intf->p_vout->change_lock );
}
break;
case SDL_QUIT:
intf_ProcessKey( p_intf, SDLK_q );
break;
default:
break;
}
}
}
void intf_SDL_Keymap(intf_thread_t * p_intf )
{
/* p_intf->p_intf_getKey = intf_getKey; */
intf_AssignKey(p_intf, SDLK_q, INTF_KEY_QUIT, 0);
intf_AssignKey(p_intf, SDLK_ESCAPE, INTF_KEY_QUIT, 0);
/* intf_AssignKey(p_intf,3,'Q'); */
intf_AssignKey(p_intf, SDLK_0, INTF_KEY_SET_CHANNEL,0);
intf_AssignKey(p_intf, SDLK_1, INTF_KEY_SET_CHANNEL,1);
intf_AssignKey(p_intf, SDLK_2, INTF_KEY_SET_CHANNEL,2);
intf_AssignKey(p_intf, SDLK_3, INTF_KEY_SET_CHANNEL,3);
intf_AssignKey(p_intf, SDLK_4, INTF_KEY_SET_CHANNEL,4);
intf_AssignKey(p_intf, SDLK_5, INTF_KEY_SET_CHANNEL,5);
intf_AssignKey(p_intf, SDLK_6, INTF_KEY_SET_CHANNEL,6);
intf_AssignKey(p_intf, SDLK_7, INTF_KEY_SET_CHANNEL,7);
intf_AssignKey(p_intf, SDLK_8, INTF_KEY_SET_CHANNEL,8);
intf_AssignKey(p_intf, SDLK_9, INTF_KEY_SET_CHANNEL,9);
intf_AssignKey(p_intf, SDLK_PLUS, INTF_KEY_INC_VOLUME, 0);
intf_AssignKey(p_intf, SDLK_MINUS, INTF_KEY_DEC_VOLUME, 0);
intf_AssignKey(p_intf, SDLK_m, INTF_KEY_TOGGLE_VOLUME, 0);
/* intf_AssignKey(p_intf,'M','M'); */
intf_AssignKey(p_intf, SDLK_g, INTF_KEY_DEC_GAMMA, 0);
/* intf_AssignKey(p_intf,'G','G'); */
intf_AssignKey(p_intf, SDLK_c, INTF_KEY_TOGGLE_GRAYSCALE, 0);
intf_AssignKey(p_intf, SDLK_SPACE, INTF_KEY_TOGGLE_INTERFACE, 0);
intf_AssignKey(p_intf, SDLK_i, INTF_KEY_TOGGLE_INFO, 0);
intf_AssignKey(p_intf, SDLK_s, INTF_KEY_TOGGLE_SCALING, 0);
}
...@@ -36,14 +36,12 @@ ...@@ -36,14 +36,12 @@
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "tests.h" #include "tests.h"
#include "plugins.h"
#include "interface.h"
#include "audio_output.h" #include "audio_output.h"
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
/* audio includes */
#include "modules.h" #include "modules.h"
#include "modules_inner.h" #include "modules_inner.h"
...@@ -59,6 +57,7 @@ MODULE_CONFIG_END ...@@ -59,6 +57,7 @@ MODULE_CONFIG_END
* Capabilities defined in the other files. * Capabilities defined in the other files.
******************************************************************************/ ******************************************************************************/
extern void aout_getfunctions( function_list_t * p_function_list ); extern void aout_getfunctions( function_list_t * p_function_list );
extern void vout_getfunctions( function_list_t * p_function_list );
/***************************************************************************** /*****************************************************************************
* InitModule: get the module structure and configuration. * InitModule: get the module structure and configuration.
...@@ -75,6 +74,7 @@ int InitModule( module_t * p_module ) ...@@ -75,6 +74,7 @@ int InitModule( module_t * p_module )
p_module->psz_version = VERSION; p_module->psz_version = VERSION;
p_module->i_capabilities = MODULE_CAPABILITY_NULL p_module->i_capabilities = MODULE_CAPABILITY_NULL
| MODULE_CAPABILITY_VOUT
| MODULE_CAPABILITY_AOUT; | MODULE_CAPABILITY_AOUT;
return( 0 ); return( 0 );
...@@ -97,6 +97,7 @@ int ActivateModule( module_t * p_module ) ...@@ -97,6 +97,7 @@ int ActivateModule( module_t * p_module )
} }
aout_getfunctions( &p_module->p_functions->aout ); aout_getfunctions( &p_module->p_functions->aout );
vout_getfunctions( &p_module->p_functions->vout );
p_module->p_config = p_config; p_module->p_config = p_config;
...@@ -117,82 +118,3 @@ int DeactivateModule( module_t * p_module ) ...@@ -117,82 +118,3 @@ int DeactivateModule( module_t * p_module )
return( 0 ); return( 0 );
} }
/* old plugin API */
/*****************************************************************************
* Exported prototypes
*****************************************************************************/
static void vout_GetPlugin( p_vout_thread_t p_vout );
static void intf_GetPlugin( p_intf_thread_t p_intf );
/* Video output */
int vout_SDLCreate ( vout_thread_t *p_vout, char *psz_display,
int i_root_window, void *p_data );
int vout_SDLInit ( p_vout_thread_t p_vout );
void vout_SDLEnd ( p_vout_thread_t p_vout );
void vout_SDLDestroy ( p_vout_thread_t p_vout );
int vout_SDLManage ( p_vout_thread_t p_vout );
void vout_SDLDisplay ( p_vout_thread_t p_vout );
void vout_SDLSetPalette ( p_vout_thread_t p_vout,
u16 *red, u16 *green, u16 *blue, u16 *transp );
/* Interface */
int intf_SDLCreate ( p_intf_thread_t p_intf );
void intf_SDLDestroy ( p_intf_thread_t p_intf );
void intf_SDLManage ( p_intf_thread_t p_intf );
/*****************************************************************************
* GetConfig: get the plugin structure and configuration
*****************************************************************************/
plugin_info_t * GetConfig( void )
{
plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
p_info->psz_name = "SDL (video)";
p_info->psz_version = VERSION;
p_info->psz_author = "the VideoLAN team <vlc@videolan.org>";
p_info->aout_GetPlugin = NULL;
p_info->vout_GetPlugin = vout_GetPlugin;
p_info->intf_GetPlugin = intf_GetPlugin;
p_info->yuv_GetPlugin = NULL;
/* if the SDL libraries are there, assume we can enter the
* initialization part at least, even if we fail afterwards */
p_info->i_score = 0x100;
/* If this plugin was requested, score it higher */
if( TestMethod( VOUT_METHOD_VAR, "sdl" ) )
{
p_info->i_score += 0x200;
}
return( p_info );
}
/*****************************************************************************
* Following functions are only called through the p_info structure
*****************************************************************************/
static void vout_GetPlugin( p_vout_thread_t p_vout )
{
p_vout->p_sys_create = vout_SDLCreate;
p_vout->p_sys_init = vout_SDLInit;
p_vout->p_sys_end = vout_SDLEnd;
p_vout->p_sys_destroy = vout_SDLDestroy;
p_vout->p_sys_manage = vout_SDLManage;
p_vout->p_sys_display = vout_SDLDisplay;
p_vout->p_set_palette = vout_SDLSetPalette;
}
static void intf_GetPlugin( p_intf_thread_t p_intf )
{
p_intf->p_sys_create = intf_SDLCreate;
p_intf->p_sys_destroy = intf_SDLDestroy;
p_intf->p_sys_manage = intf_SDLManage;
}
This diff is collapsed.
...@@ -227,7 +227,7 @@ static void SetYUV( vout_thread_t *p_vout ) ...@@ -227,7 +227,7 @@ static void SetYUV( vout_thread_t *p_vout )
transp[ i_index ] = 0; transp[ i_index ] = 0;
} }
/* the colors have been allocated, we can set the palette */ /* the colors have been allocated, we can set the palette */
p_vout->p_set_palette( p_vout, bright, bright, bright, transp ); p_vout->pf_setpalette( p_vout, bright, bright, bright, transp );
p_vout->i_white_pixel = 0xff; p_vout->i_white_pixel = 0xff;
p_vout->i_black_pixel = 0x00; p_vout->i_black_pixel = 0x00;
p_vout->i_gray_pixel = 0x44; p_vout->i_gray_pixel = 0x44;
...@@ -325,7 +325,7 @@ static void SetYUV( vout_thread_t *p_vout ) ...@@ -325,7 +325,7 @@ static void SetYUV( vout_thread_t *p_vout )
/* the colors have been allocated, we can set the palette */ /* the colors have been allocated, we can set the palette */
/* there will eventually be a way to know which colors /* there will eventually be a way to know which colors
* couldn't be allocated and try to find a replacement */ * couldn't be allocated and try to find a replacement */
p_vout->p_set_palette( p_vout, red, green, blue, transp ); p_vout->pf_setpalette( p_vout, red, green, blue, transp );
p_vout->i_white_pixel = 0xff; p_vout->i_white_pixel = 0xff;
p_vout->i_black_pixel = 0x00; p_vout->i_black_pixel = 0x00;
......
...@@ -190,7 +190,7 @@ static void SetYUV( vout_thread_t *p_vout ) ...@@ -190,7 +190,7 @@ static void SetYUV( vout_thread_t *p_vout )
transp[ i_index ] = 0; transp[ i_index ] = 0;
} }
/* the colors have been allocated, we can set the palette */ /* the colors have been allocated, we can set the palette */
p_vout->p_set_palette( p_vout, bright, bright, bright, transp ); p_vout->pf_setpalette( p_vout, bright, bright, bright, transp );
p_vout->i_white_pixel = 0xff; p_vout->i_white_pixel = 0xff;
p_vout->i_black_pixel = 0x00; p_vout->i_black_pixel = 0x00;
p_vout->i_gray_pixel = 0x44; p_vout->i_gray_pixel = 0x44;
...@@ -263,7 +263,7 @@ static void SetYUV( vout_thread_t *p_vout ) ...@@ -263,7 +263,7 @@ static void SetYUV( vout_thread_t *p_vout )
/* the colors have been allocated, we can set the palette */ /* the colors have been allocated, we can set the palette */
/* there will eventually be a way to know which colors /* there will eventually be a way to know which colors
* couldn't be allocated and try to find a replacement */ * couldn't be allocated and try to find a replacement */
p_vout->p_set_palette( p_vout, red, green, blue, transp ); p_vout->pf_setpalette( p_vout, red, green, blue, transp );
p_vout->i_white_pixel = 0xff; p_vout->i_white_pixel = 0xff;
p_vout->i_black_pixel = 0x00; p_vout->i_black_pixel = 0x00;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ac3_decoder_thread.c: ac3 decoder thread * ac3_decoder_thread.c: ac3 decoder thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: ac3_decoder_thread.c,v 1.23 2001/01/05 18:46:44 massiot Exp $ * $Id: ac3_decoder_thread.c,v 1.24 2001/02/11 01:15:10 sam Exp $
* *
* Authors: * Authors:
* *
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#include "common.h" #include "common.h"
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "plugins.h"
#include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */ #include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "common.h" #include "common.h"
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "plugins.h"
#include "intf_msg.h" #include "intf_msg.h"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* audio_decoder.c: MPEG audio decoder thread * audio_decoder.c: MPEG audio decoder thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: audio_decoder.c,v 1.46 2001/01/11 17:44:48 sam Exp $ * $Id: audio_decoder.c,v 1.47 2001/02/11 01:15:10 sam Exp $
* *
* Authors: Michel Kaempf <maxx@via.ecp.fr> * Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr> * Michel Lespinasse <walken@via.ecp.fr>
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include "common.h" #include "common.h"
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "plugins.h"
#include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */ #include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
......
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
#include "common.h" #include "common.h"
#include "threads.h" #include "threads.h"
#include "mtime.h" /* mtime_t, mdate(), msleep() */ #include "mtime.h" /* mtime_t, mdate(), msleep() */
#include "plugins.h"
#include "modules.h" #include "modules.h"
#include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */ #include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
...@@ -112,7 +111,7 @@ aout_thread_t *aout_CreateThread( int *pi_status ) ...@@ -112,7 +111,7 @@ aout_thread_t *aout_CreateThread( int *pi_status )
} }
/* Choose the best module */ /* Choose the best module */
p_aout->p_module = module_Need( p_main->p_module_bank, p_aout->p_module = module_Need( p_main->p_bank,
MODULE_CAPABILITY_AOUT, NULL ); MODULE_CAPABILITY_AOUT, NULL );
if( p_aout->p_module == NULL ) if( p_aout->p_module == NULL )
...@@ -135,7 +134,7 @@ aout_thread_t *aout_CreateThread( int *pi_status ) ...@@ -135,7 +134,7 @@ aout_thread_t *aout_CreateThread( int *pi_status )
*/ */
if ( p_aout->pf_open( p_aout ) ) if ( p_aout->pf_open( p_aout ) )
{ {
module_Unneed( p_main->p_module_bank, p_aout->p_module ); module_Unneed( p_main->p_bank, p_aout->p_module );
free( p_aout ); free( p_aout );
return( NULL ); return( NULL );
} }
...@@ -146,7 +145,7 @@ aout_thread_t *aout_CreateThread( int *pi_status ) ...@@ -146,7 +145,7 @@ aout_thread_t *aout_CreateThread( int *pi_status )
if ( p_aout->pf_setformat( p_aout ) ) if ( p_aout->pf_setformat( p_aout ) )
{ {
p_aout->pf_close( p_aout ); p_aout->pf_close( p_aout );
module_Unneed( p_main->p_module_bank, p_aout->p_module ); module_Unneed( p_main->p_bank, p_aout->p_module );
free( p_aout ); free( p_aout );
return( NULL ); return( NULL );
} }
...@@ -160,7 +159,7 @@ aout_thread_t *aout_CreateThread( int *pi_status ) ...@@ -160,7 +159,7 @@ aout_thread_t *aout_CreateThread( int *pi_status )
if( aout_SpawnThread( p_aout ) ) if( aout_SpawnThread( p_aout ) )
{ {
p_aout->pf_close( p_aout ); p_aout->pf_close( p_aout );
module_Unneed( p_main->p_module_bank, p_aout->p_module ); module_Unneed( p_main->p_bank, p_aout->p_module );
free( p_aout ); free( p_aout );
return( NULL ); return( NULL );
} }
...@@ -338,7 +337,7 @@ void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status ) ...@@ -338,7 +337,7 @@ void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status )
p_aout->pf_close( p_aout ); p_aout->pf_close( p_aout );
/* Release the aout module */ /* Release the aout module */
module_Unneed( p_main->p_module_bank, p_aout->p_module ); module_Unneed( p_main->p_bank, p_aout->p_module );
/* Free structure */ /* Free structure */
free( p_aout ); free( p_aout );
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* decoders. * decoders.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.78 2001/02/08 13:52:35 massiot Exp $ * $Id: input.c,v 1.79 2001/02/11 01:15:11 sam Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -115,7 +115,7 @@ input_thread_t *input_CreateThread ( playlist_item_t *p_item, int *pi_status ) ...@@ -115,7 +115,7 @@ input_thread_t *input_CreateThread ( playlist_item_t *p_item, int *pi_status )
/* Initialize default settings for spawned decoders */ /* Initialize default settings for spawned decoders */
p_input->p_default_aout = p_main->p_aout; p_input->p_default_aout = p_main->p_aout;
p_input->p_default_vout = p_main->p_intf->p_vout; p_input->p_default_vout = p_main->p_vout;
/* Create thread and set locks. */ /* Create thread and set locks. */
vlc_mutex_init( &p_input->stream.stream_lock ); vlc_mutex_init( &p_input->stream.stream_lock );
...@@ -268,7 +268,7 @@ static void InitThread( input_thread_t * p_input ) ...@@ -268,7 +268,7 @@ static void InitThread( input_thread_t * p_input )
p_input->c_packets_trashed = 0; p_input->c_packets_trashed = 0;
#endif #endif
p_input->p_input_module = module_Need( p_main->p_module_bank, p_input->p_input_module = module_Need( p_main->p_bank,
MODULE_CAPABILITY_INPUT, NULL ); MODULE_CAPABILITY_INPUT, NULL );
if( p_input->p_input_module == NULL ) if( p_input->p_input_module == NULL )
...@@ -297,7 +297,7 @@ static void InitThread( input_thread_t * p_input ) ...@@ -297,7 +297,7 @@ static void InitThread( input_thread_t * p_input )
if( p_input->b_error ) if( p_input->b_error )
{ {
module_Unneed( p_main->p_module_bank, p_input->p_input_module ); module_Unneed( p_main->p_bank, p_input->p_input_module );
} }
else else
{ {
...@@ -352,7 +352,7 @@ static void EndThread( input_thread_t * p_input ) ...@@ -352,7 +352,7 @@ static void EndThread( input_thread_t * p_input )
p_input->pf_end( p_input ); p_input->pf_end( p_input );
/* Release modules */ /* Release modules */
module_Unneed( p_main->p_module_bank, p_input->p_input_module ); module_Unneed( p_main->p_bank, p_input->p_input_module );
/* Destroy Mutex locks */ /* Destroy Mutex locks */
vlc_mutex_destroy( &p_input->stream.control.control_lock ); vlc_mutex_destroy( &p_input->stream.control.control_lock );
......
This diff is collapsed.
This diff is collapsed.
/***************************************************************************** /*****************************************************************************
* plugins.h : Dynamic plugin management functions * intf_channels.h: Channel handling functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* *
* Authors: * Authors:
* *
...@@ -20,40 +20,31 @@ ...@@ -20,40 +20,31 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
#ifdef SYS_BEOS /*****************************************************************************
typedef int plugin_id_t; * intf_channel_t: channel description
#define GET_PLUGIN( p_func, plugin_id, psz_name ) \ *****************************************************************************
get_image_symbol( plugin_id, psz_name, B_SYMBOL_TYPE_TEXT, &p_func ); * A 'channel' is a descriptor of an input method. It is used to switch easily
#else * from source to source without having to specify the whole input thread
typedef void *plugin_id_t; * configuration. The channels array, stored in the interface thread object, is
#define GET_PLUGIN( p_func, plugin_id, psz_name ) \ * loaded in intf_Create, and unloaded in intf_Destroy.
p_func = dlsym( plugin_id, psz_name ); *****************************************************************************/
#endif typedef struct intf_channel_s
typedef struct plugin_info_s
{ {
plugin_id_t plugin_id; /* Channel description */
int i_channel; /* channel number, -1 for end of array */
char * psz_filename; char * psz_description; /* channel description (owned) */
char * psz_name;
char * psz_version;
char * psz_author;
void * aout_GetPlugin; /* Input configuration */
void * vout_GetPlugin; int i_input_method; /* input method descriptor */
void * intf_GetPlugin; char * psz_input_source; /* source string (owned) */
void * yuv_GetPlugin; int i_input_port; /* port */
int i_input_vlan_id; /* vlan id */
} intf_channel_t;
int i_score; /*****************************************************************************
} plugin_info_t; * Prototypes
*****************************************************************************/
typedef struct plugin_bank_s int intf_LoadChannels ( struct intf_thread_s *, char * );
{ void intf_UnloadChannels ( struct intf_thread_s * );
int i_plugin_count; int intf_SelectChannel ( struct intf_thread_s *, int );
plugin_info_t * p_info[ MAX_PLUGIN_COUNT ];
} plugin_bank_t;
plugin_bank_t * bank_Create ( void );
void bank_Init ( plugin_bank_t * p_bank );
void bank_Destroy ( plugin_bank_t * p_bank );
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include "common.h" #include "common.h"
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "plugins.h"
#include "interface.h" #include "interface.h"
#include "intf_msg.h" #include "intf_msg.h"
......
...@@ -54,7 +54,6 @@ ...@@ -54,7 +54,6 @@
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "debug.h" #include "debug.h"
#include "plugins.h"
#include "intf_msg.h" #include "intf_msg.h"
#include "stream_control.h" #include "stream_control.h"
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include "common.h" #include "common.h"
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "plugins.h"
#include "intf_msg.h" #include "intf_msg.h"
#include "interface.h" #include "interface.h"
#include "intf_console.h" #include "intf_console.h"
...@@ -224,7 +224,7 @@ void intf_WarnMsg( int i_level, char *psz_format, ... ) ...@@ -224,7 +224,7 @@ void intf_WarnMsg( int i_level, char *psz_format, ... )
{ {
va_list ap; va_list ap;
if( i_level >= p_main->p_intf->i_warning_level ) if( i_level >= p_main->i_warning_level )
{ {
va_start( ap, psz_format ); va_start( ap, psz_format );
QueueMsg( p_main->p_msg, INTF_MSG_WARN, psz_format, ap ); QueueMsg( p_main->p_msg, INTF_MSG_WARN, psz_format, ap );
...@@ -316,7 +316,7 @@ void intf_WarnMsgImm( int i_level, char *psz_format, ... ) ...@@ -316,7 +316,7 @@ void intf_WarnMsgImm( int i_level, char *psz_format, ... )
{ {
va_list ap; va_list ap;
if( i_level >= p_main->p_intf->i_warning_level ) if( i_level >= p_main->i_warning_level )
{ {
va_start( ap, psz_format ); va_start( ap, psz_format );
QueueMsg( p_main->p_msg, INTF_MSG_WARN, psz_format, ap ); QueueMsg( p_main->p_msg, INTF_MSG_WARN, psz_format, ap );
......
...@@ -85,7 +85,7 @@ void intf_PlstInit ( playlist_t * p_playlist ) ...@@ -85,7 +85,7 @@ void intf_PlstInit ( playlist_t * p_playlist )
/* The playlist is empty */ /* The playlist is empty */
p_playlist->p_item = NULL; p_playlist->p_item = NULL;
intf_Msg("intf: playlist initialized"); intf_WarnMsg( 1, "intf: playlist initialized" );
} }
/***************************************************************************** /*****************************************************************************
...@@ -235,7 +235,7 @@ void intf_PlstDestroy( playlist_t * p_playlist ) ...@@ -235,7 +235,7 @@ void intf_PlstDestroy( playlist_t * p_playlist )
free( p_playlist ); free( p_playlist );
intf_Msg("intf: playlist destroyed"); intf_WarnMsg( 1, "intf: playlist destroyed" );
} }
/***************************************************************************** /*****************************************************************************
......
This diff is collapsed.
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "common.h" #include "common.h"
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "plugins.h"
#include "intf_msg.h" #include "intf_msg.h"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* lpcm_decoder_thread.c: lpcm decoder thread * lpcm_decoder_thread.c: lpcm decoder thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: lpcm_decoder_thread.c,v 1.9 2001/01/05 18:46:44 massiot Exp $ * $Id: lpcm_decoder_thread.c,v 1.10 2001/02/11 01:15:11 sam Exp $
* *
* Authors: * Authors:
* *
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include "common.h" #include "common.h"
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "plugins.h"
#include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */ #include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
......
...@@ -95,7 +95,7 @@ void module_InitBank( module_bank_t * p_bank ) ...@@ -95,7 +95,7 @@ void module_InitBank( module_bank_t * p_bank )
p_bank->first = NULL; p_bank->first = NULL;
vlc_mutex_init( &p_bank->lock ); vlc_mutex_init( &p_bank->lock );
intf_Msg( "module: module bank initialized" ); intf_WarnMsg( 1, "module: module bank initialized" );
for( ; *ppsz_path != NULL ; ppsz_path++ ) for( ; *ppsz_path != NULL ; ppsz_path++ )
{ {
...@@ -308,7 +308,11 @@ module_t * module_Need( module_bank_t *p_bank, ...@@ -308,7 +308,11 @@ module_t * module_Need( module_bank_t *p_bank,
/* We release the global lock */ /* We release the global lock */
vlc_mutex_unlock( &p_bank->lock ); vlc_mutex_unlock( &p_bank->lock );
intf_WarnMsg( 1, "module: locking module `%s'", p_bestmodule->psz_name ); if( p_bestmodule != NULL )
{
intf_WarnMsg( 1, "module: locking module `%s'",
p_bestmodule->psz_name );
}
/* Don't forget that the module is still locked if bestmodule != NULL */ /* Don't forget that the module is still locked if bestmodule != NULL */
return( p_bestmodule ); return( p_bestmodule );
...@@ -357,8 +361,8 @@ static int AllocateDynModule( module_bank_t * p_bank, char * psz_filename ) ...@@ -357,8 +361,8 @@ static int AllocateDynModule( module_bank_t * p_bank, char * psz_filename )
if( module_load( psz_filename, &handle ) ) if( module_load( psz_filename, &handle ) )
{ {
/* The dynamic module couldn't be opened */ /* The dynamic module couldn't be opened */
intf_ErrMsg( "module warning: cannot open %s (%s)", intf_WarnMsgImm( 1, "module warning: cannot open %s (%s)",
psz_filename, module_error() ); psz_filename, module_error() );
return( -1 ); return( -1 );
} }
......
This diff is collapsed.
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "common.h" #include "common.h"
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "plugins.h"
#include "intf_msg.h" #include "intf_msg.h"
#include "debug.h" /* ASSERT */ #include "debug.h" /* ASSERT */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* video_decoder.c : video decoder thread * video_decoder.c : video decoder thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: video_decoder.c,v 1.45 2001/01/18 05:13:23 sam Exp $ * $Id: video_decoder.c,v 1.46 2001/02/11 01:15:11 sam Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Gal Hendryckx <jimmy@via.ecp.fr> * Gal Hendryckx <jimmy@via.ecp.fr>
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include "common.h" #include "common.h"
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "plugins.h"
#include "intf_msg.h" #include "intf_msg.h"
......
...@@ -41,7 +41,8 @@ ...@@ -41,7 +41,8 @@
#include "common.h" #include "common.h"
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "plugins.h" #include "modules.h"
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "video_text.h" #include "video_text.h"
...@@ -49,6 +50,7 @@ ...@@ -49,6 +50,7 @@
#include "video_yuv.h" #include "video_yuv.h"
#include "intf_msg.h" #include "intf_msg.h"
#include "main.h" #include "main.h"
/***************************************************************************** /*****************************************************************************
...@@ -90,15 +92,11 @@ static void SetPalette ( p_vout_thread_t p_vout, u16 *red, ...@@ -90,15 +92,11 @@ static void SetPalette ( p_vout_thread_t p_vout, u16 *red,
* If pi_status is NULL, then the function will block until the thread is ready. * If pi_status is NULL, then the function will block until the thread is ready.
* If not, it will be updated using one of the THREAD_* constants. * If not, it will be updated using one of the THREAD_* constants.
*****************************************************************************/ *****************************************************************************/
vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window, vout_thread_t * vout_CreateThread ( int *pi_status )
int i_width, int i_height, int *pi_status,
int i_method, void *p_data )
{ {
vout_thread_t * p_vout; /* thread descriptor */ vout_thread_t * p_vout; /* thread descriptor */
typedef void ( vout_getplugin_t ) ( vout_thread_t * p_vout );
int i_status; /* thread status */ int i_status; /* thread status */
int i_index; /* index for array initialization */ int i_index; /* index for array initialization */
int i_best_index = 0, i_best_score = 0;
/* Allocate descriptor */ /* Allocate descriptor */
p_vout = (vout_thread_t *) malloc( sizeof(vout_thread_t) ); p_vout = (vout_thread_t *) malloc( sizeof(vout_thread_t) );
...@@ -109,37 +107,31 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window, ...@@ -109,37 +107,31 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
return( NULL ); return( NULL );
} }
p_vout->p_set_palette = SetPalette; /* Choose the best module */
p_vout->p_module = module_Need( p_main->p_bank,
MODULE_CAPABILITY_VOUT, NULL );
/* Get a suitable video plugin */ if( p_vout->p_module == NULL )
for( i_index = 0 ; i_index < p_main->p_bank->i_plugin_count ; i_index++ )
{
/* If there's a plugin in p_info ... */
if( p_main->p_bank->p_info[ i_index ] != NULL )
{
/* ... and if this plugin provides the functions we want ... */
if( p_main->p_bank->p_info[ i_index ]->vout_GetPlugin != NULL )
{
/* ... 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 )
{ {
intf_ErrMsg( "vout error: no suitable vout module" );
free( p_vout ); free( p_vout );
return( NULL ); return( NULL );
} }
/* Get the plugin functions */ #define f p_vout->p_module->p_functions->vout.functions.vout
( (vout_getplugin_t *) p_vout->pf_create = f.pf_create;
p_main->p_bank->p_info[ i_best_index ]->vout_GetPlugin )( p_vout ); p_vout->pf_init = f.pf_init;
p_vout->pf_end = f.pf_end;
p_vout->pf_destroy = f.pf_destroy;
p_vout->pf_manage = f.pf_manage;
p_vout->pf_display = f.pf_display;
p_vout->pf_setpalette = f.pf_setpalette;
#undef f
if( p_vout->pf_setpalette == NULL )
{
p_vout->pf_setpalette = SetPalette;
}
/* Initialize thread properties - thread id and locks will be initialized /* Initialize thread properties - thread id and locks will be initialized
* later */ * later */
...@@ -153,16 +145,18 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window, ...@@ -153,16 +145,18 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
* fields will probably be modified by the method, and are only * fields will probably be modified by the method, and are only
* preferences */ * preferences */
p_vout->i_changes = 0; p_vout->i_changes = 0;
p_vout->i_width = i_width; p_vout->i_width = main_GetIntVariable( VOUT_WIDTH_VAR,
p_vout->i_height = i_height; VOUT_WIDTH_DEFAULT );
p_vout->i_bytes_per_line = i_width * 2; p_vout->i_height = main_GetIntVariable( VOUT_HEIGHT_VAR,
VOUT_HEIGHT_DEFAULT );
p_vout->i_bytes_per_line = p_vout->i_width * 2;
p_vout->i_screen_depth = 15; p_vout->i_screen_depth = 15;
p_vout->i_bytes_per_pixel = 2; p_vout->i_bytes_per_pixel = 2;
p_vout->f_gamma = VOUT_GAMMA; p_vout->f_gamma = VOUT_GAMMA;
p_vout->b_need_render = 1; p_vout->b_need_render = 1;
p_vout->b_grayscale = main_GetIntVariable( VOUT_GRAYSCALE_VAR, p_vout->b_grayscale = main_GetIntVariable( VOUT_GRAYSCALE_VAR,
VOUT_GRAYSCALE_DEFAULT ); VOUT_GRAYSCALE_DEFAULT );
p_vout->b_info = 0; p_vout->b_info = 0;
p_vout->b_interface = 0; p_vout->b_interface = 0;
p_vout->b_scale = 1; p_vout->b_scale = 1;
...@@ -199,8 +193,9 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window, ...@@ -199,8 +193,9 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
/* Create and initialize system-dependant method - this function issues its /* Create and initialize system-dependant method - this function issues its
* own error messages */ * own error messages */
if( p_vout->p_sys_create( p_vout, psz_display, i_root_window, p_data ) ) if( p_vout->pf_create( p_vout ) )
{ {
module_Unneed( p_main->p_bank, p_vout->p_module );
free( p_vout ); free( p_vout );
return( NULL ); return( NULL );
} }
...@@ -235,7 +230,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window, ...@@ -235,7 +230,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
if( p_vout->p_default_font == NULL ) if( p_vout->p_default_font == NULL )
{ {
intf_ErrMsg( "vout error: could not load default font" ); intf_ErrMsg( "vout error: could not load default font" );
p_vout->p_sys_destroy( p_vout ); p_vout->pf_destroy( p_vout );
free( p_vout ); free( p_vout );
return( NULL ); return( NULL );
} }
...@@ -248,7 +243,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window, ...@@ -248,7 +243,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
{ {
intf_ErrMsg( "vout error: could not load large font" ); intf_ErrMsg( "vout error: could not load large font" );
vout_UnloadFont( p_vout->p_default_font ); vout_UnloadFont( p_vout->p_default_font );
p_vout->p_sys_destroy( p_vout ); p_vout->pf_destroy( p_vout );
free( p_vout ); free( p_vout );
return( NULL ); return( NULL );
} }
...@@ -264,7 +259,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window, ...@@ -264,7 +259,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
intf_ErrMsg("vout error: %s", strerror(ENOMEM)); intf_ErrMsg("vout error: %s", strerror(ENOMEM));
vout_UnloadFont( p_vout->p_default_font ); vout_UnloadFont( p_vout->p_default_font );
vout_UnloadFont( p_vout->p_large_font ); vout_UnloadFont( p_vout->p_large_font );
p_vout->p_sys_destroy( p_vout ); p_vout->pf_destroy( p_vout );
free( p_vout ); free( p_vout );
return( NULL ); return( NULL );
} }
...@@ -930,7 +925,7 @@ static int InitThread( vout_thread_t *p_vout ) ...@@ -930,7 +925,7 @@ static int InitThread( vout_thread_t *p_vout )
#endif #endif
/* Initialize output method - this function issues its own error messages */ /* Initialize output method - this function issues its own error messages */
if( p_vout->p_sys_init( p_vout ) ) if( p_vout->pf_init( p_vout ) )
{ {
return( 1 ); return( 1 );
} }
...@@ -1191,7 +1186,7 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -1191,7 +1186,7 @@ static void RunThread( vout_thread_t *p_vout)
#endif #endif
if( b_display /* && !(p_vout->i_changes & VOUT_NODISPLAY_CHANGE) */ ) if( b_display /* && !(p_vout->i_changes & VOUT_NODISPLAY_CHANGE) */ )
{ {
p_vout->p_sys_display( p_vout ); p_vout->pf_display( p_vout );
#ifndef SYS_BEOS #ifndef SYS_BEOS
p_vout->i_buffer_index = ++p_vout->i_buffer_index & 1; p_vout->i_buffer_index = ++p_vout->i_buffer_index & 1;
#endif #endif
...@@ -1217,7 +1212,7 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -1217,7 +1212,7 @@ static void RunThread( vout_thread_t *p_vout)
/* /*
* Check events and manage thread * Check events and manage thread
*/ */
if( p_vout->p_sys_manage( p_vout ) | Manage( p_vout ) ) if( p_vout->pf_manage( p_vout ) | Manage( p_vout ) )
{ {
/* A fatal error occured, and the thread must terminate immediately, /* A fatal error occured, and the thread must terminate immediately,
* without displaying anything - setting b_error to 1 cause the * without displaying anything - setting b_error to 1 cause the
...@@ -1299,7 +1294,7 @@ static void EndThread( vout_thread_t *p_vout ) ...@@ -1299,7 +1294,7 @@ static void EndThread( vout_thread_t *p_vout )
/* Destroy translation tables */ /* Destroy translation tables */
vout_EndYUV( p_vout ); vout_EndYUV( p_vout );
p_vout->p_sys_end( p_vout ); p_vout->pf_end( p_vout );
/* Release the change lock */ /* Release the change lock */
vlc_mutex_unlock( &p_vout->change_lock ); vlc_mutex_unlock( &p_vout->change_lock );
...@@ -1321,13 +1316,16 @@ static void DestroyThread( vout_thread_t *p_vout, int i_status ) ...@@ -1321,13 +1316,16 @@ static void DestroyThread( vout_thread_t *p_vout, int i_status )
/* Destroy thread structures allocated by Create and InitThread */ /* Destroy thread structures allocated by Create and InitThread */
vout_UnloadFont( p_vout->p_default_font ); vout_UnloadFont( p_vout->p_default_font );
vout_UnloadFont( p_vout->p_large_font ); vout_UnloadFont( p_vout->p_large_font );
p_vout->p_sys_destroy( p_vout ); p_vout->pf_destroy( p_vout );
/* Destroy the locks */ /* Destroy the locks */
vlc_mutex_destroy( &p_vout->picture_lock ); vlc_mutex_destroy( &p_vout->picture_lock );
vlc_mutex_destroy( &p_vout->subpicture_lock ); vlc_mutex_destroy( &p_vout->subpicture_lock );
vlc_mutex_destroy( &p_vout->change_lock ); vlc_mutex_destroy( &p_vout->change_lock );
/* Release the module */
module_Unneed( p_main->p_bank, p_vout->p_module );
/* Free structure */ /* Free structure */
free( p_vout ); free( p_vout );
*pi_status = i_status; *pi_status = i_status;
...@@ -2076,7 +2074,7 @@ static int Manage( vout_thread_t *p_vout ) ...@@ -2076,7 +2074,7 @@ static int Manage( vout_thread_t *p_vout )
/* Detect unauthorized changes */ /* Detect unauthorized changes */
if( p_vout->i_changes ) if( p_vout->i_changes )
{ {
/* Some changes were not acknowledged by p_vout->p_sys_manage or this /* Some changes were not acknowledged by p_vout->pf_manage or this
* function, it means they should not be authorized */ * function, it means they should not be authorized */
intf_ErrMsg( "vout error: unauthorized changes in the vout thread" ); intf_ErrMsg( "vout error: unauthorized changes in the vout thread" );
return( 1 ); return( 1 );
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment