[vlc-commits] [Git][videolan/vlc][master] 6 commits: contrib: pthreads: assume mingw-w64 8.0 doesn't have proper winrt headers
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Sat Oct 1 13:03:59 UTC 2022
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
2532ecc7 by Steve Lhomme at 2022-10-01T11:57:14+00:00
contrib: pthreads: assume mingw-w64 8.0 doesn't have proper winrt headers
We can no longer assume a clean Mingw64 8.0 installation is enough to compile
VLC with winrt headers (until the next release with these patches merged). Only
version 8.1 has the proper names.
Copy the ones needed for proper system directory usage.
- - - - -
c0ff6f98 by Steve Lhomme at 2022-10-01T11:57:14+00:00
configure: detect __x_ABI_CWindows_CStorage_CIStorageFolder is defined
Older versions of mingw had only the simplified variants, but the official SDK
doesn't use these so we should use the prefix ones.
Do the same type of check for __x_ABI_CWindows_CStorage_CIApplicationData2
We require mingw 8+ to make UAP/UWP builds.
- - - - -
fb973169 by Steve Lhomme at 2022-10-01T11:57:14+00:00
dirs-uap: group the config_GetCacheDir calls
So it looks more like win32/dirs.c. Eventually they should be combined.
- - - - -
8b0ee10e by Steve Lhomme at 2022-10-01T11:57:14+00:00
dirs-uap: remove WindowsDeleteString of WindowsCreateStringReference
https://learn.microsoft.com/en-us/windows/win32/api/winstring/nf-winstring-windowscreatestringreference#remarks
> You don't need to call the WindowsDeleteString function to de-allocate a
> fast-pass HSTRING created by the WindowsCreateStringReference function.
- - - - -
c4546593 by Steve Lhomme at 2022-10-01T11:57:14+00:00
dirs-uap: use the properly prefixed class names
- - - - -
ffd8229e by Steve Lhomme at 2022-10-01T11:57:14+00:00
contrib: pthreads: install the headers rather than copying them
- - - - -
3 changed files:
- configure.ac
- contrib/src/pthreads/rules.mak
- src/win32/dirs-uap.c
Changes:
=====================================
configure.ac
=====================================
@@ -2589,10 +2589,34 @@ dnl
AC_CHECK_HEADERS([dxgidebug.h dxgi1_6.h d3d11_4.h])
dnl
-dnl IApplicationData2
+dnl IStorageFolder
dnl
-have_iapplication_data2="no"
-AC_CHECK_TYPES([IApplicationData2],[],[],[#include <windows.storage.h>])
+AS_IF([test "$vlc_winstore_app" = "1"],
+[
+ AC_MSG_CHECKING([for proper __x_ABI_CWindows_CStorage_CIStorageFolder definition])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <windows.storage.h>
+__x_ABI_CWindows_CStorage_CIStorageFolder *toto;
+ ]])], [
+ AC_MSG_RESULT([yes])
+ ], [
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([IStorageFolder not properly defined, use mingw-w64 8.0.1 or higher])
+ ])
+
+ AC_MSG_CHECKING([for proper __x_ABI_CWindows_CStorage_CIApplicationData2 definition])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <windows.storage.h>
+__x_ABI_CWindows_CStorage_CIApplicationData2 *toto;
+ ]])], [
+ AC_MSG_RESULT([yes])
+ have_iapplication_data2="yes"
+ ], [
+ AC_MSG_RESULT([no])
+ ])
+])
+
+AM_CONDITIONAL([HAVE_WINDOWS_STORAGE], [test "${have_iapplication_data2}" = "yes"])
dnl
dnl DirectComposition
=====================================
contrib/src/pthreads/rules.mak
=====================================
@@ -17,10 +17,12 @@ PKGS += d3d9 dxva dxvahd dcomp
PKGS_ALL += d3d9 dxva dxvahd dcomp
ifeq ($(call mingw_at_least, 8), true)
PKGS_FOUND += d3d9 dxvahd
+endif # MINGW 8
+ifeq ($(call mingw_at_least, 9), true)
ifdef HAVE_WINSTORE
PKGS_FOUND += winrt_headers
endif # HAVE_WINSTORE
-endif # MINGW 8
+endif # MINGW 9
ifeq ($(call mingw_at_least, 10), true)
PKGS_FOUND += dxva
endif # MINGW 10
@@ -57,42 +59,52 @@ pthreads: mingw-w64-v$(MINGW64_VERSION).tar.bz2 .sum-pthreads
.sum-winrt_headers: .sum-pthreads
touch $@
+MINGW_HEADERS_WINRT := \
+ windows.foundation.h \
+ windows.storage.h \
+ windows.storage.streams.h \
+ windows.system.threading.h \
+ windows.foundation.collections.h \
+ eventtoken.h \
+ asyncinfo.h \
+ windowscontracts.h
+
.winrt_headers: pthreads
- mkdir -p -- "$(PREFIX)/include"
- cd $< && cp mingw-w64-headers/include/windows.storage.h "$(PREFIX)/include"
- cd $< && cp mingw-w64-headers/include/eventtoken.h "$(PREFIX)/include"
+ install -d "$(PREFIX)/include"
+ install $(addprefix $</mingw-w64-headers/include/,$(MINGW_HEADERS_WINRT)) "$(PREFIX)/include"
touch $@
.sum-dxvahd: .sum-pthreads
touch $@
.dxvahd: pthreads
- mkdir -p -- "$(PREFIX)/include"
- cd $< && cp mingw-w64-headers/include/dxvahd.h "$(PREFIX)/include"
+ install -d "$(PREFIX)/include"
+ install $</mingw-w64-headers/include/dxvahd.h "$(PREFIX)/include"
touch $@
.sum-dcomp: .sum-pthreads
touch $@
.dcomp: pthreads
- mkdir -p -- "$(PREFIX)/include"
- cd $< && cp mingw-w64-headers/include/dcomp.h "$(PREFIX)/include"
+ install -d "$(PREFIX)/include"
+ install $</mingw-w64-headers/include/dcomp.h "$(PREFIX)/include"
touch $@
.sum-d3d9: .sum-pthreads
touch $@
+MINGW_HEADERS_D3D9 := d3d9.h d3d9caps.h
+
.d3d9: pthreads
- mkdir -p -- "$(PREFIX)/include"
- cd $< && cp mingw-w64-headers/include/d3d9.h "$(PREFIX)/include"
- cd $< && cp mingw-w64-headers/include/d3d9caps.h "$(PREFIX)/include"
+ install -d "$(PREFIX)/include"
+ install $(addprefix $</mingw-w64-headers/include/,$(MINGW_HEADERS_D3D9)) "$(PREFIX)/include"
touch $@
.sum-dxva: .sum-pthreads
touch $@
.dxva: pthreads
- mkdir -p -- "$(PREFIX)/include"
- cd $< && cp mingw-w64-headers/include/dxva.h "$(PREFIX)/include"
+ install -d "$(PREFIX)/include"
+ install $</mingw-w64-headers/include/dxva.h "$(PREFIX)/include"
touch $@
=====================================
src/win32/dirs-uap.c
=====================================
@@ -38,9 +38,42 @@
#include <assert.h>
#include <winstring.h>
-#include <windows.storage.h>
#include <roapi.h>
+#define WIDL_using_Windows_Storage
+#include <windows.storage.h>
+
+#ifndef IStorageItem_get_Path
+typedef __x_ABI_CWindows_CStorage_CIStorageFolder IStorageFolder;
+typedef __x_ABI_CWindows_CStorage_CIStorageItem IStorageItem;
+typedef __x_ABI_CWindows_CStorage_CIKnownFoldersStatics IKnownFoldersStatics;
+typedef __x_ABI_CWindows_CStorage_CIApplicationDataStatics IApplicationDataStatics;
+typedef __x_ABI_CWindows_CStorage_CIApplicationData IApplicationData;
+typedef __x_ABI_CWindows_CStorage_CIApplicationData2 IApplicationData2;
+
+#define IID_IStorageItem IID___x_ABI_CWindows_CStorage_CIStorageItem
+#define IID_IKnownFoldersStatics IID___x_ABI_CWindows_CStorage_CIKnownFoldersStatics
+#define IID_IApplicationDataStatics IID___x_ABI_CWindows_CStorage_CIApplicationDataStatics
+#define IID_IApplicationData2 IID___x_ABI_CWindows_CStorage_CIApplicationData2
+
+#define IKnownFoldersStatics_get_DocumentsLibrary(a,f) __x_ABI_CWindows_CStorage_CIKnownFoldersStatics_get_DocumentsLibrary(a,f)
+#define IKnownFoldersStatics_get_MusicLibrary(a,f) __x_ABI_CWindows_CStorage_CIKnownFoldersStatics_get_MusicLibrary(a,f)
+#define IKnownFoldersStatics_get_PicturesLibrary(a,f) __x_ABI_CWindows_CStorage_CIKnownFoldersStatics_get_PicturesLibrary(a,f)
+#define IKnownFoldersStatics_get_VideosLibrary(a,f) __x_ABI_CWindows_CStorage_CIKnownFoldersStatics_get_VideosLibrary(a,f)
+#define IStorageItem_get_Path(a,f) __x_ABI_CWindows_CStorage_CIStorageItem_get_Path(a,f)
+#define IStorageItem_Release(a) __x_ABI_CWindows_CStorage_CIStorageItem_Release(a)
+#define IStorageFolder_Release(a) __x_ABI_CWindows_CStorage_CIStorageFolder_Release(a)
+#define IStorageFolder_QueryInterface(a,i,v) __x_ABI_CWindows_CStorage_CIStorageFolder_QueryInterface(a,i,v)
+#define IKnownFoldersStatics_Release(a) __x_ABI_CWindows_CStorage_CIKnownFoldersStatics_Release(a)
+#define IApplicationDataStatics_get_Current(a,f) __x_ABI_CWindows_CStorage_CIApplicationDataStatics_get_Current(a,f)
+#define IApplicationData_get_LocalFolder(a,f) __x_ABI_CWindows_CStorage_CIApplicationData_get_LocalFolder(a,f)
+#define IApplicationDataStatics_Release(a) __x_ABI_CWindows_CStorage_CIApplicationDataStatics_Release(a)
+#define IApplicationData_Release(a) __x_ABI_CWindows_CStorage_CIApplicationData_Release(a)
+#define IApplicationData_QueryInterface(a,i,v) __x_ABI_CWindows_CStorage_CIApplicationData_QueryInterface(a,i,v)
+#define IApplicationData2_get_LocalCacheFolder(a,f) __x_ABI_CWindows_CStorage_CIApplicationData2_get_LocalCacheFolder(a,f)
+#define IApplicationData2_Release(a) __x_ABI_CWindows_CStorage_CIApplicationData2_Release(a)
+#endif
+
static char * GetFolderName(IStorageFolder *folder)
{
HRESULT hr;
@@ -109,7 +142,6 @@ static char *config_GetShellDir(vlc_userdir_t csidl)
}
end_other:
- WindowsDeleteString(hClassName);
if (knownFoldersStatics)
IKnownFoldersStatics_Release(knownFoldersStatics);
@@ -210,7 +242,6 @@ static char *config_GetAppDir (void)
}
end_appdata:
- WindowsDeleteString(hClassName);
if (appDataStatics)
IApplicationDataStatics_Release(appDataStatics);
if (appData)
@@ -219,7 +250,7 @@ end_appdata:
return psz_dir;
}
-#ifdef HAVE_IAPPLICATIONDATA2
+#ifdef HAVE___X_ABI_CWINDOWS_CSTORAGE_CIAPPLICATIONDATA2
static char *config_GetCacheDir (void)
{
HRESULT hr;
@@ -268,7 +299,6 @@ static char *config_GetCacheDir (void)
hr = IApplicationData2_get_LocalCacheFolder(appData2, &folder);
end_appdata:
- WindowsDeleteString(hClassName);
if (appDataStatics)
IApplicationDataStatics_Release(appDataStatics);
if (appData2)
@@ -281,7 +311,12 @@ end_appdata:
return GetFolderName(folder);
}
-#endif // HAVE_IAPPLICATIONDATA2
+#else
+static inline char *config_GetCacheDir(void)
+{
+ return config_GetAppDir();
+}
+#endif // HAVE___X_ABI_CWINDOWS_CSTORAGE_CIAPPLICATIONDATA2
char *config_GetUserDir (vlc_userdir_t type)
{
@@ -298,11 +333,7 @@ char *config_GetUserDir (vlc_userdir_t type)
case VLC_USERDATA_DIR:
return config_GetAppDir ();
case VLC_CACHE_DIR:
-#ifdef HAVE_IAPPLICATIONDATA2
return config_GetCacheDir ();
-#else // !HAVE_IAPPLICATIONDATA2
- return config_GetAppDir();
-#endif // !HAVE_IAPPLICATIONDATA2
case VLC_MUSIC_DIR:
return config_GetShellDir (VLC_MUSIC_DIR);
case VLC_PICTURES_DIR:
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/829d66b69d8ae3d8ced33363e5b0c71e99e292ac...ffd8229e0aab98576e91d8cfae9b394eca064e9e
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/829d66b69d8ae3d8ced33363e5b0c71e99e292ac...ffd8229e0aab98576e91d8cfae9b394eca064e9e
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list