diff options
author | Roberto Togni <r_togni@tiscali.it> | 2003-11-26 20:57:15 +0000 |
---|---|---|
committer | Roberto Togni <r_togni@tiscali.it> | 2003-11-26 20:57:15 +0000 |
commit | e1c2a5a0a8e9f8a4e68a33f31d4a917771bbc1bb (patch) | |
tree | 55a2328310433ac4589cf42db5a3aa57a5880101 /libavcodec/utils.c | |
parent | 9bc8b38660a18e1aa2717d3724bd9c03da3fe6fc (diff) | |
download | ffmpeg-e1c2a5a0a8e9f8a4e68a33f31d4a917771bbc1bb.tar.gz |
- 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
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 2e944e4001..1f95c55290 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -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; } /** |