Commit c5b4ad24 authored by Mark Thompson's avatar Mark Thompson

vaapi_encode: Remove common priv_data and options fields

The codec-specific context now contains both the common context and the
codec-specific options directly.
parent 1616106f
...@@ -1372,17 +1372,9 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx) ...@@ -1372,17 +1372,9 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
ctx->codec_options = ctx->codec_options_data;
ctx->va_config = VA_INVALID_ID; ctx->va_config = VA_INVALID_ID;
ctx->va_context = VA_INVALID_ID; ctx->va_context = VA_INVALID_ID;
ctx->priv_data = av_mallocz(ctx->codec->priv_data_size);
if (!ctx->priv_data) {
err = AVERROR(ENOMEM);
goto fail;
}
ctx->input_frames_ref = av_buffer_ref(avctx->hw_frames_ctx); ctx->input_frames_ref = av_buffer_ref(avctx->hw_frames_ctx);
if (!ctx->input_frames_ref) { if (!ctx->input_frames_ref) {
err = AVERROR(ENOMEM); err = AVERROR(ENOMEM);
...@@ -1583,7 +1575,5 @@ av_cold int ff_vaapi_encode_close(AVCodecContext *avctx) ...@@ -1583,7 +1575,5 @@ av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
av_buffer_unref(&ctx->input_frames_ref); av_buffer_unref(&ctx->input_frames_ref);
av_buffer_unref(&ctx->device_ref); av_buffer_unref(&ctx->device_ref);
av_freep(&ctx->priv_data);
return 0; return 0;
} }
...@@ -113,9 +113,6 @@ typedef struct VAAPIEncodeContext { ...@@ -113,9 +113,6 @@ typedef struct VAAPIEncodeContext {
// Everything above this point must be set before calling // Everything above this point must be set before calling
// ff_vaapi_encode_init(). // ff_vaapi_encode_init().
// Codec-specific state.
void *priv_data;
// Configuration attributes to use when creating va_config. // Configuration attributes to use when creating va_config.
VAConfigAttrib config_attributes[MAX_CONFIG_ATTRIBUTES]; VAConfigAttrib config_attributes[MAX_CONFIG_ATTRIBUTES];
int nb_config_attributes; int nb_config_attributes;
...@@ -205,18 +202,10 @@ typedef struct VAAPIEncodeContext { ...@@ -205,18 +202,10 @@ typedef struct VAAPIEncodeContext {
int gop_counter; int gop_counter;
int p_counter; int p_counter;
int end_of_stream; int end_of_stream;
// Codec-local options are allocated to follow this structure in
// memory (in the AVCodec definition, set priv_data_size to
// sizeof(VAAPIEncodeContext) + sizeof(VAAPIEncodeFooOptions)).
void *codec_options;
char codec_options_data[0];
} VAAPIEncodeContext; } VAAPIEncodeContext;
typedef struct VAAPIEncodeType { typedef struct VAAPIEncodeType {
size_t priv_data_size;
// Perform any extra codec-specific configuration after the // Perform any extra codec-specific configuration after the
// codec context is initialised (set up the private data and // codec context is initialised (set up the private data and
// add any necessary global parameters). // add any necessary global parameters).
......
...@@ -867,8 +867,6 @@ static av_cold int vaapi_encode_h264_configure(AVCodecContext *avctx) ...@@ -867,8 +867,6 @@ static av_cold int vaapi_encode_h264_configure(AVCodecContext *avctx)
} }
static const VAAPIEncodeType vaapi_encode_type_h264 = { static const VAAPIEncodeType vaapi_encode_type_h264 = {
.priv_data_size = sizeof(VAAPIEncodeH264Context),
.configure = &vaapi_encode_h264_configure, .configure = &vaapi_encode_h264_configure,
.sequence_params_size = sizeof(VAEncSequenceParameterBufferH264), .sequence_params_size = sizeof(VAEncSequenceParameterBufferH264),
......
...@@ -1026,8 +1026,6 @@ static av_cold int vaapi_encode_h265_configure(AVCodecContext *avctx) ...@@ -1026,8 +1026,6 @@ static av_cold int vaapi_encode_h265_configure(AVCodecContext *avctx)
} }
static const VAAPIEncodeType vaapi_encode_type_h265 = { static const VAAPIEncodeType vaapi_encode_type_h265 = {
.priv_data_size = sizeof(VAAPIEncodeH265Context),
.configure = &vaapi_encode_h265_configure, .configure = &vaapi_encode_h265_configure,
.sequence_params_size = sizeof(VAEncSequenceParameterBufferHEVC), .sequence_params_size = sizeof(VAEncSequenceParameterBufferHEVC),
......
...@@ -360,8 +360,6 @@ static av_cold int vaapi_encode_mjpeg_configure(AVCodecContext *avctx) ...@@ -360,8 +360,6 @@ static av_cold int vaapi_encode_mjpeg_configure(AVCodecContext *avctx)
} }
static const VAAPIEncodeType vaapi_encode_type_mjpeg = { static const VAAPIEncodeType vaapi_encode_type_mjpeg = {
.priv_data_size = sizeof(VAAPIEncodeMJPEGContext),
.configure = &vaapi_encode_mjpeg_configure, .configure = &vaapi_encode_mjpeg_configure,
.picture_params_size = sizeof(VAEncPictureParameterBufferJPEG), .picture_params_size = sizeof(VAEncPictureParameterBufferJPEG),
......
...@@ -553,8 +553,6 @@ static av_cold int vaapi_encode_mpeg2_configure(AVCodecContext *avctx) ...@@ -553,8 +553,6 @@ static av_cold int vaapi_encode_mpeg2_configure(AVCodecContext *avctx)
} }
static const VAAPIEncodeType vaapi_encode_type_mpeg2 = { static const VAAPIEncodeType vaapi_encode_type_mpeg2 = {
.priv_data_size = sizeof(VAAPIEncodeMPEG2Context),
.configure = &vaapi_encode_mpeg2_configure, .configure = &vaapi_encode_mpeg2_configure,
.sequence_params_size = sizeof(VAEncSequenceParameterBufferMPEG2), .sequence_params_size = sizeof(VAEncSequenceParameterBufferMPEG2),
......
...@@ -178,8 +178,6 @@ static av_cold int vaapi_encode_vp8_configure(AVCodecContext *avctx) ...@@ -178,8 +178,6 @@ static av_cold int vaapi_encode_vp8_configure(AVCodecContext *avctx)
static const VAAPIEncodeType vaapi_encode_type_vp8 = { static const VAAPIEncodeType vaapi_encode_type_vp8 = {
.configure = &vaapi_encode_vp8_configure, .configure = &vaapi_encode_vp8_configure,
.priv_data_size = sizeof(VAAPIEncodeVP8Context),
.sequence_params_size = sizeof(VAEncSequenceParameterBufferVP8), .sequence_params_size = sizeof(VAEncSequenceParameterBufferVP8),
.init_sequence_params = &vaapi_encode_vp8_init_sequence_params, .init_sequence_params = &vaapi_encode_vp8_init_sequence_params,
......
...@@ -206,8 +206,6 @@ static av_cold int vaapi_encode_vp9_configure(AVCodecContext *avctx) ...@@ -206,8 +206,6 @@ static av_cold int vaapi_encode_vp9_configure(AVCodecContext *avctx)
static const VAAPIEncodeType vaapi_encode_type_vp9 = { static const VAAPIEncodeType vaapi_encode_type_vp9 = {
.configure = &vaapi_encode_vp9_configure, .configure = &vaapi_encode_vp9_configure,
.priv_data_size = sizeof(VAAPIEncodeVP9Context),
.sequence_params_size = sizeof(VAEncSequenceParameterBufferVP9), .sequence_params_size = sizeof(VAEncSequenceParameterBufferVP9),
.init_sequence_params = &vaapi_encode_vp9_init_sequence_params, .init_sequence_params = &vaapi_encode_vp9_init_sequence_params,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment