89 lines
4.2 KiB
C++
89 lines
4.2 KiB
C++
#pragma once
|
|
|
|
#include "DeckLinkAPI_h.h"
|
|
#include "DeckLinkDisplayMode.h"
|
|
#include "DeckLinkFrameTransfer.h"
|
|
#include "VideoIOFormat.h"
|
|
|
|
#include <atlbase.h>
|
|
#include <deque>
|
|
#include <string>
|
|
|
|
class OpenGLComposite;
|
|
|
|
class DeckLinkSession
|
|
{
|
|
public:
|
|
DeckLinkSession() = default;
|
|
~DeckLinkSession();
|
|
|
|
void ReleaseResources();
|
|
bool DiscoverDevicesAndModes(const VideoFormatSelection& videoModes, std::string& error);
|
|
bool SelectPreferredFormats(const VideoFormatSelection& videoModes, std::string& error);
|
|
bool ConfigureInput(OpenGLComposite* owner, HDC hdc, HGLRC hglrc, const VideoFormat& inputVideoMode, std::string& error);
|
|
bool ConfigureOutput(OpenGLComposite* owner, HDC hdc, HGLRC hglrc, const VideoFormat& outputVideoMode, bool externalKeyingEnabled, std::string& error);
|
|
bool Start();
|
|
bool Stop();
|
|
|
|
bool HasInputDevice() const { return input != nullptr; }
|
|
bool HasInputSource() const { return !hasNoInputSource; }
|
|
void SetInputSourceMissing(bool missing) { hasNoInputSource = missing; }
|
|
bool InputOutputDimensionsDiffer() const { return inputFrameSize != outputFrameSize; }
|
|
const FrameSize& InputFrameSize() const { return inputFrameSize; }
|
|
const FrameSize& OutputFrameSize() const { return outputFrameSize; }
|
|
unsigned InputFrameWidth() const { return inputFrameSize.width; }
|
|
unsigned InputFrameHeight() const { return inputFrameSize.height; }
|
|
unsigned OutputFrameWidth() const { return outputFrameSize.width; }
|
|
unsigned OutputFrameHeight() const { return outputFrameSize.height; }
|
|
VideoIOPixelFormat InputPixelFormat() const { return inputPixelFormat; }
|
|
VideoIOPixelFormat OutputPixelFormat() const { return outputPixelFormat; }
|
|
bool InputIsTenBit() const { return VideoIOPixelFormatIsTenBit(inputPixelFormat); }
|
|
bool OutputIsTenBit() const { return VideoIOPixelFormatIsTenBit(outputPixelFormat); }
|
|
unsigned InputFrameRowBytes() const { return inputFrameRowBytes; }
|
|
unsigned OutputFrameRowBytes() const { return outputFrameRowBytes; }
|
|
unsigned CaptureTextureWidth() const { return captureTextureWidth; }
|
|
unsigned OutputPackTextureWidth() const { return outputPackTextureWidth; }
|
|
const std::string& FormatStatusMessage() const { return formatStatusMessage; }
|
|
const std::string& InputDisplayModeName() const { return inputDisplayModeName; }
|
|
const std::string& OutputModelName() const { return outputModelName; }
|
|
bool SupportsInternalKeying() const { return supportsInternalKeying; }
|
|
bool SupportsExternalKeying() const { return supportsExternalKeying; }
|
|
bool KeyerInterfaceAvailable() const { return keyerInterfaceAvailable; }
|
|
bool ExternalKeyingActive() const { return externalKeyingActive; }
|
|
const std::string& StatusMessage() const { return statusMessage; }
|
|
void SetStatusMessage(const std::string& message) { statusMessage = message; }
|
|
double FrameBudgetMilliseconds() const;
|
|
IDeckLinkMutableVideoFrame* RotateOutputFrame();
|
|
void AccountForCompletionResult(BMDOutputFrameCompletionResult completionResult);
|
|
bool ScheduleOutputFrame(IDeckLinkMutableVideoFrame* outputVideoFrame);
|
|
|
|
private:
|
|
CComPtr<CaptureDelegate> captureDelegate;
|
|
CComPtr<PlayoutDelegate> playoutDelegate;
|
|
CComPtr<IDeckLinkInput> input;
|
|
CComPtr<IDeckLinkOutput> output;
|
|
CComPtr<IDeckLinkKeyer> keyer;
|
|
std::deque<CComPtr<IDeckLinkMutableVideoFrame>> outputVideoFrameQueue;
|
|
BMDTimeValue frameDuration = 0;
|
|
BMDTimeScale frameTimescale = 0;
|
|
unsigned totalPlayoutFrames = 0;
|
|
FrameSize inputFrameSize;
|
|
FrameSize outputFrameSize;
|
|
VideoIOPixelFormat inputPixelFormat = VideoIOPixelFormat::Uyvy8;
|
|
VideoIOPixelFormat outputPixelFormat = VideoIOPixelFormat::Uyvy8;
|
|
unsigned inputFrameRowBytes = 0;
|
|
unsigned outputFrameRowBytes = 0;
|
|
unsigned captureTextureWidth = 0;
|
|
unsigned outputPackTextureWidth = 0;
|
|
std::string inputDisplayModeName = "1080p59.94";
|
|
std::string outputDisplayModeName = "1080p59.94";
|
|
bool hasNoInputSource = true;
|
|
std::string outputModelName;
|
|
bool supportsInternalKeying = false;
|
|
bool supportsExternalKeying = false;
|
|
bool keyerInterfaceAvailable = false;
|
|
bool externalKeyingActive = false;
|
|
std::string statusMessage;
|
|
std::string formatStatusMessage;
|
|
};
|