#include SDL_INCLUDE_FILE
-#define SDL_MAX_DIRECTBUFFERS 10
+/* SDL is not able to crop overlays - so use only 1 direct buffer */
+#define SDL_MAX_DIRECTBUFFERS 1
#define SDL_DEFAULT_BPP 16
/*****************************************************************************
/* Create XImage / XvImage */
#ifdef MODULE_NAME_IS_xvideo
+
+ /* Make sure the buffer is aligned to multiple of 16 */
+ i_height = ( i_height + 15 ) >> 4 << 4;
+ i_width = ( i_width + 15 ) >> 4 << 4;
+
p_image = XvShmCreateImage( p_display, i_xvport, i_chroma, 0,
i_width, i_height, p_shm );
#else
/* Allocate memory for image */
#ifdef MODULE_NAME_IS_xvideo
+
+ /* Make sure the buffer is aligned to multiple of 16 */
+ i_height = ( i_height + 15 ) >> 4 << 4;
+ i_width = ( i_width + 15 ) >> 4 << 4;
+
p_data = (byte_t *) malloc( i_width * i_height * i_bits_per_pixel / 8 );
#elif defined(MODULE_NAME_IS_x11)
i_bytes_per_line = i_width * i_bytes_per_pixel;