summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-02-06 07:44:10 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-02-09 17:22:23 +0100
commitf025b8e110b36c1cdb4fb56c4cd57aeca1767b5b (patch)
tree3b668e0c57158154ea4b7bdaa13cbd5ad23221da /libavcodec/utils.c
parentb3551b6072687539c9e162fcec9e1e42a668ee8c (diff)
avcodec/threadframe: Add ff_thread_(get|release)_ext_buffer()
These will be used by the codecs that need allocated progress and is in preparation for no longer using ThreadFrame by the codecs that don't. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index cf01f72570..77465f3ff7 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -875,7 +875,7 @@ int ff_thread_ref_frame(ThreadFrame *dst, const ThreadFrame *src)
if (src->progress &&
!(dst->progress = av_buffer_ref(src->progress))) {
- ff_thread_release_buffer(dst->owner[0], dst);
+ ff_thread_release_ext_buffer(dst->owner[0], dst);
return AVERROR(ENOMEM);
}
@@ -895,12 +895,25 @@ int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
return ff_get_buffer(avctx, f->f, flags);
}
+int ff_thread_get_ext_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
+{
+ f->owner[0] = f->owner[1] = avctx;
+ return ff_get_buffer(avctx, f->f, flags);
+}
+
void ff_thread_release_buffer(AVCodecContext *avctx, ThreadFrame *f)
{
if (f->f)
av_frame_unref(f->f);
}
+void ff_thread_release_ext_buffer(AVCodecContext *avctx, ThreadFrame *f)
+{
+ f->owner[0] = f->owner[1] = NULL;
+ if (f->f)
+ av_frame_unref(f->f);
+}
+
void ff_thread_finish_setup(AVCodecContext *avctx)
{
}