mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/utils: add ff_thread_replace_frame()
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
01d444c077
commit
3fe74c9017
|
@ -84,6 +84,9 @@ void ff_thread_release_ext_buffer(AVCodecContext *avctx, ThreadFrame *f);
|
|||
|
||||
int ff_thread_ref_frame(ThreadFrame *dst, const ThreadFrame *src);
|
||||
|
||||
int ff_thread_replace_frame(AVCodecContext *avctx, ThreadFrame *dst,
|
||||
const ThreadFrame *src);
|
||||
|
||||
int ff_thread_can_start_frame(AVCodecContext *avctx);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -915,6 +915,27 @@ int ff_thread_ref_frame(ThreadFrame *dst, const ThreadFrame *src)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int ff_thread_replace_frame(AVCodecContext *avctx, ThreadFrame *dst,
|
||||
const ThreadFrame *src)
|
||||
{
|
||||
int ret;
|
||||
|
||||
dst->owner[0] = src->owner[0];
|
||||
dst->owner[1] = src->owner[1];
|
||||
|
||||
ret = av_frame_replace(dst->f, src->f);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = av_buffer_replace(&dst->progress, src->progress);
|
||||
if (ret < 0) {
|
||||
ff_thread_release_ext_buffer(dst->owner[0], dst);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !HAVE_THREADS
|
||||
|
||||
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags)
|
||||
|
|
Loading…
Reference in New Issue