72 lines
3.3 KiB
C++
72 lines
3.3 KiB
C++
#pragma once
|
|
|
|
#include "DeckLinkAPI_h.h"
|
|
#include "DeckLinkFrameTransfer.h"
|
|
|
|
#include <deque>
|
|
#include <string>
|
|
|
|
class OpenGLComposite;
|
|
|
|
class DeckLinkSession
|
|
{
|
|
public:
|
|
DeckLinkSession() = default;
|
|
~DeckLinkSession();
|
|
|
|
void ReleaseResources();
|
|
bool DiscoverDevicesAndModes(BMDDisplayMode inputDisplayMode, BMDDisplayMode outputDisplayMode, const std::string& requestedInputDisplayModeName, const std::string& requestedOutputDisplayModeName, std::string& error);
|
|
bool ConfigureInput(OpenGLComposite* owner, HDC hdc, HGLRC hglrc, BMDDisplayMode inputDisplayMode, std::string& error);
|
|
bool ConfigureOutput(OpenGLComposite* owner, HDC hdc, HGLRC hglrc, BMDDisplayMode outputDisplayMode, 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 inputFrameWidth != outputFrameWidth || inputFrameHeight != outputFrameHeight; }
|
|
unsigned InputFrameWidth() const { return inputFrameWidth; }
|
|
unsigned InputFrameHeight() const { return inputFrameHeight; }
|
|
unsigned OutputFrameWidth() const { return outputFrameWidth; }
|
|
unsigned OutputFrameHeight() const { return outputFrameHeight; }
|
|
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();
|
|
bool TransferPlayoutFrame(void* address, GLuint outputTexture);
|
|
void WaitForPlayoutTransferComplete(void* address);
|
|
void AccountForCompletionResult(BMDOutputFrameCompletionResult completionResult);
|
|
bool ScheduleOutputFrame(IDeckLinkMutableVideoFrame* outputVideoFrame);
|
|
|
|
private:
|
|
CaptureDelegate* captureDelegate = nullptr;
|
|
PlayoutDelegate* playoutDelegate = nullptr;
|
|
IDeckLinkInput* input = nullptr;
|
|
IDeckLinkOutput* output = nullptr;
|
|
IDeckLinkKeyer* keyer = nullptr;
|
|
std::deque<IDeckLinkMutableVideoFrame*> outputVideoFrameQueue;
|
|
PinnedMemoryAllocator* playoutAllocator = nullptr;
|
|
BMDTimeValue frameDuration = 0;
|
|
BMDTimeScale frameTimescale = 0;
|
|
unsigned totalPlayoutFrames = 0;
|
|
unsigned inputFrameWidth = 0;
|
|
unsigned inputFrameHeight = 0;
|
|
unsigned outputFrameWidth = 0;
|
|
unsigned outputFrameHeight = 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;
|
|
};
|