summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-03-29 14:37:21 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-03-29 14:37:21 +0000
commitb4f5702c0a2643672e77491786a021b51b8d0aec (patch)
tree2b7c494314765afb76416dc3898032aeedff9059
parentc3cf2ce654f54c5dda2618ae9e26614d6fe4ab2a (diff)
downloadmpv-b4f5702c0a2643672e77491786a021b51b8d0aec.tar.bz2
mpv-b4f5702c0a2643672e77491786a021b51b8d0aec.tar.xz
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. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29101 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--libvo/vo_aa.c12
-rw-r--r--libvo/vo_kva.c10
-rw-r--r--libvo/vo_vesa.c8
-rw-r--r--libvo/vo_x11.c6
4 files changed, 17 insertions, 19 deletions
diff --git a/libvo/vo_aa.c b/libvo/vo_aa.c
index 514ad25898..321c8a25fa 100644
--- a/libvo/vo_aa.c
+++ b/libvo/vo_aa.c
@@ -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:
diff --git a/libvo/vo_kva.c b/libvo/vo_kva.c
index 57df14b358..4805d51fbd 100644
--- a/libvo/vo_kva.c
+++ b/libvo/vo_kva.c
@@ -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;
diff --git a/libvo/vo_vesa.c b/libvo/vo_vesa.c
index f3d3ff1519..2bbf92e29d 100644
--- a/libvo/vo_vesa.c
+++ b/libvo/vo_vesa.c
@@ -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;
diff --git a/libvo/vo_x11.c b/libvo/vo_x11.c
index d06c4394ed..e165dc56a2 100644
--- a/libvo/vo_x11.c
+++ b/libvo/vo_x11.c
@@ -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[], int stride[], int w, int h,
}
dst_width = newW;
}
- dstStride[1] = dstStride[2] = 0;
- dst[1] = dst[2] = NULL;
dstStride[0] = image_width * ((bpp + 7) / 8);
dst[0] = ImageData;