Skip to content

Commit e87ad70

Browse files
committed
hwaccel/vaapi: Remove vaapi_ctx
This struct isn't used for anything, no point in keeping it
1 parent 8f905eb commit e87ad70

2 files changed

Lines changed: 2 additions & 27 deletions

File tree

src/hwaccel_vaapi.cpp

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,6 @@ using AVHWFramesConstraints_uniq = std::unique_ptr<AVHWFramesConstraints, delete
6767

6868
constexpr int DEFAULT_SURFACES = 20;
6969

70-
struct vaapi_ctx {
71-
AVBufferRef *device_ref;
72-
AVHWDeviceContext *device_ctx;
73-
AVVAAPIDeviceContext *device_vaapi_ctx;
74-
75-
AVBufferRef *hw_frames_ctx;
76-
AVHWFramesContext *frame_ctx;
77-
};
78-
7970
/**
8071
* Returns first SW format from valid_sw_formats. This is usually
8172
* AV_PIX_FMT_YUV420P or AV_PIX_FMT_NV12.
@@ -131,21 +122,13 @@ AVPixelFormat get_sw_format(AVBufferRef *device_ref){
131122

132123
}
133124

134-
void vaapi_uninit(hw_accel_state *s){
135-
auto ctx = static_cast<vaapi_ctx *>(s->ctx);
136-
delete ctx;
137-
}
138-
139125
int vaapi_init(AVCodecContext *s, hw_accel_state *state, codec_t /*out_codec*/){
140126
AVBufferRef_uniq device_ref;
141127
int ret = create_hw_device_ctx(AV_HWDEVICE_TYPE_VAAPI, out_ptr(device_ref));
142128
if(ret < 0){
143129
return -1;
144130
}
145131

146-
auto device_ctx = (AVHWDeviceContext*)(void *)device_ref->data;
147-
auto device_vaapi_ctx = static_cast<AVVAAPIDeviceContext *>(device_ctx->hwctx);
148-
149132
int decode_surfaces = DEFAULT_SURFACES;
150133

151134
if (s->active_thread_type & FF_THREAD_FRAME)
@@ -178,20 +161,13 @@ int vaapi_init(AVCodecContext *s, hw_accel_state *state, codec_t /*out_codec*/){
178161
return -1;
179162
}
180163

181-
auto ctx = std::make_unique<vaapi_ctx>();
182-
ctx->device_ref = device_ref.get();
183-
ctx->device_ctx = device_ctx;
184-
ctx->device_vaapi_ctx = device_vaapi_ctx;
185-
ctx->hw_frames_ctx = hw_frames_ctx.get();
186-
ctx->frame_ctx = (AVHWFramesContext *)(void *) (ctx->hw_frames_ctx->data);
187-
188164
s->hw_frames_ctx = hw_frames_ctx.release();
189165

190166
state->type = HWACCEL_VAAPI;
191167
state->copy = true;
192-
state->ctx = ctx.release();
168+
state->ctx = nullptr;
193169
state->tmp_frame = tmp_frame.release();
194-
state->uninit = vaapi_uninit;
170+
state->uninit = nullptr;
195171

196172
return 0;
197173
}

src/hwaccel_vaapi.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ extern "C" {
5656
struct AVCodecContext;
5757
struct hw_accel_state;
5858

59-
void vaapi_uninit(struct hw_accel_state *s);
6059
int vaapi_init(struct AVCodecContext *s,
6160
struct hw_accel_state *state,
6261
codec_t out_codec);

0 commit comments

Comments
 (0)