Cogs.Core
IVideoEncoder.h
1#pragma once
2
3#include "IVideoDecoder.h"
4
5#include <string>
6
7namespace Cogs::Memory{
8 class MemoryBuffer;
9}
10namespace Cogs::Core
11{
12 using VideoEncoderCallback = std::function<void(struct IVideoEncoder*, struct VideoEncoderPayload &payload)>;
13
14 enum PictureType
15 {
16 UNKNOWN,
17 P,
18 B,
19 I,
20 IDR,
21 BI,
22 SKIPPED,
23 INTRA_REFRESH,
24 NONREF_P,
25 };
27 {
28 PictureType type;
29 uint32_t frameIdx;
30 uint64_t timestamp;
31 uint64_t duration;
32 bool ltrFrame; // Long Term Reference
33 uint32_t ltrFrameIdx;
34 uint8_t *data;
35 size_t size;
36 };
38 {
39 Codec codec;
40 uint32_t encodeWidth;
41 uint32_t encodeHeight;
42 uint32_t darWidth;
43 uint32_t darHeight;
44 uint32_t maxWidth;
45 uint32_t maxHeight;
46 uint32_t bitrate;
47 uint32_t maxBitrate;
48 uint32_t bFrameCount;
49 uint32_t bFrameReference;
50 float frameRate;
51 bool lookahead;
52 bool recordToDisk;
53 bool useMSAA;
54 std::string recordPath;
55 VideoEncoderCallback callback;
56 };
58 {
60 uint64_t timestamp = 0;
61 uint64_t duration = 0;
62 bool forceIntra = false;
63 bool forceIDR = false;
64 bool outputSPSPPS = false;
65 };
67 {
68 uint64_t timestamp = 0;
69 };
70
72 {
73 virtual ~IVideoEncoder() { }
74 virtual Cogs::Core::TextureHandle getRenderTarget() = 0;
75 virtual Cogs::Core::TextureHandle getCurrentInputBuffer() = 0;
76 virtual Cogs::Core::TextureHandle getNextInputBuffer() = 0;
77 virtual void encode(VideoEncoderInput &input) = 0;
78 virtual void getBitstream() = 0;
79 virtual void getSPSPPS(Cogs::Memory::MemoryBuffer& spspps) = 0;
80 virtual VideoEncoderStatus getStatus() = 0;
81 virtual void reconfigure(VideoEncoderDescription &desc, bool resetEncoder, bool forceIDR) = 0;
82 };
84 {
85 virtual ~IVideoEncoderContext() { }
86 virtual IVideoEncoder *createVideoEncoder(VideoEncoderDescription &desc) = 0;
87 virtual void destroyVideoEncoder(IVideoEncoder*) = 0;
88 };
89}// namespace ...
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....