Agora C++ API Reference for All Platforms
Loading...
Searching...
No Matches
NGIAgoraVideoFrame.h
1
2// Copyright (c) 2020 Agora.io. All rights reserved
3
4// This program is confidential and proprietary to Agora.io.
5// And may not be copied, reproduced, modified, disclosed to others, published
6// or used, in whole or in part, without the express prior written permission
7// of Agora.io.
8
9#pragma once // NOLINT(build/header_guard)
10
11#include "AgoraBase.h"
12
13#ifndef OPTIONAL_ENUM_CLASS
14#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
15#define OPTIONAL_ENUM_CLASS enum class
16#else
17#define OPTIONAL_ENUM_CLASS enum
18#endif
19#endif
20
21namespace agora {
22namespace rtc {
23
30 OPTIONAL_ENUM_CLASS TextureType {
31 kGlTextureOes,
32 kGlTexture2D,
33 };
34 OPTIONAL_ENUM_CLASS EglContextType {
35 kEglContext10,
36 kEglContext14,
37 };
38
43 int64_t fence_object;
46};
47
53 OPTIONAL_ENUM_CLASS Format {
54 kUnknown,
55 kI420,
56 kI422,
57 kNV21,
58 kNV12,
59 kI010,
60 kRGBA,
61 kARGB,
62 kBGRA,
63 kABGR
64 };
66 uint8_t* data;
67 int size;
68};
69
72 uint8_t* data;
73 int size;
74 int stride;
75 int width;
76 int height;
77 uint8_t* data_y;
79 uint8_t* data_u;
81 uint8_t* data_v;
84 : data(NULL), size(0), stride(0), width(0), height(0), data_y(NULL), stride_y(0),
85 data_u(NULL), stride_u(0), data_v(NULL), stride_v(0) {}
86};
87
93 OPTIONAL_ENUM_CLASS Type {
94 kRawPixels, // Raw pixels in memory
95 kTexture, // Deprecated Android: GL_TEXTURE_2D/GL_TEXTURE_OES
96 kCVPixelBuffer, // iOS: CVPixelBufferRef
97 kPaddedRawPixels, // Raw pixels with paddings
98 kTextureOES,// Android: GL_TEXTURE_OES
99 kTexture2D, // Android: GL_TEXTURE_2D
100 kDoubleBuffer, //Android: double buffer
101 };
103 union {
104 TextureInfo texture; // Android (To be supported)
105 RawPixelBuffer pixels; // All platform
106 void* cvpixelbuffer; // iOS (To be supported)
107 };
108 int width;
112 int64_t timestamp_ms; // Capture time in milli-seconds
113};
114
118
119OPTIONAL_ENUM_CLASS VideoFrameMetaDataType {
120 kAlphaChannel,
121 kScreenMetaInfo,
122 kVideoSourceType,
123 kFaceInfo,
124 kFaceCaptureInfo,
125 kGravityRotation,
126 // Add other types afterwards
127};
128
129OPTIONAL_ENUM_CLASS VideoFrameGravityRotation {
130 kGravityRotation_Unknown = -1,
131 kGravityRotation_0 = 0,
132 kGravityRotation_90 = 90,
133 kGravityRotation_180 = 180,
134 kGravityRotation_270 = 270
135};
136
138 uint8_t* data;
139 int size;
140};
141
142typedef int32_t VideoSourceType;
143
149 public:
156 virtual int getVideoFrameData(VideoFrameData& data) const = 0;
157
167 virtual int fillVideoFrameData(const VideoFrameData& data) = 0;
168
178 virtual int getVideoFrameMetaData(VideoFrameMetaDataType type, void* data) = 0;
179
189 virtual int fillVideoFrameMetaData(VideoFrameMetaDataType type, const void* data) = 0;
190
191 protected:
193};
194
196 public:
204 const VideoFrameData& data, const VideoFrameMetaDataType* metatypes = NULL, int count = 0) = 0;
205
206 protected:
208};
209
210} // namespace rtc
211} // namespace agora
Definition AgoraRefPtr.h:31
Definition AgoraRefPtr.h:44
Definition NGIAgoraVideoFrame.h:148
virtual int getVideoFrameMetaData(VideoFrameMetaDataType type, void *data)=0
~IVideoFrame()
Definition NGIAgoraVideoFrame.h:192
virtual int fillVideoFrameData(const VideoFrameData &data)=0
virtual int getVideoFrameData(VideoFrameData &data) const =0
virtual int fillVideoFrameMetaData(VideoFrameMetaDataType type, const void *data)=0
Definition NGIAgoraVideoFrame.h:195
virtual ~IVideoFrameMemoryPool()
Definition NGIAgoraVideoFrame.h:207
virtual agora::agora_refptr< IVideoFrame > createVideoFrame(const VideoFrameData &data, const VideoFrameMetaDataType *metatypes=NULL, int count=0)=0
Definition AgoraExtensions.h:5
OPTIONAL_ENUM_CLASS VideoFrameMetaDataType
Definition NGIAgoraVideoFrame.h:119
int32_t VideoSourceType
Definition NGIAgoraVideoFrame.h:142
OPTIONAL_ENUM_CLASS VideoFrameGravityRotation
Definition NGIAgoraVideoFrame.h:129
Definition AgoraAtomicOps.h:21
Definition AgoraMediaBase.h:638
Definition NGIAgoraVideoFrame.h:137
int size
Definition NGIAgoraVideoFrame.h:139
uint8_t * data
Definition NGIAgoraVideoFrame.h:138
Definition NGIAgoraVideoFrame.h:70
int height
Definition NGIAgoraVideoFrame.h:76
int size
Definition NGIAgoraVideoFrame.h:73
uint8_t * data
Definition NGIAgoraVideoFrame.h:72
int stride_y
Definition NGIAgoraVideoFrame.h:78
int stride
Definition NGIAgoraVideoFrame.h:74
int stride_u
Definition NGIAgoraVideoFrame.h:80
RawPixelBuffer::Format format
Definition NGIAgoraVideoFrame.h:71
PaddedRawPixelBuffer()
Definition NGIAgoraVideoFrame.h:83
uint8_t * data_v
Definition NGIAgoraVideoFrame.h:81
uint8_t * data_u
Definition NGIAgoraVideoFrame.h:79
int stride_v
Definition NGIAgoraVideoFrame.h:82
uint8_t * data_y
Definition NGIAgoraVideoFrame.h:77
int width
Definition NGIAgoraVideoFrame.h:75
Definition NGIAgoraVideoFrame.h:52
Format format
Definition NGIAgoraVideoFrame.h:65
OPTIONAL_ENUM_CLASS Format
Definition NGIAgoraVideoFrame.h:53
int size
Definition NGIAgoraVideoFrame.h:67
uint8_t * data
Definition NGIAgoraVideoFrame.h:66
Definition NGIAgoraVideoFrame.h:29
OPTIONAL_ENUM_CLASS TextureType
Definition NGIAgoraVideoFrame.h:30
int texture_id
Definition NGIAgoraVideoFrame.h:42
int64_t fence_object
Definition NGIAgoraVideoFrame.h:43
OPTIONAL_ENUM_CLASS EglContextType
Definition NGIAgoraVideoFrame.h:34
void * shared_context
Definition NGIAgoraVideoFrame.h:41
int frame_buffer_id
Definition NGIAgoraVideoFrame.h:44
EglContextType context_type
Definition NGIAgoraVideoFrame.h:40
TextureType texture_type
Definition NGIAgoraVideoFrame.h:39
float transform_matrix[16]
Definition NGIAgoraVideoFrame.h:45
Definition NGIAgoraVideoFrame.h:92
TextureInfo texture
Definition NGIAgoraVideoFrame.h:104
int width
Definition NGIAgoraVideoFrame.h:108
int rotation
Definition NGIAgoraVideoFrame.h:110
agora::media::base::ColorSpace color_space
Definition NGIAgoraVideoFrame.h:111
RawPixelBuffer pixels
Definition NGIAgoraVideoFrame.h:105
int64_t timestamp_ms
Definition NGIAgoraVideoFrame.h:112
void * cvpixelbuffer
Definition NGIAgoraVideoFrame.h:106
OPTIONAL_ENUM_CLASS Type
Definition NGIAgoraVideoFrame.h:93
int height
Definition NGIAgoraVideoFrame.h:109
Type type
Definition NGIAgoraVideoFrame.h:102
Definition NGIAgoraVideoFrame.h:115
PaddedRawPixelBuffer padded_pixels
Definition NGIAgoraVideoFrame.h:116