diff --git a/libavcodec/vaapi_decode.h b/libavcodec/vaapi_decode.h
index e195e863a044fcf6ba25265c5a45523aa07a27e3..fda228b5a98abf19ef38bd48432fa29f9e85c707 100644
--- a/libavcodec/vaapi_decode.h
+++ b/libavcodec/vaapi_decode.h
@@ -24,6 +24,7 @@
 #include "libavutil/frame.h"
 #include "libavutil/hwcontext.h"
 #include "libavutil/hwcontext_vaapi.h"
+#include "libavutil/internal.h"
 
 #include "avcodec.h"
 
@@ -57,9 +58,11 @@ typedef struct VAAPIDecodeContext {
     VAContextID           va_context;
 
 #if FF_API_VAAPI_CONTEXT
+FF_DISABLE_DEPRECATION_WARNINGS
     int                   have_old_context;
     struct vaapi_context *old_context;
     AVBufferRef          *device_ref;
+FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 
     AVHWDeviceContext    *device;