aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2019-08-30 11:37:25 -0300
committerJames Almer <jamrial@gmail.com>2019-09-04 10:07:12 -0300
commit9ea6d2149e25d68885a24894bb911077b05388c4 (patch)
treed302ed27dd814bea2189537f62c4120f69ecb669 /libavcodec
parent39f129593756e3e270ed3881ca076627f30e1eb7 (diff)
downloadffmpeg-9ea6d2149e25d68885a24894bb911077b05388c4.tar.gz
avcodec/decode: add a flags parameter to ff_reget_buffer()
Some decoders may not need a writable buffer in some specific cases, but only a reference to the existing buffer with updated frame properties instead, for the purpose of returning duplicate frames. For this, the FF_REGET_BUFFER_FLAG_READONLY flag is added, which will prevent potential allocations and buffer copies when they are not needed. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/aasc.c2
-rw-r--r--libavcodec/anm.c2
-rw-r--r--libavcodec/ansi.c2
-rw-r--r--libavcodec/avs.c2
-rw-r--r--libavcodec/bethsoftvideo.c2
-rw-r--r--libavcodec/bink.c2
-rw-r--r--libavcodec/c93.c2
-rw-r--r--libavcodec/cdgraphics.c2
-rw-r--r--libavcodec/cinepak.c2
-rw-r--r--libavcodec/clearvideo.c4
-rw-r--r--libavcodec/cpia.c2
-rw-r--r--libavcodec/cscd.c2
-rw-r--r--libavcodec/decode.c8
-rw-r--r--libavcodec/dsicinvideo.c2
-rw-r--r--libavcodec/fic.c4
-rw-r--r--libavcodec/flashsv.c2
-rw-r--r--libavcodec/flicvideo.c6
-rw-r--r--libavcodec/gifdec.c2
-rw-r--r--libavcodec/indeo2.c2
-rw-r--r--libavcodec/internal.h7
-rw-r--r--libavcodec/jvdec.c2
-rw-r--r--libavcodec/mmvideo.c2
-rw-r--r--libavcodec/motionpixels.c2
-rw-r--r--libavcodec/msrle.c2
-rw-r--r--libavcodec/mss1.c2
-rw-r--r--libavcodec/mss2.c2
-rw-r--r--libavcodec/mss3.c2
-rw-r--r--libavcodec/mss4.c2
-rw-r--r--libavcodec/msvideo1.c2
-rw-r--r--libavcodec/nuv.c2
-rw-r--r--libavcodec/pafvideo.c2
-rw-r--r--libavcodec/qtrle.c2
-rw-r--r--libavcodec/roqvideodec.c2
-rw-r--r--libavcodec/rpza.c2
-rw-r--r--libavcodec/rscc.c2
-rw-r--r--libavcodec/scpr.c2
-rw-r--r--libavcodec/screenpresso.c2
-rw-r--r--libavcodec/smacker.c2
-rw-r--r--libavcodec/smc.c2
-rw-r--r--libavcodec/tiertexseqv.c2
-rw-r--r--libavcodec/truemotion1.c2
-rw-r--r--libavcodec/truemotion2.c2
-rw-r--r--libavcodec/tscc.c2
-rw-r--r--libavcodec/tscc2.c2
-rw-r--r--libavcodec/ulti.c2
-rw-r--r--libavcodec/vmnc.c2
-rw-r--r--libavcodec/xxan.c2
-rw-r--r--libavcodec/yop.c2
48 files changed, 58 insertions, 57 deletions
diff --git a/libavcodec/aasc.c b/libavcodec/aasc.c
index 58cc3c85ba..26570f49e5 100644
--- a/libavcodec/aasc.c
+++ b/libavcodec/aasc.c
@@ -91,7 +91,7 @@ static int aasc_decode_frame(AVCodecContext *avctx,
return AVERROR_INVALIDDATA;
}
- if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
compr = AV_RL32(buf);
diff --git a/libavcodec/anm.c b/libavcodec/anm.c
index 778f38413e..cd1fcc5998 100644
--- a/libavcodec/anm.c
+++ b/libavcodec/anm.c
@@ -122,7 +122,7 @@ static int decode_frame(AVCodecContext *avctx,
if (buf_size < 7)
return AVERROR_INVALIDDATA;
- if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
dst = s->frame->data[0];
dst_end = s->frame->data[0] + s->frame->linesize[0]*avctx->height;
diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c
index f1fafab771..5e1035ffd0 100644
--- a/libavcodec/ansi.c
+++ b/libavcodec/ansi.c
@@ -362,7 +362,7 @@ static int decode_frame(AVCodecContext *avctx,
const uint8_t *buf_end = buf+buf_size;
int ret, i, count;
- if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
if (!avctx->frame_number) {
for (i=0; i<avctx->height; i++)
diff --git a/libavcodec/avs.c b/libavcodec/avs.c
index 66724d47b7..2f2361e5ea 100644
--- a/libavcodec/avs.c
+++ b/libavcodec/avs.c
@@ -59,7 +59,7 @@ avs_decode_frame(AVCodecContext * avctx,
AvsBlockType type;
GetBitContext change_map = {0}; //init to silence warning
- if ((ret = ff_reget_buffer(avctx, p)) < 0)
+ if ((ret = ff_reget_buffer(avctx, p, 0)) < 0)
return ret;
p->pict_type = AV_PICTURE_TYPE_P;
p->key_frame = 0;
diff --git a/libavcodec/bethsoftvideo.c b/libavcodec/bethsoftvideo.c
index e5a73f55a1..a931b54911 100644
--- a/libavcodec/bethsoftvideo.c
+++ b/libavcodec/bethsoftvideo.c
@@ -79,7 +79,7 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx,
int code, ret;
int yoffset;
- if ((ret = ff_reget_buffer(avctx, vid->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, vid->frame, 0)) < 0)
return ret;
wrap_to_next_line = vid->frame->linesize[0] - avctx->width;
diff --git a/libavcodec/bink.c b/libavcodec/bink.c
index 5bb3955f93..f251ab4017 100644
--- a/libavcodec/bink.c
+++ b/libavcodec/bink.c
@@ -1261,7 +1261,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
return ret;
} else {
- if ((ret = ff_reget_buffer(avctx, c->last)) < 0)
+ if ((ret = ff_reget_buffer(avctx, c->last, 0)) < 0)
return ret;
if ((ret = av_frame_ref(frame, c->last)) < 0)
return ret;
diff --git a/libavcodec/c93.c b/libavcodec/c93.c
index b708659cca..e1808150b8 100644
--- a/libavcodec/c93.c
+++ b/libavcodec/c93.c
@@ -138,7 +138,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
c93->currentpic ^= 1;
- if ((ret = ff_reget_buffer(avctx, newpic)) < 0)
+ if ((ret = ff_reget_buffer(avctx, newpic, 0)) < 0)
return ret;
stride = newpic->linesize[0];
diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c
index cf3f01a417..469128964c 100644
--- a/libavcodec/cdgraphics.c
+++ b/libavcodec/cdgraphics.c
@@ -283,7 +283,7 @@ static int cdg_decode_frame(AVCodecContext *avctx,
bytestream2_init(&gb, avpkt->data, avpkt->size);
- if ((ret = ff_reget_buffer(avctx, cc->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, cc->frame, 0)) < 0)
return ret;
if (!cc->cleared) {
memset(cc->frame->data[0], 0, cc->frame->linesize[0] * avctx->height);
diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c
index aeb15de0ed..9c5b254231 100644
--- a/libavcodec/cinepak.c
+++ b/libavcodec/cinepak.c
@@ -473,7 +473,7 @@ static int cinepak_decode_frame(AVCodecContext *avctx,
return ret;
}
- if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
if (s->palette_video) {
diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c
index 26cdfb2731..65bf140401 100644
--- a/libavcodec/clearvideo.c
+++ b/libavcodec/clearvideo.c
@@ -524,7 +524,7 @@ static int clv_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_INVALIDDATA;
}
- if ((ret = ff_reget_buffer(avctx, c->pic)) < 0)
+ if ((ret = ff_reget_buffer(avctx, c->pic, 0)) < 0)
return ret;
c->pic->key_frame = 1;
@@ -558,7 +558,7 @@ static int clv_decode_frame(AVCodecContext *avctx, void *data,
if (c->pmb_width * c->pmb_height > 8LL*(buf_size - bytestream2_tell(&gb)))
return AVERROR_INVALIDDATA;
- if ((ret = ff_reget_buffer(avctx, c->pic)) < 0)
+ if ((ret = ff_reget_buffer(avctx, c->pic, 0)) < 0)
return ret;
ret = av_frame_copy(c->pic, c->prev);
diff --git a/libavcodec/cpia.c b/libavcodec/cpia.c
index f6d7332606..bf09e1a5db 100644
--- a/libavcodec/cpia.c
+++ b/libavcodec/cpia.c
@@ -100,7 +100,7 @@ static int cpia_decode_frame(AVCodecContext *avctx,
}
// Get buffer filled with previous frame
- if ((ret = ff_reget_buffer(avctx, frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, frame, 0)) < 0)
return ret;
diff --git a/libavcodec/cscd.c b/libavcodec/cscd.c
index 8781df110c..d50ddd6258 100644
--- a/libavcodec/cscd.c
+++ b/libavcodec/cscd.c
@@ -77,7 +77,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
return AVERROR_INVALIDDATA;
}
- if ((ret = ff_reget_buffer(avctx, c->pic)) < 0)
+ if ((ret = ff_reget_buffer(avctx, c->pic, 0)) < 0)
return ret;
// decompress data
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index cf9676e2ac..a9ea5a51e6 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1970,7 +1970,7 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
return ret;
}
-static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame)
+static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags)
{
AVFrame *tmp;
int ret;
@@ -1986,7 +1986,7 @@ static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame)
if (!frame->data[0])
return ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);
- if (av_frame_is_writable(frame))
+ if ((flags & FF_REGET_BUFFER_FLAG_READONLY) || av_frame_is_writable(frame))
return ff_decode_frame_props(avctx, frame);
tmp = av_frame_alloc();
@@ -2007,9 +2007,9 @@ static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame)
return 0;
}
-int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame)
+int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
{
- int ret = reget_buffer_internal(avctx, frame);
+ int ret = reget_buffer_internal(avctx, frame, flags);
if (ret < 0)
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return ret;
diff --git a/libavcodec/dsicinvideo.c b/libavcodec/dsicinvideo.c
index d422df068d..7f74808e6d 100644
--- a/libavcodec/dsicinvideo.c
+++ b/libavcodec/dsicinvideo.c
@@ -290,7 +290,7 @@ static int cinvideo_decode_frame(AVCodecContext *avctx,
break;
}
- if ((res = ff_reget_buffer(avctx, cin->frame)) < 0)
+ if ((res = ff_reget_buffer(avctx, cin->frame, 0)) < 0)
return res;
memcpy(cin->frame->data[1], cin->palette, sizeof(cin->palette));
diff --git a/libavcodec/fic.c b/libavcodec/fic.c
index 540078eda1..95baaedaa5 100644
--- a/libavcodec/fic.c
+++ b/libavcodec/fic.c
@@ -278,7 +278,7 @@ static int fic_decode_frame(AVCodecContext *avctx, void *data,
int skip_cursor = ctx->skip_cursor;
uint8_t *sdata;
- if ((ret = ff_reget_buffer(avctx, ctx->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, ctx->frame, 0)) < 0)
return ret;
/* Header + at least one slice (4) */
@@ -421,7 +421,7 @@ static int fic_decode_frame(AVCodecContext *avctx, void *data,
}
/* Make sure we use a user-supplied buffer. */
- if ((ret = ff_reget_buffer(avctx, ctx->final_frame)) < 0) {
+ if ((ret = ff_reget_buffer(avctx, ctx->final_frame, 0)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Could not make frame writable.\n");
return ret;
}
diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c
index 92d1af9fcf..f55cb0feeb 100644
--- a/libavcodec/flashsv.c
+++ b/libavcodec/flashsv.c
@@ -368,7 +368,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
s->image_width, s->image_height, s->block_width, s->block_height,
h_blocks, v_blocks, h_part, v_part);
- if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
/* loop over all block columns */
diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c
index bf8ffeba4f..276c2ff2a6 100644
--- a/libavcodec/flicvideo.c
+++ b/libavcodec/flicvideo.c
@@ -185,7 +185,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
bytestream2_init(&g2, buf, buf_size);
- if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
pixels = s->frame->data[0];
@@ -519,7 +519,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
bytestream2_init(&g2, buf, buf_size);
- if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
pixels = s->frame->data[0];
@@ -817,7 +817,7 @@ static int flic_decode_frame_24BPP(AVCodecContext *avctx,
bytestream2_init(&g2, buf, buf_size);
- if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
pixels = s->frame->data[0];
diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c
index 2115da163f..1906a4c738 100644
--- a/libavcodec/gifdec.c
+++ b/libavcodec/gifdec.c
@@ -513,7 +513,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
return AVERROR_INVALIDDATA;
}
- if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
s->frame->pict_type = AV_PICTURE_TYPE_P;
diff --git a/libavcodec/indeo2.c b/libavcodec/indeo2.c
index f367682e61..ccf6cd84cb 100644
--- a/libavcodec/indeo2.c
+++ b/libavcodec/indeo2.c
@@ -161,7 +161,7 @@ static int ir2_decode_frame(AVCodecContext *avctx,
int start, ret;
int ltab, ctab;
- if ((ret = ff_reget_buffer(avctx, p)) < 0)
+ if ((ret = ff_reget_buffer(avctx, p, 0)) < 0)
return ret;
start = 48; /* hardcoded for now */
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 5f964148fd..9db3d36acb 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -320,11 +320,12 @@ static av_always_inline float ff_exp2fi(int x) {
*/
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags);
+#define FF_REGET_BUFFER_FLAG_READONLY 1 ///< the returned buffer does not need to be writable
/**
- * Identical in function to av_frame_make_writable(), except it uses
- * ff_get_buffer() to allocate the buffer when needed.
+ * Identical in function to ff_get_buffer(), except it reuses the existing buffer
+ * if available.
*/
-int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame);
+int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame, int flags);
int ff_thread_can_start_frame(AVCodecContext *avctx);
diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c
index b06e7cf2bf..6f10157b0d 100644
--- a/libavcodec/jvdec.c
+++ b/libavcodec/jvdec.c
@@ -168,7 +168,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
GetBitContext gb;
init_get_bits(&gb, buf, 8 * video_size);
- if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
if (avctx->height/8 * (avctx->width/8) > 4 * video_size) {
diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c
index 04de6bb4c8..7f650be80e 100644
--- a/libavcodec/mmvideo.c
+++ b/libavcodec/mmvideo.c
@@ -201,7 +201,7 @@ static int mm_decode_frame(AVCodecContext *avctx,
buf_size -= MM_PREAMBLE_SIZE;
bytestream2_init(&s->gb, buf, buf_size);
- if ((res = ff_reget_buffer(avctx, s->frame)) < 0)
+ if ((res = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return res;
switch(type) {
diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c
index 73977664a5..be45586e3d 100644
--- a/libavcodec/motionpixels.c
+++ b/libavcodec/motionpixels.c
@@ -292,7 +292,7 @@ static int mp_decode_frame(AVCodecContext *avctx,
GetBitContext gb;
int i, count1, count2, sz, ret;
- if ((ret = ff_reget_buffer(avctx, mp->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, mp->frame, 0)) < 0)
return ret;
/* le32 bitstream msb first */
diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c
index b83b3d2a41..9233b34cc5 100644
--- a/libavcodec/msrle.c
+++ b/libavcodec/msrle.c
@@ -93,7 +93,7 @@ static int msrle_decode_frame(AVCodecContext *avctx,
if (buf_size < 2) //Minimally a end of picture code should be there
return AVERROR_INVALIDDATA;
- if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) {
diff --git a/libavcodec/mss1.c b/libavcodec/mss1.c
index 84b7a37007..7af8024d63 100644
--- a/libavcodec/mss1.c
+++ b/libavcodec/mss1.c
@@ -154,7 +154,7 @@ static int mss1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
arith_init(&acoder, &gb);
- if ((ret = ff_reget_buffer(avctx, ctx->pic)) < 0)
+ if ((ret = ff_reget_buffer(avctx, ctx->pic, 0)) < 0)
return ret;
c->pal_pic = ctx->pic->data[0] + ctx->pic->linesize[0] * (avctx->height - 1);
diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c
index 29897cea2e..d977cb1160 100644
--- a/libavcodec/mss2.c
+++ b/libavcodec/mss2.c
@@ -618,7 +618,7 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
return AVERROR_INVALIDDATA;
}
} else {
- if ((ret = ff_reget_buffer(avctx, ctx->last_pic)) < 0)
+ if ((ret = ff_reget_buffer(avctx, ctx->last_pic, 0)) < 0)
return ret;
if ((ret = av_frame_ref(frame, ctx->last_pic)) < 0)
return ret;
diff --git a/libavcodec/mss3.c b/libavcodec/mss3.c
index 02bd360996..113af5ba37 100644
--- a/libavcodec/mss3.c
+++ b/libavcodec/mss3.c
@@ -737,7 +737,7 @@ static int mss3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
return buf_size;
c->got_error = 0;
- if ((ret = ff_reget_buffer(avctx, c->pic)) < 0)
+ if ((ret = ff_reget_buffer(avctx, c->pic, 0)) < 0)
return ret;
c->pic->key_frame = keyframe;
c->pic->pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
diff --git a/libavcodec/mss4.c b/libavcodec/mss4.c
index 76c746a2d5..432df294d6 100644
--- a/libavcodec/mss4.c
+++ b/libavcodec/mss4.c
@@ -558,7 +558,7 @@ static int mss4_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if (frame_type != SKIP_FRAME && 8*buf_size < 8*HEADER_SIZE + mb_width*mb_height)
return AVERROR_INVALIDDATA;
- if ((ret = ff_reget_buffer(avctx, c->pic)) < 0)
+ if ((ret = ff_reget_buffer(avctx, c->pic, 0)) < 0)
return ret;
c->pic->key_frame = (frame_type == INTRA_FRAME);
c->pic->pict_type = (frame_type == INTRA_FRAME) ? AV_PICTURE_TYPE_I
diff --git a/libavcodec/msvideo1.c b/libavcodec/msvideo1.c
index de048d8b6f..c9bcce552d 100644
--- a/libavcodec/msvideo1.c
+++ b/libavcodec/msvideo1.c
@@ -310,7 +310,7 @@ static int msvideo1_decode_frame(AVCodecContext *avctx,
return AVERROR_INVALIDDATA;
}
- if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
if (s->mode_8bit) {
diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
index 75b14bce5b..2cca206d9b 100644
--- a/libavcodec/nuv.c
+++ b/libavcodec/nuv.c
@@ -268,7 +268,7 @@ retry:
init_frame = 1;
}
- if ((result = ff_reget_buffer(avctx, c->pic)) < 0)
+ if ((result = ff_reget_buffer(avctx, c->pic, 0)) < 0)
return result;
if (init_frame) {
memset(c->pic->data[0], 0, avctx->height * c->pic->linesize[0]);
diff --git a/libavcodec/pafvideo.c b/libavcodec/pafvideo.c
index 323c662c59..6b4771cbce 100644
--- a/libavcodec/pafvideo.c
+++ b/libavcodec/pafvideo.c
@@ -289,7 +289,7 @@ static int paf_video_decode(AVCodecContext *avctx, void *data,
c->video_size / 32 - (int64_t)bytestream2_get_bytes_left(&c->gb) > c->video_size / 32 * (int64_t)avctx->discard_damaged_percentage / 100)
return AVERROR_INVALIDDATA;
- if ((ret = ff_reget_buffer(avctx, c->pic)) < 0)
+ if ((ret = ff_reget_buffer(avctx, c->pic, 0)) < 0)
return ret;
if (code & 0x20) { // frame is keyframe
diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c
index f565e0e358..52394f5264 100644
--- a/libavcodec/qtrle.c
+++ b/libavcodec/qtrle.c
@@ -490,7 +490,7 @@ static int qtrle_decode_frame(AVCodecContext *avctx,
start_line = 0;
height = s->avctx->height;
}
- if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
row_ptr = s->frame->linesize[0] * start_line;
diff --git a/libavcodec/roqvideodec.c b/libavcodec/roqvideodec.c
index 0ab7d399d6..a0c293f2f0 100644
--- a/libavcodec/roqvideodec.c
+++ b/libavcodec/roqvideodec.c
@@ -206,7 +206,7 @@ static int roq_decode_frame(AVCodecContext *avctx,
int copy = !s->current_frame->data[0] && s->last_frame->data[0];
int ret;
- if ((ret = ff_reget_buffer(avctx, s->current_frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->current_frame, 0)) < 0)
return ret;
if (copy) {
diff --git a/libavcodec/rpza.c b/libavcodec/rpza.c
index 8e1efa2445..02bbfe753f 100644
--- a/libavcodec/rpza.c
+++ b/libavcodec/rpza.c
@@ -108,7 +108,7 @@ static int rpza_decode_stream(RpzaContext *s)
if (total_blocks / 32 > bytestream2_get_bytes_left(&s->gb))
return AVERROR_INVALIDDATA;
- if ((ret = ff_reget_buffer(s->avctx, s->frame)) < 0)
+ if ((ret = ff_reget_buffer(s->avctx, s->frame, 0)) < 0)
return ret;
pixels = (uint16_t *)s->frame->data[0];
stride = s->frame->linesize[0] / 2;
diff --git a/libavcodec/rscc.c b/libavcodec/rscc.c
index f494c30ed8..bd0520950f 100644
--- a/libavcodec/rscc.c
+++ b/libavcodec/rscc.c
@@ -310,7 +310,7 @@ static int rscc_decode_frame(AVCodecContext *avctx, void *data,
}
/* Allocate when needed */
- ret = ff_reget_buffer(avctx, ctx->reference);
+ ret = ff_reget_buffer(avctx, ctx->reference, 0);
if (ret < 0)
goto end;
diff --git a/libavcodec/scpr.c b/libavcodec/scpr.c
index dc890a87e5..ab4d5b57df 100644
--- a/libavcodec/scpr.c
+++ b/libavcodec/scpr.c
@@ -504,7 +504,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
return ret;
}
- if ((ret = ff_reget_buffer(avctx, s->current_frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->current_frame, 0)) < 0)
return ret;
bytestream2_init(gb, avpkt->data, avpkt->size);
diff --git a/libavcodec/screenpresso.c b/libavcodec/screenpresso.c
index fb8bfd4701..5fac100897 100644
--- a/libavcodec/screenpresso.c
+++ b/libavcodec/screenpresso.c
@@ -145,7 +145,7 @@ static int screenpresso_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_UNKNOWN;
}
- ret = ff_reget_buffer(avctx, ctx->current);
+ ret = ff_reget_buffer(avctx, ctx->current, 0);
if (ret < 0)
return ret;
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index 70e0dfd5df..c45137b7d5 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -428,7 +428,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if (avpkt->size <= 769)
return AVERROR_INVALIDDATA;
- if ((ret = ff_reget_buffer(avctx, smk->pic)) < 0)
+ if ((ret = ff_reget_buffer(avctx, smk->pic, 0)) < 0)
return ret;
/* make the palette available on the way out */
diff --git a/libavcodec/smc.c b/libavcodec/smc.c
index 3cb4834737..2beb1ce291 100644
--- a/libavcodec/smc.c
+++ b/libavcodec/smc.c
@@ -445,7 +445,7 @@ static int smc_decode_frame(AVCodecContext *avctx,
bytestream2_init(&s->gb, buf, buf_size);
- if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
if (pal && pal_size == AVPALETTE_SIZE) {
diff --git a/libavcodec/tiertexseqv.c b/libavcodec/tiertexseqv.c
index af39f74d7d..91c8314379 100644
--- a/libavcodec/tiertexseqv.c
+++ b/libavcodec/tiertexseqv.c
@@ -239,7 +239,7 @@ static int seqvideo_decode_frame(AVCodecContext *avctx,
SeqVideoContext *seq = avctx->priv_data;
- if ((ret = ff_reget_buffer(avctx, seq->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, seq->frame, 0)) < 0)
return ret;
if (seqvideo_decode(seq, buf, buf_size))
diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
index e1824384c5..bcfe473852 100644
--- a/libavcodec/truemotion1.c
+++ b/libavcodec/truemotion1.c
@@ -882,7 +882,7 @@ static int truemotion1_decode_frame(AVCodecContext *avctx,
if ((ret = truemotion1_decode_header(s)) < 0)
return ret;
- if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
if (compression_types[s->compression].algorithm == ALGO_RGB24H) {
diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c
index 27c876fd7d..800cae0a40 100644
--- a/libavcodec/truemotion2.c
+++ b/libavcodec/truemotion2.c
@@ -915,7 +915,7 @@ static int decode_frame(AVCodecContext *avctx,
return AVERROR(ENOMEM);
}
- if ((ret = ff_reget_buffer(avctx, p)) < 0)
+ if ((ret = ff_reget_buffer(avctx, p, 0)) < 0)
return ret;
l->bdsp.bswap_buf((uint32_t *) l->buffer, (const uint32_t *) buf,
diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c
index fc1ec4de0d..6d03081bb0 100644
--- a/libavcodec/tscc.c
+++ b/libavcodec/tscc.c
@@ -103,7 +103,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
return AVERROR_UNKNOWN;
}
- if ((ret = ff_reget_buffer(avctx, frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, frame, 0)) < 0)
return ret;
if (ret != Z_DATA_ERROR) {
diff --git a/libavcodec/tscc2.c b/libavcodec/tscc2.c
index a8c7ee7996..65fbb010f6 100644
--- a/libavcodec/tscc2.c
+++ b/libavcodec/tscc2.c
@@ -240,7 +240,7 @@ static int tscc2_decode_frame(AVCodecContext *avctx, void *data,
return buf_size;
}
- if ((ret = ff_reget_buffer(avctx, c->pic)) < 0) {
+ if ((ret = ff_reget_buffer(avctx, c->pic, 0)) < 0) {
return ret;
}
diff --git a/libavcodec/ulti.c b/libavcodec/ulti.c
index 9318af064b..e6fb661f6e 100644
--- a/libavcodec/ulti.c
+++ b/libavcodec/ulti.c
@@ -230,7 +230,7 @@ static int ulti_decode_frame(AVCodecContext *avctx,
int skip;
int tmp;
- if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
bytestream2_init(&s->gb, buf, buf_size);
diff --git a/libavcodec/vmnc.c b/libavcodec/vmnc.c
index e273043311..7f441bc4bd 100644
--- a/libavcodec/vmnc.c
+++ b/libavcodec/vmnc.c
@@ -339,7 +339,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if (12LL * chunks > bytestream2_get_bytes_left(gb))
return AVERROR_INVALIDDATA;
- if ((ret = ff_reget_buffer(avctx, c->pic)) < 0)
+ if ((ret = ff_reget_buffer(avctx, c->pic, 0)) < 0)
return ret;
c->pic->key_frame = 0;
diff --git a/libavcodec/xxan.c b/libavcodec/xxan.c
index 8bb7087af9..afe60e1564 100644
--- a/libavcodec/xxan.c
+++ b/libavcodec/xxan.c
@@ -410,7 +410,7 @@ static int xan_decode_frame(AVCodecContext *avctx,
int ftype;
int ret;
- if ((ret = ff_reget_buffer(avctx, s->pic)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->pic, 0)) < 0)
return ret;
bytestream2_init(&s->gb, avpkt->data, avpkt->size);
diff --git a/libavcodec/yop.c b/libavcodec/yop.c
index 32cfea200a..aff28ef3fc 100644
--- a/libavcodec/yop.c
+++ b/libavcodec/yop.c
@@ -204,7 +204,7 @@ static int yop_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
return AVERROR_INVALIDDATA;
}
- if ((ret = ff_reget_buffer(avctx, frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, frame, 0)) < 0)
return ret;
if (!avctx->frame_number)