* ./plugins/aa/aa.c: we now parse the AAOPTS environment variable.

* ./plugins/aa/aa.c: a few simplifications in the code.
This commit is contained in:
Sam Hocevar 2002-04-10 00:04:04 +00:00
parent cb8ef93ce9
commit fe7ab73ad6
2 changed files with 43 additions and 57 deletions

View File

@ -4,6 +4,8 @@
HEAD
* ./plugins/aa/aa.c: we now parse the AAOPTS environment variable.
* ./plugins/aa/aa.c: a few simplifications in the code.
* ./configure.in: wrote a better test for libdvdread detection.
* ./plugins/gtk/gtk.glade: added lines this #@%$! Glade had munched, fixes
a segfault in the Gtk+ popup menu when toggling the interface.

View File

@ -2,7 +2,7 @@
* vout_aa.c: Aa video output display method for testing purposes
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: aa.c,v 1.1 2002/03/19 14:00:50 sam Exp $
* $Id: aa.c,v 1.2 2002/04/10 00:04:04 sam Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
@ -10,7 +10,7 @@
* 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
@ -35,8 +35,6 @@
#include "video.h"
#include "video_output.h"
#define AA_MAX_DIRECTBUFFERS 1
/*****************************************************************************
* Capabilities defined in the other files.
*****************************************************************************/
@ -91,7 +89,6 @@ static int vout_Manage ( struct vout_thread_s * );
static void vout_Render ( struct vout_thread_s *, struct picture_s * );
static void vout_Display ( struct vout_thread_s *, struct picture_s * );
static int NewPicture ( struct vout_thread_s *, struct picture_s * );
static void SetPalette ( struct vout_thread_s *, u16 *, u16 *, u16 * );
/*****************************************************************************
@ -124,9 +121,13 @@ static int vout_Create( vout_thread_t *p_vout )
return( 1 );
}
if (!(p_vout->p_sys->aa_context = aa_autoinit(&aa_defparams))) {
intf_ErrMsg("error: Cannot initialize AA-lib. Sorry");
return( 1 );
/* Don't parse any options, but take $AAOPTS into account */
aa_parseoptions( NULL, NULL, NULL, NULL );
if (!(p_vout->p_sys->aa_context = aa_autoinit(&aa_defparams)))
{
intf_ErrMsg( "vout error: cannot initialize AA-lib. Sorry" );
return( 1 );
}
p_vout->p_sys->i_width = aa_imgwidth(p_vout->p_sys->aa_context);
p_vout->p_sys->i_height = aa_imgheight(p_vout->p_sys->aa_context);
@ -140,8 +141,8 @@ static int vout_Create( vout_thread_t *p_vout )
static int vout_Init( vout_thread_t *p_vout )
{
int i_index;
picture_t *p_pic;
picture_t *p_pic = NULL;
I_OUTPUTPICTURES = 0;
p_vout->output.i_chroma = FOURCC_RGB2;
@ -151,37 +152,36 @@ static int vout_Init( vout_thread_t *p_vout )
* VOUT_ASPECT_FACTOR / p_vout->p_sys->i_height;
p_vout->output.pf_setpalette = SetPalette;
/* Try to initialize AA_MAX_DIRECTBUFFERS direct buffers */
while( I_OUTPUTPICTURES < AA_MAX_DIRECTBUFFERS )
/* Find an empty picture slot */
for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ )
{
p_pic = NULL;
/* Find an empty picture slot */
for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ )
{
if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE )
{
p_pic = p_vout->p_picture + i_index;
break;
}
}
/* Allocate the picture */
if( p_pic == NULL || NewPicture( p_vout, p_pic ) )
if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE )
{
p_pic = p_vout->p_picture + i_index;
break;
}
p_pic->i_status = DESTROYED_PICTURE;
p_pic->i_type = DIRECT_PICTURE;
PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic;
I_OUTPUTPICTURES++;
}
return( 0 );
if( p_pic == NULL )
{
return -1;
}
/* Allocate the picture */
p_pic->p->p_pixels = aa_image( p_vout->p_sys->aa_context );
p_pic->p->i_pixel_bytes = 1;
p_pic->p->i_lines = p_vout->p_sys->i_height;
p_pic->p->i_pitch = p_vout->p_sys->i_width;
p_pic->p->b_margin = 0;
p_pic->i_planes = 1;
p_pic->i_status = DESTROYED_PICTURE;
p_pic->i_type = DIRECT_PICTURE;
PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic;
I_OUTPUTPICTURES++;
return 0;
}
/*****************************************************************************
@ -233,27 +233,11 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
vout_PlacePicture( p_vout, p_vout->p_sys->i_width, p_vout->p_sys->i_height,
&i_x, &i_y, &i_width, &i_height );
// p_vout->p_sys->aa_context->imagebuffer = p_pic->p_data;
aa_fastrender(p_vout->p_sys->aa_context, 0, 0, aa_scrwidth(p_vout->p_sys->aa_context),
aa_scrheight(p_vout->p_sys->aa_context));
aa_fastrender( p_vout->p_sys->aa_context, 0, 0,
aa_scrwidth(p_vout->p_sys->aa_context),
aa_scrheight(p_vout->p_sys->aa_context) );
aa_flush(p_vout->p_sys->aa_context);
}
/*****************************************************************************
* NewPicture: allocate a picture
*****************************************************************************
* Returns 0 on success, -1 otherwise
*****************************************************************************/
static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
{
p_pic->p->p_pixels = aa_image(p_vout->p_sys->aa_context);
p_pic->p->i_pixel_bytes = 1;
p_pic->p->i_lines = p_vout->p_sys->i_height;
p_pic->p->i_pitch = p_vout->p_sys->i_width;
p_pic->p->b_margin = 0;
p_pic->i_planes = 1;
return( 0 );
}
/*****************************************************************************
@ -262,11 +246,11 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
static void SetPalette( vout_thread_t *p_vout, u16 *red, u16 *green, u16 *blue )
{
int i;
/* Fill colors with color information */
for( i = 0; i < 256; i++ )
{
aa_setpalette( p_vout->p_sys->palette, 256 -i,
aa_setpalette( p_vout->p_sys->palette, 256 -i,
red[ i ], green[ i ], blue[ i ] );
}
}