decklink start up to separate factory

This commit is contained in:
2026-05-22 15:27:46 +10:00
parent 315cbda9d1
commit 64a6125c3f
14 changed files with 330 additions and 88 deletions

View File

@@ -7,7 +7,6 @@
#include "../control/RuntimeStateJson.h"
#include "../preview/PreviewWindowThread.h"
#include "../telemetry/TelemetryHealthMonitor.h"
#include "DeckLinkOutput.h"
#include "VideoIOEdges.h"
#include "VideoOutputThread.h"
@@ -53,11 +52,15 @@ template <typename RenderThread, typename SystemFrameExchange>
class RenderCadenceApp
{
public:
RenderCadenceApp(RenderThread& renderThread, SystemFrameExchange& frameExchange, AppConfig config = DefaultAppConfig()) :
RenderCadenceApp(
RenderThread& renderThread,
SystemFrameExchange& frameExchange,
AppConfig config,
std::unique_ptr<IVideoOutputEdge> output) :
mRenderThread(renderThread),
mFrameExchange(frameExchange),
mConfig(config),
mOutput(std::make_unique<DeckLinkOutput>()),
mOutput(std::move(output)),
mOutputThread(*mOutput, mFrameExchange, VideoOutputThreadConfig{
mConfig.outputThread.targetBufferedFrames,
mConfig.outputThread.idleSleep
@@ -134,8 +137,16 @@ public:
private:
void StartOptionalVideoOutput()
{
if (mConfig.videoOutputBackend == "none")
{
mVideoOutputEnabled = false;
mVideoOutputStatus = "Video output backend disabled by config.";
Log("app", mVideoOutputStatus);
return;
}
std::string outputError;
Log("app", "Initializing optional DeckLink output.");
Log("app", "Initializing optional video output backend: " + mConfig.videoOutputBackend + ".");
if (!mOutput->Initialize(
mConfig.deckLink,
[this](const VideoIOCompletion& completion) {
@@ -143,7 +154,7 @@ private:
},
outputError))
{
DisableVideoOutput("DeckLink output unavailable: " + outputError);
DisableVideoOutput("Video output unavailable: " + outputError);
return;
}
@@ -154,26 +165,26 @@ private:
return;
}
Log("app", "Waiting for DeckLink preroll frames.");
Log("app", "Waiting for video output preroll frames.");
if (!WaitForPreroll())
{
DisableVideoOutput("Timed out waiting for DeckLink preroll frames.");
return;
}
Log("app", "Starting DeckLink scheduled playback.");
Log("app", "Starting scheduled video playback.");
if (!mOutput->StartScheduledPlayback(outputError))
{
DisableVideoOutput("DeckLink scheduled playback failed: " + outputError);
DisableVideoOutput("Scheduled video playback failed: " + outputError);
return;
}
mVideoOutputEnabled = true;
mVideoOutputStatus = "DeckLink scheduled output running.";
mVideoOutputStatus = mConfig.videoOutputBackend + " scheduled output running.";
Log("app", mVideoOutputStatus);
Log(
"app",
"DeckLink output mode: " + mOutput->State().outputDisplayModeName +
"Video output mode: " + mOutput->State().outputDisplayModeName +
", frame budget " + std::to_string(mOutput->State().frameBudgetMilliseconds) + " ms.");
}
@@ -313,6 +324,6 @@ private:
uint64_t mLastInputCapturedFrames = 0;
bool mStarted = false;
bool mVideoOutputEnabled = false;
std::string mVideoOutputStatus = "DeckLink output not started.";
std::string mVideoOutputStatus = "Video output not started.";
};
}