[MPlayer-cvslog] r22255 - in trunk/libvo: video_out.c video_out.h vo_xvmc.c

reimar subversion at mplayerhq.hu
Sun Feb 18 10:33:47 CET 2007


Author: reimar
Date: Sun Feb 18 10:33:45 2007
New Revision: 22255

Modified:
   trunk/libvo/video_out.c
   trunk/libvo/video_out.h
   trunk/libvo/vo_xvmc.c

Log:
Avoid parts of xvmc reinit when source format does not change


Modified: trunk/libvo/video_out.c
==============================================================================
--- trunk/libvo/video_out.c	(original)
+++ trunk/libvo/video_out.c	Sun Feb 18 10:33:45 2007
@@ -327,6 +327,8 @@
 int config_video_out(vo_functions_t *vo, uint32_t width, uint32_t height,
                      uint32_t d_width, uint32_t d_height, uint32_t flags,
                      char *title, uint32_t format) {
+  static uint32_t old_width, old_height, old_format;
+  int res;
   panscan_init();
   aspect_save_orig(width,height);
   aspect_save_prescale(d_width,d_height);
@@ -342,7 +344,14 @@
   vo_dwidth = d_width;
   vo_dheight = d_height;
 
-  return vo->config(width, height, d_width, d_height, flags, title, format);
+  if (vo_config_count && width == old_width && height == old_height &&
+      format == old_format)
+    flags |= VOFLAG_SAME_INPUT;
+  res = vo->config(width, height, d_width, d_height, flags, title, format);
+  if (!res) {
+    old_width = width; old_height = height; old_format = format;
+  }
+  return res;
 }
 
 #if defined(HAVE_FBDEV)||defined(HAVE_VESA)  

Modified: trunk/libvo/video_out.h
==============================================================================
--- trunk/libvo/video_out.h	(original)
+++ trunk/libvo/video_out.h	Sun Feb 18 10:33:45 2007
@@ -95,6 +95,7 @@
 #define VOFLAG_MODESWITCHING	0x02
 #define VOFLAG_SWSCALE		0x04
 #define VOFLAG_FLIPPING		0x08
+#define VOFLAG_SAME_INPUT	0x10
 #define VOFLAG_XOVERLAY_SUB_VO  0x10000
 
 typedef struct vo_info_s

Modified: trunk/libvo/vo_xvmc.c
==============================================================================
--- trunk/libvo/vo_xvmc.c	(original)
+++ trunk/libvo/vo_xvmc.c	Sun Feb 18 10:33:45 2007
@@ -419,33 +419,14 @@
    return 0;
 }
 
-static int config(uint32_t width, uint32_t height,
-		       uint32_t d_width, uint32_t d_height,
-		       uint32_t flags, char *title, uint32_t format){
+static int init_xvmc(int width, int height, unsigned format) {
 int i,mode_id,rez;
 int numblocks,blocks_per_macroblock;//bpmb we have 6,8,12
 
-//from vo_xv
-char *hello = (title == NULL) ? "XvMC render" : title;
-XSizeHints hint;
-XVisualInfo vinfo;
-XGCValues xgcv;
-XSetWindowAttributes xswa;
-XWindowAttributes attribs;
-unsigned long xswamask;
-int depth;
-#ifdef HAVE_XF86VM
-int vm=0;
-unsigned int modeline_width, modeline_height;
-static uint32_t vm_width;
-static uint32_t vm_height;
-#endif
-//end of vo_xv
-
    if( !IMGFMT_IS_XVMC(format) )
    {
       assert(0);//should never happen, abort on debug or
-      return 1;//return error on relese
+      return -1;//return error on relese
    }
 
 // Find free port that supports MC, by querying adaptors
@@ -600,6 +581,38 @@
 
    vo_xv_enable_vsync();//it won't break anything
 
+   /* store image dimesions for displaying */
+   p_render_surface_visible = NULL;
+   p_render_surface_to_show = NULL;
+
+   free_element = 0;
+   first_frame = 1;
+   return 0;
+}
+
+static int config(uint32_t width, uint32_t height,
+		       uint32_t d_width, uint32_t d_height,
+		       uint32_t flags, char *title, uint32_t format){
+//from vo_xv
+char *hello = (title == NULL) ? "XvMC render" : title;
+XSizeHints hint;
+XVisualInfo vinfo;
+XGCValues xgcv;
+XSetWindowAttributes xswa;
+XWindowAttributes attribs;
+unsigned long xswamask;
+int depth;
+#ifdef HAVE_XF86VM
+int vm=0;
+unsigned int modeline_width, modeline_height;
+static uint32_t vm_width;
+static uint32_t vm_height;
+#endif
+//end of vo_xv
+
+   if (!(flags & VOFLAG_SAME_INPUT))
+     if (init_xvmc(width, height, format) < 0) return -1;
+
 //taken from vo_xv
    image_height = height;
    image_width = width;
@@ -744,13 +757,6 @@
 
 //end vo_xv
 
-   /* store image dimesions for displaying */
-   p_render_surface_visible = NULL;
-   p_render_surface_to_show = NULL;
-
-   free_element = 0;
-   first_frame = 1;
-
    vo_directrendering = 1;//ugly hack, coz xvmc works only with direct rendering
    return 0;		
 }



More information about the MPlayer-cvslog mailing list