From 5a8c7028dc99f3158f43fd1809b75846c19f521e Mon Sep 17 00:00:00 2001 From: Wickedness Date: Fri, 10 Jul 2026 06:41:48 +0900 Subject: [PATCH] feat: add safe Tornado K3D playout adapter --- .gitignore | 12 + Config/playout.example.json | 21 + MBN_STOCK_WEBVIEW.csproj | 5 + MBN_STOCK_WEBVIEW.sln | 74 +- MainWindow.Playout.cs | 503 ++++++++ MainWindow.xaml.cs | 21 +- README.md | 18 +- Web/app.js | 388 +++++- Web/index.html | 23 +- Web/styles.css | 26 + docs/MIGRATION.md | 16 +- docs/PLAYOUT.md | 187 +++ scripts/Generate-K3DInterop.ps1 | 440 +++++++ scripts/Inspect-K3DRegistration.ps1 | 338 ++++++ .../Playout/IPlayoutEngine.cs | 134 +++ .../Configuration/PlayoutOptions.cs | 49 + .../Configuration/PlayoutOptionsLoader.cs | 201 ++++ .../Configuration/ValidatedPlayoutOptions.cs | 374 ++++++ .../Interop/DynamicK3dSession.cs | 352 ++++++ .../Interop/K3dComConstants.cs | 19 + .../MBN_STOCK_WEBVIEW.Playout.csproj | 18 + .../PlayoutEngineFactory.cs | 31 + .../Properties/AssemblyInfo.cs | 3 + .../Registration/K3dRegistrationProbe.cs | 387 ++++++ .../Runtime/StaDispatcher.cs | 422 +++++++ .../Runtime/TornadoProcessProbe.cs | 125 ++ .../Safety/LiveAuthorization.cs | 18 + .../TornadoPlayoutEngine.cs | 1068 +++++++++++++++++ .../AssemblyInfo.cs | 3 + .../DryRunPlayoutEngineTests.cs | 152 +++ .../DynamicK3dSessionTests.cs | 280 +++++ .../GlobalUsings.cs | 4 + .../K3dRegistrationProbeTests.cs | 204 ++++ .../LiveAuthorizationTests.cs | 40 + .../MBN_STOCK_WEBVIEW.Playout.Tests.csproj | 28 + .../PlayoutFakes.cs | 195 +++ .../PlayoutOptionsLoaderTests.cs | 162 +++ .../PlayoutSafetyValidationTests.cs | 229 ++++ .../StaDispatcherTests.cs | 169 +++ .../TestScopes.cs | 118 ++ .../TornadoPlayoutEngineTests.cs | 435 +++++++ .../MBN_STOCK_WEBVIEW.PlayoutSmoke.csproj | 17 + .../MBN_STOCK_WEBVIEW.PlayoutSmoke/Program.cs | 124 ++ 43 files changed, 7341 insertions(+), 92 deletions(-) create mode 100644 Config/playout.example.json create mode 100644 MainWindow.Playout.cs create mode 100644 docs/PLAYOUT.md create mode 100644 scripts/Generate-K3DInterop.ps1 create mode 100644 scripts/Inspect-K3DRegistration.ps1 create mode 100644 src/MBN_STOCK_WEBVIEW.Core/Playout/IPlayoutEngine.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Playout/Configuration/PlayoutOptions.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Playout/Configuration/PlayoutOptionsLoader.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Playout/Configuration/ValidatedPlayoutOptions.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Playout/Interop/DynamicK3dSession.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Playout/Interop/K3dComConstants.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Playout/MBN_STOCK_WEBVIEW.Playout.csproj create mode 100644 src/MBN_STOCK_WEBVIEW.Playout/PlayoutEngineFactory.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Playout/Properties/AssemblyInfo.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Playout/Registration/K3dRegistrationProbe.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Playout/Runtime/StaDispatcher.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Playout/Runtime/TornadoProcessProbe.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Playout/Safety/LiveAuthorization.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Playout/TornadoPlayoutEngine.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Playout.Tests/AssemblyInfo.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Playout.Tests/DryRunPlayoutEngineTests.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Playout.Tests/DynamicK3dSessionTests.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Playout.Tests/GlobalUsings.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Playout.Tests/K3dRegistrationProbeTests.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Playout.Tests/LiveAuthorizationTests.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Playout.Tests/MBN_STOCK_WEBVIEW.Playout.Tests.csproj create mode 100644 tests/MBN_STOCK_WEBVIEW.Playout.Tests/PlayoutFakes.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Playout.Tests/PlayoutOptionsLoaderTests.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Playout.Tests/PlayoutSafetyValidationTests.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Playout.Tests/StaDispatcherTests.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Playout.Tests/TestScopes.cs create mode 100644 tests/MBN_STOCK_WEBVIEW.Playout.Tests/TornadoPlayoutEngineTests.cs create mode 100644 tools/MBN_STOCK_WEBVIEW.PlayoutSmoke/MBN_STOCK_WEBVIEW.PlayoutSmoke.csproj create mode 100644 tools/MBN_STOCK_WEBVIEW.PlayoutSmoke/Program.cs diff --git a/.gitignore b/.gitignore index 5db954b..ddd2eed 100644 --- a/.gitignore +++ b/.gitignore @@ -26,11 +26,23 @@ Config/appsettings.local.json Config/*.secrets.json Config/database.local.json **/database.local.json +Config/playout.local.json +**/playout.local.json *.local.ini .env .env.* !.env.example +# Tornado/K3D vendor artifacts (generated/installed locally only) +artifacts/K3DInterop/ +**/Interop.K3DAsyncEngineLib.dll +**/K3DAsyncEngine.dll +**/K3DAsyncEngine.tlb +*.t2s +*.k3s +K3D*.lic +Tornado*.lic + # Web tooling (if introduced later) node_modules/ dist/ diff --git a/Config/playout.example.json b/Config/playout.example.json new file mode 100644 index 0000000..18b54ed --- /dev/null +++ b/Config/playout.example.json @@ -0,0 +1,21 @@ +{ + "mode": "DryRun", + "host": "127.0.0.1", + "port": 30001, + "tcpMode": 1, + "clientPort": 0, + "sceneDirectory": null, + "outputChannel": null, + "layoutIndex": 10, + "testProcessWindowTitlePattern": null, + "testSceneAllowlist": [], + "trustedLiveOutputEnabled": false, + "queueCapacity": 64, + "connectTimeoutMilliseconds": 5000, + "operationTimeoutMilliseconds": 5000, + "disconnectTimeoutMilliseconds": 3000, + "processPollIntervalMilliseconds": 1000, + "reconnectDelayMilliseconds": 1000, + "maximumReconnectAttempts": 3, + "reconnectEnabled": true +} diff --git a/MBN_STOCK_WEBVIEW.csproj b/MBN_STOCK_WEBVIEW.csproj index cb3b5b4..8fad7fd 100644 --- a/MBN_STOCK_WEBVIEW.csproj +++ b/MBN_STOCK_WEBVIEW.csproj @@ -42,6 +42,10 @@ PreserveNewest + + PreserveNewest + PreserveNewest + PreserveNewest PreserveNewest @@ -72,6 +76,7 @@ +