Agora Java API Reference for Android
media_sdk_script
rte_sdk
interface
cpp
api2
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
39
TextureType texture_type;
40
EglContextType context_type;
41
void
* shared_context;
42
int
texture_id;
43
int64_t fence_object;
44
float
transform_matrix[16];
45
};
46
51
struct
RawPixelBuffer
{
52
OPTIONAL_ENUM_CLASS Format {
53
kUnknown,
54
kI420,
55
kI422,
56
kNV21,
57
kNV12,
58
kI010,
59
kRGBA,
60
kARGB,
61
kBGRA
62
};
63
Format format;
64
uint8_t* data;
65
int
size;
66
};
67
68
struct
PaddedRawPixelBuffer
{
69
RawPixelBuffer::Format format;
70
uint8_t* data;
71
int
size;
72
int
stride;
73
PaddedRawPixelBuffer
()
74
: data(NULL), size(0), stride(0) {}
75
};
76
81
struct
VideoFrameData
{
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
};
90
Type type;
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;
99
agora::media::base::ColorSpace
color_space;
100
int64_t timestamp_ms;
// Capture time in milli-seconds
101
};
102
103
struct
VideoFrameDataV2
:
public
VideoFrameData
{
104
PaddedRawPixelBuffer
padded_pixels;
// All platform
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
127
class
IVideoFrame
:
public
RefCountInterface
{
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
:
171
~
IVideoFrame
() {}
172
};
173
174
class
IVideoFrameMemoryPool
:
public
RefCountInterface
{
175
public
:
182
virtual
agora::agora_refptr<IVideoFrame>
createVideoFrame
(
183
const
VideoFrameData
& data,
const
VideoFrameMetaDataType* metatypes = NULL,
int
count = 0) = 0;
184
185
protected
:
186
virtual
~
IVideoFrameMemoryPool
() {}
187
};
188
189
}
// namespace rtc
190
}
// namespace agora
agora::rtc::TextureInfo
Definition:
NGIAgoraVideoFrame.h:29
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::VideoFrameData
Definition:
NGIAgoraVideoFrame.h:81
agora::media::base::ColorSpace
Definition:
AgoraMediaBase.h:619
agora::rtc::IVideoFrame::getVideoFrameMetaData
virtual int getVideoFrameMetaData(VideoFrameMetaDataType type, void *data)=0
agora::rtc::IVideoFrameMemoryPool
Definition:
NGIAgoraVideoFrame.h:174
agora::rtc::IVideoFrame::getVideoFrameData
virtual int getVideoFrameData(VideoFrameData &data) const =0
agora::rtc::PaddedRawPixelBuffer
Definition:
NGIAgoraVideoFrame.h:68
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
Definition:
NGIAgoraVideoFrame.h:127
Generated by
1.8.18