70 lines
2.3 KiB
C++
70 lines
2.3 KiB
C++
#pragma once
|
|
|
|
#include "VideoIOTypes.h"
|
|
|
|
#include <chrono>
|
|
#include <cstdint>
|
|
#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:
|
|
void HandleInputFrame(const VideoIOFrame& frame);
|
|
void HandleOutputFrameCompletion(const VideoIOCompletion& completion);
|
|
void RecordFramePacing(VideoIOCompletionResult completionResult);
|
|
|
|
HealthTelemetry& mHealthTelemetry;
|
|
std::unique_ptr<VideoIODevice> mVideoIODevice;
|
|
std::unique_ptr<OpenGLVideoIOBridge> mBridge;
|
|
std::chrono::steady_clock::time_point mLastPlayoutCompletionTime;
|
|
double mCompletionIntervalMilliseconds = 0.0;
|
|
double mSmoothedCompletionIntervalMilliseconds = 0.0;
|
|
double mMaxCompletionIntervalMilliseconds = 0.0;
|
|
uint64_t mLateFrameCount = 0;
|
|
uint64_t mDroppedFrameCount = 0;
|
|
uint64_t mFlushedFrameCount = 0;
|
|
};
|