Files
UnrealEngineUWP/Engine/Source/Runtime/MovieSceneCapture/Private/FrameGrabberProtocol.cpp
Ryan Vance 7c51ff94af Merging //UE4/Dev-Main to Dev-VR (//UE4/Dev-VR)
CL 1 of 8
#rb integration

[CL 4748712 by Ryan Vance in Dev-VR branch]
2019-01-17 18:54:05 -05:00

53 lines
1.2 KiB
C++

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#include "Protocols/FrameGrabberProtocol.h"
#include "Templates/Casts.h"
bool UFrameGrabberProtocol::HasFinishedProcessingImpl() const
{
return FrameGrabber.IsValid() && !FrameGrabber->HasOutstandingFrames();
}
bool UFrameGrabberProtocol::SetupImpl()
{
// We'll use our own grabber to capture the entire viewport
FrameGrabber.Reset(new FFrameGrabber(InitSettings->SceneViewport.ToSharedRef(), InitSettings->DesiredSize, DesiredPixelFormat, RingBufferSize));
FrameGrabber->StartCapturingFrames();
return true;
}
void UFrameGrabberProtocol::BeginFinalizeImpl()
{
FrameGrabber->StopCapturingFrames();
}
void UFrameGrabberProtocol::CaptureFrameImpl(const FFrameMetrics& FrameMetrics)
{
if (FrameGrabber.IsValid())
{
FrameGrabber->CaptureThisFrame(GetFramePayload(FrameMetrics));
}
}
void UFrameGrabberProtocol::TickImpl()
{
if (FrameGrabber.IsValid())
{
TArray<FCapturedFrameData> CapturedFrames = FrameGrabber->GetCapturedFrames();
for (FCapturedFrameData& Frame : CapturedFrames)
{
ProcessFrame(MoveTemp(Frame));
}
}
}
void UFrameGrabberProtocol::FinalizeImpl()
{
if (FrameGrabber.IsValid())
{
FrameGrabber->Shutdown();
FrameGrabber.Reset();
}
}