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/msrle.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/msrle.c')
-rw-r--r-- | libavcodec/msrle.c | 36 |
1 files changed, 7 insertions, 29 deletions
diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c index f7819cb951..76649894aa 100644 --- a/libavcodec/msrle.c +++ b/libavcodec/msrle.c @@ -41,7 +41,6 @@ typedef struct MsrleContext { AVCodecContext *avctx; AVFrame frame; - AVFrame prev_frame; unsigned char *buf; int size; @@ -244,7 +243,7 @@ static int msrle_decode_init(AVCodecContext *avctx) avctx->pix_fmt = PIX_FMT_PAL8; avctx->has_b_frames = 0; - s->frame.data[0] = s->prev_frame.data[0] = NULL; + s->frame.data[0] = NULL; return 0; } @@ -263,26 +262,12 @@ static int msrle_decode_frame(AVCodecContext *avctx, s->size = buf_size; s->frame.reference = 1; - s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE; - if (avctx->cr_available) - s->frame.buffer_hints |= FF_BUFFER_HINTS_REUSABLE; - else - s->frame.buffer_hints |= FF_BUFFER_HINTS_READABLE; - if (avctx->get_buffer(avctx, &s->frame)) { - av_log(avctx, AV_LOG_ERROR, " MS RLE: get_buffer() failed\n"); + s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; + if (avctx->reget_buffer(avctx, &s->frame)) { + av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return -1; } - if (s->prev_frame.data[0] && (s->frame.linesize[0] != s->prev_frame.linesize[0])) - av_log(avctx, AV_LOG_ERROR, " MS RLE: Buffer linesize changed: current %u, previous %u.\n" - " Expect wrong image and/or crash!\n", - s->frame.linesize[0], s->prev_frame.linesize[0]); - - /* grossly inefficient, but...oh well */ - if (s->prev_frame.data[0] != NULL) - memcpy(s->frame.data[0], s->prev_frame.data[0], - s->frame.linesize[0] * s->avctx->height); - switch (avctx->bits_per_sample) { case 8: msrle_decode_pal8(s); @@ -295,13 +280,6 @@ static int msrle_decode_frame(AVCodecContext *avctx, avctx->bits_per_sample); } - if (s->prev_frame.data[0]) - avctx->release_buffer(avctx, &s->prev_frame); - - /* shuffle frames */ - if (!avctx->cr_available) - s->prev_frame = s->frame; - *data_size = sizeof(AVFrame); *(AVFrame*)data = s->frame; @@ -314,8 +292,8 @@ static int msrle_decode_end(AVCodecContext *avctx) MsrleContext *s = (MsrleContext *)avctx->priv_data; /* release the last frame */ - if (s->prev_frame.data[0]) - avctx->release_buffer(avctx, &s->prev_frame); + if (s->frame.data[0]) + avctx->release_buffer(avctx, &s->frame); return 0; } @@ -329,5 +307,5 @@ AVCodec msrle_decoder = { NULL, msrle_decode_end, msrle_decode_frame, - CODEC_CAP_DR1 | CODEC_CAP_CR, + CODEC_CAP_DR1, }; |