mirror of
https://mirror.skon.top/https://github.com/FFmpeg/FFmpeg
synced 2026-04-20 21:00:41 +08:00
avutil/hwcontext: Allocate AVHWFramesCtx jointly with its internals
This is possible because the lifetime of these structures coincide. It has the advantage of allowing to remove AVHWFramesInternal from the public header; given that AVHWFramesInternal.priv is no more, most accesses to AVHWFramesInternal are no more; indeed, the only field accessed of it outside of hwcontext.c is the internal frame pool, making this commit very simple. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
committed by
James Almer
parent
a0b9b96269
commit
3e669b24e2
@@ -633,10 +633,10 @@ static int vaapi_frames_init(AVHWFramesContext *hwfc)
|
||||
avfc->surface_ids = NULL;
|
||||
}
|
||||
|
||||
hwfc->internal->pool_internal =
|
||||
ffhwframesctx(hwfc)->pool_internal =
|
||||
av_buffer_pool_init2(sizeof(VASurfaceID), hwfc,
|
||||
&vaapi_pool_alloc, NULL);
|
||||
if (!hwfc->internal->pool_internal) {
|
||||
if (!ffhwframesctx(hwfc)->pool_internal) {
|
||||
av_log(hwfc, AV_LOG_ERROR, "Failed to create VAAPI surface pool.\n");
|
||||
err = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
@@ -654,7 +654,7 @@ static int vaapi_frames_init(AVHWFramesContext *hwfc)
|
||||
goto fail;
|
||||
}
|
||||
} else {
|
||||
test_surface = av_buffer_pool_get(hwfc->internal->pool_internal);
|
||||
test_surface = av_buffer_pool_get(ffhwframesctx(hwfc)->pool_internal);
|
||||
if (!test_surface) {
|
||||
av_log(hwfc, AV_LOG_ERROR, "Unable to allocate a surface from "
|
||||
"internal buffer pool.\n");
|
||||
|
||||
Reference in New Issue
Block a user