]> git.sesse.net Git - vlc/commitdiff
* ./plugins/chroma/i420_rgb16.c: 24/32 bpp software YUV.
authorSam Hocevar <sam@videolan.org>
Sat, 12 Jan 2002 01:25:57 +0000 (01:25 +0000)
committerSam Hocevar <sam@videolan.org>
Sat, 12 Jan 2002 01:25:57 +0000 (01:25 +0000)
  * ./plugins/ggi/ggi.c: activated double buffering.
  * ./src/video_output/vout_pictures.c: we create more Xv pictures to
    get smoother rendering.

12 files changed:
debian/control
plugins/chroma/i420_rgb.c
plugins/chroma/i420_rgb.h
plugins/chroma/i420_rgb16.c
plugins/chroma/i420_rgb8.c
plugins/dummy/vout_dummy.c
plugins/fb/fb.c
plugins/ggi/ggi.c
plugins/sdl/vout_sdl.c
plugins/x11/xcommon.c
src/video_output/video_output.c
src/video_output/vout_pictures.c

index 58ca0a8f6389793a631cbb1085a5ec0add50941f..c1955f0043d7c75a499e3714988199f3d13e9fed 100644 (file)
@@ -3,7 +3,7 @@ Section: graphics
 Priority: optional
 Maintainer: Samuel Hocevar <sam@zoy.org>
 Build-Depends: debhelper (>=2.2.0),
-               xlibs-dev,
+               xlibs-dev, xlibs-pic
                libgnome-dev,
                libggi2-dev,
                libglide2-dev [i386],
index c5cc1ed5072299a0f135497e1247b68592941860..279b72e05299a91456a802fc9cd97952b5685fc8 100644 (file)
@@ -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 <sam@zoy.org>
  *
@@ -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;
 
index 701d5589177660613629a446fb057a26d1250c00..d402a5d86d69502331651f9a5078c4fb179fac17 100644 (file)
@@ -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 <sam@zoy.org>
  *
@@ -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 * );
 
 /*****************************************************************************
index cef58f40291edba0229e37a76e097ba1e0fbc213..5fa64dd63c9eb0c1602730137b7673cfb2e90bf9 100644 (file)
@@ -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 <sam@zoy.org>
  *
@@ -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 */
index 9fa80fcad0be7891de0961c85583c6df7ce7a7bf..d105c4051e8b397398f36e3cc95597c8781d406c 100644 (file)
@@ -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 <sam@zoy.org>
  *
@@ -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" );
 }
index 4a6542b3fc639092038edd7b3f56c0fedc7cf0b4..2f41bd765ae4e4a74596ad48df2c697cc93fb297 100644 (file)
@@ -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 <sam@zoy.org>
  *
@@ -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
index cf86c24ecfd1e41eaf8103a9b1abcbca08644da0..5bf04207b1218fdf4bc6231eb82553dfb30e87dd 100644 (file)
@@ -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 <sam@zoy.org>
  *      
@@ -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
  *****************************************************************************
index b09c11c102c57823af1552bb528e9f8b24f119be..08455a82cefee739105bf99819d7eb0bc8c37ea7 100644 (file)
@@ -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 <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -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
-}
-
index 775635f85b2943627942a3e3cc767edd36a22946..5be925da6436f27d4e69cef08ddd407404279598 100644 (file)
@@ -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 <sam@zoy.org>
  *          Pierre Baillet <oct@zoy.org>
@@ -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
 
 /*****************************************************************************
index 37b23b14bab8dd1f00317d1c2f0f8949d61943f8..66180afa7349bbcc77b36298834ba47a310bcdc7 100644 (file)
@@ -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 <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -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
 
index d2e28f481bea1c719c1f828220e0756d428a7d87..5ae3f7e1adfd078434670f2ae631c1090a84ebb5 100644 (file)
@@ -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 <seguin@via.ecp.fr>
  *
@@ -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++ )
index 0c73dca7a50041fbed5f17ee357b3d17690db17e..8909a034a1d7faec225aeb2cef18e0be05ec7f5f 100644 (file)
@@ -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 <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -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;