ore untangling
This commit is contained in:
175
apps/LoopThroughWithOpenGLCompositing/videoio/VideoBackend.cpp
Normal file
175
apps/LoopThroughWithOpenGLCompositing/videoio/VideoBackend.cpp
Normal file
@@ -0,0 +1,175 @@
|
||||
#include "VideoBackend.h"
|
||||
|
||||
#include "DeckLinkSession.h"
|
||||
#include "OpenGLVideoIOBridge.h"
|
||||
#include "RenderEngine.h"
|
||||
#include "HealthTelemetry.h"
|
||||
|
||||
VideoBackend::VideoBackend(RenderEngine& renderEngine, HealthTelemetry& healthTelemetry) :
|
||||
mVideoIODevice(std::make_unique<DeckLinkSession>()),
|
||||
mBridge(std::make_unique<OpenGLVideoIOBridge>(*mVideoIODevice, renderEngine, healthTelemetry))
|
||||
{
|
||||
}
|
||||
|
||||
VideoBackend::~VideoBackend()
|
||||
{
|
||||
ReleaseResources();
|
||||
}
|
||||
|
||||
void VideoBackend::ReleaseResources()
|
||||
{
|
||||
if (mVideoIODevice)
|
||||
mVideoIODevice->ReleaseResources();
|
||||
}
|
||||
|
||||
bool VideoBackend::DiscoverDevicesAndModes(const VideoFormatSelection& videoModes, std::string& error)
|
||||
{
|
||||
return mVideoIODevice->DiscoverDevicesAndModes(videoModes, error);
|
||||
}
|
||||
|
||||
bool VideoBackend::SelectPreferredFormats(const VideoFormatSelection& videoModes, bool outputAlphaRequired, std::string& error)
|
||||
{
|
||||
return mVideoIODevice->SelectPreferredFormats(videoModes, outputAlphaRequired, error);
|
||||
}
|
||||
|
||||
bool VideoBackend::ConfigureInput(const VideoFormat& inputVideoMode, std::string& error)
|
||||
{
|
||||
return mVideoIODevice->ConfigureInput(
|
||||
[this](const VideoIOFrame& frame) { mBridge->VideoFrameArrived(frame); },
|
||||
inputVideoMode,
|
||||
error);
|
||||
}
|
||||
|
||||
bool VideoBackend::ConfigureOutput(const VideoFormat& outputVideoMode, bool externalKeyingEnabled, std::string& error)
|
||||
{
|
||||
return mVideoIODevice->ConfigureOutput(
|
||||
[this](const VideoIOCompletion& completion) { mBridge->PlayoutFrameCompleted(completion); },
|
||||
outputVideoMode,
|
||||
externalKeyingEnabled,
|
||||
error);
|
||||
}
|
||||
|
||||
bool VideoBackend::Start()
|
||||
{
|
||||
return mVideoIODevice->Start();
|
||||
}
|
||||
|
||||
bool VideoBackend::Stop()
|
||||
{
|
||||
return mVideoIODevice->Stop();
|
||||
}
|
||||
|
||||
const VideoIOState& VideoBackend::State() const
|
||||
{
|
||||
return mVideoIODevice->State();
|
||||
}
|
||||
|
||||
VideoIOState& VideoBackend::MutableState()
|
||||
{
|
||||
return mVideoIODevice->MutableState();
|
||||
}
|
||||
|
||||
bool VideoBackend::BeginOutputFrame(VideoIOOutputFrame& frame)
|
||||
{
|
||||
return mVideoIODevice->BeginOutputFrame(frame);
|
||||
}
|
||||
|
||||
void VideoBackend::EndOutputFrame(VideoIOOutputFrame& frame)
|
||||
{
|
||||
mVideoIODevice->EndOutputFrame(frame);
|
||||
}
|
||||
|
||||
bool VideoBackend::ScheduleOutputFrame(const VideoIOOutputFrame& frame)
|
||||
{
|
||||
return mVideoIODevice->ScheduleOutputFrame(frame);
|
||||
}
|
||||
|
||||
void VideoBackend::AccountForCompletionResult(VideoIOCompletionResult result)
|
||||
{
|
||||
mVideoIODevice->AccountForCompletionResult(result);
|
||||
}
|
||||
|
||||
bool VideoBackend::HasInputDevice() const
|
||||
{
|
||||
return mVideoIODevice->HasInputDevice();
|
||||
}
|
||||
|
||||
bool VideoBackend::HasInputSource() const
|
||||
{
|
||||
return mVideoIODevice->HasInputSource();
|
||||
}
|
||||
|
||||
unsigned VideoBackend::InputFrameWidth() const
|
||||
{
|
||||
return mVideoIODevice->InputFrameWidth();
|
||||
}
|
||||
|
||||
unsigned VideoBackend::InputFrameHeight() const
|
||||
{
|
||||
return mVideoIODevice->InputFrameHeight();
|
||||
}
|
||||
|
||||
unsigned VideoBackend::OutputFrameWidth() const
|
||||
{
|
||||
return mVideoIODevice->OutputFrameWidth();
|
||||
}
|
||||
|
||||
unsigned VideoBackend::OutputFrameHeight() const
|
||||
{
|
||||
return mVideoIODevice->OutputFrameHeight();
|
||||
}
|
||||
|
||||
unsigned VideoBackend::CaptureTextureWidth() const
|
||||
{
|
||||
return mVideoIODevice->CaptureTextureWidth();
|
||||
}
|
||||
|
||||
unsigned VideoBackend::OutputPackTextureWidth() const
|
||||
{
|
||||
return mVideoIODevice->OutputPackTextureWidth();
|
||||
}
|
||||
|
||||
VideoIOPixelFormat VideoBackend::InputPixelFormat() const
|
||||
{
|
||||
return mVideoIODevice->InputPixelFormat();
|
||||
}
|
||||
|
||||
const std::string& VideoBackend::InputDisplayModeName() const
|
||||
{
|
||||
return mVideoIODevice->InputDisplayModeName();
|
||||
}
|
||||
|
||||
const std::string& VideoBackend::OutputModelName() const
|
||||
{
|
||||
return mVideoIODevice->OutputModelName();
|
||||
}
|
||||
|
||||
bool VideoBackend::SupportsInternalKeying() const
|
||||
{
|
||||
return mVideoIODevice->SupportsInternalKeying();
|
||||
}
|
||||
|
||||
bool VideoBackend::SupportsExternalKeying() const
|
||||
{
|
||||
return mVideoIODevice->SupportsExternalKeying();
|
||||
}
|
||||
|
||||
bool VideoBackend::KeyerInterfaceAvailable() const
|
||||
{
|
||||
return mVideoIODevice->KeyerInterfaceAvailable();
|
||||
}
|
||||
|
||||
bool VideoBackend::ExternalKeyingActive() const
|
||||
{
|
||||
return mVideoIODevice->ExternalKeyingActive();
|
||||
}
|
||||
|
||||
const std::string& VideoBackend::StatusMessage() const
|
||||
{
|
||||
return mVideoIODevice->StatusMessage();
|
||||
}
|
||||
|
||||
void VideoBackend::SetStatusMessage(const std::string& message)
|
||||
{
|
||||
mVideoIODevice->SetStatusMessage(message);
|
||||
}
|
||||
55
apps/LoopThroughWithOpenGLCompositing/videoio/VideoBackend.h
Normal file
55
apps/LoopThroughWithOpenGLCompositing/videoio/VideoBackend.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include "VideoIOTypes.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
class HealthTelemetry;
|
||||
class OpenGLVideoIOBridge;
|
||||
class RenderEngine;
|
||||
class VideoIODevice;
|
||||
|
||||
class VideoBackend
|
||||
{
|
||||
public:
|
||||
VideoBackend(RenderEngine& renderEngine, HealthTelemetry& healthTelemetry);
|
||||
~VideoBackend();
|
||||
|
||||
void ReleaseResources();
|
||||
bool DiscoverDevicesAndModes(const VideoFormatSelection& videoModes, std::string& error);
|
||||
bool SelectPreferredFormats(const VideoFormatSelection& videoModes, bool outputAlphaRequired, std::string& error);
|
||||
bool ConfigureInput(const VideoFormat& inputVideoMode, std::string& error);
|
||||
bool ConfigureOutput(const VideoFormat& outputVideoMode, bool externalKeyingEnabled, std::string& error);
|
||||
bool Start();
|
||||
bool Stop();
|
||||
|
||||
const VideoIOState& State() const;
|
||||
VideoIOState& MutableState();
|
||||
bool BeginOutputFrame(VideoIOOutputFrame& frame);
|
||||
void EndOutputFrame(VideoIOOutputFrame& frame);
|
||||
bool ScheduleOutputFrame(const VideoIOOutputFrame& frame);
|
||||
void AccountForCompletionResult(VideoIOCompletionResult result);
|
||||
|
||||
bool HasInputDevice() const;
|
||||
bool HasInputSource() const;
|
||||
unsigned InputFrameWidth() const;
|
||||
unsigned InputFrameHeight() const;
|
||||
unsigned OutputFrameWidth() const;
|
||||
unsigned OutputFrameHeight() const;
|
||||
unsigned CaptureTextureWidth() const;
|
||||
unsigned OutputPackTextureWidth() const;
|
||||
VideoIOPixelFormat InputPixelFormat() const;
|
||||
const std::string& InputDisplayModeName() const;
|
||||
const std::string& OutputModelName() const;
|
||||
bool SupportsInternalKeying() const;
|
||||
bool SupportsExternalKeying() const;
|
||||
bool KeyerInterfaceAvailable() const;
|
||||
bool ExternalKeyingActive() const;
|
||||
const std::string& StatusMessage() const;
|
||||
void SetStatusMessage(const std::string& message);
|
||||
|
||||
private:
|
||||
std::unique_ptr<VideoIODevice> mVideoIODevice;
|
||||
std::unique_ptr<OpenGLVideoIOBridge> mBridge;
|
||||
};
|
||||
Reference in New Issue
Block a user