@@ -67,15 +67,6 @@ using AVHWFramesConstraints_uniq = std::unique_ptr<AVHWFramesConstraints, delete
6767
6868constexpr 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-
139125int 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}
0 commit comments