diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-02-11 22:16:32 +0100 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2024-03-07 08:53:31 -0300 |
commit | 3e669b24e282594ab92ef50c839bb1fdc01331b4 (patch) | |
tree | 2b11f6af5630dae3717866cbb7cf5c2be64c1e64 /libavutil/hwcontext_vaapi.c | |
parent | a0b9b96269b48298eddb927059cb4dfea6725167 (diff) | |
download | ffmpeg-3e669b24e282594ab92ef50c839bb1fdc01331b4.tar.gz |
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>
Diffstat (limited to 'libavutil/hwcontext_vaapi.c')
-rw-r--r-- | libavutil/hwcontext_vaapi.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index 2c75f5f5b1..56d03aa4cd 100644 --- a/libavutil/hwcontext_vaapi.c +++ b/libavutil/hwcontext_vaapi.c @@ -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"); |