FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
API-Examples/macOS/SimpleFilter/VideoProcessor.cpp at main · jinweizhao/API-Examples · GitHub
jinweizhao
/
API-Examples
Public
forked from
AgoraIO/API-Examples
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
API-Examples
/
macOS
/
SimpleFilter
/
VideoProcessor.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
61 lines (52 loc) · 1.73 KB
Breadcrumbs
API-Examples
/
macOS
/
SimpleFilter
/
VideoProcessor.cpp
Copy path
File metadata and controls
61 lines (52 loc) · 1.73 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
//
Created by DYF on 2020/7/13.
//
#
include
"
VideoProcessor.hpp
"
#
include
<
chrono
>
namespace
agora
{
namespace
extension
{
bool
enableGrey =
true
;
bool
YUVImageProcessor::initOpenGL
() {
const
std::lock_guard<std::mutex>
lock
(mutex_);
return
true
;
}
bool
YUVImageProcessor::releaseOpenGL
() {
const
std::lock_guard<std::mutex>
lock
(mutex_);
return
true
;
}
int
YUVImageProcessor::processFrame
(agora::rtc::VideoFrameData &capturedFrame) {
if
(wmEffectEnabled_) {
process
(capturedFrame);
}
return
0
;
}
void
YUVImageProcessor::process
(
const
agora::rtc::VideoFrameData &capturedFrame) {
if
(!enableGrey){
return
;
}
//
agora::rtc::RawPixelBuffer::Format format = capturedFrame.pixels.format;
unsigned
char
* pic = capturedFrame.
pixels
.
data
;
int
offset = capturedFrame.
height
* capturedFrame.
width
;
memset
(pic + offset,
128
, capturedFrame.
height
* capturedFrame.
width
/
2
);
}
int
YUVImageProcessor::setParameters
(std::string parameter) {
const
std::lock_guard<std::mutex>
lock
(mutex_);
if
(parameter ==
"
1
"
){
enableGrey =
true
;
}
else
{
enableGrey =
false
;
}
return
0
;
}
std::thread::id
YUVImageProcessor::getThreadId
() {
std::thread::id id =
std::this_thread::get_id
();
return
id;
}
void
YUVImageProcessor::dataCallback
(
const
char
* data){
if
(control_) {
control_->
postEvent
(
"
key
"
, data);
}
}
}
}
Back
|
FazBrowse Home
|
New Git URL