You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#jira UE-74648 #jira UE-74649 General improvements to the FHighlightRecorder class. Also, it now works in PIE too. #rb Josie.Yang [CL 6628795 by Rui Figueira in Main branch]
60 lines
1.6 KiB
C++
60 lines
1.6 KiB
C++
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "WmfMp4Writer.h"
|
|
|
|
#include "GameplayMediaEncoderSample.h"
|
|
|
|
#if WMFMEDIA_SUPPORTED_PLATFORM
|
|
#pragma comment(lib, "mfplat")
|
|
#pragma comment(lib, "mfuuid")
|
|
#pragma comment(lib, "Mfreadwrite")
|
|
#endif
|
|
|
|
DECLARE_LOG_CATEGORY_EXTERN(MP4, Log, VeryVerbose);
|
|
|
|
DEFINE_LOG_CATEGORY(MP4);
|
|
|
|
WINDOWSPLATFORMFEATURES_START
|
|
|
|
bool FWmfMp4Writer::Initialize(const TCHAR* Filename)
|
|
{
|
|
CHECK_HR(MFCreateSinkWriterFromURL(Filename, nullptr, nullptr, Writer.GetInitReference()));
|
|
UE_LOG(WMF, Verbose, TEXT("Initialised Mp4Writer for %s"), Filename);
|
|
return true;
|
|
}
|
|
|
|
bool FWmfMp4Writer::CreateStream(IMFMediaType* StreamType, DWORD& StreamIndex)
|
|
{
|
|
CHECK_HR(Writer->AddStream(StreamType, &StreamIndex));
|
|
// no transcoding here so input type is the same as output type
|
|
CHECK_HR(Writer->SetInputMediaType(StreamIndex, StreamType, nullptr));
|
|
return true;
|
|
}
|
|
|
|
bool FWmfMp4Writer::Start()
|
|
{
|
|
CHECK_HR(Writer->BeginWriting());
|
|
return true;
|
|
}
|
|
|
|
bool FWmfMp4Writer::Write(const FGameplayMediaEncoderSample& Sample, DWORD StreamIndex)
|
|
{
|
|
CHECK_HR(Writer->WriteSample(StreamIndex, const_cast<IMFSample*>(Sample.GetSample())));
|
|
|
|
UE_LOG(MP4, VeryVerbose, TEXT("stream #%d: time %.3f, duration %.3f%s"), static_cast<int>(Sample.GetType()), Sample.GetTime().GetTotalSeconds(), Sample.GetDuration().GetTotalSeconds(), Sample.IsVideoKeyFrame() ? TEXT(", key-frame") : TEXT(""));
|
|
|
|
return true;
|
|
}
|
|
|
|
bool FWmfMp4Writer::Finalize()
|
|
{
|
|
CHECK_HR(Writer->Finalize());
|
|
UE_LOG(WMF, VeryVerbose, TEXT("Closed .mp4"));
|
|
|
|
return true;
|
|
}
|
|
|
|
WINDOWSPLATFORMFEATURES_END
|
|
|
|
|