[vlc-commits] Dxva2 is only available in Windows Vista and above

Rafaël Carré git at videolan.org
Wed Dec 7 17:41:27 CET 2011


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Wed Dec  7 11:20:40 2011 -0500| [87038073b8434addc0d360d98a55b67fd55352a7] | committer: Rafaël Carré

Dxva2 is only available in Windows Vista and above

Define _WIN32_WINNT to 0x600 when checking/using dxva2 headers
Continue to use a lower version to retain XP compatibility for the rest of VLC

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=87038073b8434addc0d360d98a55b67fd55352a7
---

 configure.ac                  |    4 +++-
 modules/codec/avcodec/dxva2.c |   10 ++++++++++
 modules/codec/avcodec/video.c |    8 ++++++++
 3 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0647c62..d0538e2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2443,7 +2443,9 @@ AS_IF([test "${enable_dxva2}" != "no"], [
     AS_IF([test "${enable_dxva2}" = "yes"],
           [AC_MSG_ERROR([dxva2 is present but libavcodec/dxva2.h is missing])],
               [AC_MSG_WARN([dxva2 is present but libavcodec/dxva2.h is missing ])])
-        ])
+        ], [#undef _WIN32_WINNT
+            /* DXVA2 is only available in Vista and above */
+            #define _WIN32_WINNT 0x600])
       ],[
     AS_IF([test "${enable_dxva2}" = "yes"],
               [AC_MSG_ERROR([Could not find required dxva2api.h])],
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 11ad2e7..8ae4fd3 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -27,6 +27,15 @@
 # include "config.h"
 #endif
 
+
+#if defined(HAVE_LIBAVCODEC_AVCODEC_H) && defined(HAVE_AVCODEC_DXVA2)
+# if _WIN32_WINNT < 0x600
+/* dxva2 needs Vista support */
+#  undef _WIN32_WINNT
+#  define _WIN32_WINNT 0x600
+# endif
+#endif
+
 #include <vlc_common.h>
 #include <vlc_picture.h>
 #include <vlc_fourcc.h>
@@ -37,6 +46,7 @@
 #   include <libavcodec/avcodec.h>
 #   ifdef HAVE_AVCODEC_DXVA2
 #       define DXVA2API_USE_BITFIELDS
+#       define COBJMACROS
 #       include <libavcodec/dxva2.h>
 #   endif
 #else
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 6c9b865..95e64b5 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -29,6 +29,14 @@
 # include "config.h"
 #endif
 
+#if defined(HAVE_LIBAVCODEC_AVCODEC_H) && defined(HAVE_AVCODEC_DXVA2)
+# if _WIN32_WINNT < 0x600
+/* dxva2 needs Vista support */
+#  undef _WIN32_WINNT
+#  define _WIN32_WINNT 0x600
+# endif
+#endif
+
 #include <vlc_common.h>
 #include <vlc_codec.h>
 #include <vlc_avcodec.h>



More information about the vlc-commits mailing list