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.
This commit is contained in:
parent
1616106f11
commit
c5b4ad247b
@ -1372,17 +1372,9 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
ctx->codec_options = ctx->codec_options_data;
|
||||
|
||||
ctx->va_config = 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);
|
||||
if (!ctx->input_frames_ref) {
|
||||
err = AVERROR(ENOMEM);
|
||||
@ -1583,7 +1575,5 @@ av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
|
||||
av_buffer_unref(&ctx->input_frames_ref);
|
||||
av_buffer_unref(&ctx->device_ref);
|
||||
|
||||
av_freep(&ctx->priv_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -113,9 +113,6 @@ typedef struct VAAPIEncodeContext {
|
||||
// Everything above this point must be set before calling
|
||||
// ff_vaapi_encode_init().
|
||||
|
||||
// Codec-specific state.
|
||||
void *priv_data;
|
||||
|
||||
// Configuration attributes to use when creating va_config.
|
||||
VAConfigAttrib config_attributes[MAX_CONFIG_ATTRIBUTES];
|
||||
int nb_config_attributes;
|
||||
@ -205,18 +202,10 @@ typedef struct VAAPIEncodeContext {
|
||||
int gop_counter;
|
||||
int p_counter;
|
||||
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;
|
||||
|
||||
|
||||
typedef struct VAAPIEncodeType {
|
||||
size_t priv_data_size;
|
||||
|
||||
// Perform any extra codec-specific configuration after the
|
||||
// codec context is initialised (set up the private data and
|
||||
// add any necessary global parameters).
|
||||
|
@ -867,8 +867,6 @@ static av_cold int vaapi_encode_h264_configure(AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
static const VAAPIEncodeType vaapi_encode_type_h264 = {
|
||||
.priv_data_size = sizeof(VAAPIEncodeH264Context),
|
||||
|
||||
.configure = &vaapi_encode_h264_configure,
|
||||
|
||||
.sequence_params_size = sizeof(VAEncSequenceParameterBufferH264),
|
||||
|
@ -1026,8 +1026,6 @@ static av_cold int vaapi_encode_h265_configure(AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
static const VAAPIEncodeType vaapi_encode_type_h265 = {
|
||||
.priv_data_size = sizeof(VAAPIEncodeH265Context),
|
||||
|
||||
.configure = &vaapi_encode_h265_configure,
|
||||
|
||||
.sequence_params_size = sizeof(VAEncSequenceParameterBufferHEVC),
|
||||
|
@ -360,8 +360,6 @@ static av_cold int vaapi_encode_mjpeg_configure(AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
static const VAAPIEncodeType vaapi_encode_type_mjpeg = {
|
||||
.priv_data_size = sizeof(VAAPIEncodeMJPEGContext),
|
||||
|
||||
.configure = &vaapi_encode_mjpeg_configure,
|
||||
|
||||
.picture_params_size = sizeof(VAEncPictureParameterBufferJPEG),
|
||||
|
@ -553,8 +553,6 @@ static av_cold int vaapi_encode_mpeg2_configure(AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
static const VAAPIEncodeType vaapi_encode_type_mpeg2 = {
|
||||
.priv_data_size = sizeof(VAAPIEncodeMPEG2Context),
|
||||
|
||||
.configure = &vaapi_encode_mpeg2_configure,
|
||||
|
||||
.sequence_params_size = sizeof(VAEncSequenceParameterBufferMPEG2),
|
||||
|
@ -178,8 +178,6 @@ static av_cold int vaapi_encode_vp8_configure(AVCodecContext *avctx)
|
||||
static const VAAPIEncodeType vaapi_encode_type_vp8 = {
|
||||
.configure = &vaapi_encode_vp8_configure,
|
||||
|
||||
.priv_data_size = sizeof(VAAPIEncodeVP8Context),
|
||||
|
||||
.sequence_params_size = sizeof(VAEncSequenceParameterBufferVP8),
|
||||
.init_sequence_params = &vaapi_encode_vp8_init_sequence_params,
|
||||
|
||||
|
@ -206,8 +206,6 @@ static av_cold int vaapi_encode_vp9_configure(AVCodecContext *avctx)
|
||||
static const VAAPIEncodeType vaapi_encode_type_vp9 = {
|
||||
.configure = &vaapi_encode_vp9_configure,
|
||||
|
||||
.priv_data_size = sizeof(VAAPIEncodeVP9Context),
|
||||
|
||||
.sequence_params_size = sizeof(VAEncSequenceParameterBufferVP9),
|
||||
.init_sequence_params = &vaapi_encode_vp9_init_sequence_params,
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user