Files
UnrealEngineUWP/Engine/Source/Runtime/AVEncoder/Public/VideoEncoderFactory.h
Bryan sefcik b4a6e947d8 Ran IWYU on Public headers under Engine/Source/Runtime/...
Headers are updated to contain any missing #includes needed to compile and #includes are sorted.  Nothing is removed.

#ushell-cherrypick of 21065896 by bryan.sefcik
#preflight 62d4b1a5a6141b6adfb0c892
#jira

#ROBOMERGE-OWNER: Bryan.sefcik
#ROBOMERGE-AUTHOR: bryan.sefcik
#ROBOMERGE-SOURCE: CL 21150156 via CL 21151754 via CL 21154719
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v972-20964824)
#ROBOMERGE-CONFLICT from-shelf

[CL 21181076 by Bryan sefcik in ue5-main branch]
2022-07-20 11:31:36 -04:00

66 lines
2.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Containers/Array.h"
#include "HAL/CriticalSection.h"
#include "HAL/Platform.h"
#include "HAL/ThreadSafeBool.h"
#include "Templates/Function.h"
#include "Templates/SharedPointer.h"
#include "Templates/UniquePtr.h"
#include "VideoCommon.h"
#include "VideoEncoder.h"
class FThreadSafeCounter;
namespace AVEncoder
{
class FVideoEncoderInput;
class AVENCODER_API FVideoEncoderFactory
{
public:
static FVideoEncoderFactory& Get();
static void Shutdown();
static void Debug_SetDontRegisterDefaultCodecs();
bool IsSetup() const { return bWasSetup; }
// --- encoder registry
// the callback type used to create a registered encoder
using CreateEncoderCallback = TFunction<TUniquePtr<FVideoEncoder>()>;
// register an encoder so that it can be iterated and created
void Register(const FVideoEncoderInfo& InInfo, const CreateEncoderCallback& InCreateEncoder);
// get a list of registered encoders
const TArray<FVideoEncoderInfo>& GetAvailable() const { return AvailableEncoders; }
bool GetInfo(uint32 InID, FVideoEncoderInfo& OutInfo) const;
bool HasEncoderForCodec(ECodecType CodecType) const;
// --- encoder creation
TUniquePtr<FVideoEncoder> Create(uint32 InID, const FVideoEncoder::FLayerConfig& config);
TUniquePtr<FVideoEncoder> Create(uint32 InID, TSharedPtr<FVideoEncoderInput> InInput, const FVideoEncoder::FLayerConfig& config);
private:
FVideoEncoderFactory() = default;
~FVideoEncoderFactory() = default;
FVideoEncoderFactory(const FVideoEncoderFactory&) = delete;
FVideoEncoderFactory& operator=(const FVideoEncoderFactory&) = delete;
void RegisterDefaultCodecs();
static FCriticalSection ProtectSingleton;
static FVideoEncoderFactory Singleton;
static FThreadSafeCounter NextID;
bool bDebugDontRegisterDefaultCodecs = false;
FThreadSafeBool bWasSetup;
TArray<FVideoEncoderInfo> AvailableEncoders;
TArray<CreateEncoderCallback> CreateEncoders;
};
} /* namespace AVEncoder */