[MPlayer-cvslog] CVS: main/libvo vo_xv.c,1.159,1.160

Alexander Strasser beastd syncmail at mplayerhq.hu
Wed Feb 23 13:23:47 CET 2005


CVS change done by Alexander Strasser (beastd)

Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv29046/libvo

Modified Files:
	vo_xv.c 
Log Message:
Don't change buffers when paused and redrawing.


Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -r1.159 -r1.160
--- vo_xv.c	20 Feb 2005 22:43:25 -0000	1.159
+++ vo_xv.c	23 Feb 2005 12:23:44 -0000	1.160
@@ -75,6 +75,7 @@
 static int current_buf = 0;
 static int current_ip_buf = 0;
 static int num_buffers = 1;     // default
+static int visible_buf = -1;    // -1 means: no buffer was drawn yet
 static XvImage *xvimage[NUM_BUFFERS];
 
 
@@ -177,6 +178,7 @@
     vo_mouse_autohide = 1;
 
     int_pause = 0;
+    visible_buf = -1;
 
     vo_dx = (vo_screenwidth - d_width) / 2;
     vo_dy = (vo_screenheight - d_height) / 2;
@@ -522,6 +524,28 @@
     return;
 }
 
+static inline void put_xvimage( XvImage * xvi )
+{
+#ifdef HAVE_SHM
+    if (Shmem_Flag)
+    {
+        XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc,
+                      xvi, 0, 0, image_width,
+                      image_height, drwX - (vo_panscan_x >> 1),
+                      drwY - (vo_panscan_y >> 1), vo_dwidth + vo_panscan_x,
+                      vo_dheight + vo_panscan_y,
+                      False);
+    } else
+#endif
+    {
+        XvPutImage(mDisplay, xv_port, vo_window, vo_gc,
+                   xvi, 0, 0, image_width, image_height,
+                   drwX - (vo_panscan_x >> 1), drwY - (vo_panscan_y >> 1),
+                   vo_dwidth + vo_panscan_x,
+                   vo_dheight + vo_panscan_y);
+    }
+}
+
 static void check_events(void)
 {
     int e = vo_x11_check_events(mDisplay);
@@ -561,7 +585,14 @@
     }
 
     if ((e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) && int_pause)
-        flip_page();
+    {
+        /* did we already draw a buffer */
+        if ( visible_buf != -1 )
+        {
+          /* redraw the last visible buffer */
+          put_xvimage( xvimage[visible_buf] );
+        }
+    }
 }
 
 static void draw_osd(void)
@@ -573,25 +604,11 @@
 
 static void flip_page(void)
 {
+    put_xvimage( xvimage[current_buf] );
+
+    /* remember the currently visible buffer */
+    visible_buf = current_buf;
 
-#ifdef HAVE_SHM
-    if (Shmem_Flag)
-    {
-        XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc,
-                      xvimage[current_buf], 0, 0, image_width,
-                      image_height, drwX - (vo_panscan_x >> 1),
-                      drwY - (vo_panscan_y >> 1), vo_dwidth + vo_panscan_x,
-                      vo_dheight + vo_panscan_y,
-                      False);
-    } else
-#endif
-    {
-        XvPutImage(mDisplay, xv_port, vo_window, vo_gc,
-                   xvimage[current_buf], 0, 0, image_width, image_height,
-                   drwX - (vo_panscan_x >> 1), drwY - (vo_panscan_y >> 1),
-                   vo_dwidth + vo_panscan_x,
-                   vo_dheight + vo_panscan_y);
-    }
     if (num_buffers > 1)
     {
         current_buf =
@@ -761,6 +778,7 @@
 
     if (!vo_config_count)
         return;
+    visible_buf = -1;
     XvFreeAdaptorInfo(ai);
     ai = NULL;
     if(fo){




More information about the MPlayer-cvslog mailing list