changeset 1265:f1f35276f635

switching double buffering at runtime with -double
author arpi
date Tue, 03 Jul 2001 23:22:29 +0000
parents 8d4d00fe62a3
children 9e1b353f8171
files libvo/vo_xv.c
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_xv.c	Tue Jul 03 23:04:36 2001 +0000
+++ b/libvo/vo_xv.c	Tue Jul 03 23:22:29 2001 +0000
@@ -1,5 +1,7 @@
 
-#define NUM_BUFFERS 1
+// Number of buffers _FOR_DOUBLEBUFFERING_MODE_
+// Use option -double to enable double buffering! (default: single buffer)
+#define NUM_BUFFERS 2
 
 /*
  * vo_xv.c, X11 Xv interface
@@ -11,6 +13,8 @@
  * Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
  *
  * Xv image suuport by Gerd Knorr <kraxel@goldbach.in-berlin.de>
+ * fullscreen support by Pontscho
+ * double buffering support by A'rpi
  */
 
 #include <stdio.h>
@@ -65,6 +69,7 @@
 static XvImageFormatValues  *fo;
 
 static int current_buf=0;
+static int num_buffers=1; // default
 static XvImage* xvimage[NUM_BUFFERS];
 
 #include <sys/ipc.h>
@@ -113,6 +118,7 @@
 
  mFullscreen=flags&1;
  dwidth=d_width; dheight=d_height;
+ num_buffers=vo_doublebuffering?NUM_BUFFERS:1;
  
  if (!vo_init()) return -1;
 
@@ -210,7 +216,7 @@
     {
      printf( "using Xvideo port %d for hw scaling\n",xv_port );
 
-     for(current_buf=0;current_buf<NUM_BUFFERS;++current_buf)
+     for(current_buf=0;current_buf<num_buffers;++current_buf)
        allocate_xvimage(current_buf);
 
      current_buf=0;
@@ -331,7 +337,7 @@
          drwX,drwY,drwWidth,(mFullscreen?drwHeight - 1:drwHeight),
          False);
  XFlush(mDisplay);
- current_buf=(current_buf+1)%NUM_BUFFERS;
+ current_buf=(current_buf+1)%num_buffers;
  return;
 }