comparison flashsvenc.c @ 4406:548b2c0a2a51 libavcodec

Don't copy more then needed, bugfix by Gus Scheidt ellocogato at gmail dot com and Michel Bardiaux mbardiaux at mediaxim dot be.
author banan
date Thu, 25 Jan 2007 08:21:02 +0000
parents d15d3cd71df2
children 414d484f6483
comparison
equal deleted inserted replaced
4405:48952197d91f 4406:548b2c0a2a51
240 int opt_w, opt_h; 240 int opt_w, opt_h;
241 241
242 *p = *pict; 242 *p = *pict;
243 243
244 if (s->first_frame) { 244 if (s->first_frame) {
245 s->previous_frame = av_mallocz(p->linesize[0]*s->image_height*3); 245 s->previous_frame = av_mallocz(p->linesize[0]*s->image_height);
246 if (!s->previous_frame) { 246 if (!s->previous_frame) {
247 av_log(avctx, AV_LOG_ERROR, "Memory allocation failed.\n"); 247 av_log(avctx, AV_LOG_ERROR, "Memory allocation failed.\n");
248 return -1; 248 return -1;
249 } 249 }
250 I_frame = 1; 250 I_frame = 1;
293 } 293 }
294 294
295 res = encode_bitstream(s, p, buf, buf_size, opt_w*16, opt_h*16, s->previous_frame, &I_frame); 295 res = encode_bitstream(s, p, buf, buf_size, opt_w*16, opt_h*16, s->previous_frame, &I_frame);
296 #endif 296 #endif
297 //save the current frame 297 //save the current frame
298 memcpy(s->previous_frame, p->data[0], s->image_height*p->linesize[0]*3); 298 memcpy(s->previous_frame, p->data[0], s->image_height*p->linesize[0]);
299 299
300 //mark the frame type so the muxer can mux it correctly 300 //mark the frame type so the muxer can mux it correctly
301 if (I_frame) { 301 if (I_frame) {
302 p->pict_type = FF_I_TYPE; 302 p->pict_type = FF_I_TYPE;
303 p->key_frame = 1; 303 p->key_frame = 1;