From 347f73b9a7d42ccb75a2bee1e639e65f173a6254 Mon Sep 17 00:00:00 2001 From: Marvin Scholz <epirat07@gmail.com> Date: Tue, 11 May 2021 15:06:00 +0200 Subject: [PATCH] Only define VLC_WINSTORE_APP if true This makes it consistent with all the other uses of such defines in the source code, which are tested for their existence rather than the actual value. --- configure.ac | 2 +- modules/access/file.c | 2 +- modules/audio_output/directsound.c | 2 +- modules/codec/avcodec/d3d11va.c | 2 +- modules/codec/avcodec/video.c | 2 +- modules/codec/mft.c | 2 +- modules/control/cli/cli.c | 8 +++--- modules/control/dummy.c | 2 +- modules/hw/d3d11/d3d11_filters.c | 2 +- modules/lua/extension.c | 2 +- modules/lua/intf.c | 2 +- modules/lua/libs/win.c | 2 +- .../text_renderer/freetype/fonts/backends.h | 2 +- .../text_renderer/freetype/fonts/dwrite.cpp | 8 +++--- modules/text_renderer/freetype/fonts/win32.c | 2 +- .../text_renderer/freetype/platform_fonts.c | 4 +-- modules/video_chroma/d3d11_fmt.c | 16 ++++++------ modules/video_chroma/d3d9_fmt.c | 2 +- modules/video_output/win32/common.c | 6 ++--- modules/video_output/win32/common.h | 2 +- .../video_output/win32/d3d11_swapchain.cpp | 6 ++--- modules/video_output/win32/d3d11_swapchain.h | 2 +- .../video_output/win32/d3d_dynamic_shader.c | 6 ++--- modules/video_output/win32/direct3d11.cpp | 14 +++++----- modules/video_output/win32/dxgi_swapchain.cpp | 12 ++++----- modules/video_output/win32/dxgi_swapchain.h | 2 +- src/config/help.c | 6 ++--- src/input/es_out_timeshift.c | 2 +- src/libvlc-module.c | 4 +-- src/misc/interrupt.c | 2 +- src/misc/update.c | 2 +- src/modules/bank.c | 2 +- src/text/unicode.c | 2 +- src/win32/filesystem.c | 8 +++--- src/win32/plugin.c | 2 +- src/win32/rand.c | 4 +-- src/win32/specific.c | 2 +- src/win32/thread.c | 26 +++++++++++-------- 38 files changed, 90 insertions(+), 86 deletions(-) diff --git a/configure.ac b/configure.ac index 773fdd3435e6..9c32dbdfd154 100644 --- a/configure.ac +++ b/configure.ac @@ -400,10 +400,10 @@ AS_IF([test "${SYS}" = "mingw32"],[ LDFLAGS="${LDFLAGS} -lwindowsappcompat" VLC_ADD_LIBS([libvlccore], [-lruntimeobject]) AC_LIBOBJ([gai_strerror]) + AC_DEFINE([VLC_WINSTORE_APP], [1], [Define to 1 if building for Windows Store.]) ],[]) AC_SUBST([LIBCOM]) ]) -AC_DEFINE_UNQUOTED(VLC_WINSTORE_APP, ${vlc_winstore_app}, [Define to 1 if you want to build for Windows Store apps]) vlc_build_pdb=0 AC_ARG_ENABLE([pdb], diff --git a/modules/access/file.c b/modules/access/file.c index e5fa3620401e..ba4a04c1fd3e 100644 --- a/modules/access/file.c +++ b/modules/access/file.c @@ -110,7 +110,7 @@ static bool IsRemote (int fd) #else /* _WIN32 || __OS2__ */ static bool IsRemote (const char *path) { -# if !defined(__OS2__) && !VLC_WINSTORE_APP +# if !defined(__OS2__) && !defined(VLC_WINSTORE_APP) wchar_t *wpath = ToWide (path); bool is_remote = (wpath != NULL && PathIsNetworkPathW (wpath)); free (wpath); diff --git a/modules/audio_output/directsound.c b/modules/audio_output/directsound.c index 4acdb555b7bc..4274c7bf727f 100644 --- a/modules/audio_output/directsound.c +++ b/modules/audio_output/directsound.c @@ -590,7 +590,7 @@ static HRESULT Start( vlc_object_t *obj, aout_stream_sys_t *sys, if( aout_FormatNbChannels( pfmt ) == 0 ) return E_FAIL; -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP /* Set DirectSound Cooperative level, ie what control we want over Windows * sound device. In our case, DSSCL_EXCLUSIVE means that we can modify the * settings of the primary buffer, but also that only the sound of our diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c index deb8a277785a..5652435be24c 100644 --- a/modules/codec/avcodec/d3d11va.c +++ b/modules/codec/avcodec/d3d11va.c @@ -510,7 +510,7 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id, ID3D10Multithread_Release(pMultithread); } -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP /* On the Xbox 1/S, any decoding of H264 with one dimension over 2304 * crashes totally the device */ if (codec_id == AV_CODEC_ID_H264 && diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c index 30da0783a7d6..0e470faa2459 100644 --- a/modules/codec/avcodec/video.c +++ b/modules/codec/avcodec/video.c @@ -522,7 +522,7 @@ int InitVideoDec( vlc_object_t *obj ) i_thread_count++; //FIXME: take in count the decoding time -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP i_thread_count = __MIN( i_thread_count, 6 ); #else i_thread_count = __MIN( i_thread_count, p_codec->id == AV_CODEC_ID_HEVC ? 10 : 6 ); diff --git a/modules/codec/mft.c b/modules/codec/mft.c index 0e0cf5a6950e..b884d6e1a878 100644 --- a/modules/codec/mft.c +++ b/modules/codec/mft.c @@ -1152,7 +1152,7 @@ static int FindMFT(decoder_t *p_dec) static int LoadMFTLibrary(MFHandle *mf) { -#if _WIN32_WINNT < _WIN32_WINNT_WIN7 || VLC_WINSTORE_APP || __MINGW64_VERSION_MAJOR < 6 +#if _WIN32_WINNT < _WIN32_WINNT_WIN7 || defined(VLC_WINSTORE_APP) || __MINGW64_VERSION_MAJOR < 6 mf->mfplat_dll = LoadLibrary(TEXT("mfplat.dll")); if (!mf->mfplat_dll) return VLC_EGENERIC; diff --git a/modules/control/cli/cli.c b/modules/control/cli/cli.c index 74f913bd635c..b44279c32682 100644 --- a/modules/control/cli/cli.c +++ b/modules/control/cli/cli.c @@ -605,7 +605,7 @@ int cli_printf(struct cli_client *cl, const char *fmt, ...) return VLC_SUCCESS; } -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP static bool ReadWin32( intf_thread_t *p_intf, unsigned char *p_buffer, int *pi_size ) { INPUT_RECORD input_record; @@ -693,7 +693,7 @@ static bool ReadWin32( intf_thread_t *p_intf, unsigned char *p_buffer, int *pi_s static bool ReadCommand(intf_thread_t *p_intf, char *p_buffer, int *pi_size) { -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP if( p_intf->p_sys->i_socket == -1 && !p_intf->p_sys->b_quiet ) return ReadWin32( p_intf, (unsigned char*)p_buffer, pi_size ); else if( p_intf->p_sys->i_socket == -1 ) @@ -760,7 +760,7 @@ static void *Run( void *data ) p_buffer[0] = 0; -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP /* Get the file descriptor of the console input */ p_intf->p_sys->hConsoleIn = GetStdHandle(STD_INPUT_HANDLE); if( p_intf->p_sys->hConsoleIn == INVALID_HANDLE_VALUE ) @@ -946,7 +946,7 @@ static int Activate( vlc_object_t *p_this ) if (pi_socket != NULL) #else p_sys->i_socket = -1; -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP p_sys->b_quiet = true; #else p_sys->b_quiet = var_InheritBool( p_intf, "rc-quiet" ); diff --git a/modules/control/dummy.c b/modules/control/dummy.c index 1ed3fc92e845..2f46172c083a 100644 --- a/modules/control/dummy.c +++ b/modules/control/dummy.c @@ -40,7 +40,7 @@ vlc_module_begin () set_description( N_("Dummy interface") ) set_capability( "interface", 0 ) set_callback( Open ) -#if defined(_WIN32) && !VLC_WINSTORE_APP +#if defined(_WIN32) && !defined(VLC_WINSTORE_APP) add_obsolete_bool( "dummy-quiet" ) /* since 4.0.0 */ #endif vlc_module_end () diff --git a/modules/hw/d3d11/d3d11_filters.c b/modules/hw/d3d11/d3d11_filters.c index c32b1d35da44..a3b808bc28e5 100644 --- a/modules/hw/d3d11/d3d11_filters.c +++ b/modules/hw/d3d11/d3d11_filters.c @@ -606,7 +606,7 @@ vlc_module_begin() add_submodule() set_description(N_("Direct3D11")) set_callback_dec_device( D3D11OpenDecoderDeviceAny, 8 ) -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP /* LEGACY, the d3dcontext and swapchain were given by the host app */ add_integer("winrt-d3dcontext", 0x0, N_("Context"), NULL) /* ID3D11DeviceContext* */ #endif /* VLC_WINSTORE_APP */ diff --git a/modules/lua/extension.c b/modules/lua/extension.c index 998ba5a0cd8d..f9bb5ae20c55 100644 --- a/modules/lua/extension.c +++ b/modules/lua/extension.c @@ -835,7 +835,7 @@ static lua_State* GetLuaState( extensions_manager_t *p_mgr, luaopen_errno( L ); luaopen_rand( L ); luaopen_rd( L ); -#if defined(_WIN32) && !VLC_WINSTORE_APP +#if defined(_WIN32) && !defined(VLC_WINSTORE_APP) luaopen_win( L ); #endif diff --git a/modules/lua/intf.c b/modules/lua/intf.c index 409432e8ecce..688f856196ce 100644 --- a/modules/lua/intf.c +++ b/modules/lua/intf.c @@ -272,7 +272,7 @@ static int Start_LuaIntf( vlc_object_t *p_this, const char *name ) luaopen_errno( L ); luaopen_rand( L ); luaopen_rd( L ); -#if defined(_WIN32) && !VLC_WINSTORE_APP +#if defined(_WIN32) && !defined(VLC_WINSTORE_APP) luaopen_win( L ); #endif diff --git a/modules/lua/libs/win.c b/modules/lua/libs/win.c index c51f71c7f9f4..6467783a807b 100644 --- a/modules/lua/libs/win.c +++ b/modules/lua/libs/win.c @@ -33,7 +33,7 @@ #include "../vlc.h" #include "../libs.h" -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP /* Based on modules/control/rc.c and include/vlc_interface.h */ static HANDLE GetConsole( lua_State *L ) diff --git a/modules/text_renderer/freetype/fonts/backends.h b/modules/text_renderer/freetype/fonts/backends.h index 6730ba46a4c4..8bc32d3b31f9 100644 --- a/modules/text_renderer/freetype/fonts/backends.h +++ b/modules/text_renderer/freetype/fonts/backends.h @@ -88,7 +88,7 @@ int DWrite_GetFallbacks( vlc_font_select_t *, const char *psz_family, int InitDWrite( vlc_font_select_t * ); int ReleaseDWrite( vlc_font_select_t * ); int DWrite_GetFontStream( vlc_font_select_t *, int i_index, FT_Stream *pp_stream ); -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP int Win32_GetFallbacks( vlc_font_select_t *, const char *psz_family, uni_char_t codepoint, vlc_family_t ** ); diff --git a/modules/text_renderer/freetype/fonts/dwrite.cpp b/modules/text_renderer/freetype/fonts/dwrite.cpp index acbaecfc7e6b..0bce957996e0 100644 --- a/modules/text_renderer/freetype/fonts/dwrite.cpp +++ b/modules/text_renderer/freetype/fonts/dwrite.cpp @@ -57,7 +57,7 @@ struct dw_sys_t dw_sys_t( HMODULE p_dw_dll ) : p_dw_dll( p_dw_dll ) { /* This will fail on versions of Windows prior to 8.1 */ -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP if( DWriteCreateFactory( DWRITE_FACTORY_TYPE_SHARED, __uuidof( IDWriteFactory2 ), reinterpret_cast<IUnknown **>( p_dw_factory.GetAddressOf() ) ) ) throw runtime_error( "failed to create DWrite factory" ); @@ -137,7 +137,7 @@ extern "C" int InitDWrite( vlc_font_select_t *fs ) try { -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP p_dw_sys = new dw_sys_t( p_dw_dll ); #else p_dw_dll = LoadLibrary( TEXT( "Dwrite.dll" ) ); @@ -149,7 +149,7 @@ extern "C" int InitDWrite( vlc_font_select_t *fs ) } catch( const exception &e ) { -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP FreeLibrary( p_dw_dll ); (void)e; #else @@ -168,7 +168,7 @@ extern "C" int ReleaseDWrite( vlc_font_select_t *fs ) { dw_sys_t *p_dw_sys = ( dw_sys_t * ) fs->p_dw_sys; -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP delete p_dw_sys; #else HMODULE p_dw_dll = NULL; diff --git a/modules/text_renderer/freetype/fonts/win32.c b/modules/text_renderer/freetype/fonts/win32.c index 17cc85371bfc..888efbbea842 100644 --- a/modules/text_renderer/freetype/fonts/win32.c +++ b/modules/text_renderer/freetype/fonts/win32.c @@ -57,7 +57,7 @@ #include "../platform_fonts.h" #include "backends.h" -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP #define FONT_DIR_NT TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts") #define FONT_LINKING_NT TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\FontLink\\SystemLink") diff --git a/modules/text_renderer/freetype/platform_fonts.c b/modules/text_renderer/freetype/platform_fonts.c index 180de9dd5ee3..8eec989edf10 100644 --- a/modules/text_renderer/freetype/platform_fonts.c +++ b/modules/text_renderer/freetype/platform_fonts.c @@ -841,7 +841,7 @@ static int StaticMap_GetFamily( vlc_font_select_t *fs, const char *psz_lcname, } #endif -#if !defined(_WIN32) || VLC_WINSTORE_APP +#if !defined(_WIN32) || defined(VLC_WINSTORE_APP) char * MakeFilePath( vlc_font_select_t *fs, const char *psz_filename ) { @@ -902,7 +902,7 @@ vlc_font_select_t * FontSelectNew( filter_t *p_filter ) } else { -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP msg_Err( p_filter, "Error initializing DirectWrite" ); goto error; #else diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c index 69f66b97c080..0ba853e51178 100644 --- a/modules/video_chroma/d3d11_fmt.c +++ b/modules/video_chroma/d3d11_fmt.c @@ -138,7 +138,7 @@ int D3D11_AllocateResourceView(vlc_object_t *obj, ID3D11Device *d3ddevice, return VLC_SUCCESS; } -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP static HKEY GetAdapterRegistry(vlc_object_t *obj, DXGI_ADAPTER_DESC *adapterDesc) { HKEY hKey; @@ -225,7 +225,7 @@ static void D3D11_GetDriverVersion(vlc_object_t *obj, d3d11_device_t *d3d_dev) typedef struct { -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP HINSTANCE hdll; /* handle of the opened d3d11 dll */ #if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H) HINSTANCE dxgidebug_dll; @@ -246,7 +246,7 @@ typedef struct { static int D3D11_Create(vlc_object_t *obj, d3d11_handle_t *hd3d) { -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP hd3d->hdll = LoadLibrary(TEXT("D3D11.DLL")); if (!hd3d->hdll) { @@ -278,7 +278,7 @@ static int D3D11_Create(vlc_object_t *obj, d3d11_handle_t *hd3d) static void D3D11_Destroy(d3d11_handle_t *hd3d) { -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP if (hd3d->hdll) FreeLibrary(hd3d->hdll); @@ -374,7 +374,7 @@ static HRESULT CreateDevice(vlc_object_t *obj, d3d11_handle_t *hd3d, IDXGIAdapter *adapter, bool hw_decoding, d3d11_device_t *out) { -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP # define D3D11CreateDevice(args...) pf_CreateDevice(args) /* */ PFN_D3D11_CREATE_DEVICE pf_CreateDevice; @@ -480,7 +480,7 @@ d3d11_decoder_device_t *(D3D11_CreateDevice)(vlc_object_t *obj, sys->external.cleanupDeviceCb = NULL; HRESULT hr = E_FAIL; -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP /* LEGACY, the d3dcontext and swapchain were given by the host app */ ID3D11DeviceContext *d3dcontext = (ID3D11DeviceContext*)(uintptr_t) var_InheritInteger(obj, "winrt-d3dcontext"); if ( likely(d3dcontext != NULL) ) @@ -522,7 +522,7 @@ d3d11_decoder_device_t *(D3D11_CreateDevice)(vlc_object_t *obj, engineType == libvlc_video_engine_d3d11 ) { /* internal decoder device */ -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP if (!forced) { /* Allow using D3D11 automatically starting from Windows 8.1 */ @@ -846,7 +846,7 @@ error: void D3D11_LogResources(d3d11_decoder_device_t *dev_sys) { -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP # if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H) d3d11_decoder_device *sys = container_of(dev_sys, d3d11_decoder_device, dec_device); d3d11_handle_t *hd3d = &sys->hd3d; diff --git a/modules/video_chroma/d3d9_fmt.c b/modules/video_chroma/d3d9_fmt.c index d8c21fc41fa8..107cbe5d4e81 100644 --- a/modules/video_chroma/d3d9_fmt.c +++ b/modules/video_chroma/d3d9_fmt.c @@ -68,7 +68,7 @@ static void FillPresentationParameters(D3DPRESENT_PARAMETERS *d3dpp) d3dpp->hDeviceWindow = NULL; d3dpp->SwapEffect = D3DSWAPEFFECT_COPY; d3dpp->BackBufferCount = 1; -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP d3dpp->BackBufferWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN); d3dpp->BackBufferHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN); #endif // VLC_WINSTORE_APP diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c index ea2cbf9d8236..5b161b00d99d 100644 --- a/modules/video_output/win32/common.c +++ b/modules/video_output/win32/common.c @@ -46,7 +46,7 @@ void CommonInit(display_win32_area_t *area) area->place_changed = false; } -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP /* */ int CommonWindowInit(vout_display_t *vd, display_win32_area_t *area, vout_display_sys_win32_t *sys, bool projection_gestures) @@ -115,7 +115,7 @@ void CommonPlacePicture(vout_display_t *vd, display_win32_area_t *area) } } -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP /* */ void CommonWindowClean(vout_display_sys_win32_t *sys) { @@ -138,7 +138,7 @@ int CommonControl(vout_display_t *vd, display_win32_area_t *area, vout_display_s } case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE: { /* Update dimensions */ -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP if (sys->event != NULL) { RECT clientRect; diff --git a/modules/video_output/win32/common.h b/modules/video_output/win32/common.h index ea833608ff55..57b2a7128da5 100644 --- a/modules/video_output/win32/common.h +++ b/modules/video_output/win32/common.h @@ -68,7 +68,7 @@ typedef struct vout_display_sys_win32_t /***************************************************************************** * Prototypes from common.c *****************************************************************************/ -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP int CommonWindowInit(vout_display_t *, display_win32_area_t *, vout_display_sys_win32_t *, bool projection_gestures); void CommonWindowClean(vout_display_sys_win32_t *); diff --git a/modules/video_output/win32/d3d11_swapchain.cpp b/modules/video_output/win32/d3d11_swapchain.cpp index 777465ed4a82..e8e490fefcf0 100644 --- a/modules/video_output/win32/d3d11_swapchain.cpp +++ b/modules/video_output/win32/d3d11_swapchain.cpp @@ -91,7 +91,7 @@ static bool UpdateSwapchain( d3d11_local_swapchain *display, const libvlc_video_ display->swapchainTargetView[i].Reset(); const d3d_format_t *newPixelFormat = NULL; -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP ComPtr<IDXGISwapChain1> dxgiswapChain = DXGI_GetSwapChain1(display->sys); if (!dxgiswapChain.Get()) dxgiswapChain = static_cast<IDXGISwapChain1*>((void*)(uintptr_t)var_InheritInteger(display->obj, "winrt-swapchain")); @@ -192,7 +192,7 @@ void D3D11_LocalSwapchainSetMetadata( void *opaque, libvlc_video_metadata_type_t bool D3D11_LocalSwapchainWinstoreSize( void *opaque, uint32_t *width, uint32_t *height ) { -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP d3d11_local_swapchain *display = static_cast<d3d11_local_swapchain *>(opaque); /* legacy UWP mode, the width/height was set in GUID_SWAPCHAIN_WIDTH/HEIGHT */ UINT dataSize = sizeof(*width); @@ -244,7 +244,7 @@ void *D3D11_CreateLocalSwapchainHandleHwnd(vlc_object_t *o, HWND hwnd, d3d11_dev return display; } -#if defined(HAVE_DCOMP_H) && !VLC_WINSTORE_APP +#if defined(HAVE_DCOMP_H) && !defined(VLC_WINSTORE_APP) void *D3D11_CreateLocalSwapchainHandleDComp(vlc_object_t *o, void* dcompDevice, void* dcompVisual, d3d11_device_t *d3d_dev) { d3d11_local_swapchain *display = new (std::nothrow) d3d11_local_swapchain(); diff --git a/modules/video_output/win32/d3d11_swapchain.h b/modules/video_output/win32/d3d11_swapchain.h index 12d88d43a527..77a6d640c441 100644 --- a/modules/video_output/win32/d3d11_swapchain.h +++ b/modules/video_output/win32/d3d11_swapchain.h @@ -29,7 +29,7 @@ #include "../../video_chroma/d3d11_fmt.h" void *D3D11_CreateLocalSwapchainHandleHwnd(vlc_object_t *, HWND, d3d11_device_t *d3d_dev); -#if defined(HAVE_DCOMP_H) && !VLC_WINSTORE_APP +#if defined(HAVE_DCOMP_H) && !defined(VLC_WINSTORE_APP) void *D3D11_CreateLocalSwapchainHandleDComp(vlc_object_t *, void* dcompDevice, void* dcompVisual, d3d11_device_t *d3d_dev); #endif diff --git a/modules/video_output/win32/d3d_dynamic_shader.c b/modules/video_output/win32/d3d_dynamic_shader.c index 6913e3e6ab25..b1624b36ebb1 100644 --- a/modules/video_output/win32/d3d_dynamic_shader.c +++ b/modules/video_output/win32/d3d_dynamic_shader.c @@ -324,7 +324,7 @@ static HRESULT CompileShader(vlc_object_t *obj, const d3d_shader_compiler_t *com ID3D10Blob* pShaderBlob = NULL, *pErrBlob = NULL; UINT compileFlags = 0; -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP VLC_UNUSED(compiler); #else # define D3DCompile(args...) compiler->OurD3DCompile(args) @@ -732,7 +732,7 @@ HRESULT D3D_CompileVertexShader(vlc_object_t *obj, const d3d_shader_compiler_t * int D3D_InitShaderCompiler(vlc_object_t *obj, d3d_shader_compiler_t *compiler) { -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP /* d3dcompiler_47 is the latest on windows 10 */ for (int i = 47; i > 41; --i) { @@ -757,7 +757,7 @@ int D3D_InitShaderCompiler(vlc_object_t *obj, d3d_shader_compiler_t *compiler) void D3D_ReleaseShaderCompiler(d3d_shader_compiler_t *compiler) { -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP if (compiler->compiler_dll) { FreeLibrary(compiler->compiler_dll); diff --git a/modules/video_output/win32/direct3d11.cpp b/modules/video_output/win32/direct3d11.cpp index 9e27ab275f31..dba4a1a5eed1 100644 --- a/modules/video_output/win32/direct3d11.cpp +++ b/modules/video_output/win32/direct3d11.cpp @@ -81,7 +81,7 @@ vlc_module_begin () add_bool("direct3d11-hw-blending", true, HW_BLENDING_TEXT, HW_BLENDING_LONGTEXT) -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP add_integer("winrt-swapchain", 0x0, NULL, NULL) /* IDXGISwapChain1* */ #endif @@ -393,7 +393,7 @@ static int Open(vout_display_t *vd, if ( sys->swapCb == NULL || sys->startEndRenderingCb == NULL || sys->updateOutputCb == NULL ) { -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP if (vd->cfg->window->type == VOUT_WINDOW_TYPE_HWND) { if (CommonWindowInit(vd, &sys->area, &sys->sys, @@ -404,7 +404,7 @@ static int Open(vout_display_t *vd, #endif /* !VLC_WINSTORE_APP */ /* use our internal swapchain callbacks */ -#if defined(HAVE_DCOMP_H) && !VLC_WINSTORE_APP +#if defined(HAVE_DCOMP_H) && !defined(VLC_WINSTORE_APP) if (vd->cfg->window->type == VOUT_WINDOW_TYPE_DCOMP) sys->outside_opaque = D3D11_CreateLocalSwapchainHandleDComp(VLC_OBJECT(vd), @@ -422,7 +422,7 @@ static int Open(vout_display_t *vd, sys->selectPlaneCb = D3D11_LocalSwapchainSelectPlane; } -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP if (vd->source->projection_mode != PROJECTION_MODE_RECTANGULAR && sys->sys.hvideownd) sys->p_sensors = HookWindowsSensors(vd, sys->sys.hvideownd); #endif // !VLC_WINSTORE_APP @@ -462,7 +462,7 @@ static void Close(vout_display_t *vd) { vout_display_sys_t *sys = static_cast<vout_display_sys_t *>(vd->sys); D3D_ReleaseShaderCompiler(&sys->shaders); -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP UnhookWindowsSensors(sys->p_sensors); CommonWindowClean(&sys->sys); #endif @@ -665,7 +665,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture, vout_display_sys_t *sys = static_cast<vout_display_sys_t *>(vd->sys); d3d11_device_lock( sys->d3d_dev ); -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP if ( sys->swapCb == D3D11_LocalSwapchainSwap ) { /* legacy UWP mode, the width/height was set in GUID_SWAPCHAIN_WIDTH/HEIGHT */ @@ -769,7 +769,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmtp, vlc_video_co if (err != VLC_SUCCESS) { if (!is_d3d11_opaque(vd->source->i_chroma) -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP && vd->obj.force #endif ) diff --git a/modules/video_output/win32/dxgi_swapchain.cpp b/modules/video_output/win32/dxgi_swapchain.cpp index 59d52975eb22..a0de83c1b3a8 100644 --- a/modules/video_output/win32/dxgi_swapchain.cpp +++ b/modules/video_output/win32/dxgi_swapchain.cpp @@ -34,7 +34,7 @@ #include <vlc_es.h> -#if defined(HAVE_DCOMP_H) && !VLC_WINSTORE_APP +#if defined(HAVE_DCOMP_H) && !defined(VLC_WINSTORE_APP) # include <dcomp.h> #endif @@ -81,7 +81,7 @@ struct dxgi_swapchain const dxgi_color_space *colorspace = nullptr; swapchain_surface_type swapchainSurfaceType; -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP union { HWND hwnd; #if defined(HAVE_DCOMP_H) @@ -251,7 +251,7 @@ done: color_spaces[best].color == (video_color_space_t) cfg->colorspace; } -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP static void FillSwapChainDesc(dxgi_swapchain *display, UINT width, UINT height, DXGI_SWAP_CHAIN_DESC1 *out) { ZeroMemory(out, sizeof(*out)); @@ -416,7 +416,7 @@ dxgi_swapchain *DXGI_CreateLocalSwapchainHandleHwnd(vlc_object_t *o, HWND hwnd) return NULL; display->obj = o; -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP display->swapchainSurfaceType = SWAPCHAIN_SURFACE_HWND; display->swapchainSurface.hwnd = hwnd; #else // VLC_WINSTORE_APP @@ -426,7 +426,7 @@ dxgi_swapchain *DXGI_CreateLocalSwapchainHandleHwnd(vlc_object_t *o, HWND hwnd) return display; } -#if defined(HAVE_DCOMP_H) && !VLC_WINSTORE_APP +#if defined(HAVE_DCOMP_H) && !defined(VLC_WINSTORE_APP) dxgi_swapchain *DXGI_CreateLocalSwapchainHandleDComp(vlc_object_t *o, void* dcompDevice, void* dcompVisual) { dxgi_swapchain *display = new (std::nothrow) dxgi_swapchain(); @@ -460,7 +460,7 @@ bool DXGI_UpdateSwapChain( dxgi_swapchain *display, IDXGIAdapter *dxgiadapter, IUnknown *pFactoryDevice, const d3d_format_t *newPixelFormat, const libvlc_video_render_cfg_t *cfg ) { -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP if (display->dxgiswapChain.Get() && display->pixelFormat != newPixelFormat) { // the pixel format changed, we need a new swapchain diff --git a/modules/video_output/win32/dxgi_swapchain.h b/modules/video_output/win32/dxgi_swapchain.h index df31c279d3e8..8da93224869f 100644 --- a/modules/video_output/win32/dxgi_swapchain.h +++ b/modules/video_output/win32/dxgi_swapchain.h @@ -48,7 +48,7 @@ struct dxgi_swapchain; struct dxgi_swapchain *DXGI_CreateLocalSwapchainHandleHwnd(vlc_object_t *, HWND); -#if defined(HAVE_DCOMP_H) && !VLC_WINSTORE_APP +#if defined(HAVE_DCOMP_H) && !defined(VLC_WINSTORE_APP) struct dxgi_swapchain *DXGI_CreateLocalSwapchainHandleDComp(vlc_object_t *, void /*IDCompositionDevice*/ * dcompDevice, void /*IDCompositionVisual*/ * dcompVisual); diff --git a/src/config/help.c b/src/config/help.c index 036b4564326b..c4b96c3169db 100644 --- a/src/config/help.c +++ b/src/config/help.c @@ -47,7 +47,7 @@ # include <sys/ioctl.h> #endif -#if defined( _WIN32 ) && !VLC_WINSTORE_APP +#if defined( _WIN32 ) && !defined( VLC_WINSTORE_APP ) static void ShowConsole (void); static void PauseConsole (void); #else @@ -77,7 +77,7 @@ static unsigned ConsoleWidth(void) if (ioctl(STDOUT_FILENO, WIOCGETD, &uw) == 0) return uw.uw_height / uw.uw_vs; #endif -#if defined (_WIN32) && !VLC_WINSTORE_APP +#if defined (_WIN32) && !defined(VLC_WINSTORE_APP) CONSOLE_SCREEN_BUFFER_INFO buf; if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &buf)) @@ -701,7 +701,7 @@ static void Version( void ) PauseConsole(); } -#if defined( _WIN32 ) && !VLC_WINSTORE_APP +#if defined( _WIN32 ) && !defined(VLC_WINSTORE_APP) /***************************************************************************** * ShowConsole: On Win32, create an output console for debug messages ***************************************************************************** diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c index d43a1da65d09..f7546773ea97 100644 --- a/src/input/es_out_timeshift.c +++ b/src/input/es_out_timeshift.c @@ -362,7 +362,7 @@ es_out_t *input_EsOutTimeshiftNew( input_thread_t *p_input, es_out_t *p_next_out (int)p_sys->i_tmp_size_max/(1024*1024) ); p_sys->psz_tmp_path = var_InheritString( p_input, "input-timeshift-path" ); -#if defined (_WIN32) && !VLC_WINSTORE_APP +#if defined (_WIN32) && !defined(VLC_WINSTORE_APP) if( p_sys->psz_tmp_path == NULL ) { const DWORD count = GetTempPath( 0, NULL ); diff --git a/src/libvlc-module.c b/src/libvlc-module.c index 579af7825a4d..9caaaaa2259c 100644 --- a/src/libvlc-module.c +++ b/src/libvlc-module.c @@ -1134,7 +1134,7 @@ static const char* const ppsz_restore_playback_desc[] = { #ifdef _WIN32 static const char *const clock_sources[] = { "", "interrupt", "tick", -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP "multimedia", #endif "perf", "wall", @@ -1142,7 +1142,7 @@ static const char *const clock_sources[] = { static const char *const clock_sources_text[] = { N_("Auto"), "Interrupt time", "Windows time", -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP "Multimedia timers", #endif "Performance counters", "System time (DANGEROUS!)", diff --git a/src/misc/interrupt.c b/src/misc/interrupt.c index cd80d8d3f3b3..a5a528178841 100644 --- a/src/misc/interrupt.c +++ b/src/misc/interrupt.c @@ -546,7 +546,7 @@ static void CALLBACK vlc_poll_i11e_wake_self(ULONG_PTR data) static void vlc_poll_i11e_wake(void *opaque) { -#if !VLC_WINSTORE_APP || _WIN32_WINNT >= 0x0A00 +#if !defined(VLC_WINSTORE_APP) || _WIN32_WINNT >= 0x0A00 HANDLE th = opaque; QueueUserAPC(vlc_poll_i11e_wake_self, th, 0); #else diff --git a/src/misc/update.c b/src/misc/update.c index ebd6c7f5335a..a4c9349153a5 100644 --- a/src/misc/update.c +++ b/src/misc/update.c @@ -725,7 +725,7 @@ static void* update_DownloadReal( void *obj ) psz_msg ); if(answer == 1) { -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP wchar_t psz_wdestfile[MAX_PATH]; MultiByteToWideChar( CP_UTF8, 0, psz_destfile, -1, psz_wdestfile, MAX_PATH ); answer = (int)ShellExecuteW( NULL, L"open", psz_wdestfile, NULL, NULL, SW_SHOW); diff --git a/src/modules/bank.c b/src/modules/bank.c index 197dfdeb7ee3..76bf56be3636 100644 --- a/src/modules/bank.c +++ b/src/modules/bank.c @@ -568,7 +568,7 @@ static void AllocateAllPlugins (vlc_object_t *p_this) if (var_InheritBool(p_this, "reset-plugins-cache")) mode = (mode | CACHE_WRITE_FILE) & ~CACHE_READ_FILE; -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP /* Windows Store Apps can not load external plugins with absolute paths. */ AllocatePluginPath (p_this, "plugins", mode); #else diff --git a/src/text/unicode.c b/src/text/unicode.c index a862c5a2e192..fb1538f6001a 100644 --- a/src/text/unicode.c +++ b/src/text/unicode.c @@ -59,7 +59,7 @@ int utf8_vfprintf( FILE *stream, const char *fmt, va_list ap ) if (unlikely(res == -1)) return -1; -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP /* Writing to the console is a lot of fun on Microsoft Windows. * If you use the standard I/O functions, you must use the OEM code page, * which is different from the usual ANSI code page. Or maybe not, if the diff --git a/src/win32/filesystem.c b/src/win32/filesystem.c index 09b8ec70d39a..50c47429af8a 100644 --- a/src/win32/filesystem.c +++ b/src/win32/filesystem.c @@ -144,7 +144,7 @@ int vlc_mkdir( const char *dirname, mode_t mode ) char *vlc_getcwd (void) { -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP return NULL; #else wchar_t *wdir = _wgetcwd (NULL, 0); @@ -172,7 +172,7 @@ DIR *vlc_opendir (const char *dirname) return NULL; } -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP /* Special mode to list drive letters */ if (wpath[0] == L'\0' || (wcscmp (wpath, L"\\") == 0)) { @@ -205,7 +205,7 @@ const char *vlc_readdir (DIR *dir) free(p_dir->entry); -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP /* Drive letters mode */ if (p_dir->wdir == NULL) { @@ -314,7 +314,7 @@ int vlc_dup2(int oldfd, int newfd) int vlc_pipe (int fds[2]) { -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP _set_errno(EPERM); return -1; #else diff --git a/src/win32/plugin.c b/src/win32/plugin.c index a0d392e6e0f4..afd399429051 100644 --- a/src/win32/plugin.c +++ b/src/win32/plugin.c @@ -57,7 +57,7 @@ void *vlc_dlopen(const char *psz_file, bool lazy) return NULL; HMODULE handle = NULL; -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP DWORD mode; if (SetThreadErrorMode (SEM_FAILCRITICALERRORS, &mode) != 0) { diff --git a/src/win32/rand.c b/src/win32/rand.c index 5a48522764c3..da703e1f8180 100644 --- a/src/win32/rand.c +++ b/src/win32/rand.c @@ -25,7 +25,7 @@ #include <vlc_common.h> #include <vlc_rand.h> -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP # include <bcrypt.h> #else # include <wincrypt.h> @@ -33,7 +33,7 @@ void vlc_rand_bytes (void *buf, size_t len) { -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP BCRYPT_ALG_HANDLE algo_handle; NTSTATUS ret = BCryptOpenAlgorithmProvider(&algo_handle, BCRYPT_RNG_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0); diff --git a/src/win32/specific.c b/src/win32/specific.c index cf5836af0b6f..81401bcc49da 100644 --- a/src/win32/specific.c +++ b/src/win32/specific.c @@ -73,7 +73,7 @@ typedef struct void system_Configure( libvlc_int_t *p_this, int i_argc, const char *const ppsz_argv[] ) { -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP if( var_InheritBool( p_this, "one-instance" ) || ( var_InheritBool( p_this, "one-instance-when-started-from-file" ) && var_InheritBool( p_this, "started-from-file" ) ) ) diff --git a/src/win32/thread.c b/src/win32/thread.c index 91f3c40eaa84..f7b57b848e62 100644 --- a/src/win32/thread.c +++ b/src/win32/thread.c @@ -39,7 +39,7 @@ #include <limits.h> #include <errno.h> #include <time.h> -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP #include <mmsystem.h> #endif @@ -47,7 +47,11 @@ static CRITICAL_SECTION super_mutex; static CONDITION_VARIABLE super_variable; -#define IS_INTERRUPTIBLE (!VLC_WINSTORE_APP || _WIN32_WINNT >= 0x0A00) +#ifndef VLC_WINSTORE_APP +# define IS_INTERRUPTIBLE (1) +#else +# define IS_INTERRUPTIBLE (_WIN32_WINNT >= 0x0A00) +#endif /*** Threads ***/ static DWORD thread_key; @@ -340,7 +344,7 @@ void vlc_atomic_notify_all(void *addr) /*** Threads ***/ static -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP DWORD #else // !VLC_WINSTORE_APP unsigned @@ -372,7 +376,7 @@ int vlc_clone (vlc_thread_t *p_handle, void *(*entry) (void *), InitializeCriticalSection(&th->wait.lock); HANDLE h; -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP h = CreateThread(NULL, 0, vlc_entry, th, 0, NULL); #else // !VLC_WINSTORE_APP /* When using the MSVCRT C library you have to use the _beginthreadex @@ -495,7 +499,7 @@ void vlc_testcancel (void) p->proc (p->data); th->data = NULL; /* TODO: special value? */ -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP ExitThread(0); #else // !VLC_WINSTORE_APP _endthreadex(0); @@ -555,7 +559,7 @@ static union { LARGE_INTEGER freq; } perf; -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP struct { MMRESULT (WINAPI *timeGetDevCaps)(LPTIMECAPS ptc,UINT cbtc); @@ -586,7 +590,7 @@ static vlc_tick_t mdate_tick (void) static_assert ((CLOCK_FREQ % 1000) == 0, "Broken frequencies ratio"); return VLC_TICK_FROM_MS( ts ); } -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP static vlc_tick_t mdate_multimedia (void) { DWORD ts = clk.multimedia.timeGetTime (); @@ -614,7 +618,7 @@ static vlc_tick_t mdate_wall (void) FILETIME ts; ULARGE_INTEGER s; -#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) && (!VLC_WINSTORE_APP || _WIN32_WINNT >= 0x0A00) +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) && (!defined(VLC_WINSTORE_APP) || _WIN32_WINNT >= 0x0A00) GetSystemTimePreciseAsFileTime (&ts); #else GetSystemTimeAsFileTime (&ts); @@ -664,7 +668,7 @@ void (vlc_tick_sleep)(vlc_tick_t delay) static BOOL SelectClockSource(vlc_object_t *obj) { -#if VLC_WINSTORE_APP +#ifdef VLC_WINSTORE_APP const char *name = "perf"; #else const char *name = "multimedia"; @@ -685,7 +689,7 @@ static BOOL SelectClockSource(vlc_object_t *obj) msg_Dbg (obj, "using Windows time as clock source"); mdate_selected = mdate_tick; } -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP else if (!strcmp (name, "multimedia")) { @@ -766,7 +770,7 @@ void vlc_threads_setup(libvlc_int_t *vlc) abort(); assert(mdate_selected != mdate_default); -#if !VLC_WINSTORE_APP +#ifndef VLC_WINSTORE_APP /* Raise default priority of the current process */ #ifndef ABOVE_NORMAL_PRIORITY_CLASS # define ABOVE_NORMAL_PRIORITY_CLASS 0x00008000 -- GitLab