Agora C++ API Reference for All Platforms
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 
21 namespace agora {
22 namespace rtc {
23 
29 struct TextureInfo {
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;
44  float transform_matrix[16];
45 };
46 
52  OPTIONAL_ENUM_CLASS Format {
53  kUnknown,
54  kI420,
55  kI422,
56  kNV21,
57  kNV12,
58  kI010,
59  kRGBA,
60  kARGB,
61  kBGRA
62  };
64  uint8_t* data;
65  int size;
66 };
67 
70  uint8_t* data;
71  int size;
72  int stride;
74  : data(NULL), size(0), stride(0) {}
75 };
76 
82  OPTIONAL_ENUM_CLASS Type {
83  kRawPixels, // Raw pixels in memory
84  kTexture, // Deprecated Android: GL_TEXTURE_2D/GL_TEXTURE_OES
85  kCVPixelBuffer, // iOS: CVPixelBufferRef
86  kPaddedRawPixels, // Raw pixels with paddings
87  kTextureOES,// Android: GL_TEXTURE_OES
88  kTexture2D, // Android: GL_TEXTURE_2D
89  };
91  union {
92  TextureInfo texture; // Android (To be supported)
93  RawPixelBuffer pixels; // All platform
94  void* cvpixelbuffer; // iOS (To be supported)
95  };
96  int width;
97  int height;
98  int rotation;
100  int64_t timestamp_ms; // Capture time in milli-seconds
101 };
102 
105 };
106 
107 OPTIONAL_ENUM_CLASS VideoFrameMetaDataType {
108  kAlphaChannel,
109  kScreenMetaInfo,
110  kVideoSourceType,
111  kFaceInfo,
112  kFaceCaptureInfo,
113  // Add other types afterwards
114 };
115 
116 struct AlphaChannel {
117  uint8_t* data;
118  int size;
119 };
120 
121 typedef int32_t VideoSourceType;
122 
128  public:
135  virtual int getVideoFrameData(VideoFrameData& data) const = 0;
136 
146  virtual int fillVideoFrameData(const VideoFrameData& data) = 0;
147 
157  virtual int getVideoFrameMetaData(VideoFrameMetaDataType type, void* data) = 0;
158 
168  virtual int fillVideoFrameMetaData(VideoFrameMetaDataType type, const void* data) = 0;
169 
170  protected:
172 };
173 
175  public:
183  const VideoFrameData& data, const VideoFrameMetaDataType* metatypes = NULL, int count = 0) = 0;
184 
185  protected:
187 };
188 
189 } // namespace rtc
190 } // namespace agora
agora::rtc::TextureInfo
Definition: NGIAgoraVideoFrame.h:29
agora::rtc::VideoFrameData::width
int width
Definition: NGIAgoraVideoFrame.h:96
agora::rtc::PaddedRawPixelBuffer::PaddedRawPixelBuffer
PaddedRawPixelBuffer()
Definition: NGIAgoraVideoFrame.h:73
agora::agora_refptr
Definition: AgoraRefPtr.h:44
agora::rtc::IVideoFrameMemoryPool::createVideoFrame
virtual agora::agora_refptr< IVideoFrame > createVideoFrame(const VideoFrameData &data, const VideoFrameMetaDataType *metatypes=NULL, int count=0)=0
agora::rtc::AlphaChannel
Definition: NGIAgoraVideoFrame.h:116
agora::rtc::PaddedRawPixelBuffer::format
RawPixelBuffer::Format format
Definition: NGIAgoraVideoFrame.h:69
agora::rtc::VideoFrameData::pixels
RawPixelBuffer pixels
Definition: NGIAgoraVideoFrame.h:93
agora::rtc::VideoFrameMetaDataType
OPTIONAL_ENUM_CLASS VideoFrameMetaDataType
Definition: NGIAgoraVideoFrame.h:107
agora::rtc::AlphaChannel::data
uint8_t * data
Definition: NGIAgoraVideoFrame.h:117
agora::rtc::VideoFrameData::timestamp_ms
int64_t timestamp_ms
Definition: NGIAgoraVideoFrame.h:100
agora::rtc::TextureInfo::context_type
EglContextType context_type
Definition: NGIAgoraVideoFrame.h:40
agora::rtc::VideoFrameData::height
int height
Definition: NGIAgoraVideoFrame.h:97
agora::rtc::TextureInfo::EglContextType
OPTIONAL_ENUM_CLASS EglContextType
Definition: NGIAgoraVideoFrame.h:34
agora::rtc::VideoFrameData::texture
TextureInfo texture
Definition: NGIAgoraVideoFrame.h:92
agora
Definition: AgoraAtomicOps.h:21
agora::rtc::VideoFrameData
Definition: NGIAgoraVideoFrame.h:81
agora::rtc::TextureInfo::TextureType
OPTIONAL_ENUM_CLASS TextureType
Definition: NGIAgoraVideoFrame.h:30
agora::rtc::RawPixelBuffer::format
Format format
Definition: NGIAgoraVideoFrame.h:63
agora::rtc::VideoFrameData::Type
OPTIONAL_ENUM_CLASS Type
Definition: NGIAgoraVideoFrame.h:82
agora::media::base::ColorSpace
Definition: AgoraMediaBase.h:619
agora::rtc::PaddedRawPixelBuffer::stride
int stride
Definition: NGIAgoraVideoFrame.h:72
agora::rtc::VideoFrameData::color_space
agora::media::base::ColorSpace color_space
Definition: NGIAgoraVideoFrame.h:99
agora::rtc::IVideoFrame::getVideoFrameMetaData
virtual int getVideoFrameMetaData(VideoFrameMetaDataType type, void *data)=0
agora::rtc::IVideoFrameMemoryPool
Definition: NGIAgoraVideoFrame.h:174
agora::rtc::VideoFrameData::rotation
int rotation
Definition: NGIAgoraVideoFrame.h:98
agora::rtc::VideoFrameData::cvpixelbuffer
void * cvpixelbuffer
Definition: NGIAgoraVideoFrame.h:94
agora::rtc::IVideoFrame::getVideoFrameData
virtual int getVideoFrameData(VideoFrameData &data) const =0
agora::rtc::RawPixelBuffer::Format
OPTIONAL_ENUM_CLASS Format
Definition: NGIAgoraVideoFrame.h:52
agora::rtc::VideoFrameData::type
Type type
Definition: NGIAgoraVideoFrame.h:90
agora::rtc::RawPixelBuffer::data
uint8_t * data
Definition: NGIAgoraVideoFrame.h:64
agora::rtc::PaddedRawPixelBuffer::data
uint8_t * data
Definition: NGIAgoraVideoFrame.h:70
agora::rtc::IVideoFrameMemoryPool::~IVideoFrameMemoryPool
virtual ~IVideoFrameMemoryPool()
Definition: NGIAgoraVideoFrame.h:186
agora::rtc::TextureInfo::transform_matrix
float transform_matrix[16]
Definition: NGIAgoraVideoFrame.h:44
agora::rtc::RawPixelBuffer::size
int size
Definition: NGIAgoraVideoFrame.h:65
agora::rtc::PaddedRawPixelBuffer
Definition: NGIAgoraVideoFrame.h:68
agora::rtc::VideoFrameDataV2::padded_pixels
PaddedRawPixelBuffer padded_pixels
Definition: NGIAgoraVideoFrame.h:104
agora::rtc::VideoSourceType
int32_t VideoSourceType
Definition: NGIAgoraVideoFrame.h:121
agora::rtc::TextureInfo::texture_id
int texture_id
Definition: NGIAgoraVideoFrame.h:42
agora::rtc::AlphaChannel::size
int size
Definition: NGIAgoraVideoFrame.h:118
agora::rtc::IVideoFrame::fillVideoFrameMetaData
virtual int fillVideoFrameMetaData(VideoFrameMetaDataType type, const void *data)=0
agora::RefCountInterface
Definition: AgoraRefPtr.h:31
agora::rtc::VideoFrameDataV2
Definition: NGIAgoraVideoFrame.h:103
agora::rtc::RawPixelBuffer
Definition: NGIAgoraVideoFrame.h:51
agora::rtc::IVideoFrame::fillVideoFrameData
virtual int fillVideoFrameData(const VideoFrameData &data)=0
agora::rtc::IVideoFrame::~IVideoFrame
~IVideoFrame()
Definition: NGIAgoraVideoFrame.h:171
agora::rtc::IVideoFrame
Definition: NGIAgoraVideoFrame.h:127
agora::rtc::TextureInfo::texture_type
TextureType texture_type
Definition: NGIAgoraVideoFrame.h:39
agora::rtc::TextureInfo::fence_object
int64_t fence_object
Definition: NGIAgoraVideoFrame.h:43
agora::rtc::PaddedRawPixelBuffer::size
int size
Definition: NGIAgoraVideoFrame.h:71
agora::rtc::TextureInfo::shared_context
void * shared_context
Definition: NGIAgoraVideoFrame.h:41
rtc
Definition: video_node_i.h:28