From 8e21decb8dbd5fe0c610823d8bfa47a4bf5859fb Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sun, 4 Oct 2020 19:24:08 +0200 Subject: [PATCH] Add WASAPI plugin to own setup file Seem to still be stability issues. --- Changelog | 1 - dist/CMakeLists.txt | 1 + dist/windows/strawberry-wasapi.nsi.in | 182 ++++++++++++++++++++++++++ dist/windows/strawberry.nsi.in | 2 +- 4 files changed, 184 insertions(+), 2 deletions(-) create mode 100644 dist/windows/strawberry-wasapi.nsi.in diff --git a/Changelog b/Changelog index a461ab5f4..654ae9600 100644 --- a/Changelog +++ b/Changelog @@ -41,7 +41,6 @@ Unreleased: * Added Qobuz streaming support. * Added Subsonic server side scrobbling support. * Load thumbnails from iPods to show under device collection. - * (Windows) Added back WASAPI support. 0.7.2: diff --git a/dist/CMakeLists.txt b/dist/CMakeLists.txt index 764b9e9ee..57c909446 100644 --- a/dist/CMakeLists.txt +++ b/dist/CMakeLists.txt @@ -7,6 +7,7 @@ endif (APPLE) if (WIN32) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/windows/strawberry.nsi.in ${CMAKE_CURRENT_SOURCE_DIR}/windows/strawberry.nsi @ONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/windows/strawberry-wasapi.nsi.in ${CMAKE_CURRENT_SOURCE_DIR}/windows/strawberry-wasapi.nsi @ONLY) endif (WIN32) if (UNIX AND NOT APPLE) diff --git a/dist/windows/strawberry-wasapi.nsi.in b/dist/windows/strawberry-wasapi.nsi.in new file mode 100644 index 000000000..8bf9bea4d --- /dev/null +++ b/dist/windows/strawberry-wasapi.nsi.in @@ -0,0 +1,182 @@ +!if "@ARCH@" == x86 + !define arch_x86 +!endif + +!if "@ARCH@" == i686-w64-mingw32.shared + !define arch_x86 +!endif + +!if "@ARCH@" == x86_64 + !define arch_x64 +!endif + +!if "@ARCH@" == x86_64-w64-mingw32.shared + !define arch_x64 +!endif + +!if "@CMAKE_BUILD_TYPE@" == Debug + !define debug +!endif + +!if "@BUILD_WITH_QT6@" == "ON" + !define with_qt6 +!endif + +!ifdef debug + !define PRODUCT_NAME "Strawberry Music Player Debug WASAPI plugin" + !define PRODUCT_NAME_SHORT "StrawberryWASAPI" + !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME_SHORT}Debug" + !ifdef arch_x86 + !define PRODUCT_INSTALL_DIR "$PROGRAMFILES\Strawberry Music Player Debug" + !endif + !ifdef arch_x64 + !define PRODUCT_INSTALL_DIR "$PROGRAMFILES64\Strawberry Music Player Debug" + !endif +!else + !define PRODUCT_NAME "Strawberry Music Player WASAPI plugin" + !define PRODUCT_NAME_SHORT "StrawberryWASAPI" + !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME_SHORT}" + !ifdef arch_x86 + !define PRODUCT_INSTALL_DIR "$PROGRAMFILES\Strawberry Music Player" + !endif + !ifdef arch_x64 + !define PRODUCT_INSTALL_DIR "$PROGRAMFILES64\Strawberry Music Player" + !endif +!endif + +!define PRODUCT_VERSION_MAJOR @STRAWBERRY_VERSION_MAJOR@ +!define PRODUCT_VERSION_MINOR @STRAWBERRY_VERSION_MINOR@ +!define PRODUCT_VERSION_PATCH @STRAWBERRY_VERSION_PATCH@ +!define PRODUCT_DISPLAY_VERSION "@STRAWBERRY_VERSION_PACKAGE@" +!define PRODUCT_DISPLAY_VERSION_SHORT "@STRAWBERRY_VERSION_PACKAGE@" + +!define PRODUCT_PUBLISHER "Jonas Kvinge" +!define PRODUCT_WEB_SITE "https://www.strawberrymusicplayer.org/" + +!define PRODUCT_UNINST_ROOT_KEY "HKLM" + +SetCompressor /SOLID lzma + +!addplugindir nsisplugins +!include "MUI2.nsh" +!include "FileAssociation.nsh" +!include "Capabilities.nsh" +!include LogicLib.nsh +!include x64.nsh + +!define MUI_ICON "strawberry.ico" + +!define MUI_COMPONENTSPAGE_SMALLDESC + +; Installer pages +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_INSTFILES +!insertmacro MUI_PAGE_FINISH + +; Uninstaller pages +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES +!insertmacro MUI_UNPAGE_FINISH + +!insertmacro MUI_LANGUAGE "English" ;first language is the default language + +Name "${PRODUCT_NAME}" +!ifdef arch_x86 + !ifdef debug + !ifdef with_qt6 + OutFile "${PRODUCT_NAME_SHORT}Setup-${PRODUCT_DISPLAY_VERSION}-Qt6-Debug-x86.exe" + !else + OutFile "${PRODUCT_NAME_SHORT}Setup-${PRODUCT_DISPLAY_VERSION}-Debug-x86.exe" + !endif + !else + !ifdef with_qt6 + OutFile "${PRODUCT_NAME_SHORT}Setup-${PRODUCT_DISPLAY_VERSION}-Qt6-x86.exe" + !else + OutFile "${PRODUCT_NAME_SHORT}Setup-${PRODUCT_DISPLAY_VERSION}-x86.exe" + !endif + !endif +!endif + +!ifdef arch_x64 + !ifdef debug + !ifdef with_qt6 + OutFile "${PRODUCT_NAME_SHORT}Setup-${PRODUCT_DISPLAY_VERSION}-Qt6-Debug-x64.exe" + !else + OutFile "${PRODUCT_NAME_SHORT}Setup-${PRODUCT_DISPLAY_VERSION}-Debug-x64.exe" + !endif + !else + !ifdef with_qt6 + OutFile "${PRODUCT_NAME_SHORT}Setup-${PRODUCT_DISPLAY_VERSION}-Qt6-x64.exe" + !else + OutFile "${PRODUCT_NAME_SHORT}Setup-${PRODUCT_DISPLAY_VERSION}-x64.exe" + !endif + !endif +!endif + +InstallDir "${PRODUCT_INSTALL_DIR}" + +; Get the path where Strawberry was installed previously and set it as default path +InstallDirRegKey ${PRODUCT_UNINST_ROOT_KEY} ${PRODUCT_UNINST_KEY} "UninstallString" + +ShowInstDetails show +ShowUnInstDetails show +RequestExecutionLevel admin + +; Check for previous installation, and call the uninstaller if any +Function CheckPreviousInstall + + ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} ${PRODUCT_UNINST_KEY} "UninstallString" + StrCmp $R0 "" done + + MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \ + "${PRODUCT_NAME} is already installed. $\n$\nClick `OK` to remove the \ + previous version or `Cancel` to cancel this upgrade." \ + IDOK uninst + Abort +; Run the uninstaller +uninst: + ClearErrors + ExecWait '$R0' ; Do not copy the uninstaller to a temp file + +done: + +FunctionEnd + +Function .onInit + + !insertmacro MUI_LANGDLL_DISPLAY + + Call CheckPreviousInstall + +FunctionEnd + +Section "Gstreamer wasapi plugin" gstreamer-wasapi-plugin + SetOutPath "$INSTDIR\gstreamer-plugins" + File "/oname=libgstwasapi.dll" "gstreamer-plugins\libgstwasapi.dll" +SectionEnd + +Section "Uninstaller" + ; Create uninstaller + WriteUninstaller "$INSTDIR\Uninstall-WASAPI.exe" + + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME}" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\Uninstall-WASAPI.exe" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\strawberry.ico" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_DISPLAY_VERSION}" + WriteRegDWORD ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "VersionMajor" "${PRODUCT_VERSION_MAJOR}" + WriteRegDWORD ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "VersionMinor" "${PRODUCT_VERSION_MINOR}" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" + +SectionEnd + +Section "Uninstall" + + Delete "$INSTDIR\gstreamer-plugins\libgstwasapi.dll" + Delete "$INSTDIR\Uninstall-WASAPI.exe" + + ; Remove the entry from 'installed programs list' + DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" + +SectionEnd diff --git a/dist/windows/strawberry.nsi.in b/dist/windows/strawberry.nsi.in index 59cc7667a..35c4a334d 100644 --- a/dist/windows/strawberry.nsi.in +++ b/dist/windows/strawberry.nsi.in @@ -361,7 +361,7 @@ Section "Gstreamer plugins" gstreamer-plugins File "/oname=libgsttypefindfunctions.dll" "gstreamer-plugins\libgsttypefindfunctions.dll" File "/oname=libgstgio.dll" "gstreamer-plugins\libgstgio.dll" File "/oname=libgstdirectsound.dll" "gstreamer-plugins\libgstdirectsound.dll" - File "/oname=libgstwasapi.dll" "gstreamer-plugins\libgstwasapi.dll" + ;File "/oname=libgstwasapi.dll" "gstreamer-plugins\libgstwasapi.dll" File "/oname=libgstapetag.dll" "gstreamer-plugins\libgstapetag.dll" File "/oname=libgsticydemux.dll" "gstreamer-plugins\libgsticydemux.dll" File "/oname=libgstid3demux.dll" "gstreamer-plugins\libgstid3demux.dll"