- 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

Originally committed as revision 2531 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Roberto Togni
2003-11-26 20:57:15 +00:00
parent 9bc8b38660
commit e1c2a5a0a8
7 changed files with 78 additions and 136 deletions

View File

@@ -290,6 +290,38 @@ void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){
//printf("R%X\n", pic->opaque);
}
int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){
AVFrame temp_pic;
int i;
/* If no picture return a new buffer */
if(pic->data[0] == NULL) {
/* We will copy from buffer, so must be readable */
pic->buffer_hints |= FF_BUFFER_HINTS_READABLE;
return s->get_buffer(s, pic);
}
/* If internal buffer type return the same buffer */
if(pic->type == FF_BUFFER_TYPE_INTERNAL)
return 0;
/*
* Not internal type and reget_buffer not overridden, emulate cr buffer
*/
temp_pic = *pic;
for(i = 0; i < 4; i++)
pic->data[i] = pic->base[i] = NULL;
pic->opaque = NULL;
/* Allocate new frame */
if (s->get_buffer(s, pic))
return -1;
/* Copy image data from old buffer to new buffer */
img_copy((AVPicture*)pic, (AVPicture*)&temp_pic, s->pix_fmt, s->width,
s->height);
s->release_buffer(s, &temp_pic); // Release old frame
return 0;
}
enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, enum PixelFormat * fmt){
return fmt[0];
}
@@ -326,7 +358,7 @@ void avcodec_get_context_defaults(AVCodecContext *s){
s->intra_quant_bias= FF_DEFAULT_QUANT_BIAS;
s->inter_quant_bias= FF_DEFAULT_QUANT_BIAS;
s->palctrl = NULL;
s->cr_available = 0;
s->reget_buffer= avcodec_default_reget_buffer;
}
/**