[MPlayer-cvslog] r29101 - in trunk/libvo: vo_aa.c vo_kva.c vo_vesa.c vo_x11.c

reimar subversion at mplayerhq.hu
Sun Mar 29 16:37:21 CEST 2009


Author: reimar
Date: Sun Mar 29 16:37:21 2009
New Revision: 29101

Log:
Consistently use MP_MAX_PLANES as size for plane pointer/stride arrays.
This might avoid some issues since sws_scale in some cases assumes these
have at least 4 valid entries.

Modified:
   trunk/libvo/vo_aa.c
   trunk/libvo/vo_kva.c
   trunk/libvo/vo_vesa.c
   trunk/libvo/vo_x11.c

Modified: trunk/libvo/vo_aa.c
==============================================================================
--- trunk/libvo/vo_aa.c	Sun Mar 29 16:35:38 2009	(r29100)
+++ trunk/libvo/vo_aa.c	Sun Mar 29 16:37:21 2009	(r29101)
@@ -68,8 +68,8 @@ aa_context *c;
 aa_renderparams *p;
 static int fast =0;
 /* used for the sws */
-static uint8_t * image[3];
-static int image_stride[3];
+static uint8_t * image[MP_MAX_PLANES];
+static int image_stride[MP_MAX_PLANES];
 
 /* image infos */
 static int image_format;
@@ -123,13 +123,11 @@ resize(void){
     sws = sws_getContextFromCmdLine(src_width,src_height,image_format,
 				   image_width,image_height,IMGFMT_Y8);
 
+    memset(image, 0, sizeof(image));
     image[0] = aa_image(c) + image_y * aa_imgwidth(c) + image_x;
-    image[1] = NULL;
-    image[2] = NULL;
 
+    memset(image_stride, 0, sizeof(image_stride));
     image_stride[0] = aa_imgwidth(c);
-    image_stride[1] = 0; 
-    image_stride[2] = 0;
 
     showosdmessage=0;
 
@@ -339,7 +337,7 @@ query_format(uint32_t format) {
 
 static int 
 draw_frame(uint8_t *src[]) {
-  int stride[3] = { 0 , 0 , 0 };
+  int stride[MP_MAX_PLANES] = {0};
 
   switch(image_format) {
   case IMGFMT_BGR15:

Modified: trunk/libvo/vo_kva.c
==============================================================================
--- trunk/libvo/vo_kva.c	Sun Mar 29 16:35:38 2009	(r29100)
+++ trunk/libvo/vo_kva.c	Sun Mar 29 16:37:21 2009	(r29101)
@@ -131,8 +131,8 @@ struct {
     PBYTE       pbImage;
     BOOL        fFixT23;
     PFNWP       pfnwpOldFrame;
-    uint8_t    *planes[3];     // y = 0, u = 1, v = 2
-    int         stride[3];
+    uint8_t    *planes[MP_MAX_PLANES];     // y = 0, u = 1, v = 2
+    int         stride[MP_MAX_PLANES];
     BOOL        fHWAccel;
     RECTL       rclParent;
     struct SwsContext *sws;
@@ -230,6 +230,8 @@ static void imgCreate(void)
 
     m_int.pbImage = malloc(size);
 
+    memset(m_int.planes, 0, sizeof(m_int.planes));
+    memset(m_int.stride, 0, sizeof(m_int.stride));
     m_int.planes[0] = m_int.pbImage;
     m_int.stride[0] = m_int.lStride;
 
@@ -257,8 +259,8 @@ static void imgDisplay(void)
     ULONG ulBPL;
 
     if (!kvaLockBuffer(&pBuffer, &ulBPL)) {
-        uint8_t *dst[3];
-        int      dstStride[3];
+        uint8_t *dst[MP_MAX_PLANES] = {NULL};
+        int      dstStride[MP_MAX_PLANES] = {0};
 
         // Get packed or Y
         dst[0]       = pBuffer;

Modified: trunk/libvo/vo_vesa.c
==============================================================================
--- trunk/libvo/vo_vesa.c	Sun Mar 29 16:35:38 2009	(r29100)
+++ trunk/libvo/vo_vesa.c	Sun Mar 29 16:37:21 2009	(r29101)
@@ -283,8 +283,8 @@ static void vbeCopyData(uint8_t *image)
 static int draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
 {
     int dstride=HAS_DGA()?video_mode_info.XResolution:dstW;
-    uint8_t *dst[3]= {dga_buffer, NULL, NULL};
-    int dstStride[3];
+    uint8_t *dst[MP_MAX_PLANES]={dga_buffer};
+    int dstStride[MP_MAX_PLANES]={0};
     if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
 	mp_msg(MSGT_VO,MSGL_DBG3, "vo_vesa: draw_slice was called: w=%u h=%u x=%u y=%u\n",w,h,x,y);
     dstStride[0]=dstride*((dstBpp+7)/8);
@@ -423,8 +423,8 @@ static int draw_frame(uint8_t *src[])
     {
 	int dstride=HAS_DGA()?video_mode_info.XResolution:dstW;
 	int srcStride[1];
-	uint8_t *dst[3]= {dga_buffer, NULL, NULL};
-	int dstStride[3];
+	uint8_t *dst[MP_MAX_PLANES]={dga_buffer};
+	int dstStride[MP_MAX_PLANES]={0};
 	dstStride[0]=dstride*((dstBpp+7)/8);
 	dstStride[1]=
 	dstStride[2]=dstStride[0]>>1;

Modified: trunk/libvo/vo_x11.c
==============================================================================
--- trunk/libvo/vo_x11.c	Sun Mar 29 16:35:38 2009	(r29100)
+++ trunk/libvo/vo_x11.c	Sun Mar 29 16:37:21 2009	(r29101)
@@ -523,8 +523,8 @@ static void flip_page(void)
 static int draw_slice(uint8_t * src[], int stride[], int w, int h,
                            int x, int y)
 {
-    uint8_t *dst[3];
-    int dstStride[3];
+    uint8_t *dst[MP_MAX_PLANES] = {NULL};
+    int dstStride[MP_MAX_PLANES] = {0};
 
     if ((old_vo_dwidth != vo_dwidth
          || old_vo_dheight != vo_dheight) /*&& y==0 */  && zoomFlag)
@@ -557,8 +557,6 @@ static int draw_slice(uint8_t * src[], i
         }
         dst_width = newW;
     }
-    dstStride[1] = dstStride[2] = 0;
-    dst[1] = dst[2] = NULL;
 
     dstStride[0] = image_width * ((bpp + 7) / 8);
     dst[0] = ImageData;


More information about the MPlayer-cvslog mailing list