Commit 75eb696d authored by Sam Hocevar's avatar Sam Hocevar

 * added --intf option to vlc
 * started cleaning vout_sdl.c
 * the dummy plugin works again
 * added a slider to the Gnome interface so that we can browse through streams

  There is a problem with the slider: we sometimes get unexpected async
  replies, which would mean that we don't properly lock our Xlib calls.
  Which is true. But we also get these errors when using `--vout dummy'.
  I'll investigate.
parent e8ceb0e1
......@@ -22,7 +22,7 @@ ac_help="$ac_help
ac_help="$ac_help
--disable-optimizations Disable compiler optimizations (default enabled)"
ac_help="$ac_help
--enable-dummy dummy audio and video support (default disabled)"
--disable-dummy dummy module (default enabled)"
ac_help="$ac_help
--disable-null Null module (default enabled)"
ac_help="$ac_help
......@@ -3419,9 +3419,10 @@ else
# Check whether --enable-dummy or --disable-dummy was given.
if test "${enable_dummy+set}" = set; then
enableval="$enable_dummy"
if test x$enable_dummy = xyes; then PLUGINS=${PLUGINS}"dummy "; fi
:
fi
if test x$enable_dummy != xno; then PLUGINS=${PLUGINS}"dummy "; fi
# Check whether --enable-null or --disable-null was given.
if test "${enable_null+set}" = set; then
enableval="$enable_null"
......@@ -3508,17 +3509,17 @@ if test "${enable_alsa+set}" = set; then
enableval="$enable_alsa"
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 "configure:3512: checking for sys/asoundlib.h" >&5
echo "configure:3513: checking for sys/asoundlib.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3517 "configure"
#line 3518 "configure"
#include "confdefs.h"
#include <sys/asoundlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3522: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:3523: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -3535,7 +3536,7 @@ fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for main in -lasound""... $ac_c" 1>&6
echo "configure:3539: checking for main in -lasound" >&5
echo "configure:3540: checking for main in -lasound" >&5
ac_lib_var=`echo asound'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -3543,14 +3544,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lasound $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3547 "configure"
#line 3548 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
if { (eval echo configure:3554: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
......
......@@ -138,8 +138,8 @@ dnl default case
else
AC_ARG_ENABLE(dummy,
[ --enable-dummy dummy audio and video support (default disabled)],
[if test x$enable_dummy = xyes; then PLUGINS=${PLUGINS}"dummy "; fi])
[ --disable-dummy dummy module (default enabled)])
if test x$enable_dummy != xno; then PLUGINS=${PLUGINS}"dummy "; fi
AC_ARG_ENABLE(null,
[ --disable-null Null module (default enabled)])
if test x$enable_null != xno; then PLUGINS=${PLUGINS}"null "; fi
......
......@@ -32,6 +32,9 @@ follows the usual GNU command line syntax, with long
options starting with two dashes (`-').
A summary of options is included below.
.TP
.B \-\-intf <module>
Specify an interface module: "gnome", "curses", "shell", for instance.
.TP
.B \-\-noaudio
Disable audio output.
.TP
......@@ -45,7 +48,7 @@ Choose stereo or mono audio output
Disable video output.
.TP
.B \-\-vout <module>
Specify a video output module: "gnome", "fb", "glide", for instance.
Specify a video output module: "x11", "sdl", "fb", for instance.
.TP
.B \-\-motion <module>
Specify a module for motion compensation: "motion", "motionmmx", for instance.
......@@ -85,9 +88,6 @@ displaying of all images.
Note that the vlc is certainly going to crash if you ask it to
display more images than your CPU can cope with.
.TP
.B \-\-dvd
Activate DVD mode, by directly accessing the DVD drive (no need to mount
it). By default,
.B vlc
opens /dev/dvd, but this behaviour may be overridden by the vlc_dvd_device
environment variable (see below).
......@@ -124,6 +124,7 @@ Output version information and exit.
also accepts a lot of parameters to customize its behaviour.
.TP
.B Interface parameters:
vlc_intf=<method name> interface method
vlc_init=<filename> initialization script
vlc_channels=<filename> channels list
warning_level=<level> warning level
......
/*****************************************************************************
* aout_dummy.c : dummy audio output plugin
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* Copyright (C) 2000, 2001 VideoLAN
*
* Authors:
* Authors: Samuel Hocevar <sam@zoy.org>
*
* 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
......@@ -94,8 +94,10 @@ static int aout_Open( aout_thread_t *p_aout )
{
/* Initialize some variables */
p_aout->i_format = AOUT_FORMAT_DEFAULT;
p_aout->i_channels = 1 + main_GetIntVariable( AOUT_STEREO_VAR, AOUT_STEREO_DEFAULT );
p_aout->l_rate = main_GetIntVariable( AOUT_RATE_VAR, AOUT_RATE_DEFAULT );
p_aout->i_channels = 1 + main_GetIntVariable( AOUT_STEREO_VAR,
AOUT_STEREO_DEFAULT );
p_aout->l_rate = main_GetIntVariable( AOUT_RATE_VAR,
AOUT_RATE_DEFAULT );
return( 0 );
}
......
/*****************************************************************************
* dummy.c : dummy plugin for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* Copyright (C) 2000, 2001 VideoLAN
*
* Authors:
* Authors: Samuel Hocevar <sam@zoy.org>
*
* 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
......@@ -34,10 +34,11 @@
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "plugins.h"
#include "interface.h"
#include "audio_output.h"
#include "video.h"
#include "video_output.h"
......@@ -56,6 +57,8 @@ MODULE_CONFIG_END
* Capabilities defined in the other files.
*****************************************************************************/
extern void aout_getfunctions( function_list_t * p_function_list );
extern void vout_getfunctions( function_list_t * p_function_list );
extern void intf_getfunctions( function_list_t * p_function_list );
/*****************************************************************************
* InitModule: get the module structure and configuration.
......@@ -72,7 +75,9 @@ int InitModule( module_t * p_module )
p_module->psz_version = VERSION;
p_module->i_capabilities = MODULE_CAPABILITY_NULL
| MODULE_CAPABILITY_AOUT;
| MODULE_CAPABILITY_AOUT
| MODULE_CAPABILITY_VOUT
| MODULE_CAPABILITY_INTF;
return( 0 );
}
......@@ -94,6 +99,8 @@ int ActivateModule( module_t * p_module )
}
aout_getfunctions( &p_module->p_functions->aout );
vout_getfunctions( &p_module->p_functions->vout );
intf_getfunctions( &p_module->p_functions->intf );
p_module->p_config = p_config;
......@@ -114,76 +121,3 @@ int DeactivateModule( module_t * p_module )
return( 0 );
}
/* OLD MODULE STRUCTURE -- soon to be removed */
/*****************************************************************************
* 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_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
*****************************************************************************/
plugin_info_t * GetConfig( void )
{
plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
p_info->psz_name = "Dummy";
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;
/* The dummy plugin always works, but should have low priority */
p_info->i_score = 0x1;
/* If this plugin was requested, score it higher */
if( TestMethod( VOUT_METHOD_VAR, "dummy" ) )
{
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_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;
}
static void intf_GetPlugin( p_intf_thread_t p_intf )
{
p_intf->p_sys_create = intf_DummyCreate;
p_intf->p_sys_destroy = intf_DummyDestroy;
p_intf->p_sys_manage = intf_DummyManage;
}
/*****************************************************************************
* intf_dummy.c: dummy interface plugin
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* Copyright (C) 2000, 2001 VideoLAN
*
* Authors:
* Authors: Samuel Hocevar <sam@zoy.org>
*
* 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
......@@ -31,13 +31,8 @@
#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 "tests.h"
#include "modules.h"
#include "intf_msg.h"
#include "interface.h"
......@@ -53,9 +48,45 @@ typedef struct intf_sys_s
} intf_sys_t;
/*****************************************************************************
* intf_DummyCreate: initialize dummy interface
* Local prototypes.
*****************************************************************************/
static int intf_Probe ( probedata_t *p_data );
static int intf_Open ( intf_thread_t *p_intf );
static void intf_Close ( intf_thread_t *p_intf );
static void intf_Run ( intf_thread_t *p_intf );
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
void intf_getfunctions( function_list_t * p_function_list )
{
p_function_list->pf_probe = intf_Probe;
p_function_list->functions.intf.pf_open = intf_Open;
p_function_list->functions.intf.pf_close = intf_Close;
p_function_list->functions.intf.pf_run = intf_Run;
}
/*****************************************************************************
* intf_Probe: probe the interface and return a score
*****************************************************************************
* This function tries to initialize Gnome and returns a score to the
* plugin manager so that it can select the best plugin.
*****************************************************************************/
static int intf_Probe( probedata_t *p_data )
{
if( TestMethod( INTF_METHOD_VAR, "dummy" ) )
{
return( 999 );
}
return( 1 );
}
/*****************************************************************************
* intf_Open: initialize dummy interface
*****************************************************************************/
int intf_DummyCreate( intf_thread_t *p_intf )
static int intf_Open( intf_thread_t *p_intf )
{
/* Allocate instance and initialize some members */
p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
......@@ -64,46 +95,31 @@ int intf_DummyCreate( intf_thread_t *p_intf )
return( 1 );
};
/* Spawn video output thread */
if( p_main->b_video )
{
p_intf->p_vout = vout_CreateThread( NULL, 0, 0, 0, NULL, 0, NULL );
if( p_intf->p_vout == NULL ) /* error */
{
intf_ErrMsg("intf error: can't create output thread" );
return( 1 );
}
}
return( 0 );
}
/*****************************************************************************
* intf_DummyDestroy: destroy dummy interface
* intf_Close: destroy dummy interface
*****************************************************************************/
void intf_DummyDestroy( intf_thread_t *p_intf )
static void intf_Close( 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 );
}
/* Destroy structure */
free( p_intf->p_sys );
}
/*****************************************************************************
* intf_DummyManage: event loop
* intf_Run: main loop
*****************************************************************************/
void intf_DummyManage( intf_thread_t *p_intf )
static void intf_Run( intf_thread_t *p_intf )
{
;
while( !p_intf->b_die )
{
/* Manage core vlc functions through the callback */
p_intf->pf_manage( p_intf );
/* Wait a bit */
msleep( INTF_IDLE_SLEEP );
}
}
/*****************************************************************************
* vout_dummy.c: Dummy video output display method for testing purposes
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* Copyright (C) 2000, 2001 VideoLAN
*
* Authors:
* Authors: Samuel Hocevar <sam@zoy.org>
*
* 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
......@@ -33,17 +33,18 @@
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "plugins.h"
#include "tests.h"
#include "modules.h"
#include "video.h"
#include "video_output.h"
#include "intf_msg.h"
#define WIDTH 16
#define HEIGHT 16
#define BITS_PER_PLANE 16
#define BYTES_PER_PIXEL 2
#define DUMMY_WIDTH 16
#define DUMMY_HEIGHT 16
#define DUMMY_BITS_PER_PLANE 16
#define DUMMY_BYTES_PER_PIXEL 2
/*****************************************************************************
* vout_sys_t: dummy video output method descriptor
......@@ -62,16 +63,49 @@ typedef struct vout_sys_s
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int DummyOpenDisplay ( vout_thread_t *p_vout );
static void DummyCloseDisplay ( vout_thread_t *p_vout );
static int vout_Probe ( probedata_t *p_data );
static int vout_Create ( struct vout_thread_s * );
static int vout_Init ( struct vout_thread_s * );
static void vout_End ( struct vout_thread_s * );
static void vout_Destroy ( struct vout_thread_s * );
static int vout_Manage ( struct vout_thread_s * );
static void vout_Display ( struct vout_thread_s * );
/*****************************************************************************
* vout_DummyCreate: allocates dummy video thread output method
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
void vout_getfunctions( function_list_t * p_function_list )
{
p_function_list->pf_probe = vout_Probe;
p_function_list->functions.vout.pf_create = vout_Create;
p_function_list->functions.vout.pf_init = vout_Init;
p_function_list->functions.vout.pf_end = vout_End;
p_function_list->functions.vout.pf_destroy = vout_Destroy;
p_function_list->functions.vout.pf_manage = vout_Manage;
p_function_list->functions.vout.pf_display = vout_Display;
p_function_list->functions.vout.pf_setpalette = NULL;
}
/*****************************************************************************
* intf_Probe: return a score
*****************************************************************************/
static int vout_Probe( probedata_t *p_data )
{
if( TestMethod( VOUT_METHOD_VAR, "dummy" ) )
{
return( 999 );
}
return( 1 );
}
/*****************************************************************************
* vout_Create: allocates dummy video thread output method
*****************************************************************************
* This function allocates and initializes a dummy vout method.
*****************************************************************************/
int vout_DummyCreate( vout_thread_t *p_vout, char *psz_display,
int i_root_window, void *p_data )
static int vout_Create( vout_thread_t *p_vout )
{
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
......@@ -81,109 +115,78 @@ int vout_DummyCreate( vout_thread_t *p_vout, char *psz_display,
return( 1 );
}
/* Open and initialize device */
if( DummyOpenDisplay( p_vout ) )
p_vout->i_width = DUMMY_WIDTH;
p_vout->i_height = DUMMY_HEIGHT;
p_vout->i_screen_depth = DUMMY_BITS_PER_PLANE;
p_vout->i_bytes_per_pixel = DUMMY_BYTES_PER_PIXEL;
p_vout->i_bytes_per_line = DUMMY_WIDTH * DUMMY_BYTES_PER_PIXEL;
p_vout->p_sys->i_page_size = DUMMY_WIDTH * DUMMY_HEIGHT
* DUMMY_BYTES_PER_PIXEL;
/* Map two framebuffers a the very beginning of the fb */
p_vout->p_sys->p_video = malloc( 2 * p_vout->p_sys->i_page_size );
if( p_vout->p_sys->p_video == NULL )
{
intf_ErrMsg("vout error: can't open display");
intf_ErrMsg( "vout error: can't map video memory (%s)",
strerror(errno) );
free( p_vout->p_sys );
return( 1 );
}
/* Set and initialize buffers */
vout_SetBuffers( p_vout, p_vout->p_sys->p_video,
p_vout->p_sys->p_video + p_vout->p_sys->i_page_size );
return( 0 );
}
/*****************************************************************************
* vout_DummyInit: initialize dummy video thread output method
* vout_Init: initialize dummy video thread output method
*****************************************************************************/
int vout_DummyInit( vout_thread_t *p_vout )
static int vout_Init( vout_thread_t *p_vout )
{
return( 0 );
}
/*****************************************************************************
* vout_DummyEnd: terminate dummy video thread output method
* vout_End: terminate dummy video thread output method
*****************************************************************************/
void vout_DummyEnd( vout_thread_t *p_vout )
static void vout_End( vout_thread_t *p_vout )
{
;
}
/*****************************************************************************
* vout_DummyDestroy: destroy dummy video thread output method
* vout_Destroy: destroy dummy video thread output method
*****************************************************************************
* Terminate an output method created by DummyCreateOutputMethod
*****************************************************************************/
void vout_DummyDestroy( vout_thread_t *p_vout )
static void vout_Destroy( vout_thread_t *p_vout )
{
DummyCloseDisplay( p_vout );
free( p_vout->p_sys->p_video );
free( p_vout->p_sys );
}
/*****************************************************************************
* vout_DummyManage: handle dummy events
* vout_Manage: 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_DummyManage( vout_thread_t *p_vout )
static int vout_Manage( vout_thread_t *p_vout )
{
return( 0 );
}
/*****************************************************************************
* vout_DummyDisplay: displays previously rendered output
* vout_Display: 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_DummyDisplay( vout_thread_t *p_vout )
static void vout_Display( vout_thread_t *p_vout )
{
;
}
/* following functions are local */
/*****************************************************************************
* DummyOpenDisplay: open and initialize dummy device
*****************************************************************************
* XXX?? The framebuffer mode is only provided as a fast and efficient way to
* display video, providing the card is configured and the mode ok. It is
* not portable, and is not supposed to work with many cards. Use at your
* own risk !
*****************************************************************************/
static int DummyOpenDisplay( vout_thread_t *p_vout )
{
p_vout->i_width = WIDTH;
p_vout->i_height = HEIGHT;
p_vout->i_screen_depth = BITS_PER_PLANE;
p_vout->i_bytes_per_pixel = BYTES_PER_PIXEL;
p_vout->i_bytes_per_line = WIDTH * BYTES_PER_PIXEL;
p_vout->p_sys->i_page_size = WIDTH * HEIGHT * BYTES_PER_PIXEL;
/* Map two framebuffers a the very beginning of the fb */
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)", strerror(errno) );
return( 1 );
}
/* Set and initialize buffers */
vout_SetBuffers( p_vout, p_vout->p_sys->p_video,
p_vout->p_sys->p_video + p_vout->p_sys->i_page_size );
return( 0 );
}
/*****************************************************************************
* DummyCloseDisplay: close and reset dummy device
*****************************************************************************
* Returns all resources allocated by DummyOpenDisplay and restore the original
* state of the device.
*****************************************************************************/
static void DummyCloseDisplay( vout_thread_t *p_vout )
{
free( p_vout->p_sys->p_video );