V2 working
This commit is contained in:
83
apps/RenderCadenceCompositor/RenderCadenceCompositor.cpp
Normal file
83
apps/RenderCadenceCompositor/RenderCadenceCompositor.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
#include "app/AppConfig.h"
|
||||
#include "app/RenderCadenceApp.h"
|
||||
#include "frames/SystemFrameExchange.h"
|
||||
#include "render/RenderThread.h"
|
||||
#include "VideoIOFormat.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
namespace
|
||||
{
|
||||
class ComInitGuard
|
||||
{
|
||||
public:
|
||||
~ComInitGuard()
|
||||
{
|
||||
if (mInitialized)
|
||||
CoUninitialize();
|
||||
}
|
||||
|
||||
bool Initialize()
|
||||
{
|
||||
const HRESULT result = CoInitialize(nullptr);
|
||||
mInitialized = SUCCEEDED(result);
|
||||
mResult = result;
|
||||
return mInitialized;
|
||||
}
|
||||
|
||||
HRESULT Result() const { return mResult; }
|
||||
|
||||
private:
|
||||
bool mInitialized = false;
|
||||
HRESULT mResult = S_OK;
|
||||
};
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
ComInitGuard com;
|
||||
if (!com.Initialize())
|
||||
{
|
||||
std::cerr << "COM initialization failed: 0x" << std::hex << com.Result() << std::dec << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::cout << "RenderCadenceCompositor\n"
|
||||
<< " Starts render cadence, system-memory exchange, DeckLink scheduled output, and telemetry.\n"
|
||||
<< " Press Enter to stop.\n";
|
||||
|
||||
SystemFrameExchangeConfig frameExchangeConfig;
|
||||
frameExchangeConfig.width = 1920;
|
||||
frameExchangeConfig.height = 1080;
|
||||
frameExchangeConfig.pixelFormat = VideoIOPixelFormat::Bgra8;
|
||||
frameExchangeConfig.rowBytes = VideoIORowBytes(frameExchangeConfig.pixelFormat, frameExchangeConfig.width);
|
||||
frameExchangeConfig.capacity = 12;
|
||||
|
||||
SystemFrameExchange frameExchange(frameExchangeConfig);
|
||||
|
||||
RenderThread::Config renderConfig;
|
||||
renderConfig.width = frameExchangeConfig.width;
|
||||
renderConfig.height = frameExchangeConfig.height;
|
||||
renderConfig.frameDurationMilliseconds = 1000.0 / 59.94;
|
||||
renderConfig.pboDepth = 6;
|
||||
|
||||
RenderThread renderThread(frameExchange, renderConfig);
|
||||
|
||||
RenderCadenceCompositor::AppConfig appConfig = RenderCadenceCompositor::DefaultAppConfig();
|
||||
RenderCadenceCompositor::RenderCadenceApp<RenderThread, SystemFrameExchange> app(renderThread, frameExchange, appConfig);
|
||||
|
||||
std::string error;
|
||||
if (!app.Start(error))
|
||||
{
|
||||
std::cerr << "RenderCadenceCompositor start failed: " << error << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::string line;
|
||||
std::getline(std::cin, line);
|
||||
app.Stop();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user