Files
UnrealEngineUWP/Engine/Source/Runtime/Windows/WindowsPlatformFeatures/Private/WmfMp4Writer.cpp
Josh Adams d0bf843c9c - Merging Dev-Kairos/Engine/... to Main/Engine/...
- Brings over the necessary engine changes for embedding UE4 mobile as a dylib/so in native mobile app
- Various changes for facial animation, screen recording, others
- ARKit and ARCore plugins were removed, as deemed "not ready"
#rb many people


#ROBOMERGE-OWNER: josh.adams
#ROBOMERGE-AUTHOR: josh.adams
#ROBOMERGE-SOURCE: CL 5201138 via CL 5203024

[CL 5226277 by Josh Adams in Main branch]
2019-02-27 11:57:17 -05:00

60 lines
1.6 KiB
C++

// Copyright 1998-2018 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)
{
CHECK_HR(Writer->WriteSample(static_cast<DWORD>(Sample.GetType()), 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