changeset 29059:48ba0e64e754

Use MP_MAX_PLANES as size of arrays passed to mpcodecs_draw_slice.
author reimar
date Sun, 29 Mar 2009 14:15:09 +0000
parents 713fe7dab281
children e7f277bf38b5
files libmpcodecs/vd_ffmpeg.c libmpcodecs/vd_libmpeg2.c
diffstat 2 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c	Sun Mar 29 13:47:30 2009 +0000
+++ b/libmpcodecs/vd_ffmpeg.c	Sun Mar 29 14:15:09 2009 +0000
@@ -451,7 +451,7 @@
                         AVFrame *src, int offset[4],
                         int y, int type, int height){
     sh_video_t *sh = s->opaque;
-    uint8_t *source[3]= {src->data[0] + offset[0], src->data[1] + offset[1], src->data[2] + offset[2]};
+    uint8_t *source[MP_MAX_PLANES]= {src->data[0] + offset[0], src->data[1] + offset[1], src->data[2] + offset[2]};
 #if 0
     int start=0, i;
     int width= s->width;
--- a/libmpcodecs/vd_libmpeg2.c	Sun Mar 29 13:47:30 2009 +0000
+++ b/libmpcodecs/vd_libmpeg2.c	Sun Mar 29 14:15:09 2009 +0000
@@ -125,14 +125,12 @@
     vd_libmpeg2_ctx_t *context = sh->context;
     mpeg2dec_t* mpeg2dec = context->mpeg2dec;
     const mpeg2_info_t * info = mpeg2_info (mpeg2dec);
-    int stride[3];
+    int stride[MP_MAX_PLANES] = {mpeg2dec->decoder.stride, mpeg2dec->decoder.uv_stride, mpeg2dec->decoder.uv_stride};
+    uint8_t *srcs[MP_MAX_PLANES] = {src[0], src[1], src[2]};
 
 //  printf("draw_slice() y=%d  \n",y);
 
-    stride[0]=mpeg2dec->decoder.stride;
-    stride[1]=stride[2]=mpeg2dec->decoder.uv_stride;
-
-    mpcodecs_draw_slice(sh, (uint8_t **)src,
+    mpcodecs_draw_slice(sh, srcs,
 		stride, info->sequence->picture_width,
 		(y+16<=info->sequence->picture_height) ? 16 :
 		    info->sequence->picture_height-y,