summaryrefslogtreecommitdiff
path: root/libavcodec/vaapi_h264.c
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2015-07-28 11:16:12 +0200
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2015-08-19 14:03:24 +0200
commitbabd340f584988446ef578e7dbc7064b19804f81 (patch)
treedd45b394217e4e6e741035447a86c71125dc4112 /libavcodec/vaapi_h264.c
parent9f8e57efe4400ca86352277873792792279c3b15 (diff)
downloadffmpeg-babd340f584988446ef578e7dbc7064b19804f81.tar.gz
vaapi: streamline public context structure.
Move libavcodec managed objects from the public struct vaapi_context to a new privately owned FFVAContext. This is done so that to clean up and streamline the public structure, but also to prepare for new codec support, thus requiring new internal data to be added in there. The AVCodecContext.hwaccel_context, that holds the public vaapi_context, shall no longer be accessed from within vaapi_*.c codec support files. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Diffstat (limited to 'libavcodec/vaapi_h264.c')
-rw-r--r--libavcodec/vaapi_h264.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c
index 55ee2fc233..ded2cb3d49 100644
--- a/libavcodec/vaapi_h264.c
+++ b/libavcodec/vaapi_h264.c
@@ -227,7 +227,7 @@ static int vaapi_h264_start_frame(AVCodecContext *avctx,
av_unused uint32_t size)
{
H264Context * const h = avctx->priv_data;
- struct vaapi_context * const vactx = avctx->hwaccel_context;
+ FFVAContext * const vactx = ff_vaapi_get_context(avctx);
VAPictureParameterBufferH264 *pic_param;
VAIQMatrixBufferH264 *iq_matrix;
@@ -292,7 +292,7 @@ static int vaapi_h264_start_frame(AVCodecContext *avctx,
/** End a hardware decoding based frame. */
static int vaapi_h264_end_frame(AVCodecContext *avctx)
{
- struct vaapi_context * const vactx = avctx->hwaccel_context;
+ FFVAContext * const vactx = ff_vaapi_get_context(avctx);
H264Context * const h = avctx->priv_data;
H264SliceContext *sl = &h->slice_ctx[0];
int ret;
@@ -318,6 +318,7 @@ static int vaapi_h264_decode_slice(AVCodecContext *avctx,
const uint8_t *buffer,
uint32_t size)
{
+ FFVAContext * const vactx = ff_vaapi_get_context(avctx);
H264Context * const h = avctx->priv_data;
H264SliceContext *sl = &h->slice_ctx[0];
VASliceParameterBufferH264 *slice_param;
@@ -326,7 +327,7 @@ static int vaapi_h264_decode_slice(AVCodecContext *avctx,
buffer, size);
/* Fill in VASliceParameterBufferH264. */
- slice_param = (VASliceParameterBufferH264 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size);
+ slice_param = (VASliceParameterBufferH264 *)ff_vaapi_alloc_slice(vactx, buffer, size);
if (!slice_param)
return -1;
slice_param->slice_data_bit_offset = get_bits_count(&sl->gb) + 8; /* bit buffer started beyond nal_unit_type */
@@ -363,4 +364,7 @@ AVHWAccel ff_h264_vaapi_hwaccel = {
.start_frame = vaapi_h264_start_frame,
.end_frame = vaapi_h264_end_frame,
.decode_slice = vaapi_h264_decode_slice,
+ .init = ff_vaapi_context_init,
+ .uninit = ff_vaapi_context_fini,
+ .priv_data_size = sizeof(FFVAContext),
};