* 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>
*
* 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
#include "video.h"
#include "video_output.h"
-#define AA_MAX_DIRECTBUFFERS 1
-
/*****************************************************************************
* Capabilities defined in the other files.
*****************************************************************************/
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 * );
/*****************************************************************************
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);
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;
* 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++;
+ if( p_pic == NULL )
+ {
+ return -1;
}
- return( 0 );
+ /* 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;
}
/*****************************************************************************
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_flush(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) );
-/*****************************************************************************
- * 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 );
+ aa_flush(p_vout->p_sys->aa_context);
}
/*****************************************************************************
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 ] );
}
}