@@ -13,7 +13,7 @@ $OPENVINO_VERSION = "2026.0.0"
1313$OPENVINO_VERSION_SHORT = " 2026.0"
1414$PYTHON_VERSION = " 3.12.7"
1515$OPENVINO_DEST_FOLDER = " $env: LOCALAPPDATA \Programs\openvino"
16- $GSTREAMER_DEST_FOLDER = " $env: ProgramFiles \gstreamer"
16+ $GSTREAMER_DEST_FOLDER = " $env: ProgramFiles \gstreamer\1.0\msvc_x86_64 "
1717$DLSTREAMER_TMP = " $env: TEMP \dlstreamer_tmp"
1818
1919if ($useInternalProxy ) {
@@ -81,6 +81,51 @@ function Invoke-DownloadFile {
8181 }
8282}
8383
84+ function Uninstall-GStreamer {
85+ # Check if this is an Inno installation (GStreamer 1.28+)
86+ $innoUninstallKey = " HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\c20a66dc-b249-4e6d-a68a-d0f836b2b3cf_is1"
87+ $quietUninstall = (Get-ItemProperty - Path $innoUninstallKey - Name " QuietUninstallString" - ErrorAction SilentlyContinue).QuietUninstallString
88+
89+ if ($quietUninstall ) {
90+ Write-Host " Uninstalling GStreamer (Inno)..."
91+ if ($quietUninstall -match ' ^"([^"]+)"\s*(.*)$' ) {
92+ $process = Start-Process - Wait - PassThru - FilePath $Matches [1 ] - ArgumentList $Matches [2 ]
93+ if ($process.ExitCode -ne 0 ) {
94+ Write-Host " GStreamer uninstall returned exit code: $ ( $process.ExitCode ) "
95+ }
96+ }
97+ else {
98+ Write-Host " Could not parse QuietUninstallString: $quietUninstall "
99+ }
100+ # Workaround: GStreamer 1.28.1 uninstaller does not remove registry entries
101+ if (Test-Path " HKLM:\SOFTWARE\GStreamer1.0\x86_64" ) {
102+ Remove-Item - Path " HKLM:\SOFTWARE\GStreamer1.0\x86_64" - Recurse - Force
103+ Write-Host " Removed GStreamer registry entries"
104+ }
105+ }
106+ else {
107+ Write-Host " Uninstalling GStreamer (MSI)..."
108+ try {
109+ $installer = New-Object - ComObject " WindowsInstaller.Installer"
110+ foreach ($upgradeCode in @ (" {c20a66dc-b249-4e6d-a68a-d0f836b2b3cf}" , " {49c4a3aa-249f-453c-b82e-ecd05fac0693}" )) {
111+ $products = $installer.RelatedProducts ($upgradeCode )
112+ if ($products ) {
113+ foreach ($productCode in $products ) {
114+ $result = Start-Process - Wait - PassThru - FilePath " msiexec" - ArgumentList " /x" , $productCode , " /qn" , " /norestart"
115+ if ($result.ExitCode -ne 0 -and $result.ExitCode -ne 1605 ) {
116+ Write-Host " MSI uninstall returned exit code: $ ( $result.ExitCode ) "
117+ }
118+ }
119+ }
120+ }
121+ [System.Runtime.Interopservices.Marshal ]::ReleaseComObject($installer ) | Out-Null
122+ }
123+ catch {
124+ Write-Host " Error during MSI uninstall: $_ "
125+ }
126+ }
127+ }
128+
84129# ============================================================================
85130# WinGet
86131# ============================================================================
@@ -138,7 +183,6 @@ Write-Section "Done"
138183# GStreamer
139184# ============================================================================
140185$GSTREAMER_NEEDS_INSTALL = $false
141- $GSTREAMER_INSTALL_MODE = " none" # values: none | fresh | upgrade
142186
143187try {
144188 $regPath = " HKLM:\SOFTWARE\GStreamer1.0\x86_64"
@@ -148,11 +192,14 @@ try {
148192 if ($regInstallDir -and $regVersion ) {
149193 Write-Host " GStreamer found in registry - InstallDir: $regInstallDir , Version: $regVersion "
150194 $GSTREAMER_DEST_FOLDER = $regInstallDir.TrimEnd (' \' )
151- # Check for conflicting architectures first
152- $expectedPath = " $GSTREAMER_DEST_FOLDER \1.0\msvc_x86_64"
195+ # Backward compatibility with 1.26
196+ if (-Not $GSTREAMER_DEST_FOLDER.EndsWith (' \1.0\msvc_x86_64' )) {
197+ $GSTREAMER_DEST_FOLDER = " $GSTREAMER_DEST_FOLDER \1.0\msvc_x86_64"
198+ }
199+ # Check for conflicting architectures
153200 $envMsvcX64 = [Environment ]::GetEnvironmentVariable(' GSTREAMER_1_0_ROOT_MSVC_X86_64' , ' Machine' )
154201
155- if ($envMsvcX64 -and ($envMsvcX64.TrimEnd (' \' ) -ne $expectedPath )) {
202+ if ($envMsvcX64 -and ($envMsvcX64.TrimEnd (' \' ) -ne $GSTREAMER_DEST_FOLDER )) {
156203 Write-Host " Warning: GSTREAMER_1_0_ROOT_MSVC_X86_64 points to unexpected location: $envMsvcX64 "
157204 }
158205 $conflictingArchs = @ ()
@@ -170,86 +217,102 @@ try {
170217 Write-Host " Multiple GStreamer architectures may cause conflicts. Only msvc_x86_64 is supported."
171218 }
172219
173- # Parse and compare versions
174- $installedParts = $regVersion.Split (' .' ) | ForEach-Object { [int ]$_ }
175- $requiredParts = $GSTREAMER_VERSION.Split (' .' ) | ForEach-Object { [int ]$_ }
176- $needsUpgrade = $false
177- for ($i = 0 ; $i -lt [Math ]::Max($installedParts.Length , $requiredParts.Length ); $i ++ ) {
178- $installedPart = if ($i -lt $installedParts.Length ) { $installedParts [$i ] } else { 0 }
179- $requiredPart = if ($i -lt $requiredParts.Length ) { $requiredParts [$i ] } else { 0 }
180- if ($installedPart -lt $requiredPart ) {
181- $needsUpgrade = $true
182- break
183- }
184- elseif ($installedPart -gt $requiredPart ) {
185- # Installed version is newer, no upgrade needed
186- break
187- }
188- }
189-
190- if ($needsUpgrade ) {
191- Write-Host " GStreamer upgrade available - installed: $regVersion , required: $GSTREAMER_VERSION - upgrading"
220+ if ($regVersion -ne $GSTREAMER_VERSION ) {
221+ Write-Host " GStreamer version mismatch - installed: $regVersion , required: $GSTREAMER_VERSION "
222+ Uninstall-GStreamer
192223 $GSTREAMER_NEEDS_INSTALL = $true
193- $GSTREAMER_INSTALL_MODE = " upgrade "
224+ $GSTREAMER_DEST_FOLDER = " $ env: ProgramFiles \gstreamer\1.0\msvc_x86_64 "
194225 }
195226 else {
196227 # Verify installation directory structure exists
197- $VERSION_SPECIFIC_PATH = " $GSTREAMER_DEST_FOLDER \1.0\msvc_x86_64"
198- if (-Not (Test-Path $VERSION_SPECIFIC_PATH )) {
199- Write-Host " GStreamer installation incomplete - msvc_x86_64 directory not found - reinstallation needed"
228+ if (-Not (Test-Path $GSTREAMER_DEST_FOLDER )) {
229+ Write-Host " GStreamer installation incomplete - $GSTREAMER_DEST_FOLDER not found - reinstallation needed"
200230 $GSTREAMER_NEEDS_INSTALL = $true
201- $GSTREAMER_INSTALL_MODE = " fresh"
202231 }
203232 else {
204- Write-Host " GStreamer version $regVersion verified (compatible with $GSTREAMER_VERSION )"
233+ Write-Host " GStreamer version $regVersion verified (matches required $GSTREAMER_VERSION )"
205234 $GSTREAMER_NEEDS_INSTALL = $false
206235 }
207236 }
208237 }
209- else {
238+ else {
210239 Write-Host " GStreamer not found in registry - installation needed"
211240 $GSTREAMER_NEEDS_INSTALL = $true
212- $GSTREAMER_INSTALL_MODE = " fresh"
213- $GSTREAMER_DEST_FOLDER = " $env: ProgramFiles \gstreamer"
241+ $GSTREAMER_DEST_FOLDER = " $env: ProgramFiles \gstreamer\1.0\msvc_x86_64"
214242 }
215243}
216244catch {
217245 Write-Host " GStreamer registry check failed - assuming not installed"
218246 $GSTREAMER_NEEDS_INSTALL = $true
219- $GSTREAMER_INSTALL_MODE = " fresh"
220- $GSTREAMER_DEST_FOLDER = " $env: ProgramFiles \gstreamer"
247+ $GSTREAMER_DEST_FOLDER = " $env: ProgramFiles \gstreamer\1.0\msvc_x86_64"
221248}
222249
223250if ($GSTREAMER_NEEDS_INSTALL ) {
224- Write-Section " Preparing GStreamer ${GSTREAMER_VERSION} "
251+ # Determine installer type based on target version
252+ $vParts = $GSTREAMER_VERSION.Split (' .' ) | ForEach-Object { [int ]$_ }
253+ $useExeInstaller = ($vParts [0 ] -gt 1 ) -or ($vParts [0 ] -eq 1 -and $vParts [1 ] -ge 28 )
254+
255+ if ($useExeInstaller ) {
256+ Write-Section " Installing GStreamer ${GSTREAMER_VERSION} (Inno)"
257+ $GSTREAMER_INSTALLER = " ${DLSTREAMER_TMP} \gstreamer-1.0-msvc-x86_64-${GSTREAMER_VERSION} .exe"
258+ Write-Host " Downloading GStreamer installer..."
259+ Invoke-DownloadFile - UserAgent " curl/8.5.0" - OutFile $GSTREAMER_INSTALLER - Uri " https://gstreamer.freedesktop.org/data/pkg/windows/${GSTREAMER_VERSION} /msvc/gstreamer-1.0-msvc-x86_64-${GSTREAMER_VERSION} .exe"
260+
261+ Write-Host " Installing GStreamer..."
262+ $process = Start-Process - Wait - PassThru - FilePath $GSTREAMER_INSTALLER - ArgumentList " /SILENT" , " /LOG" , " /TYPE=full" , " /ALLUSERS"
263+ if ($process.ExitCode -ne 0 ) {
264+ Write-Error " GStreamer installation failed with exit code: $ ( $process.ExitCode ) "
265+ }
225266
226- $GSTREAMER_RUNTIME_INSTALLER = " ${DLSTREAMER_TMP} \gstreamer-1.0-msvc-x86_64-${GSTREAMER_VERSION} .msi"
227- $GSTREAMER_DEVEL_INSTALLER = " ${DLSTREAMER_TMP} \gstreamer-1.0-devel-msvc-x86_64-${GSTREAMER_VERSION} .msi"
267+ # Workaround: GStreamer 1.28.1 writes GSTREAMER_1_0_ROOT_MSVC_X86_64 to wrong registry location, fixed in 1.28.2 https://gitlab.freedesktop.org/gstreamer/cerbero/-/issues/574
268+ $wrongRegKey = " HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager"
269+ $rightRegKey = " HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
270+ $envVarName = " GSTREAMER_1_0_ROOT_MSVC_X86_64"
271+ $wrongValue = (Get-ItemProperty - Path $wrongRegKey - Name $envVarName - ErrorAction SilentlyContinue).$envVarName
272+ if ($wrongValue ) {
273+ Write-Host " Fixing $envVarName registry location..."
274+ Set-ItemProperty - Path $rightRegKey - Name $envVarName - Value $wrongValue
275+ Remove-ItemProperty - Path $wrongRegKey - Name $envVarName
276+ }
277+ }
278+ else {
279+ Write-Section " Installing GStreamer ${GSTREAMER_VERSION} (MSI)"
280+ $GSTREAMER_RUNTIME_INSTALLER = " ${DLSTREAMER_TMP} \gstreamer-1.0-msvc-x86_64-${GSTREAMER_VERSION} .msi"
281+ $GSTREAMER_DEVEL_INSTALLER = " ${DLSTREAMER_TMP} \gstreamer-1.0-devel-msvc-x86_64-${GSTREAMER_VERSION} .msi"
228282
229- Write-Host " Downloading GStreamer runtime installer..."
230- Invoke-DownloadFile - UserAgent " curl/8.5.0" - OutFile $GSTREAMER_RUNTIME_INSTALLER - Uri " https://gstreamer.freedesktop.org/data/pkg/windows/${GSTREAMER_VERSION} /msvc/gstreamer-1.0-msvc-x86_64-${GSTREAMER_VERSION} .msi"
283+ Write-Host " Downloading GStreamer runtime installer..."
284+ Invoke-DownloadFile - UserAgent " curl/8.5.0" - OutFile $GSTREAMER_RUNTIME_INSTALLER - Uri " https://gstreamer.freedesktop.org/data/pkg/windows/${GSTREAMER_VERSION} /msvc/gstreamer-1.0-msvc-x86_64-${GSTREAMER_VERSION} .msi"
231285
232- Write-Host " Downloading GStreamer development installer..."
233- Invoke-DownloadFile - UserAgent " curl/8.5.0" - OutFile $GSTREAMER_DEVEL_INSTALLER - Uri " https://gstreamer.freedesktop.org/data/pkg/windows/${GSTREAMER_VERSION} /msvc/gstreamer-1.0-devel-msvc-x86_64-${GSTREAMER_VERSION} .msi"
286+ Write-Host " Downloading GStreamer development installer..."
287+ Invoke-DownloadFile - UserAgent " curl/8.5.0" - OutFile $GSTREAMER_DEVEL_INSTALLER - Uri " https://gstreamer.freedesktop.org/data/pkg/windows/${GSTREAMER_VERSION} /msvc/gstreamer-1.0-devel-msvc-x86_64-${GSTREAMER_VERSION} .msi"
234288
235- if ($GSTREAMER_INSTALL_MODE -eq " fresh" -or $GSTREAMER_INSTALL_MODE -eq " upgrade" ) {
236289 Write-Host " Installing GStreamer runtime package..."
237- $process = Start-Process - Wait - PassThru - FilePath " msiexec" - ArgumentList " /passive" , " /i" , $GSTREAMER_RUNTIME_INSTALLER , " /qn"
290+ $process = Start-Process - Wait - PassThru - FilePath " msiexec" - ArgumentList " /passive" , " /i" , $GSTREAMER_RUNTIME_INSTALLER , " /qn" , " ADDLOCAL=ALL "
238291 if ($process.ExitCode -ne 0 ) {
239292 Write-Error " GStreamer runtime installation failed with exit code: $ ( $process.ExitCode ) "
240293 }
241294 Write-Host " Installing GStreamer development package..."
242- $process = Start-Process - Wait - PassThru - FilePath " msiexec" - ArgumentList " /passive" , " /i" , $GSTREAMER_DEVEL_INSTALLER , " /qn"
295+ $process = Start-Process - Wait - PassThru - FilePath " msiexec" - ArgumentList " /passive" , " /i" , $GSTREAMER_DEVEL_INSTALLER , " /qn" , " ADDLOCAL=ALL "
243296 if ($process.ExitCode -ne 0 ) {
244297 Write-Error " GStreamer development installation failed with exit code: $ ( $process.ExitCode ) "
245298 }
246299 # FIXME: Remove this section after GStreamer 1.28
247- $pkgConfigFile = " $GSTREAMER_DEST_FOLDER \1.0\msvc_x86_64\ lib\pkgconfig\gstreamer-analytics-1.0.pc"
300+ $pkgConfigFile = " $GSTREAMER_DEST_FOLDER \lib\pkgconfig\gstreamer-analytics-1.0.pc"
248301 if (Test-Path $pkgConfigFile ) {
249302 (Get-Content $pkgConfigFile ).Replace(' -lm' , ' ' ) | Set-Content $pkgConfigFile
250303 }
251- Write-Section " GStreamer installation completed"
252304 }
305+
306+ # Re-read registry to get actual install location
307+ $regInstallDir = (Get-ItemProperty - Path " HKLM:\SOFTWARE\GStreamer1.0\x86_64" - Name " InstallDir" - ErrorAction SilentlyContinue).InstallDir
308+ if ($regInstallDir ) {
309+ $GSTREAMER_DEST_FOLDER = $regInstallDir.TrimEnd (' \' )
310+ # Backward compatibility with 1.26
311+ if (-Not $GSTREAMER_DEST_FOLDER.EndsWith (' \1.0\msvc_x86_64' )) {
312+ $GSTREAMER_DEST_FOLDER = " $GSTREAMER_DEST_FOLDER \1.0\msvc_x86_64"
313+ }
314+ }
315+ Write-Section " GStreamer installation completed"
253316}
254317else {
255318 Write-Section " GStreamer ${GSTREAMER_VERSION} already installed"
@@ -383,10 +446,29 @@ else {
383446# Final environment setup
384447# ============================================================================
385448Write-Section " Setting paths"
449+ # Ensure GStreamer bin is in user PATH for GStreamer 1.28+
450+ $GSTREAMER_BIN = " $GSTREAMER_DEST_FOLDER \bin"
451+ $userPath = [Environment ]::GetEnvironmentVariable(' Path' , ' User' )
452+ $vParts = $GSTREAMER_VERSION.Split (' .' ) | ForEach-Object { [int ]$_ }
453+ if ($vParts [0 ] -eq 1 -and $vParts [1 ] -ge 28 ) {
454+ if ($userPath -split ' ;' -notcontains $GSTREAMER_BIN ) {
455+ [Environment ]::SetEnvironmentVariable(' Path' , " $userPath ;$GSTREAMER_BIN " , [System.EnvironmentVariableTarget ]::User)
456+ Write-Host " Added to user PATH: $GSTREAMER_BIN "
457+ }
458+ }
459+ else {
460+ $pathEntries = $userPath -split ' ;' | Where-Object { $_ -ne $GSTREAMER_BIN }
461+ $newPath = $pathEntries -join ' ;'
462+ if ($newPath -ne $userPath ) {
463+ [Environment ]::SetEnvironmentVariable(' Path' , $newPath , [System.EnvironmentVariableTarget ]::User)
464+ Write-Host " Removed from user PATH: $GSTREAMER_BIN "
465+ }
466+ }
467+
386468Update-Path
387469$DLSTREAMER_SRC_LOCATION = $PWD.Path
388- setx PKG_CONFIG_PATH " $GSTREAMER_DEST_FOLDER \1.0\msvc_x86_64\ lib\pkgconfig"
389- $env: PKG_CONFIG_PATH = " $GSTREAMER_DEST_FOLDER \1.0\msvc_x86_64\ lib\pkgconfig"
470+ setx PKG_CONFIG_PATH " $GSTREAMER_DEST_FOLDER \lib\pkgconfig"
471+ $env: PKG_CONFIG_PATH = " $GSTREAMER_DEST_FOLDER \lib\pkgconfig"
390472# Setup OpenVINO environment variables
391473. " $OPENVINO_DEST_FOLDER \setupvars.ps1"
392474# Setup VS environment variables
0 commit comments