]> git.sesse.net Git - vlc/blobdiff - src/video_output/vout_pictures.c
* src/video_output/video_output.c: small bugfix + vout_Create() is now blocking until...
[vlc] / src / video_output / vout_pictures.c
index 74830bddbc8dd8acbbdec6e0f3296280d1fd8056..3dff1615bf3f5ee6ddfba9a6dcdf9e9ec5c9b2c9 100644 (file)
@@ -2,7 +2,7 @@
  * vout_pictures.c : picture management functions
  *****************************************************************************
  * Copyright (C) 2000 VideoLAN
- * $Id: vout_pictures.c,v 1.33 2003/01/15 13:16:40 sam Exp $
+ * $Id: vout_pictures.c,v 1.38 2003/04/27 17:53:21 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -259,7 +259,8 @@ void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
 
     if( p_pic->i_refcount < 0 )
     {
-        msg_Err( p_vout, "picture refcount is %i", p_pic->i_refcount );
+        msg_Err( p_vout, "picture %p refcount is %i", 
+                 p_pic, p_pic->i_refcount );
         p_pic->i_refcount = 0;
     }
 
@@ -330,10 +331,23 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
         /* Picture is not in a direct buffer, but is exactly the
          * same size as the direct buffers. A memcpy() is enough,
          * then render the subtitles. */
+
+        if( PP_OUTPUTPICTURE[0]->pf_lock )
+            if( PP_OUTPUTPICTURE[0]->pf_lock( p_vout, PP_OUTPUTPICTURE[0] ) )
+            {
+                if( PP_OUTPUTPICTURE[0]->pf_unlock )
+                PP_OUTPUTPICTURE[0]->pf_unlock( p_vout, PP_OUTPUTPICTURE[0] );
+
+                return NULL;
+            }
+
         CopyPicture( p_vout, p_pic, PP_OUTPUTPICTURE[0] );
 
         vout_RenderSubPictures( p_vout, PP_OUTPUTPICTURE[0], p_subpic );
 
+        if( PP_OUTPUTPICTURE[0]->pf_unlock )
+            PP_OUTPUTPICTURE[0]->pf_unlock( p_vout, PP_OUTPUTPICTURE[0] );
+
         return PP_OUTPUTPICTURE[0];
     }
 
@@ -342,12 +356,19 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
      * well. This usually means software YUV, or hardware YUV with a
      * different chroma. */
 
+    if( p_vout->p_picture[0].pf_lock )
+        if( p_vout->p_picture[0].pf_lock( p_vout, &p_vout->p_picture[0] ) )
+            return NULL;
+
     /* Convert image to the first direct buffer */
     p_vout->chroma.pf_convert( p_vout, p_pic, &p_vout->p_picture[0] );
 
     /* Render subpictures on the first direct buffer */
     vout_RenderSubPictures( p_vout, &p_vout->p_picture[0], p_subpic );
 
+    if( p_vout->p_picture[0].pf_unlock )
+        p_vout->p_picture[0].pf_unlock( p_vout, &p_vout->p_picture[0] );
+
     return &p_vout->p_picture[0];
 }
 
@@ -427,6 +448,19 @@ void vout_AllocatePicture( vout_thread_t *p_vout, picture_t *p_pic,
     /* Calculate coordinates */
     switch( i_chroma )
     {
+        case FOURCC_I411:
+            p_pic->p[ Y_PLANE ].i_lines = i_height;
+            p_pic->p[ Y_PLANE ].i_pitch = i_width;
+            p_pic->p[ Y_PLANE ].i_visible_pitch = p_pic->p[ Y_PLANE ].i_pitch;
+            p_pic->p[ U_PLANE ].i_lines = i_height;
+            p_pic->p[ U_PLANE ].i_pitch = i_width / 4;
+            p_pic->p[ U_PLANE ].i_visible_pitch = p_pic->p[ U_PLANE ].i_pitch;
+            p_pic->p[ V_PLANE ].i_lines = i_height;
+            p_pic->p[ V_PLANE ].i_pitch = i_width / 4;
+            p_pic->p[ V_PLANE ].i_visible_pitch = p_pic->p[ V_PLANE ].i_pitch;
+            p_pic->i_planes = 3;
+            break;
+
         case FOURCC_I410:
             p_pic->p[ Y_PLANE ].i_lines = i_height;
             p_pic->p[ Y_PLANE ].i_pitch = i_width;
@@ -529,6 +563,18 @@ void vout_AllocatePicture( vout_thread_t *p_vout, picture_t *p_pic,
             p_pic->i_planes = 1;
             break;
 
+        case FOURCC_RV24:
+            p_pic->p->i_lines = i_height;
+            p_pic->p->i_pitch = i_width * 3;
+            p_pic->p->i_visible_pitch = p_pic->p->i_pitch;
+            p_pic->p->i_pixel_pitch = 3;
+/* FIXME: p_heap isn't always reachable
+            p_pic->p_heap->i_rmask = 0xff0000;
+            p_pic->p_heap->i_gmask = 0x00ff00;
+            p_pic->p_heap->i_bmask = 0x0000ff; */
+            p_pic->i_planes = 1;
+            break;
+
         case FOURCC_RV32:
             p_pic->p->i_lines = i_height;
             p_pic->p->i_pitch = i_width * 4;
@@ -674,4 +720,5 @@ static void CopyPicture( vout_thread_t * p_vout,
             }
         }
     }
+    p_dest->date = p_src->date;
 }