comparison utils.c @ 1630:586b5c08863c libavcodec

- Add reget_buffer() function to AVCodecContext - Add default reget_buffer implementation in libavcodec/utils.c - Remove AVCodecContext.cr_available, no longer needed - Remove CODEC_CAP_CR, no longer used - Add img_copy() prototype to avcodec.h (function from imgconvert.c) - Rename img_copy() to jpeg_img_copy() in libavformat/jpeg.c to avoid conflict - Updated msrle, msvideo1, rpza, smc to use reget_buffer
author rtognimp
date Wed, 26 Nov 2003 20:57:15 +0000
parents a1ac8e675b95
children 0e7f1aabd498
comparison
equal deleted inserted replaced
1629:74685a0ec851 1630:586b5c08863c
288 // pic->base[i]=NULL; 288 // pic->base[i]=NULL;
289 } 289 }
290 //printf("R%X\n", pic->opaque); 290 //printf("R%X\n", pic->opaque);
291 } 291 }
292 292
293 int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){
294 AVFrame temp_pic;
295 int i;
296
297 /* If no picture return a new buffer */
298 if(pic->data[0] == NULL) {
299 /* We will copy from buffer, so must be readable */
300 pic->buffer_hints |= FF_BUFFER_HINTS_READABLE;
301 return s->get_buffer(s, pic);
302 }
303
304 /* If internal buffer type return the same buffer */
305 if(pic->type == FF_BUFFER_TYPE_INTERNAL)
306 return 0;
307
308 /*
309 * Not internal type and reget_buffer not overridden, emulate cr buffer
310 */
311 temp_pic = *pic;
312 for(i = 0; i < 4; i++)
313 pic->data[i] = pic->base[i] = NULL;
314 pic->opaque = NULL;
315 /* Allocate new frame */
316 if (s->get_buffer(s, pic))
317 return -1;
318 /* Copy image data from old buffer to new buffer */
319 img_copy((AVPicture*)pic, (AVPicture*)&temp_pic, s->pix_fmt, s->width,
320 s->height);
321 s->release_buffer(s, &temp_pic); // Release old frame
322 return 0;
323 }
324
293 enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, enum PixelFormat * fmt){ 325 enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, enum PixelFormat * fmt){
294 return fmt[0]; 326 return fmt[0];
295 } 327 }
296 328
297 void avcodec_get_context_defaults(AVCodecContext *s){ 329 void avcodec_get_context_defaults(AVCodecContext *s){
324 s->sample_aspect_ratio= (AVRational){0,1}; 356 s->sample_aspect_ratio= (AVRational){0,1};
325 357
326 s->intra_quant_bias= FF_DEFAULT_QUANT_BIAS; 358 s->intra_quant_bias= FF_DEFAULT_QUANT_BIAS;
327 s->inter_quant_bias= FF_DEFAULT_QUANT_BIAS; 359 s->inter_quant_bias= FF_DEFAULT_QUANT_BIAS;
328 s->palctrl = NULL; 360 s->palctrl = NULL;
329 s->cr_available = 0; 361 s->reget_buffer= avcodec_default_reget_buffer;
330 } 362 }
331 363
332 /** 364 /**
333 * allocates a AVCodecContext and set it to defaults. 365 * allocates a AVCodecContext and set it to defaults.
334 * this can be deallocated by simply calling free() 366 * this can be deallocated by simply calling free()