Commit 3aa3ecc1 authored by Sam Hocevar's avatar Sam Hocevar

* configure.ac:

    + Fixed internal symbols for version numbers containing "+".
    + Added a --enable-caca flag.
  * modules/video_output/caca.c:
    + Updated libcaca video output to the released version.
    + Added --caca-dithering flag (none, dither, random).
parent 6f73a8f3
dnl Autoconf settings for vlc dnl Autoconf settings for vlc
dnl $Id: configure.ac,v 1.114 2003/11/20 23:13:28 sigmunau Exp $ dnl $Id: configure.ac,v 1.115 2003/11/22 15:53:18 sam Exp $
AC_INIT(vlc,0.6.3-cvs) AC_INIT(vlc,0.6.3-cvs)
...@@ -2527,6 +2527,22 @@ then ...@@ -2527,6 +2527,22 @@ then
fi fi
fi fi
dnl
dnl libcaca plugin
dnl
AC_ARG_ENABLE(caca,
[ --enable-caca libcaca output (default disabled)])
if test "${enable_caca}" = "yes"
then
AC_PATH_PROG(CACA_CONFIG, caca-config, no)
if test "${CACA_CONFIG}" != "no"
then
AX_ADD_PLUGINS([caca])
AX_ADD_CFLAGS([caca],[`${CACA_CONFIG} --cflags`])
AX_ADD_LDFLAGS([caca],[`${CACA_CONFIG} --plugin-libs`])
fi
fi
dnl dnl
dnl win32 GDI plugin dnl win32 GDI plugin
dnl dnl
...@@ -3397,7 +3413,7 @@ AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION} ${CODENAME}", [Simple version st ...@@ -3397,7 +3413,7 @@ AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION} ${CODENAME}", [Simple version st
AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VLC media player - version ${VERSION} ${CODENAME} - (c) 1996-2003 VideoLAN", [Copyright string]) AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VLC media player - version ${VERSION} ${CODENAME} - (c) 1996-2003 VideoLAN", [Copyright string])
AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line]) AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
VLC_SYMBOL="`echo ${VERSION} | sed -e 'y/.-/__/'`" VLC_SYMBOL="`echo ${VERSION} | sed -e 'y/.-+/___/'`"
AC_DEFINE_UNQUOTED(MODULE_SUFFIX, "__${VLC_SYMBOL}", [String suffix for module functions]) AC_DEFINE_UNQUOTED(MODULE_SUFFIX, "__${VLC_SYMBOL}", [String suffix for module functions])
AC_DEFINE_UNQUOTED(MODULE_SYMBOL, ${VLC_SYMBOL}, [Symbol suffix for module functions]) AC_DEFINE_UNQUOTED(MODULE_SYMBOL, ${VLC_SYMBOL}, [Symbol suffix for module functions])
AC_DEFINE_UNQUOTED(LIBEXT, "${LIBEXT}", [Dynamic object extension]) AC_DEFINE_UNQUOTED(LIBEXT, "${LIBEXT}", [Dynamic object extension])
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* caca.c: Color ASCII Art video output plugin using libcaca * caca.c: Color ASCII Art video output plugin using libcaca
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: caca.c,v 1.1 2003/11/16 22:29:33 sam Exp $ * $Id: caca.c,v 1.2 2003/11/22 15:53:18 sam Exp $
* *
* Authors: Sam Hocevar <sam@zoy.org> * Authors: Sam Hocevar <sam@zoy.org>
* *
...@@ -50,12 +50,34 @@ static void Display ( vout_thread_t *, picture_t * ); ...@@ -50,12 +50,34 @@ static void Display ( vout_thread_t *, picture_t * );
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
*****************************************************************************/ *****************************************************************************/
#define MODE_TEXT N_("dithering mode")
#define MODE_LONGTEXT N_("Choose the libcaca dithering mode")
static char *mode_list[] = { "none", "ordered", "random" };
static char *mode_list_text[] = { N_("No dithering"), N_("Ordered dithering"),
N_("Random dithering") };
vlc_module_begin(); vlc_module_begin();
set_description( _("color ASCII art video output") ); add_category_hint( N_("Dithering"), NULL, VLC_FALSE );
add_string( "caca-dithering", "ordered", NULL, MODE_TEXT,
MODE_LONGTEXT, VLC_FALSE );
change_string_list( mode_list, mode_list_text, 0 );
set_description( _("colour ASCII art video output") );
set_capability( "video output", 12 ); set_capability( "video output", 12 );
set_callbacks( Create, Destroy ); set_callbacks( Create, Destroy );
vlc_module_end(); vlc_module_end();
/*****************************************************************************
* vout_sys_t: libcaca video output method descriptor
*****************************************************************************
* This structure is part of the video output thread descriptor.
* It describes the libcaca specific properties of an output thread.
*****************************************************************************/
struct vout_sys_t
{
struct caca_bitmap *p_bitmap;
};
/***************************************************************************** /*****************************************************************************
* Create: allocates libcaca video output thread * Create: allocates libcaca video output thread
***************************************************************************** *****************************************************************************
...@@ -64,14 +86,39 @@ vlc_module_end(); ...@@ -64,14 +86,39 @@ vlc_module_end();
static int Create( vlc_object_t *p_this ) static int Create( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; vout_thread_t *p_vout = (vout_thread_t *)p_this;
enum caca_dithering dither = CACA_DITHER_ORDERED;
vlc_value_t val;
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
{
msg_Err( p_vout, "out of memory" );
return VLC_ENOMEM;
}
if( caca_init() ) if( caca_init() )
{ {
msg_Err( p_vout, "cannot initialize libcaca" ); msg_Err( p_vout, "cannot initialize libcaca" );
free( p_vout->p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
caca_set_dithering( CACA_DITHER_RANDOM ); var_Create( p_vout, "caca-dithering", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Get( p_vout, "caca-dithering", &val );
if( val.psz_string )
{
if( !strcmp( val.psz_string, "none" ) )
{
dither = CACA_DITHER_NONE;
}
else if( !strcmp( val.psz_string, "random" ) )
{
dither = CACA_DITHER_RANDOM;
}
free( val.psz_string );
}
caca_set_dithering( dither );
p_vout->pf_init = Init; p_vout->pf_init = Init;
p_vout->pf_end = End; p_vout->pf_end = End;
...@@ -92,7 +139,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -92,7 +139,7 @@ static int Init( vout_thread_t *p_vout )
I_OUTPUTPICTURES = 0; I_OUTPUTPICTURES = 0;
p_vout->output.i_chroma = VLC_FOURCC('R','V','2','4'); p_vout->output.i_chroma = VLC_FOURCC('R','V','3','2');
p_vout->output.i_width = p_vout->render.i_width; p_vout->output.i_width = p_vout->render.i_width;
p_vout->output.i_height = p_vout->render.i_height; p_vout->output.i_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect; p_vout->output.i_aspect = p_vout->render.i_aspect;
...@@ -101,6 +148,21 @@ static int Init( vout_thread_t *p_vout ) ...@@ -101,6 +148,21 @@ static int Init( vout_thread_t *p_vout )
p_vout->output.i_gmask = 0x0000ff00; p_vout->output.i_gmask = 0x0000ff00;
p_vout->output.i_bmask = 0x000000ff; p_vout->output.i_bmask = 0x000000ff;
/* Create the libcaca bitmap */
p_vout->p_sys->p_bitmap =
caca_create_bitmap( 32,
p_vout->output.i_width,
p_vout->output.i_height,
4 * ((p_vout->output.i_width + 15) & ~15),
p_vout->output.i_rmask,
p_vout->output.i_gmask,
p_vout->output.i_bmask );
if( !p_vout->p_sys->p_bitmap )
{
msg_Err( p_vout, "could not create libcaca bitmap" );
return VLC_EGENERIC;
}
/* Find an empty picture slot */ /* Find an empty picture slot */
for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ ) for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ )
{ {
...@@ -138,7 +200,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -138,7 +200,7 @@ static int Init( vout_thread_t *p_vout )
*****************************************************************************/ *****************************************************************************/
static void End( vout_thread_t *p_vout ) static void End( vout_thread_t *p_vout )
{ {
return; caca_free_bitmap( p_vout->p_sys->p_bitmap );
} }
/***************************************************************************** /*****************************************************************************
...@@ -148,7 +210,10 @@ static void End( vout_thread_t *p_vout ) ...@@ -148,7 +210,10 @@ static void End( vout_thread_t *p_vout )
*****************************************************************************/ *****************************************************************************/
static void Destroy( vlc_object_t *p_this ) static void Destroy( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this;
caca_end(); caca_end();
free( p_vout->p_sys );
} }
/***************************************************************************** /*****************************************************************************
...@@ -159,21 +224,24 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -159,21 +224,24 @@ static void Destroy( vlc_object_t *p_this )
*****************************************************************************/ *****************************************************************************/
static int Manage( vout_thread_t *p_vout ) static int Manage( vout_thread_t *p_vout )
{ {
int key; int event;
vlc_value_t val; vlc_value_t val;
while(( key = caca_get_key() )) while(( event = caca_get_event() ))
{ {
switch( key ) if( event & CACA_EVENT_KEY_PRESS )
{ {
case 'q': switch( event & 0xffff )
val.i_int = KEY_MODIFIER_CTRL | 'q'; {
break; case 'q':
case ' ': val.i_int = KEY_MODIFIER_CTRL | 'q';
val.i_int = KEY_SPACE; break;
break; case ' ':
default: val.i_int = KEY_SPACE;
continue; break;
default:
continue;
}
} }
var_Set( p_vout->p_vlc, "key-pressed", val ); var_Set( p_vout->p_vlc, "key-pressed", val );
...@@ -189,8 +257,7 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -189,8 +257,7 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
{ {
caca_clear(); caca_clear();
caca_blit( 0, 0, caca_get_width() - 1, caca_get_height() - 1, caca_blit( 0, 0, caca_get_width() - 1, caca_get_height() - 1,
p_pic->p->p_pixels, p_vout->p_sys->p_bitmap, p_pic->p->p_pixels );
p_vout->output.i_width, p_vout->output.i_height );
} }
/***************************************************************************** /*****************************************************************************
......
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