Mercurial > mplayer.hg
changeset 29062:6a0a30aa2b4a
Consistently use MP_MAX_PLANES as size for plane pointer/stride arrays in libvo.
This might avoid some issues since sws_scale in some cases assumes these
have at least 4 valid entries.
author | reimar |
---|---|
date | Sun, 29 Mar 2009 14:37:21 +0000 |
parents | 76d3bebf4e45 |
children | ea02e8fa3042 |
files | libvo/vo_aa.c libvo/vo_kva.c libvo/vo_vesa.c libvo/vo_x11.c |
diffstat | 4 files changed, 17 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/vo_aa.c Sun Mar 29 14:35:38 2009 +0000 +++ b/libvo/vo_aa.c Sun Mar 29 14:37:21 2009 +0000 @@ -68,8 +68,8 @@ 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 @@ 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 @@ 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:
--- a/libvo/vo_kva.c Sun Mar 29 14:35:38 2009 +0000 +++ b/libvo/vo_kva.c Sun Mar 29 14:37:21 2009 +0000 @@ -131,8 +131,8 @@ 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 @@ 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 @@ 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;
--- a/libvo/vo_vesa.c Sun Mar 29 14:35:38 2009 +0000 +++ b/libvo/vo_vesa.c Sun Mar 29 14:37:21 2009 +0000 @@ -283,8 +283,8 @@ 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 @@ { 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;
--- a/libvo/vo_x11.c Sun Mar 29 14:35:38 2009 +0000 +++ b/libvo/vo_x11.c Sun Mar 29 14:37:21 2009 +0000 @@ -523,8 +523,8 @@ 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 @@ } dst_width = newW; } - dstStride[1] = dstStride[2] = 0; - dst[1] = dst[2] = NULL; dstStride[0] = image_width * ((bpp + 7) / 8); dst[0] = ImageData;