Simplify ownership/lifetime
This commit is contained in:
@@ -344,7 +344,48 @@ bool DeckLinkSession::ConfigureOutput(OpenGLComposite* owner, HDC hdc, HGLRC hgl
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeckLinkSession::Start(unsigned outputHeight)
|
||||
double DeckLinkSession::FrameBudgetMilliseconds() const
|
||||
{
|
||||
return frameTimescale != 0
|
||||
? (static_cast<double>(frameDuration) * 1000.0) / static_cast<double>(frameTimescale)
|
||||
: 0.0;
|
||||
}
|
||||
|
||||
IDeckLinkMutableVideoFrame* DeckLinkSession::RotateOutputFrame()
|
||||
{
|
||||
IDeckLinkMutableVideoFrame* outputVideoFrame = outputVideoFrameQueue.front();
|
||||
outputVideoFrameQueue.push_back(outputVideoFrame);
|
||||
outputVideoFrameQueue.pop_front();
|
||||
return outputVideoFrame;
|
||||
}
|
||||
|
||||
bool DeckLinkSession::TransferPlayoutFrame(void* address, GLuint outputTexture)
|
||||
{
|
||||
return playoutAllocator != nullptr && playoutAllocator->transferFrame(address, outputTexture);
|
||||
}
|
||||
|
||||
void DeckLinkSession::WaitForPlayoutTransferComplete(void* address)
|
||||
{
|
||||
if (playoutAllocator != nullptr)
|
||||
playoutAllocator->waitForTransferComplete(address);
|
||||
}
|
||||
|
||||
void DeckLinkSession::AccountForCompletionResult(BMDOutputFrameCompletionResult completionResult)
|
||||
{
|
||||
if (completionResult == bmdOutputFrameDisplayedLate || completionResult == bmdOutputFrameDropped)
|
||||
totalPlayoutFrames += 2;
|
||||
}
|
||||
|
||||
bool DeckLinkSession::ScheduleOutputFrame(IDeckLinkMutableVideoFrame* outputVideoFrame)
|
||||
{
|
||||
if (output->ScheduleVideoFrame(outputVideoFrame, (totalPlayoutFrames * frameDuration), frameDuration, frameTimescale) != S_OK)
|
||||
return false;
|
||||
|
||||
totalPlayoutFrames++;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeckLinkSession::Start()
|
||||
{
|
||||
totalPlayoutFrames = 0;
|
||||
if (!output)
|
||||
@@ -380,7 +421,7 @@ bool DeckLinkSession::Start(unsigned outputHeight)
|
||||
|
||||
void* pFrame;
|
||||
outputVideoFrameBuffer->GetBytes((void**)&pFrame);
|
||||
memset(pFrame, 0, outputVideoFrame->GetRowBytes() * outputHeight);
|
||||
memset(pFrame, 0, outputVideoFrame->GetRowBytes() * outputFrameHeight);
|
||||
|
||||
outputVideoFrameBuffer->EndAccess(bmdBufferAccessWrite);
|
||||
outputVideoFrameBuffer->Release();
|
||||
|
||||
Reference in New Issue
Block a user