Cogs.Core
VideoCaptureComponent.h
1#pragma once
2
3#include "IVideoEncoder.h"
4
5#include "Foundation/ComponentModel/Component.h"
6
7namespace Cogs::Core
8{
9 enum struct H264Profile : unsigned
10 {
11 Baseline,
12 Main,
13 High,
14 };
15
16 enum struct H264Preset : unsigned
17 {
18 Default,
19 HighQuality,
20 HighPerformance,
21 LowLatencyHighDefault,
22 LowLatencyHighQuality,
23 LowLatencyHighPerformance,
24 LosslessDefault,
25 LosslessHighPerformance
26 };
27
28 enum struct BFrameReference : unsigned
29 {
31 Each,
32 Middle
33 };
34
36 {
37 Codec codec = Codec::H264;
38 H264Profile profile = H264Profile::High;
39 H264Preset preset = H264Preset::HighQuality;
40 BFrameReference bFrameReference = BFrameReference::Middle;
41
42 uint32_t width = 1920;
43 uint32_t height = 1080;
44 uint32_t maxWidth = 3840;
45 uint32_t maxHeight = 2160;
46
47 uint32_t bitrate = 6000000; // bits per second
48 uint32_t maxBitrate = 10000000; // bits per second
49 uint32_t frameInterval = 15; // Millisecond delay between issuing frames to the encoder. Higher numbers equate to a lower framerate.
50
51 uint32_t bFrameCount = 2;
52 //uint32_t keyframeInterval = 0;
53 bool lookahead = true;
54
55 bool updateTimestamp = true;
56 bool reconfig = false;
57 bool restart = false;
58 bool useMSAA = false; // Create a render texture that supports MSAA and resolve before feeding into the encoder.
59
63 uint64_t timestamp = 0;
64 uint64_t duration = 0;
65 bool forceIntra = false;
66 bool forceIDR = false;
67 bool outputSPSPPS = false;
68 bool endOfStream = false;
69
73 bool recordToDisk = false;
74
78 std::string recordPath;
79
80 /*
81 Get frames using callback.
82 */
83 VideoEncoderCallback callback;
84
85 static void registerType();
86 };
87}// namespace ...
88
89template<> inline Cogs::StringView getName<Cogs::Core::H264Profile>() { return "H264Profile"; }
90
91template<> inline Cogs::StringView getName<Cogs::Core::H264Preset>() { return "H264Preset"; }
92
93template<> inline Cogs::StringView getName<Cogs::Core::BFrameReference>() { return "BFrameReference"; }
94
95template<> inline Cogs::StringView getName<Cogs::Core::VideoCaptureComponent>() { return "VideoCaptureComponent"; }
Base class for Component instances.
Definition: Component.h:143
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
@ Disabled
Depth test/write disabled.
std::string recordPath
Path to directory where captured video is stored.
bool recordToDisk
Write video frames to disk.