[MPlayer-cvslog] CVS: main/libvo vo_xv.c, 1.168, 1.169 x11_common.c, 1.198, 1.199 x11_common.h, 1.43, 1.44
Alexander Strasser beastd
syncmail at mplayerhq.hu
Thu Nov 10 03:39:34 CET 2005
CVS change done by Alexander Strasser (beastd)
Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv8670/libvo
Modified Files:
vo_xv.c x11_common.c x11_common.h
Log Message:
Test if source image dimensions are too big.
Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -r1.168 -r1.169
--- vo_xv.c 5 Aug 2005 01:24:37 -0000 1.168
+++ vo_xv.c 10 Nov 2005 02:39:31 -0000 1.169
@@ -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);
Index: x11_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
retrieving revision 1.198
retrieving revision 1.199
diff -u -r1.198 -r1.199
--- x11_common.c 2 Nov 2005 21:50:55 -0000 1.198
+++ x11_common.c 10 Nov 2005 02:39:31 -0000 1.199
@@ -2277,6 +2277,45 @@
}
/**
+ * \brief Get maximum supported source image dimensions.
+ *
+ * This function does not set the variables pointed to by
+ * width and height if the information could not be retreived.
+ * So the caller is reponsible for initing them properly.
+ *
+ * \param width [out] The maximum width gets stored here.
+ * \param height [out] The maximum height gets stored here.
+ *
+ */
+void vo_xv_get_max_img_dim( uint32_t * width, uint32_t * height )
+{
+ XvEncodingInfo * encodings;
+ //unsigned long num_encodings, idx; to int or too long?!
+ unsigned int num_encodings, idx;
+
+ XvQueryEncodings( mDisplay, xv_port, &num_encodings, &encodings);
+
+ if ( encodings )
+ {
+ for ( idx = 0; idx < num_encodings; ++idx )
+ {
+ if ( strcmp( encodings[idx].name, "XV_IMAGE" ) == 0 )
+ {
+ *width = encodings[idx].width;
+ *height = encodings[idx].height;
+ break;
+ }
+ }
+ }
+
+ mp_msg( MSGT_VO, MSGL_V,
+ "[xv common] Maximum source image dimensions: %ux%u\n",
+ *width, *height );
+
+ XvFreeEncodingInfo( encodings );
+}
+
+/**
* \brief Print information about the colorkey method and source.
*
* \param ck_handling Integer value containing the information about
Index: x11_common.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- x11_common.h 21 Aug 2005 01:20:31 -0000 1.43
+++ x11_common.h 10 Nov 2005 02:39:31 -0000 1.44
@@ -77,6 +77,8 @@
extern int vo_xv_enable_vsync();
+extern void vo_xv_get_max_img_dim( uint32_t * width, uint32_t * height );
+
/*** colorkey handling ***/
typedef struct xv_ck_info_s
{
More information about the MPlayer-cvslog
mailing list