[Mplayer-cvslog] CVS: main/libvo vo_xv.c,1.53,1.54

Arpi of Ize arpi at mplayer.dev.hu
Sun Feb 10 02:43:38 CET 2002


Update of /cvsroot/mplayer/main/libvo
In directory mplayer:/var/tmp.root/cvs-serv31065

Modified Files:
	vo_xv.c 
Log Message:
BGR24 support, including flip flag

Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- vo_xv.c	9 Feb 2002 01:21:48 -0000	1.53
+++ vo_xv.c	10 Feb 2002 01:43:35 -0000	1.54
@@ -38,6 +38,8 @@
 #include "sub.h"
 #include "aspect.h"
 
+#include "../postproc/rgb2rgb.h"
+
 static vo_info_t vo_info =
 {
         "X11/Xv",
@@ -88,6 +90,7 @@
 static uint32_t image_width;
 static uint32_t image_height;
 static uint32_t image_format;
+static int flip_flag;
 
 static Window                 mRoot;
 static uint32_t               drwX,drwY,drwWidth,drwHeight,drwBorderWidth,drwDepth;
@@ -342,6 +345,7 @@
 
  mFullscreen=flags&1;
  if( flags&0x02 ) vm = 1;
+ flip_flag=flags&8;
  num_buffers=vo_doublebuffering?NUM_BUFFERS:1;
  
  if (!vo_init()) return -1;
@@ -468,15 +472,11 @@
     {
      fo = XvListImageFormats(mDisplay, xv_port, (int*)&formats);
      xv_format=0;
-     for(i = 0; i < formats; i++)
-      {
+     if(format==IMGFMT_BGR24) format=IMGFMT_YV12;
+     for(i = 0; i < formats; i++){
        printf("Xvideo image format: 0x%x (%4.4s) %s\n", fo[i].id,(char*)&fo[i].id, (fo[i].format == XvPacked) ? "packed" : "planar");
-
-       if (fo[i].id == format)
-        {
-         xv_format = fo[i].id;
-        }
-      }
+       if (fo[i].id == format) xv_format = fo[i].id;
+     }
      if (!xv_format) xv_port = 0;
     }
 
@@ -680,9 +680,8 @@
 
 static uint32_t draw_frame(uint8_t *src[])
 {
- int foo;
 
- switch (xv_format) {
+ switch (image_format) {
  case IMGFMT_YUY2:
  case IMGFMT_UYVY:
  case IMGFMT_YVYU:
@@ -720,6 +719,25 @@
         memcpy(xvimage[current_buf]->data+image_width*image_height*5/4,src[2],image_width*image_height/4);
      }
      break;
+
+ case IMGFMT_BGR24:
+
+    if(flip_flag)	// tricky, using negative src stride:
+     rgb24toyv12(src[0]+3*image_width*(image_height-1),
+                 xvimage[current_buf]->data,
+		 xvimage[current_buf]->data+image_width*image_height*5/4,
+		 xvimage[current_buf]->data+image_width*image_height,
+		 image_width,image_height,
+		 image_width,image_width/2,-3*image_width);
+    else
+     rgb24toyv12(src[0],
+                 xvimage[current_buf]->data,
+		 xvimage[current_buf]->data+image_width*image_height*5/4,
+		 xvimage[current_buf]->data+image_width*image_height,
+		 image_width,image_height,
+		 image_width,image_width/2,3*image_width);
+     break;
+
  }
 
   return 0;
@@ -728,17 +746,23 @@
 static uint32_t query_format(uint32_t format)
 {
 
+switch(format){
+ case IMGFMT_YUY2:
+ case IMGFMT_UYVY:
+ case IMGFMT_YVYU:
+
+ case IMGFMT_YV12:
+ case IMGFMT_I420:
+ case IMGFMT_IYUV:
+
+ case IMGFMT_BGR24:
+
 // umm, this is a kludge, we need to ask the server.. (see init function above)
     return 1;
-/*
- switch(format)
-  {
-   case IMGFMT_YV12:
-   case IMGFMT_YUY2: 
-       return 1;
-  }
- return 0;
-*/
+}
+
+return 0;
+
 }
 
 static void uninit(void) 




More information about the MPlayer-cvslog mailing list