diff --git a/libavcodec/vdpau.h b/libavcodec/vdpau.h
index 8bedea54ba22505059ac189907c595ffbc8cf4ba..4035f6304e97d9ca129e22fed18f3f92a1d0e76d 100644
--- a/libavcodec/vdpau.h
+++ b/libavcodec/vdpau.h
@@ -52,6 +52,10 @@
 #include <vdpau/vdpau.h>
 #include <vdpau/vdpau_x11.h>
 
+#include "libavutil/attributes.h"
+
+#include "version.h"
+
 #if FF_API_BUFS_VDPAU
 union AVVDPAUPictureInfo {
     VdpPictureInfoH264        h264;
diff --git a/libavcodec/vdpau_internal.h b/libavcodec/vdpau_internal.h
index 9e4ab4e3dfa92d9e10e94c75fb5f51ae854f58f5..50c4f5e74cd2a6a8f48b22d0bf6eeaeb154052e4 100644
--- a/libavcodec/vdpau_internal.h
+++ b/libavcodec/vdpau_internal.h
@@ -26,8 +26,10 @@
 
 #include <stdint.h>
 #include <vdpau/vdpau.h>
-#include "h264.h"
+
+#include "avcodec.h"
 #include "mpegvideo.h"
+#include "version.h"
 
 /** Extract VdpVideoSurface from a Picture */
 static inline uintptr_t ff_vdpau_get_surface_id(Picture *pic)
@@ -42,6 +44,8 @@ union AVVDPAUPictureInfo {
     VdpPictureInfoVC1          vc1;
     VdpPictureInfoMPEG4Part2 mpeg4;
 };
+#else
+#include "vdpau.h"
 #endif
 
 struct vdpau_picture_context {