changeset 4980:0e6e50c02f7b

direct rendering support
author arpi
date Thu, 07 Mar 2002 16:57:40 +0000
parents 27980a844961
children bfc652fc7f43
files libvo/vo_xv.c
diffstat 1 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_xv.c	Thu Mar 07 15:06:02 2002 +0000
+++ b/libvo/vo_xv.c	Thu Mar 07 16:57:40 2002 +0000
@@ -39,6 +39,7 @@
 #include "aspect.h"
 
 #include "../postproc/rgb2rgb.h"
+#include "../mp_image.h"
 
 static vo_info_t vo_info =
 {
@@ -741,6 +742,28 @@
   return 0;
 }
 
+static uint32_t get_image(mp_image_t *mpi){
+    if(mpi->type==MP_IMGTYPE_STATIC && num_buffers>1) return VO_FALSE; // it is not static
+//    if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram
+    if(mpi->width==image_width){
+       if(mpi->flags&MP_IMGFLAG_PLANAR){
+	   mpi->planes[0]=xvimage[current_buf]->data;
+	   mpi->planes[1]=xvimage[current_buf]->data+image_width*image_height;
+	   mpi->planes[2]=xvimage[current_buf]->data+image_width*image_height*5/4;
+	   mpi->stride[0]=image_width;
+	   mpi->stride[1]=mpi->stride[2]=image_width/2;
+       } else {
+           mpi->planes[0]=xvimage[current_buf]->data;
+	   mpi->stride[0]=image_width;
+       }
+       mpi->flags|=MP_IMGFLAG_DIRECT;
+//	printf("mga: get_image() SUCCESS -> Direct Rendering ENABLED\n");
+       return VO_TRUE;
+    }
+    return VO_FALSE;
+}
+
+
 static uint32_t query_format(uint32_t format)
 {
 
@@ -799,6 +822,8 @@
     return VO_TRUE;
   case VOCTRL_QUERY_FORMAT:
     return query_format(*((uint32_t*)data));
+  case VOCTRL_GET_IMAGE:
+    return get_image(data);
   }
   return VO_NOTIMPL;
 }