summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-07 21:33:14 +0100
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-01-25 17:00:18 +0900
commitf4a9c9424f968eb642a2c953ed4588913bdfae1d (patch)
tree632bc3a86baf652d0f021bae1002c1b608df230f
parentd9da0c9ce9105b2097d9463e4787b5fac56412cf (diff)
downloadmpv-f4a9c9424f968eb642a2c953ed4588913bdfae1d.tar.bz2
mpv-f4a9c9424f968eb642a2c953ed4588913bdfae1d.tar.xz
win32: request UTF-16 API variants, Vista+ APIs, and COM C macros
Put the Vista+ (_WIN32_WINNT) and the COM C (COBJMACROS) defines into the build system, instead of defining them over and over in the code. Conflicts: video/out/w32_common.c waftools/checks/custom.py
-rw-r--r--audio/out/ao_dsound.c2
-rw-r--r--audio/out/ao_wasapi.c3
-rwxr-xr-xaudio/out/ao_wasapi.h3
-rwxr-xr-xaudio/out/ao_wasapi_changenotify.c3
-rwxr-xr-xaudio/out/ao_wasapi_utils.c3
-rw-r--r--osdep/subprocess-win.c1
-rw-r--r--video/decode/dxva2.c9
-rw-r--r--video/filter/vf_dlopen.c2
-rw-r--r--video/out/gl_w32.c2
-rw-r--r--video/out/w32_common.c1
-rw-r--r--waftools/detections/compiler.py5
-rw-r--r--waftools/fragments/wasapi.c2
12 files changed, 10 insertions, 26 deletions
diff --git a/audio/out/ao_dsound.c b/audio/out/ao_dsound.c
index b5d8c61bcc..825e3095df 100644
--- a/audio/out/ao_dsound.c
+++ b/audio/out/ao_dsound.c
@@ -228,7 +228,7 @@ static int LoadDirectSound(struct ao *ao)
struct priv *p = ao->priv;
// initialize directsound
- p->hdsound_dll = LoadLibrary("DSOUND.DLL");
+ p->hdsound_dll = LoadLibrary(L"DSOUND.DLL");
if (p->hdsound_dll == NULL) {
MP_ERR(ao, "cannot load DSOUND.DLL\n");
return 0;
diff --git a/audio/out/ao_wasapi.c b/audio/out/ao_wasapi.c
index 8fb8a71fb9..1b99c4136a 100644
--- a/audio/out/ao_wasapi.c
+++ b/audio/out/ao_wasapi.c
@@ -17,9 +17,6 @@
* with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
-#define COBJMACROS 1
-#define _WIN32_WINNT 0x600
-
#include <stdlib.h>
#include <inttypes.h>
#include <process.h>
diff --git a/audio/out/ao_wasapi.h b/audio/out/ao_wasapi.h
index 367aae03aa..895497bffb 100755
--- a/audio/out/ao_wasapi.h
+++ b/audio/out/ao_wasapi.h
@@ -20,9 +20,6 @@
#ifndef MP_AO_WASAPI_H_
#define MP_AO_WASAPI_H_
-#define COBJMACROS 1
-#define _WIN32_WINNT 0x600
-
#include <audioclient.h>
#include <audiopolicy.h>
#include <mmdeviceapi.h>
diff --git a/audio/out/ao_wasapi_changenotify.c b/audio/out/ao_wasapi_changenotify.c
index cd869c7ab5..ea7e2c6aa7 100755
--- a/audio/out/ao_wasapi_changenotify.c
+++ b/audio/out/ao_wasapi_changenotify.c
@@ -17,9 +17,6 @@
* with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
-#define COBJMACROS 1
-#define _WIN32_WINNT 0x600
-
#include <initguid.h>
#include <audioclient.h>
#include <endpointvolume.h>
diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c
index 072e80e208..30f1f38ae8 100755
--- a/audio/out/ao_wasapi_utils.c
+++ b/audio/out/ao_wasapi_utils.c
@@ -17,9 +17,6 @@
* with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
-#define COBJMACROS 1
-#define _WIN32_WINNT 0x600
-
#include <math.h>
#include <libavutil/common.h>
#include <initguid.h>
diff --git a/osdep/subprocess-win.c b/osdep/subprocess-win.c
index 48730ef330..211f407db1 100644
--- a/osdep/subprocess-win.c
+++ b/osdep/subprocess-win.c
@@ -15,7 +15,6 @@
* with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
-#define _WIN32_WINNT 0x0600
#include <windows.h>
#include <string.h>
diff --git a/video/decode/dxva2.c b/video/decode/dxva2.c
index 405ad293b4..cbd08a7e52 100644
--- a/video/decode/dxva2.c
+++ b/video/decode/dxva2.c
@@ -21,12 +21,7 @@
#include <windows.h>
-#ifdef _WIN32_WINNT
-#undef _WIN32_WINNT
-#endif
-#define _WIN32_WINNT 0x0600
#define DXVA2API_USE_BITFIELDS
-#define COBJMACROS
#include <stdint.h>
@@ -360,12 +355,12 @@ static int dxva2_init(struct lavc_ctx *s)
ctx->deviceHandle = INVALID_HANDLE_VALUE;
- ctx->d3dlib = LoadLibrary("d3d9.dll");
+ ctx->d3dlib = LoadLibrary(L"d3d9.dll");
if (!ctx->d3dlib) {
MP_ERR(ctx, "Failed to load D3D9 library\n");
goto fail;
}
- ctx->dxva2lib = LoadLibrary("dxva2.dll");
+ ctx->dxva2lib = LoadLibrary(L"dxva2.dll");
if (!ctx->dxva2lib) {
MP_ERR(ctx, "Failed to load DXVA2 library\n");
goto fail;
diff --git a/video/filter/vf_dlopen.c b/video/filter/vf_dlopen.c
index 118a4911f2..1162f37680 100644
--- a/video/filter/vf_dlopen.c
+++ b/video/filter/vf_dlopen.c
@@ -34,7 +34,7 @@
#ifdef _WIN32
# include <windows.h>
-# define DLLOpen(name) LoadLibrary(name)
+# define DLLOpen(name) LoadLibraryA(name)
# define DLLClose(handle) FreeLibrary(handle)
# define DLLSymbol(handle, name) ((void *)GetProcAddress(handle, name))
#else
diff --git a/video/out/gl_w32.c b/video/out/gl_w32.c
index 79e3165b39..abdea60775 100644
--- a/video/out/gl_w32.c
+++ b/video/out/gl_w32.c
@@ -81,7 +81,7 @@ static void *w32gpa(const GLubyte *procName)
void *res = wglGetProcAddress(procName);
if (res)
return res;
- oglmod = GetModuleHandle("opengl32.dll");
+ oglmod = GetModuleHandle(L"opengl32.dll");
return GetProcAddress(oglmod, procName);
}
diff --git a/video/out/w32_common.c b/video/out/w32_common.c
index c67308528d..de114d3243 100644
--- a/video/out/w32_common.c
+++ b/video/out/w32_common.c
@@ -16,7 +16,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#define _WIN32_WINNT 0x0600
#include <stdio.h>
#include <limits.h>
#include <pthread.h>
diff --git a/waftools/detections/compiler.py b/waftools/detections/compiler.py
index 2c22f26a1a..97520ba76e 100644
--- a/waftools/detections/compiler.py
+++ b/waftools/detections/compiler.py
@@ -45,11 +45,16 @@ def __add_clang_flags__(ctx):
"-Wno-tautological-compare",
"-Wno-tautological-constant-out-of-range-compare" ]
+def __add_mswin_flags__(ctx):
+ ctx.env.CFLAGS += ['-D_WIN32_WINNT=0x600', '-DUNICODE', '-DCOBJMACROS']
+
def __add_mingw_flags__(ctx):
+ __add_mswin_flags__(ctx)
ctx.env.CFLAGS += ['-D__USE_MINGW_ANSI_STDIO=1']
ctx.env.LAST_LINKFLAGS += ['-mwindows']
def __add_cygwin_flags__(ctx):
+ __add_mswin_flags__(ctx)
ctx.env.CFLAGS += ['-mwin32']
ctx.env.CFLAGS += ['-U__STRICT_ANSI__']
diff --git a/waftools/fragments/wasapi.c b/waftools/fragments/wasapi.c
index ef3b3f7866..5528ce171b 100644
--- a/waftools/fragments/wasapi.c
+++ b/waftools/fragments/wasapi.c
@@ -1,5 +1,3 @@
-#define COBJMACROS 1
-#define _WIN32_WINNT 0x600
#include <malloc.h>
#include <stdlib.h>
#include <process.h>