diff libvo/vo_xv.c @ 16958:3ff863e54b93

Test if source image dimensions are too big.
author al
date Thu, 10 Nov 2005 02:39:31 +0000
parents fd51fd1ff231
children d75953576ae4
line wrap: on
line diff
--- a/libvo/vo_xv.c	Thu Nov 10 00:49:51 2005 +0000
+++ b/libvo/vo_xv.c	Thu Nov 10 02:39:31 2005 +0000
@@ -22,6 +22,7 @@
 
 #include "config.h"
 #include "mp_msg.h"
+#include "help_mp.h"
 #include "video_out.h"
 #include "video_out_internal.h"
 
@@ -89,6 +90,7 @@
 static Window mRoot;
 static uint32_t drwX, drwY, drwBorderWidth, drwDepth;
 static uint32_t dwidth, dheight;
+static uint32_t max_width = 0, max_height = 0; // zero means: not set
 
 static void (*draw_alpha_fnc) (int x0, int y0, int w, int h,
                                unsigned char *src, unsigned char *srca,
@@ -175,6 +177,14 @@
     image_width = width;
     image_format = format;
 
+    if ((max_width != 0 && max_height != 0) &&
+        (image_width > max_width || image_height > max_height))
+    {
+        mp_msg( MSGT_VO, MSGL_ERR, "[xv] " MSGTR_VO_XV_ImagedimTooHigh,
+                image_width, image_height, max_width, max_height);
+        return -1;
+    }
+
     vo_mouse_autohide = 1;
 
     int_pause = 0;
@@ -918,6 +928,7 @@
       return -1; // bail out, colorkey setup failed
     }
     vo_xv_enable_vsync();
+    vo_xv_get_max_img_dim( &max_width, &max_height );
 
     fo = XvListImageFormats(mDisplay, xv_port, (int *) &formats);