* vout_pictures.c : picture management functions
*****************************************************************************
* Copyright (C) 2000 VideoLAN
- * $Id: vout_pictures.c,v 1.28 2002/07/23 00:39:17 sam Exp $
+ * $Id: vout_pictures.c,v 1.34 2003/01/22 10:44:50 fenrir Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <errno.h> /* ENOMEM */
#include <stdlib.h> /* free() */
#include <stdio.h> /* sprintf() */
#include <string.h> /* strerror() */
vlc_mutex_lock( &p_vout->picture_lock );
/*
- * Look for an empty place. We start at 1 because the first
- * directbuffer is reserved for memcpy()ed pictures.
+ * Look for an empty place in the picture heap.
*/
- for( i_pic = 0; i_pic < I_RENDERPICTURES && p_freepic == NULL; i_pic++ )
+ for( i_pic = 0; i_pic < I_RENDERPICTURES; i_pic++ )
{
- p_pic = PP_RENDERPICTURE[ i_pic ];
-
- /* If the picture we found is a memory buffer, and we have enough
- * pictures in the stack, and we might have enough room later for
- * a direct buffer, skip it. If no other pictures are found, the
- * video decoder will try again later. */
- if( p_vout->b_direct && ( p_vout->output.i_pictures > 5 )
- && ( p_pic->i_type != DIRECT_PICTURE ) )
- {
- break;
- }
+ p_pic = PP_RENDERPICTURE[(p_vout->render.i_last_used_pic + i_pic + 1)
+ % I_RENDERPICTURES];
switch( p_pic->i_status )
{
p_pic->b_top_field_first = b_top_field_first;
p_vout->i_heap_size++;
+ p_vout->render.i_last_used_pic =
+ ( p_vout->render.i_last_used_pic + i_pic + 1 )
+ % I_RENDERPICTURES;
vlc_mutex_unlock( &p_vout->picture_lock );
return( p_pic );
case FREE_PICTURE:
/* Picture is empty and ready for allocation */
+ p_vout->render.i_last_used_pic =
+ ( p_vout->render.i_last_used_pic + i_pic + 1 )
+ % I_RENDERPICTURES;
p_freepic = p_pic;
break;
if( p_pic->i_type == DIRECT_PICTURE )
{
- if( p_pic->i_refcount )
+ if( !p_vout->render.b_allow_modify_pics || p_pic->i_refcount )
{
/* Picture is in a direct buffer and is still in use,
* we need to copy it to another direct buffer before
* This function will be accessed by plugins. It calculates the relative
* position of the output window and the image window.
*****************************************************************************/
-void vout_PlacePicture( vout_thread_t *p_vout, int i_width, int i_height,
- int *pi_x, int *pi_y, int *pi_width, int *pi_height )
+void vout_PlacePicture( vout_thread_t *p_vout,
+ unsigned int i_width, unsigned int i_height,
+ unsigned int *pi_x, unsigned int *pi_y,
+ unsigned int *pi_width, unsigned int *pi_height )
{
if( (i_width <= 0) || (i_height <=0) )
{
p_pic->i_planes = 1;
break;
+ case FOURCC_RGB2:
+ p_pic->p->i_lines = i_height;
+ p_pic->p->i_pitch = i_width;
+ p_pic->p->i_visible_pitch = p_pic->p->i_pitch;
+ p_pic->p->i_pixel_pitch = 1;
+ p_pic->i_planes = 1;
+ break;
+
case FOURCC_RV15:
p_pic->p->i_lines = i_height;
p_pic->p->i_pitch = i_width * 2;
else
{
/* We need to proceed line by line */
- u8 *p_in = p_src->p[i].p_pixels, *p_out = p_dest->p[i].p_pixels;
+ uint8_t *p_in = p_src->p[i].p_pixels;
+ uint8_t *p_out = p_dest->p[i].p_pixels;
int i_line;
for( i_line = p_src->p[i].i_lines; i_line--; )
}
}
}
+ p_dest->date = p_src->date;
}
-