forked from kendrick90/SpoutCam
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmake_release.ps1
More file actions
201 lines (170 loc) · 7.97 KB
/
Copy pathmake_release.ps1
File metadata and controls
201 lines (170 loc) · 7.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# Package a SpoutCam16 release zip.
#
# Usage:
# pwsh .\make_release.ps1 # default v1.0.0 -> release\SpoutCam16-v1.0.0.zip
# pwsh .\make_release.ps1 -Version v1.2.3
# pwsh .\make_release.ps1 -Version v1.0.0 -Output C:\out\spoutcam.zip
#
# Stages binaries + scripts + README into a temp dir, validates that all 16
# binaries exist with distinct CLSIDs, then compresses to the output zip.
[CmdletBinding()]
param(
[string]$Version = 'v1.0.0',
[string]$Output = ''
)
$ErrorActionPreference = 'Stop'
$root = $PSScriptRoot
if (-not $root) { $root = Split-Path -Parent $MyInvocation.MyCommand.Path }
$binDir = Join-Path $root 'binaries\MULTIPLE_SPOUTCAM'
if (-not (Test-Path $binDir)) {
throw "Binaries dir not found: $binDir. Run build_all_sixteen.bat first."
}
if (-not $Output) {
$Output = Join-Path $root "release\SpoutCam16-$Version.zip"
}
$outDir = Split-Path -Parent $Output
if (-not (Test-Path $outDir)) { New-Item -ItemType Directory -Path $outDir -Force | Out-Null }
Write-Host "SpoutCam16 release packager"
Write-Host "==========================="
Write-Host "Source binaries : $binDir"
Write-Host "Output zip : $Output"
Write-Host "Version : $Version"
Write-Host ""
# --- Validate binaries ---
Write-Host "Validating binaries..." -ForegroundColor Cyan
$sig = [byte[]]@(0x9A,0x54,0x14,0x8E,0x61,0xDB,0x09,0x43,0xAF,0xA1,0x35,0x78,0xE9,0x27,0xE9)
function Get-CamClsidByte {
param([string]$Path)
$b = [System.IO.File]::ReadAllBytes($Path)
for ($i = 0; $i -lt $b.Length - 16; $i++) {
$m = $true
for ($j = 0; $j -lt 15; $j++) { if ($b[$i + $j] -ne $sig[$j]) { $m = $false; break } }
if ($m) { return ('0x{0:X2}' -f $b[$i + 15]) }
}
return $null
}
$problems = @()
$expected = @{}
for ($n = 1; $n -le 16; $n++) { $expected[$n] = ('0x{0:X2}' -f (0x32 + $n)) }
$seen64 = @{}
for ($n = 1; $n -le 16; $n++) {
$f = Join-Path $binDir "SpoutCam${n}_64.ax"
if (-not (Test-Path $f)) { $problems += "MISSING: $f"; continue }
$byte = Get-CamClsidByte $f
if (-not $byte) { $problems += "NO CLSID FOUND: $f"; continue }
if ($byte -ne $expected[$n]) { $problems += "WRONG CLSID: SpoutCam${n}_64.ax has $byte, expected $($expected[$n])" }
if ($seen64.ContainsKey($byte)) { $problems += "DUPLICATE CLSID: SpoutCam${n}_64.ax shares $byte with $($seen64[$byte])" } else { $seen64[$byte] = "SpoutCam${n}_64.ax" }
}
$seen32 = @{}
$has32 = $true
for ($n = 1; $n -le 16; $n++) {
$f = Join-Path $binDir "SpoutCam${n}_32.ax"
if (-not (Test-Path $f)) { $has32 = $false; $problems += "MISSING: $f (32-bit will be skipped from zip)"; continue }
$byte = Get-CamClsidByte $f
if (-not $byte) { $problems += "NO CLSID FOUND: $f"; continue }
if ($byte -ne $expected[$n]) { $problems += "WRONG CLSID: SpoutCam${n}_32.ax has $byte, expected $($expected[$n])" }
if ($seen32.ContainsKey($byte)) { $problems += "DUPLICATE CLSID: SpoutCam${n}_32.ax shares $byte with $($seen32[$byte])" } else { $seen32[$byte] = "SpoutCam${n}_32.ax" }
}
for ($n = 1; $n -le 16; $n++) {
$f = Join-Path $binDir "SpoutCam${n}Properties.cmd"
if (-not (Test-Path $f)) { $problems += "MISSING: $f" }
}
# Reject hard problems (anything other than the optional 32-bit warnings)
$hardProblems = $problems | Where-Object { $_ -notlike '*32-bit will be skipped*' }
if ($hardProblems.Count -gt 0) {
Write-Host ""
Write-Host "Validation FAILED:" -ForegroundColor Red
foreach ($p in $hardProblems) { Write-Host " $p" -ForegroundColor Red }
throw "Cannot package — fix the problems above and re-run."
}
if (-not $has32) {
Write-Host " Note: some 32-bit binaries are missing — only 64-bit will be packaged." -ForegroundColor Yellow
}
Write-Host (" OK: 16 distinct 64-bit CLSIDs, {0} 32-bit, 16 Properties launchers." -f $(if ($has32) { 16 } else { '<16' })) -ForegroundColor Green
Write-Host ""
# --- Stage ---
$stage = Join-Path $env:TEMP "spoutcam16-stage-$([guid]::NewGuid().ToString('N').Substring(0,8))"
Write-Host "Staging at $stage" -ForegroundColor Cyan
New-Item -ItemType Directory -Path $stage -Force | Out-Null
$stageBin = Join-Path $stage 'binaries'
New-Item -ItemType Directory -Path $stageBin -Force | Out-Null
# Copy binaries (flat layout under binaries\)
Copy-Item (Join-Path $binDir 'SpoutCam*_64.ax') $stageBin
if ($has32) { Copy-Item (Join-Path $binDir 'SpoutCam*_32.ax') $stageBin }
Copy-Item (Join-Path $binDir 'SpoutCam*Properties.cmd') $stageBin
# Copy top-level scripts
foreach ($s in 'register_all_spoutcams.bat','unregister_all_spoutcams.bat','spoutcam_settings.bat','spoutcam_settings.ps1') {
Copy-Item (Join-Path $root $s) $stage
}
# README.txt
$readme = @"
SpoutCam16 — 16 independent Spout virtual cameras for Windows
=============================================================
Version: $Version
Source: https://github.com/isha-sharad/SpoutCam
What is this?
-------------
SpoutCam16 turns Spout senders (from OBS, TouchDesigner, Resolume, Notch,
Unity, Unreal, etc.) into DirectShow virtual cameras that any 64-bit
Windows app can pick up — Zoom, Teams, OBS, Discord, Chrome/Edge/Firefox
WebRTC, vMix, etc. This release gives you 16 independent virtual cameras
(SpoutCam1 ... SpoutCam16), each of which can be bound to a different
Spout sender and configured independently.
Install
-------
1. Right-click register_all_spoutcams.bat -> "Run as administrator"
(or just double-click — it self-elevates with a UAC prompt).
This registers 16 64-bit virtual cameras.
- To also register 32-bit versions, run from cmd:
register_all_spoutcams.bat --with-32bit
2. Double-click spoutcam_settings.bat to open the settings GUI.
- Pick a Spout sender (or type one) for each camera
- Adjust fps, resolution, mirror/swap/flip per camera
- Click "Save All"
3. In your camera-using app, choose "SpoutCam1" (or 2..16) as the video
source. Apps that were already running need to be (re)started after
registration to see the new cameras.
Uninstall
---------
Right-click unregister_all_spoutcams.bat -> "Run as administrator".
For a complete scrub including any stale registry entries:
unregister_all_spoutcams.bat --all
Per-camera settings
-------------------
The GUI in spoutcam_settings.bat exposes per-camera:
- Spout Sender (free text or pick from active senders)
- FPS (10/15/25/30/50/60)
- Resolution (Active Sender or fixed: 320x240..1920x1080)
- Mirror image
- Swap RGB/BGR
- Flip vertically
All settings live under HKCU\Software\Leading Edge\SpoutCam<N> — no
admin needed to change them. Apps that already have a SpoutCam open
must close and reopen the camera for changes to take effect.
Known limitations
-----------------
- Once a Chromium-based app (Electron, Chrome, etc.) loads a SpoutCam
.ax file for camera enumeration, it keeps the file mapped until that
process exits. So if you reinstall over a running app, the new
version takes effect after that app restarts.
- These are 64-bit by default. 32-bit registration is optional and
only needed for legacy 32-bit camera apps (Skype Classic, etc.).
Files in this zip
-----------------
register_all_spoutcams.bat Register all 16 (admin auto-elevate)
unregister_all_spoutcams.bat Unregister all (with --all scrub mode)
spoutcam_settings.bat Launch the settings GUI
spoutcam_settings.ps1 The GUI itself (PowerShell + WinForms)
binaries\SpoutCam<N>_64.ax 64-bit DirectShow filters (16)
binaries\SpoutCam<N>_32.ax 32-bit DirectShow filters (16, optional)
binaries\SpoutCam<N>Properties.cmd Per-camera property page (rundll32)
"@
Set-Content -Path (Join-Path $stage 'README.txt') -Value $readme -Encoding UTF8
# --- Compress ---
Write-Host "Compressing -> $Output" -ForegroundColor Cyan
if (Test-Path $Output) { Remove-Item $Output -Force }
Compress-Archive -Path "$stage\*" -DestinationPath $Output -CompressionLevel Optimal
Remove-Item $stage -Recurse -Force
Write-Host ""
Write-Host ("Created: {0}" -f $Output) -ForegroundColor Green
Write-Host ("Size: {0:N2} MB" -f ((Get-Item $Output).Length / 1MB))