diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2012-01-28 23:07:54 +0100 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2012-01-29 14:17:12 +0100 |
commit | 6a9b565e0a238b475e036c2e0a77b991cb0a3efb (patch) | |
tree | 857103d00c5e30709496fdcf03fc5d47bddb1079 /libavcodec/fraps.c | |
parent | 05741d70c7a6d877cf4cfe472e316d0b5024dfc3 (diff) | |
download | ffmpeg-6a9b565e0a238b475e036c2e0a77b991cb0a3efb.tar.gz |
FRAPS: Do not needlessly use reget_buffer.
Codec has only I- and skip-frames, so there is no
need for reget_buffer, change it so it works with
get_buffer.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diffstat (limited to 'libavcodec/fraps.c')
-rw-r--r-- | libavcodec/fraps.c | 61 |
1 files changed, 17 insertions, 44 deletions
diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c index db0e85fd6a..d674d8e467 100644 --- a/libavcodec/fraps.c +++ b/libavcodec/fraps.c @@ -167,14 +167,27 @@ static int decode_frame(AVCodecContext *avctx, buf_size, needed_size); return -1; } + /* bit 31 means same as previous pic */ + if (header & (1U<<31)) { + *data_size = 0; + return buf_size; + } + } else { + /* skip frame */ + if (buf_size == 8) { + *data_size = 0; + return buf_size; + } } f->pict_type = AV_PICTURE_TYPE_I; f->key_frame = 1; - f->reference = 3; - f->buffer_hints = FF_BUFFER_HINTS_VALID | - FF_BUFFER_HINTS_PRESERVE | - FF_BUFFER_HINTS_REUSABLE; + f->reference = 0; + f->buffer_hints = FF_BUFFER_HINTS_VALID; + if (avctx->get_buffer(avctx, f)) { + av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + return -1; + } switch(version) { case 0: @@ -186,15 +199,6 @@ static int decode_frame(AVCodecContext *avctx, return -1; } - if (avctx->reget_buffer(avctx, f)) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); - return -1; - } - /* bit 31 means same as previous pic */ - if (header & (1U<<31)) { - f->pict_type = AV_PICTURE_TYPE_P; - f->key_frame = 0; - } else { buf32=(const uint32_t*)buf; for(y=0; y<avctx->height/2; y++){ luma1=(uint32_t*)&f->data[0][ y*2*f->linesize[0] ]; @@ -210,25 +214,14 @@ static int decode_frame(AVCodecContext *avctx, *cb++ = *buf32++; } } - } break; case 1: /* Fraps v1 is an upside-down BGR24 */ - if (avctx->reget_buffer(avctx, f)) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); - return -1; - } - /* bit 31 means same as previous pic */ - if (header & (1U<<31)) { - f->pict_type = AV_PICTURE_TYPE_P; - f->key_frame = 0; - } else { for(y=0; y<avctx->height; y++) memcpy(&f->data[0][ (avctx->height-y)*f->linesize[0] ], &buf[y*avctx->width*3], 3*avctx->width); - } break; case 2: @@ -237,16 +230,6 @@ static int decode_frame(AVCodecContext *avctx, * Fraps v2 is Huffman-coded YUV420 planes * Fraps v4 is virtually the same */ - if (avctx->reget_buffer(avctx, f)) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); - return -1; - } - /* skip frame */ - if(buf_size == 8) { - f->pict_type = AV_PICTURE_TYPE_P; - f->key_frame = 0; - break; - } if (AV_RL32(buf) != FPS_TAG || buf_size < planes*1024 + 24) { av_log(avctx, AV_LOG_ERROR, "Fraps: error in data stream\n"); return -1; @@ -274,16 +257,6 @@ static int decode_frame(AVCodecContext *avctx, case 3: case 5: /* Virtually the same as version 4, but is for RGB24 */ - if (avctx->reget_buffer(avctx, f)) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); - return -1; - } - /* skip frame */ - if(buf_size == 8) { - f->pict_type = AV_PICTURE_TYPE_P; - f->key_frame = 0; - break; - } if (AV_RL32(buf) != FPS_TAG || buf_size < planes*1024 + 24) { av_log(avctx, AV_LOG_ERROR, "Fraps: error in data stream\n"); return -1; |