Added patch to populate AudioCompressorCategory registry keys.

This commit is contained in:
Sebastian Lackner 2017-03-04 21:54:30 +01:00
parent aa957fe3a3
commit 534583d958
3 changed files with 143 additions and 0 deletions

View File

@ -0,0 +1,126 @@
From 0e0bf5c67aa9c9a83ed759fc9050563419353f10 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Wed, 1 Mar 2017 18:06:50 +0100
Subject: devenum: Populate AudioCompressorCategory.
---
dlls/devenum/Makefile.in | 2 +-
dlls/devenum/createdevenum.c | 70 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 71 insertions(+), 1 deletion(-)
diff --git a/dlls/devenum/Makefile.in b/dlls/devenum/Makefile.in
index 38ca83d6888..6ab67b84904 100644
--- a/dlls/devenum/Makefile.in
+++ b/dlls/devenum/Makefile.in
@@ -1,5 +1,5 @@
MODULE = devenum.dll
-IMPORTS = strmiids uuid ole32 oleaut32 avicap32 winmm user32 advapi32
+IMPORTS = strmiids uuid ole32 oleaut32 avicap32 winmm user32 advapi32 msacm32
DELAYIMPORTS = msvfw32
C_SRCS = \
diff --git a/dlls/devenum/createdevenum.c b/dlls/devenum/createdevenum.c
index 17d98507684..002ffbc876c 100644
--- a/dlls/devenum/createdevenum.c
+++ b/dlls/devenum/createdevenum.c
@@ -114,6 +114,7 @@ static BOOL IsSpecialCategory(const CLSID *clsid)
IsEqualGUID(clsid, &CLSID_AudioInputDeviceCategory) ||
IsEqualGUID(clsid, &CLSID_VideoInputDeviceCategory) ||
IsEqualGUID(clsid, &CLSID_VideoCompressorCategory) ||
+ IsEqualGUID(clsid, &CLSID_AudioCompressorCategory) ||
IsEqualGUID(clsid, &CLSID_MidiRendererCategory);
}
@@ -638,6 +639,72 @@ static void register_vfw_codecs(void)
RegCloseKey(basekey);
}
+static BOOL WINAPI acm_driver_callback(HACMDRIVERID hadid, DWORD_PTR user, DWORD support)
+{
+ static const WCHAR CLSIDW[] = {'C','L','S','I','D',0};
+ static const WCHAR AcmIdW[] = {'A','c','m','I','d',0};
+ static const WCHAR FriendlyNameW[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
+ static const WCHAR fmtW[] = {'%','u','%','s',0};
+
+ WCHAR acmwrapper_clsid_str[CHARS_IN_GUID], buffer[MAX_PATH];
+ HKEY key, basekey = (HKEY) user;
+ ACMFORMATTAGDETAILSW format;
+ ACMDRIVERDETAILSW driver;
+ HACMDRIVER had;
+ DWORD i, res;
+
+ StringFromGUID2(&CLSID_ACMWrapper, acmwrapper_clsid_str, sizeof(acmwrapper_clsid_str)/sizeof(WCHAR));
+
+ driver.cbStruct = sizeof(driver);
+ if (acmDriverDetailsW(hadid, &driver, 0) != MMSYSERR_NOERROR)
+ return TRUE;
+
+ if (acmDriverOpen(&had, hadid, 0) != MMSYSERR_NOERROR)
+ return TRUE;
+
+ for (i = 0; i < driver.cFormatTags; i++)
+ {
+ memset(&format, 0, sizeof(format));
+ format.cbStruct = sizeof(format);
+ format.dwFormatTagIndex = i;
+
+ if (acmFormatTagDetailsW(had, &format, ACM_FORMATTAGDETAILSF_INDEX) != MMSYSERR_NOERROR)
+ continue;
+
+ snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), fmtW, format.dwFormatTag, format.szFormatTag);
+
+ res = RegCreateKeyW(basekey, buffer, &key);
+ if (res != ERROR_SUCCESS) continue;
+
+ RegSetValueExW(key, CLSIDW, 0, REG_SZ, (BYTE*)acmwrapper_clsid_str, sizeof(acmwrapper_clsid_str));
+ RegSetValueExW(key, AcmIdW, 0, REG_DWORD, (BYTE*)&format.dwFormatTag, sizeof(DWORD));
+ RegSetValueExW(key, FriendlyNameW, 0, REG_SZ, (BYTE*)format.szFormatTag, (strlenW(format.szFormatTag)+1)*sizeof(WCHAR));
+ /* FIXME: Set FilterData values */
+
+ RegCloseKey(key);
+ }
+
+ acmDriverClose(had, 0);
+
+ return TRUE;
+}
+
+static void register_acm_codecs(void)
+{
+ HKEY basekey;
+
+ basekey = open_special_category_key(&CLSID_AudioCompressorCategory, TRUE);
+ if (!basekey)
+ {
+ ERR("Could not create key\n");
+ return;
+ }
+
+ acmDriverEnum(acm_driver_callback, (DWORD_PTR)basekey, 0);
+
+ RegCloseKey(basekey);
+}
+
static HANDLE DEVENUM_populate_handle;
static const WCHAR DEVENUM_populate_handle_nameW[] =
{'_','_','W','I','N','E','_',
@@ -690,6 +757,8 @@ static HRESULT DEVENUM_CreateSpecialCategories(void)
RegDeleteTreeW(basekey, path);
if (SUCCEEDED(DEVENUM_GetCategoryKey(&CLSID_VideoCompressorCategory, &basekey, path, MAX_PATH)))
RegDeleteTreeW(basekey, path);
+ if (SUCCEEDED(DEVENUM_GetCategoryKey(&CLSID_AudioCompressorCategory, &basekey, path, MAX_PATH)))
+ RegDeleteTreeW(basekey, path);
rf2.dwVersion = 2;
rf2.dwMerit = MERIT_PREFERRED;
@@ -971,6 +1040,7 @@ static HRESULT DEVENUM_CreateSpecialCategories(void)
IFilterMapper2_Release(pMapper);
register_vfw_codecs();
+ register_acm_codecs();
SetEvent(DEVENUM_populate_handle);
return res;
--
2.11.0

View File

@ -0,0 +1 @@
Fixes: Populate AudioCompressorCategory registry keys

View File

@ -140,6 +140,7 @@ patch_enable_all ()
enable_ddraw_IDirect3DTexture2_Load="$1"
enable_ddraw_Rendering_Targets="$1"
enable_ddraw_Write_Vtable="$1"
enable_devenum_AudioCompressorCategory="$1"
enable_dinput_Initialize="$1"
enable_dmusic_SynthPort_IKsControl="$1"
enable_dsound_EAX="$1"
@ -635,6 +636,9 @@ patch_enable ()
ddraw-Write_Vtable)
enable_ddraw_Write_Vtable="$2"
;;
devenum-AudioCompressorCategory)
enable_devenum_AudioCompressorCategory="$2"
;;
dinput-Initialize)
enable_dinput_Initialize="$2"
;;
@ -3715,6 +3719,18 @@ if test "$enable_ddraw_Write_Vtable" -eq 1; then
) >> "$patchlist"
fi
# Patchset devenum-AudioCompressorCategory
# |
# | Modified files:
# | * dlls/devenum/Makefile.in, dlls/devenum/createdevenum.c
# |
if test "$enable_devenum_AudioCompressorCategory" -eq 1; then
patch_apply devenum-AudioCompressorCategory/0001-devenum-Populate-AudioCompressorCategory.patch
(
printf '%s\n' '+ { "Michael Müller", "devenum: Populate AudioCompressorCategory.", 1 },';
) >> "$patchlist"
fi
# Patchset dinput-Initialize
# |
# | This patchset fixes the following Wine bugs: