[FFmpeg-devel] [PATCH 07/26] vaapi_encode: Remove common priv_data and options fields
Mark Thompson
sw at jkqxz.net
Sun Apr 22 18:29:02 EEST 2018
The codec-specific context now contains both the common context and the
codec-specific options directly.
---
libavcodec/vaapi_encode.c | 10 ----------
libavcodec/vaapi_encode.h | 11 -----------
libavcodec/vaapi_encode_h264.c | 2 --
libavcodec/vaapi_encode_h265.c | 2 --
libavcodec/vaapi_encode_mjpeg.c | 2 --
libavcodec/vaapi_encode_mpeg2.c | 2 --
libavcodec/vaapi_encode_vp8.c | 2 --
libavcodec/vaapi_encode_vp9.c | 2 --
8 files changed, 33 deletions(-)
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 36c85a3815..609fc604c1 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -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;
}
diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
index bcb9d57371..c7370a17e2 100644
--- a/libavcodec/vaapi_encode.h
+++ b/libavcodec/vaapi_encode.h
@@ -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).
diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index cc163151a6..8396683789 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -864,8 +864,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),
diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index ba6b426eed..5529ee5a03 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -876,8 +876,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),
diff --git a/libavcodec/vaapi_encode_mjpeg.c b/libavcodec/vaapi_encode_mjpeg.c
index 983c77d194..481981a71c 100644
--- a/libavcodec/vaapi_encode_mjpeg.c
+++ b/libavcodec/vaapi_encode_mjpeg.c
@@ -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),
diff --git a/libavcodec/vaapi_encode_mpeg2.c b/libavcodec/vaapi_encode_mpeg2.c
index 5dd1f39cbc..72c838d774 100644
--- a/libavcodec/vaapi_encode_mpeg2.c
+++ b/libavcodec/vaapi_encode_mpeg2.c
@@ -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),
diff --git a/libavcodec/vaapi_encode_vp8.c b/libavcodec/vaapi_encode_vp8.c
index c182b6918a..05c9d03a38 100644
--- a/libavcodec/vaapi_encode_vp8.c
+++ b/libavcodec/vaapi_encode_vp8.c
@@ -176,8 +176,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,
diff --git a/libavcodec/vaapi_encode_vp9.c b/libavcodec/vaapi_encode_vp9.c
index 6e62213bc9..bf99597e4c 100644
--- a/libavcodec/vaapi_encode_vp9.c
+++ b/libavcodec/vaapi_encode_vp9.c
@@ -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,
--
2.16.3
More information about the ffmpeg-devel
mailing list