From 00ac3ff5f9fe8794828cfd77f3315fd65a0e2147 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sat, 12 Jan 2002 01:25:57 +0000 Subject: [PATCH] * ./plugins/chroma/i420_rgb16.c: 24/32 bpp software YUV. * ./plugins/ggi/ggi.c: activated double buffering. * ./src/video_output/vout_pictures.c: we create more Xv pictures to get smoother rendering. --- debian/control | 2 +- plugins/chroma/i420_rgb.c | 3 +- plugins/chroma/i420_rgb.h | 3 +- plugins/chroma/i420_rgb16.c | 130 +++++++++++++++++++++++++--- plugins/chroma/i420_rgb8.c | 3 +- plugins/dummy/vout_dummy.c | 4 +- plugins/fb/fb.c | 116 +++++++++++-------------- plugins/ggi/ggi.c | 143 ++++++++++++++----------------- plugins/sdl/vout_sdl.c | 4 +- plugins/x11/xcommon.c | 54 +++++++++--- src/video_output/video_output.c | 22 +++-- src/video_output/vout_pictures.c | 11 +-- 12 files changed, 309 insertions(+), 186 deletions(-) diff --git a/debian/control b/debian/control index 58ca0a8f63..c1955f0043 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: graphics Priority: optional Maintainer: Samuel Hocevar Build-Depends: debhelper (>=2.2.0), - xlibs-dev, + xlibs-dev, xlibs-pic libgnome-dev, libggi2-dev, libglide2-dev [i386], diff --git a/plugins/chroma/i420_rgb.c b/plugins/chroma/i420_rgb.c index c5cc1ed507..279b72e052 100644 --- a/plugins/chroma/i420_rgb.c +++ b/plugins/chroma/i420_rgb.c @@ -2,7 +2,7 @@ * i420_rgb.c : YUV to bitmap RGB conversion module for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: i420_rgb.c,v 1.1 2002/01/04 14:01:34 sam Exp $ + * $Id: i420_rgb.c,v 1.2 2002/01/12 01:25:57 sam Exp $ * * Authors: Samuel Hocevar * @@ -151,7 +151,6 @@ static int chroma_Init( vout_thread_t *p_vout ) break; case FOURCC_BI_BITFIELDS: - //p_vout->chroma.pf_convert = _M( I420_RGB24 ); p_vout->chroma.pf_convert = _M( I420_RGB32 ); break; diff --git a/plugins/chroma/i420_rgb.h b/plugins/chroma/i420_rgb.h index 701d558917..d402a5d86d 100644 --- a/plugins/chroma/i420_rgb.h +++ b/plugins/chroma/i420_rgb.h @@ -2,7 +2,7 @@ * i420_rgb.h : YUV to bitmap RGB conversion module for vlc ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: i420_rgb.h,v 1.1 2002/01/04 14:01:34 sam Exp $ + * $Id: i420_rgb.h,v 1.2 2002/01/12 01:25:57 sam Exp $ * * Authors: Samuel Hocevar * @@ -41,7 +41,6 @@ typedef struct chroma_sys_s void _M( I420_RGB8 ) ( vout_thread_t *, picture_t *, picture_t * ); #endif void _M( I420_RGB16 )( vout_thread_t *, picture_t *, picture_t * ); -void _M( I420_RGB24 )( vout_thread_t *, picture_t *, picture_t * ); void _M( I420_RGB32 )( vout_thread_t *, picture_t *, picture_t * ); /***************************************************************************** diff --git a/plugins/chroma/i420_rgb16.c b/plugins/chroma/i420_rgb16.c index cef58f4029..5fa64dd63c 100644 --- a/plugins/chroma/i420_rgb16.c +++ b/plugins/chroma/i420_rgb16.c @@ -2,7 +2,7 @@ * i420_rgb16.c : YUV to bitmap RGB conversion module for vlc ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: i420_rgb16.c,v 1.1 2002/01/04 14:01:34 sam Exp $ + * $Id: i420_rgb16.c,v 1.2 2002/01/12 01:25:57 sam Exp $ * * Authors: Samuel Hocevar * @@ -171,24 +171,132 @@ void _M( I420_RGB16 )( vout_thread_t *p_vout, picture_t *p_src, } } -/***************************************************************************** - * I420_RGB24: color YUV 4:2:0 to RGB 24 bpp - *****************************************************************************/ -void _M( I420_RGB24 )( vout_thread_t *p_vout, picture_t *p_src, - picture_t *p_dest ) -{ - intf_ErrMsg( "vout error: I420_RGB24 unimplemented, " - "please harass sam@zoy.org" ); -} - /***************************************************************************** * I420_RGB32: color YUV 4:2:0 to RGB 32 bpp + ***************************************************************************** + * Horizontal alignment needed: + * - input: 8 pixels (8 Y bytes, 4 U/V bytes), margins not allowed + * - output: 1 pixel (2 bytes), margins allowed + * Vertical alignment needed: + * - input: 2 lines (2 Y lines, 1 U/V line) + * - output: 1 line *****************************************************************************/ void _M( I420_RGB32 )( vout_thread_t *p_vout, picture_t *p_src, picture_t *p_dest ) { + /* We got this one from the old arguments */ + u32 *p_pic = (u32*)p_dest->p->p_pixels; + u8 *p_y = p_src->Y_PIXELS; + u8 *p_u = p_src->U_PIXELS; + u8 *p_v = p_src->V_PIXELS; + + boolean_t b_hscale; /* horizontal scaling type */ + int i_vscale; /* vertical scaling type */ + int i_x, i_y; /* horizontal and vertical indexes */ + int i_right_margin; + int i_rewind; + int i_scale_count; /* scale modulo counter */ + int i_chroma_width = p_vout->render.i_width / 2; /* chroma width */ + u32 * p_pic_start; /* beginning of the current line for copy */ + + /* Conversion buffer pointer */ + u32 * p_buffer_start = (u32*)p_vout->chroma.p_sys->p_buffer; + u32 * p_buffer; + + /* Offset array pointer */ + int * p_offset_start = p_vout->chroma.p_sys->p_offset; + int * p_offset; + + if( p_dest->p->b_margin ) + { + i_right_margin = (p_dest->p->i_pitch - p_dest->p->i_visible_bytes) / 2; + } + else + { + i_right_margin = 0; + } + + if( p_vout->render.i_width & 7 ) + { + i_rewind = 8 - ( p_vout->render.i_width & 7 ); + } + else + { + i_rewind = 0; + } + + /* Rule: when a picture of size (x1,y1) with aspect ratio r1 is rendered + * on a picture of size (x2,y2) with aspect ratio r2, if x1 grows to x1' + * then y1 grows to y1' = x1' * y2/x2 * r2/r1 */ + SetOffset( p_vout->render.i_width, p_vout->render.i_height, + p_vout->output.i_width, p_vout->output.i_height, + &b_hscale, &i_vscale, p_offset_start ); + +#if defined (MODULE_NAME_IS_chroma_i420_rgb) intf_ErrMsg( "vout error: I420_RGB32 unimplemented, " "please harass sam@zoy.org" ); +#endif + + /* + * Perform conversion + */ + i_scale_count = ( i_vscale == 1 ) ? + p_vout->output.i_height : p_vout->render.i_height; + for( i_y = 0; i_y < p_vout->render.i_height; i_y++ ) + { + p_pic_start = p_pic; + p_buffer = b_hscale ? p_buffer_start : p_pic; + + for ( i_x = p_vout->render.i_width / 8; i_x--; ) + { +#if defined (MODULE_NAME_IS_chroma_i420_rgb) + /* FIXME: TODO */ +#elif defined (MODULE_NAME_IS_chroma_i420_rgb_mmx) + __asm__( MMX_INIT_32 + : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) ); + + __asm__( ".align 8" + MMX_YUV_MUL + MMX_YUV_ADD + MMX_UNPACK_32 + : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) ); + + p_y += 8; + p_u += 4; + p_v += 4; + p_buffer += 8; +#endif + } + + /* Here we do some unaligned reads and duplicate conversions, but + * at least we have all the pixels */ + if( i_rewind ) + { + p_y -= i_rewind; + p_u -= i_rewind >> 1; + p_v -= i_rewind >> 1; + p_buffer -= i_rewind; +#if defined (MODULE_NAME_IS_chroma_i420_rgb) + /* FIXME: TODO */ +#elif defined (MODULE_NAME_IS_chroma_i420_rgb_mmx) + __asm__( MMX_INIT_32 + : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) ); + + __asm__( ".align 8" + MMX_YUV_MUL + MMX_YUV_ADD + MMX_UNPACK_32 + : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) ); + + p_y += 8; + p_u += 4; + p_v += 4; + p_buffer += 8; +#endif + } + SCALE_WIDTH; + SCALE_HEIGHT( 420, 4 ); + } } /* Following functions are local */ diff --git a/plugins/chroma/i420_rgb8.c b/plugins/chroma/i420_rgb8.c index 9fa80fcad0..d105c4051e 100644 --- a/plugins/chroma/i420_rgb8.c +++ b/plugins/chroma/i420_rgb8.c @@ -2,7 +2,7 @@ * i420_rgb8.c : YUV to bitmap RGB conversion module for vlc ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: i420_rgb8.c,v 1.1 2002/01/04 14:01:34 sam Exp $ + * $Id: i420_rgb8.c,v 1.2 2002/01/12 01:25:57 sam Exp $ * * Authors: Samuel Hocevar * @@ -76,6 +76,7 @@ void _M( I420_RGB8 )( vout_thread_t *p_vout, picture_t *p_source, &b_hscale, &i_vscale, p_offset_start ); /* FIXME */ +#warning "Please ignore the following warnings, I already know about them" intf_ErrMsg( "vout error: I420_RGB8 unimplemented, " "please harass sam@zoy.org" ); } diff --git a/plugins/dummy/vout_dummy.c b/plugins/dummy/vout_dummy.c index 4a6542b3fc..2f41bd765a 100644 --- a/plugins/dummy/vout_dummy.c +++ b/plugins/dummy/vout_dummy.c @@ -2,7 +2,7 @@ * vout_dummy.c: Dummy video output display method for testing purposes ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: vout_dummy.c,v 1.16 2002/01/05 03:49:18 sam Exp $ + * $Id: vout_dummy.c,v 1.17 2002/01/12 01:25:57 sam Exp $ * * Authors: Samuel Hocevar * @@ -35,7 +35,7 @@ #define DUMMY_WIDTH 16 #define DUMMY_HEIGHT 16 -#define DUMMY_MAX_DIRECTBUFFERS 5 +#define DUMMY_MAX_DIRECTBUFFERS 10 /***************************************************************************** * vout_sys_t: dummy video output method descriptor diff --git a/plugins/fb/fb.c b/plugins/fb/fb.c index cf86c24ecf..5bf04207b1 100644 --- a/plugins/fb/fb.c +++ b/plugins/fb/fb.c @@ -2,7 +2,7 @@ * fb.c : framebuffer plugin for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: fb.c,v 1.11 2002/01/06 00:07:37 sam Exp $ + * $Id: fb.c,v 1.12 2002/01/12 01:25:57 sam Exp $ * * Authors: Samuel Hocevar * @@ -60,7 +60,6 @@ static void vout_End ( vout_thread_t * ); static int OpenDisplay ( vout_thread_t * ); static void CloseDisplay ( vout_thread_t * ); -static int NewPicture ( vout_thread_t *, picture_t * ); static void SwitchDisplay ( int i_signal ); static void TextMode ( int i_tty ); static void GfxMode ( int i_tty ); @@ -292,7 +291,7 @@ static int vout_Init( vout_thread_t *p_vout ) p_vout->output.i_chroma = FOURCC_BI_BITFIELDS; break; default: intf_ErrMsg( "vout error: unknown screen depth" ); - return( 0 ); + return 0; } p_vout->output.i_width = p_vout->p_sys->i_width; @@ -305,35 +304,64 @@ static int vout_Init( vout_thread_t *p_vout ) /* Clear the screen */ memset( p_vout->p_sys->p_video, 0, p_vout->p_sys->i_page_size ); - /* Try to initialize up to 1 direct buffers */ - while( I_OUTPUTPICTURES < 1 ) - { - p_pic = NULL; + /* Try to initialize 1 direct buffer */ + 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 ) ) + /* 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; } + } - p_pic->i_status = DESTROYED_PICTURE; - p_pic->i_type = DIRECT_PICTURE; + /* Allocate the picture */ + if( p_pic == NULL ) + { + return 0; + } - PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic; + /* We know the chroma, allocate a buffer which will be used + * directly by the decoder */ + p_pic->p->p_pixels = p_vout->p_sys->p_video; + p_pic->p->i_pixel_bytes = p_vout->p_sys->i_bytes_per_pixel; + p_pic->p->i_lines = p_vout->p_sys->var_info.yres; - I_OUTPUTPICTURES++; + if( p_vout->p_sys->var_info.xres_virtual ) + { + p_pic->p->b_margin = 1; + p_pic->p->b_hidden = 1; + p_pic->p->i_pitch = p_vout->p_sys->var_info.xres_virtual + * p_vout->p_sys->i_bytes_per_pixel; + p_pic->p->i_visible_bytes = p_vout->p_sys->var_info.xres + * p_vout->p_sys->i_bytes_per_pixel; + } + else + { + p_pic->p->b_margin = 0; + p_pic->p->i_pitch = p_vout->p_sys->var_info.xres + * p_vout->p_sys->i_bytes_per_pixel; } + /* Only useful for p_vout->p_sys->var_info.bits_per_pixel != 8 */ + p_pic->p->i_red_mask = ( (1 << p_vout->p_sys->var_info.red.length) - 1 ) + << p_vout->p_sys->var_info.red.offset; + p_pic->p->i_green_mask = ( (1 << p_vout->p_sys->var_info.green.length) - 1 ) + << p_vout->p_sys->var_info.green.offset; + p_pic->p->i_blue_mask = ( (1 << p_vout->p_sys->var_info.blue.length) - 1 ) + << p_vout->p_sys->var_info.blue.offset; + + 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 ); } @@ -647,48 +675,6 @@ static void CloseDisplay( vout_thread_t *p_vout ) close( p_vout->p_sys->i_fd ); } -/***************************************************************************** - * NewPicture: allocate a picture - ***************************************************************************** - * Returns 0 on success, -1 otherwise - *****************************************************************************/ -static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic ) -{ - /* We know the chroma, allocate a buffer which will be used - * directly by the decoder */ - p_pic->p->p_pixels = p_vout->p_sys->p_video; - p_pic->p->i_pixel_bytes = p_vout->p_sys->i_bytes_per_pixel; - p_pic->p->i_lines = p_vout->p_sys->var_info.yres; - - if( p_vout->p_sys->var_info.xres_virtual ) - { - p_pic->p->b_margin = 1; - p_pic->p->b_hidden = 1; - p_pic->p->i_pitch = p_vout->p_sys->var_info.xres_virtual - * p_vout->p_sys->i_bytes_per_pixel; - p_pic->p->i_visible_bytes = p_vout->p_sys->var_info.xres - * p_vout->p_sys->i_bytes_per_pixel; - } - else - { - p_pic->p->b_margin = 0; - p_pic->p->i_pitch = p_vout->p_sys->var_info.xres - * p_vout->p_sys->i_bytes_per_pixel; - } - - /* Only useful for p_vout->p_sys->var_info.bits_per_pixel != 8 */ - p_pic->p->i_red_mask = ( (1 << p_vout->p_sys->var_info.red.length) - 1 ) - << p_vout->p_sys->var_info.red.offset; - p_pic->p->i_green_mask = ( (1 << p_vout->p_sys->var_info.green.length) - 1 ) - << p_vout->p_sys->var_info.green.offset; - p_pic->p->i_blue_mask = ( (1 << p_vout->p_sys->var_info.blue.length) - 1 ) - << p_vout->p_sys->var_info.blue.offset; - - p_pic->i_planes = 1; - - return 0; -} - /***************************************************************************** * SwitchDisplay: VT change signal handler ***************************************************************************** diff --git a/plugins/ggi/ggi.c b/plugins/ggi/ggi.c index b09c11c102..08455a82ce 100644 --- a/plugins/ggi/ggi.c +++ b/plugins/ggi/ggi.c @@ -2,7 +2,7 @@ * ggi.c : GGI plugin for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: ggi.c,v 1.11 2002/01/07 02:12:29 sam Exp $ + * $Id: ggi.c,v 1.12 2002/01/12 01:25:57 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -55,7 +55,6 @@ static void vout_Display ( vout_thread_t *, picture_t * ); static int OpenDisplay ( vout_thread_t * ); static void CloseDisplay ( vout_thread_t * ); -static int NewPicture ( vout_thread_t *, picture_t * ); /***************************************************************************** * Building configuration tree @@ -91,7 +90,7 @@ typedef struct vout_sys_s int i_bits_per_pixel; /* Buffer information */ - ggi_directbuffer * p_buffer[2]; /* buffers */ + ggi_directbuffer * pp_buffer[2]; /* buffers */ int i_index; boolean_t b_must_acquire; /* must be acquired before writing */ @@ -162,6 +161,8 @@ int vout_Init( vout_thread_t *p_vout ) int i_index; picture_t *p_pic; + I_OUTPUTPICTURES = 0; + p_vout->output.i_width = p_vout->p_sys->mode.visible.x; p_vout->output.i_height = p_vout->p_sys->mode.visible.y; p_vout->output.i_aspect = p_vout->p_sys->mode.visible.x @@ -182,43 +183,64 @@ int vout_Init( vout_thread_t *p_vout ) p_vout->output.i_chroma = FOURCC_BI_BITFIELDS; break; default: intf_ErrMsg( "vout error: unknown screen depth" ); - return( 0 ); + return 0; } - I_OUTPUTPICTURES = 0; + p_pic = NULL; - /* Try to initialize up to 1 direct buffers */ - while( I_OUTPUTPICTURES < 1 ) + /* 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; + if( p_pic == NULL ) + { + return 0; + } - PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic; +#define p_b p_vout->p_sys->pp_buffer + /* We know the chroma, allocate a buffer which will be used + * directly by the decoder */ + p_vout->p_sys->i_index = 0; + p_pic->p->p_pixels = p_b[ 0 ]->write; + p_pic->p->i_pixel_bytes = p_b[ 0 ]->buffer.plb.pixelformat->size / 8; + p_pic->p->i_lines = p_vout->p_sys->mode.visible.y; - I_OUTPUTPICTURES++; + if( p_b[ 0 ]->buffer.plb.pixelformat->size / 8 + * p_vout->p_sys->mode.visible.x + != p_b[ 0 ]->buffer.plb.stride ) + { + p_pic->p->b_margin = 1; + p_pic->p->b_hidden = 1; + p_pic->p->i_pitch = p_b[ 0 ]->buffer.plb.stride; + p_pic->p->i_visible_bytes = p_b[ 0 ]->buffer.plb.pixelformat->size + / 8 * p_vout->p_sys->mode.visible.x; + } + else + { + p_pic->p->b_margin = 0; + p_pic->p->i_pitch = p_b[ 0 ]->buffer.plb.stride; } - return( 0 ); -#if 0 -#define p_b p_vout->p_sys->p_buffer + /* Only useful for bits_per_pixel != 8 */ + p_pic->p->i_red_mask = p_b[ 0 ]->buffer.plb.pixelformat->red_mask; + p_pic->p->i_green_mask = p_b[ 0 ]->buffer.plb.pixelformat->green_mask; + p_pic->p->i_blue_mask = p_b[ 0 ]->buffer.plb.pixelformat->blue_mask; + + 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++; + /* Acquire first buffer */ if( p_vout->p_sys->b_must_acquire ) { @@ -235,7 +257,6 @@ int vout_Init( vout_thread_t *p_vout ) return( 0 ); #undef p_b -#endif } /***************************************************************************** @@ -245,11 +266,11 @@ int vout_Init( vout_thread_t *p_vout ) *****************************************************************************/ void vout_End( vout_thread_t *p_vout ) { -#define p_b p_vout->p_sys->p_buffer +#define p_b p_vout->p_sys->pp_buffer /* Release buffer */ if( p_vout->p_sys->b_must_acquire ) { - ggiResourceRelease( p_b[ 0 ]->resource ); + ggiResourceRelease( p_b[ p_vout->p_sys->i_index ]->resource ); } #undef p_b } @@ -336,23 +357,28 @@ void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) *****************************************************************************/ void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) { -#define p_b p_vout->p_sys->p_buffer +#define p_b p_vout->p_sys->pp_buffer + p_pic->p->p_pixels = p_b[ p_vout->p_sys->i_index ]->write; + /* Change display frame */ if( p_vout->p_sys->b_must_acquire ) { - ggiResourceRelease( p_b[ 0 ]->resource ); + ggiResourceRelease( p_b[ p_vout->p_sys->i_index ]->resource ); } ggiSetDisplayFrame( p_vout->p_sys->p_display, - p_b[ 0 ]->frame ); + p_b[ p_vout->p_sys->i_index ]->frame ); /* Swap buffers and change write frame */ + p_vout->p_sys->i_index ^= 1; + p_pic->p->p_pixels = p_b[ p_vout->p_sys->i_index ]->write; + if( p_vout->p_sys->b_must_acquire ) { - ggiResourceAcquire( p_b[ 0 ]->resource, + ggiResourceAcquire( p_b[ p_vout->p_sys->i_index ]->resource, GGI_ACTYPE_WRITE ); } ggiSetWriteFrame( p_vout->p_sys->p_display, - p_b[ 0 ]->frame ); + p_b[ p_vout->p_sys->i_index ]->frame ); /* Flush the output so that it actually displays */ ggiFlush( p_vout->p_sys->p_display ); @@ -369,7 +395,7 @@ void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) *****************************************************************************/ static int OpenDisplay( vout_thread_t *p_vout ) { -#define p_b p_vout->p_sys->p_buffer +#define p_b p_vout->p_sys->pp_buffer ggi_color col_fg; /* foreground color */ ggi_color col_bg; /* background color */ int i_index; /* all purposes index */ @@ -425,7 +451,7 @@ static int OpenDisplay( vout_thread_t *p_vout ) for( i_index = 0; i_index < 2; i_index++ ) { /* Get buffer address */ - p_vout->p_sys->p_buffer[ i_index ] = + p_vout->p_sys->pp_buffer[ i_index ] = (ggi_directbuffer *)ggiDBGetBuffer( p_vout->p_sys->p_display, i_index ); if( p_b[ i_index ] == NULL ) @@ -508,44 +534,3 @@ static void CloseDisplay( vout_thread_t *p_vout ) ggiExit(); } -/***************************************************************************** - * NewPicture: allocate a picture - ***************************************************************************** - * Returns 0 on success, -1 otherwise - *****************************************************************************/ -static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic ) -{ -#define p_b p_vout->p_sys->p_buffer - /* We know the chroma, allocate a buffer which will be used - * directly by the decoder */ - p_pic->p->p_pixels = p_b[ 0 ]->write; - p_pic->p->i_pixel_bytes = p_b[ 0 ]->buffer.plb.pixelformat->size / 8; - p_pic->p->i_lines = p_vout->p_sys->mode.visible.y; - - if( p_b[ 0 ]->buffer.plb.pixelformat->size / 8 - * p_vout->p_sys->mode.visible.x - != p_b[ 0 ]->buffer.plb.stride ) - { - p_pic->p->b_margin = 1; - p_pic->p->b_hidden = 1; - p_pic->p->i_pitch = p_b[ 0 ]->buffer.plb.stride; - p_pic->p->i_visible_bytes = p_b[ 0 ]->buffer.plb.pixelformat->size / 8 - * p_vout->p_sys->mode.visible.x; - } - else - { - p_pic->p->b_margin = 0; - p_pic->p->i_pitch = p_b[ 0 ]->buffer.plb.stride; - } - - /* Only useful for bits_per_pixel != 8 */ - p_pic->p->i_red_mask = p_b[ 0 ]->buffer.plb.pixelformat->red_mask; - p_pic->p->i_green_mask = p_b[ 0 ]->buffer.plb.pixelformat->green_mask; - p_pic->p->i_blue_mask = p_b[ 0 ]->buffer.plb.pixelformat->blue_mask; - - p_pic->i_planes = 1; - - return 0; -#undef p_b -} - diff --git a/plugins/sdl/vout_sdl.c b/plugins/sdl/vout_sdl.c index 775635f85b..5be925da64 100644 --- a/plugins/sdl/vout_sdl.c +++ b/plugins/sdl/vout_sdl.c @@ -2,7 +2,7 @@ * vout_sdl.c: SDL video output display method ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: vout_sdl.c,v 1.79 2002/01/07 02:12:29 sam Exp $ + * $Id: vout_sdl.c,v 1.80 2002/01/12 01:25:57 sam Exp $ * * Authors: Samuel Hocevar * Pierre Baillet @@ -49,7 +49,7 @@ #include "stream_control.h" /* needed by input_ext-intf.h... */ #include "input_ext-intf.h" -#define SDL_MAX_DIRECTBUFFERS 5 +#define SDL_MAX_DIRECTBUFFERS 10 #define SDL_DEFAULT_BPP 16 /***************************************************************************** diff --git a/plugins/x11/xcommon.c b/plugins/x11/xcommon.c index 37b23b14ba..66180afa73 100644 --- a/plugins/x11/xcommon.c +++ b/plugins/x11/xcommon.c @@ -2,7 +2,7 @@ * xcommon.c: Functions common to the X11 and XVideo plugins ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: xcommon.c,v 1.10 2002/01/10 04:11:25 sam Exp $ + * $Id: xcommon.c,v 1.11 2002/01/12 01:25:57 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -212,7 +212,7 @@ typedef struct mwmhints_s * Chroma defines *****************************************************************************/ #ifdef MODULE_NAME_IS_xvideo -# define MAX_DIRECTBUFFERS 5 +# define MAX_DIRECTBUFFERS 10 #else # define MAX_DIRECTBUFFERS 2 #endif @@ -611,15 +611,17 @@ static int vout_Manage( vout_thread_t *p_vout ) == True ) { /* ConfigureNotify event: prepare */ - if( (xevent.type == ConfigureNotify) - && ((xevent.xconfigure.width != p_vout->p_sys->i_width) - || (xevent.xconfigure.height != p_vout->p_sys->i_height)) ) + if( xevent.type == ConfigureNotify ) { - /* Update dimensions */ - b_resized = 1; - p_vout->i_changes |= VOUT_SIZE_CHANGE; - p_vout->p_sys->i_width = xevent.xconfigure.width; - p_vout->p_sys->i_height = xevent.xconfigure.height; + if( (xevent.xconfigure.width != p_vout->p_sys->i_width) + || (xevent.xconfigure.height != p_vout->p_sys->i_height) ) + { + /* Update dimensions */ + b_resized = 1; + p_vout->i_changes |= VOUT_SIZE_CHANGE; + p_vout->p_sys->i_width = xevent.xconfigure.width; + p_vout->p_sys->i_height = xevent.xconfigure.height; + } } /* MapNotify event: change window status and disable screen saver */ else if( xevent.type == MapNotify) @@ -766,6 +768,11 @@ static int vout_Manage( vout_thread_t *p_vout ) ToggleCursor( p_vout ); } } + /* Reparent move -- XXX: why are we getting this ? */ + else if( xevent.type == ReparentNotify ) + { + ; + } /* Other event */ else { @@ -1352,6 +1359,33 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic ) p_pic->i_planes = 1; + break; + + case FOURCC_BI_BITFIELDS: + + p_pic->p->p_pixels = p_pic->p_sys->p_image->data + + p_pic->p_sys->p_image->xoffset; + p_pic->p->i_lines = p_pic->p_sys->p_image->height; + p_pic->p->i_pitch = p_pic->p_sys->p_image->bytes_per_line; + p_pic->p->i_pixel_bytes = p_pic->p_sys->p_image->depth; + + if( p_pic->p->i_pitch == 4 * p_pic->p_sys->p_image->width ) + { + p_pic->p->b_margin = 0; + } + else + { + p_pic->p->b_margin = 1; + p_pic->p->b_hidden = 1; + p_pic->p->i_visible_bytes = 4 * p_pic->p_sys->p_image->width; + } + + p_pic->p->i_red_mask = p_pic->p_sys->p_image->red_mask; + p_pic->p->i_green_mask = p_pic->p_sys->p_image->green_mask; + p_pic->p->i_blue_mask = p_pic->p_sys->p_image->blue_mask; + + p_pic->i_planes = 1; + break; #endif diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index d2e28f481b..5ae3f7e1ad 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -5,7 +5,7 @@ * thread, and destroy a previously oppened video output thread. ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: video_output.c,v 1.155 2002/01/07 02:12:30 sam Exp $ + * $Id: video_output.c,v 1.156 2002/01/12 01:25:57 sam Exp $ * * Authors: Vincent Seguin * @@ -332,7 +332,8 @@ static int InitThread( vout_thread_t *p_vout ) if( p_vout->chroma.p_module == NULL ) { - intf_ErrMsg( "vout error: no suitable chroma module" ); + intf_ErrMsg( "vout error: no chroma module for %4.4s to %4.4s", + &p_vout->render.i_chroma, &p_vout->output.i_chroma ); p_vout->pf_end( p_vout ); vlc_mutex_unlock( &p_vout->change_lock ); return( 1 ); @@ -352,10 +353,19 @@ static int InitThread( vout_thread_t *p_vout ) return( 1 ); } - intf_WarnMsg( 2, "vout info: indirect render, mapping " - "render pictures %i-%i to system pictures %i-%i", - I_OUTPUTPICTURES - 1, VOUT_MAX_PICTURES - 2, - I_OUTPUTPICTURES, VOUT_MAX_PICTURES - 1 ); + if( I_OUTPUTPICTURES < VOUT_MAX_PICTURES ) + { + intf_WarnMsg( 2, "vout info: indirect render, mapping " + "render pictures %i-%i to system pictures %i-%i", + I_OUTPUTPICTURES - 1, VOUT_MAX_PICTURES - 2, + I_OUTPUTPICTURES, VOUT_MAX_PICTURES - 1 ); + } + else + { + intf_WarnMsg( 2, "vout info: indirect render, no system " + "pictures needed, we have %i directbuffers", + I_OUTPUTPICTURES ); + } /* Append render buffers after the direct buffers */ for( i = I_OUTPUTPICTURES; i < VOUT_MAX_PICTURES; i++ ) diff --git a/src/video_output/vout_pictures.c b/src/video_output/vout_pictures.c index 0c73dca7a5..8909a034a1 100644 --- a/src/video_output/vout_pictures.c +++ b/src/video_output/vout_pictures.c @@ -2,7 +2,7 @@ * vout_pictures.c : picture management functions ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: vout_pictures.c,v 1.9 2002/01/05 02:22:03 sam Exp $ + * $Id: vout_pictures.c,v 1.10 2002/01/12 01:25:57 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -134,10 +134,11 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, { p_pic = PP_RENDERPICTURE[ i_pic ]; - /* If the picture we found is a memory buffer, 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 > 3 ) + /* 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; -- 2.39.5