Files
UnrealEngineUWP/Engine/Source/Runtime/AVEncoder/Public/VideoCommon.h
matthew cotton add868a255 Merging //UE5/Dev-TensorWorks to Release-5.0 (//UE5/Release-5.0)
Fixing warning about includes after code.

#rb aidan.possemiers, luke.bermingham, nick.pace
[FYI] Mattias.Jansson

#ROBOMERGE-AUTHOR: matthew.cotton
#ROBOMERGE-SOURCE: CL 18346877 in //UE5/Release-5.0/... via CL 18346901
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18346917 by matthew cotton in ue5-release-engine-test branch]
2021-12-01 18:13:06 -05:00

159 lines
3.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "CodecPacket.h"
//
// Windows only include
//
#if (PLATFORM_WINDOWS || PLATFORM_HOLOLENS)
#pragma warning(push)
#pragma warning(disable: 4005)
THIRD_PARTY_INCLUDES_START
#include "Windows/AllowWindowsPlatformTypes.h"
#include "Windows/PreWindowsApi.h"
#include <d3d11.h>
#include <mfobjects.h>
#include <mftransform.h>
#include <mfapi.h>
#include <mferror.h>
#include <mfidl.h>
#include <codecapi.h>
#include <shlwapi.h>
#include <mfreadwrite.h>
#include <d3d11_1.h>
#include <d3d12.h>
#include <dxgi1_4.h>
#include "Windows/PostWindowsApi.h"
#include "Windows/HideWindowsPlatformTypes.h"
THIRD_PARTY_INCLUDES_END
#endif // PLATFORM_WINDOWS
//
// XboxOne only includes
//
#if (PLATFORM_XBOXONE && WITH_LEGACY_XDK)
#pragma warning(push)
#pragma warning(disable: 4005)
THIRD_PARTY_INCLUDES_START
#include "XboxCommonAllowPlatformTypes.h"
#include "XboxCommonPreApi.h"
#include <d3d11_x.h>
#include <d3d12_x.h>
#include <d3dx12_x.h>
#include <mfobjects.h>
#include <mftransform.h>
#include <mfapi.h>
#include <mferror.h>
#include <mfidl.h>
#include <codecapi.h>
#include <mfreadwrite.h>
#include "XboxCommonPostApi.h"
#include "XboxCommonHidePlatformTypes.h"
THIRD_PARTY_INCLUDES_END
#endif // (PLATFORM_XBOXONE && WITH_LEGACY_XDK)
#ifndef WMFMEDIA_SUPPORTED_PLATFORM
#define WMFMEDIA_SUPPORTED_PLATFORM (PLATFORM_WINDOWS && (WINVER >= 0x0600 /*Vista*/) && !UE_SERVER)
#endif
#if PLATFORM_WINDOWS
struct ID3D11DeviceChild;
#endif
namespace AVEncoder
{
const int64 TimeStampNone = 0x7fffffffll;
enum class EVideoFrameFormat
{
Undefined, // (not-yet) defined format
YUV420P, // Planar YUV420 format in CPU memory
D3D11_R8G8B8A8_UNORM, //
D3D12_R8G8B8A8_UNORM, //
CUDA_R8G8B8A8_UNORM,
VULKAN_R8G8B8A8_UNORM,
};
enum class EH264Profile
{
UNKNOWN,
CONSTRAINED_BASELINE,
BASELINE,
MAIN,
CONSTRAINED_HIGH,
HIGH,
};
inline FString ToString(EVideoFrameFormat Format)
{
switch (Format)
{
case EVideoFrameFormat::YUV420P:
return FString("EVideoFrameFormat::YUV420P");
case EVideoFrameFormat::D3D11_R8G8B8A8_UNORM:
return FString("EVideoFrameFormat::D3D11_R8G8B8A8_UNORM");
case EVideoFrameFormat::D3D12_R8G8B8A8_UNORM:
return FString("EVideoFrameFormat::D3D12_R8G8B8A8_UNORM");
case EVideoFrameFormat::CUDA_R8G8B8A8_UNORM:
return FString("EVideoFrameFormat::CUDA_R8G8B8A8_UNORM");
case EVideoFrameFormat::VULKAN_R8G8B8A8_UNORM:
return FString("EVideoFrameFormat::VULKAN_R8G8B8A8_UNORM");
case EVideoFrameFormat::Undefined:
default:
return FString("EVideoFrameFormat::Undefined");
}
}
enum class ECodecType
{
Undefined,
H264,
MPEG4,
VP8,
};
// TODO: make enums
const uint32 H264Profile_ConstrainedBaseline = 1 << 0;
const uint32 H264Profile_Baseline = 1 << 1;
const uint32 H264Profile_Main = 1 << 2;
const uint32 H264Profile_ConstrainedHigh = 1 << 3;
const uint32 H264Profile_High = 1 << 4;
struct FVideoEncoderInfo
{
uint32 ID = 0;
ECodecType CodecType = ECodecType::Undefined;
uint32 MaxWidth = 0;
uint32 MaxHeight = 0;
TArray<EVideoFrameFormat> SupportedInputFormats;
struct
{
uint32 SupportedProfiles = 0;
uint32 MinLevel = 0;
uint32 MaxLevel = 0;
} H264;
};
struct FVideoDecoderInfo
{
uint32 ID = 0;
ECodecType CodecType = ECodecType::Undefined;
uint32 MaxWidth = 0;
uint32 MaxHeight = 0;
};
#if PLATFORM_WINDOWS
void DebugSetD3D11ObjectName(ID3D11DeviceChild* InD3DObject, const char* InName);
#endif
} /* namespace AVEncoder */