Mercurial > mplayer.hg
comparison libmpcodecs/vf_screenshot.c @ 29064:67c256364220
Consistently use MP_MAX_PLANES as size for plane pointer/stride arrays in libmpcodecs.
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:46:59 +0000 |
parents | df67d03dde3b |
children | 28fb967d78d8 |
comparison
equal
deleted
inserted
replaced
29063:ea02e8fa3042 | 29064:67c256364220 |
---|---|
106 | 106 |
107 } | 107 } |
108 | 108 |
109 static void scale_image(struct vf_priv_s* priv, mp_image_t *mpi) | 109 static void scale_image(struct vf_priv_s* priv, mp_image_t *mpi) |
110 { | 110 { |
111 uint8_t *dst[3]; | 111 uint8_t *dst[MP_MAX_PLANES] = {NULL}; |
112 int dst_stride[3]; | 112 int dst_stride[MP_MAX_PLANES] = {0}; |
113 | 113 |
114 dst_stride[0] = priv->stride; | 114 dst_stride[0] = priv->stride; |
115 dst_stride[1] = dst_stride[2] = 0; | |
116 if (!priv->buffer) | 115 if (!priv->buffer) |
117 priv->buffer = memalign(16, dst_stride[0]*priv->dh); | 116 priv->buffer = memalign(16, dst_stride[0]*priv->dh); |
118 | 117 |
119 dst[0] = priv->buffer; | 118 dst[0] = priv->buffer; |
120 dst[1] = dst[2] = 0; | |
121 sws_scale_ordered(priv->ctx, mpi->planes, mpi->stride, 0, priv->dh, dst, dst_stride); | 119 sws_scale_ordered(priv->ctx, mpi->planes, mpi->stride, 0, priv->dh, dst, dst_stride); |
122 } | 120 } |
123 | 121 |
124 static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi) | 122 static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi) |
125 { | 123 { |
135 | 133 |
136 static void draw_slice(struct vf_instance_s* vf, unsigned char** src, | 134 static void draw_slice(struct vf_instance_s* vf, unsigned char** src, |
137 int* stride, int w,int h, int x, int y) | 135 int* stride, int w,int h, int x, int y) |
138 { | 136 { |
139 if (vf->priv->store_slices) { | 137 if (vf->priv->store_slices) { |
140 uint8_t *dst[3]; | 138 uint8_t *dst[MP_MAX_PLANES] = {NULL}; |
141 int dst_stride[3]; | 139 int dst_stride[MP_MAX_PLANES] = {0}; |
142 dst_stride[0] = vf->priv->stride; | 140 dst_stride[0] = vf->priv->stride; |
143 dst_stride[1] = dst_stride[2] = 0; | |
144 dst[0] = vf->priv->buffer; | 141 dst[0] = vf->priv->buffer; |
145 dst[1] = dst[2] = 0; | |
146 sws_scale_ordered(vf->priv->ctx, src, stride, y, h, dst, dst_stride); | 142 sws_scale_ordered(vf->priv->ctx, src, stride, y, h, dst, dst_stride); |
147 } | 143 } |
148 vf_next_draw_slice(vf,src,stride,w,h,x,y); | 144 vf_next_draw_slice(vf,src,stride,w,h,x,y); |
149 } | 145 } |
150 | 146 |