-
Notifications
You must be signed in to change notification settings - Fork 10
/
screenrec.h
94 lines (75 loc) · 1.99 KB
/
screenrec.h
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef SCREENREC_H
#define SCREENREC_H
#define LOG_NDEBUG 0
#define LOG_TAG "screenrec"
#include <pthread.h>
#include <cutils/log.h>
#include <errno.h>
#if SCR_SDK_VERSION < 16
#include <system/audio.h>
#define ALOGV(...) LOGV(__VA_ARGS__)
#define ALOGD(...) LOGD(__VA_ARGS__)
#define ALOGI(...) LOGI(__VA_ARGS__)
#define ALOGW(...) LOGW(__VA_ARGS__)
#define ALOGE(...) LOGE(__VA_ARGS__)
#endif
#define FRAME_RATE 15
// constants corresponding to AudioSource enum
#define SCR_AUDIO_MUTE 'x'
#define SCR_AUDIO_MIC 'm'
#define SCR_AUDIO_INTERNAL 'i'
#define SCR_AUDIO_MIX '+'
// Configuration parameters
extern char *outputName;
extern int rotation;
extern char audioSource;
extern int reqWidth;
extern int reqHeight;
extern int paddingWidth;
extern int paddingHeight;
extern int frameRate;
extern bool restrictFrameRate;
extern bool useGl;
extern bool useOes;
extern bool useFb;
extern int videoBitrate;
extern int audioSamplingRate;
extern int audioChannels;
extern bool useBGRA;
extern bool useYUV_P;
extern bool useYUV_SP;
extern int videoEncoder;
extern bool allowVerticalFrames;
// Output
extern int outputFd;
extern int videoWidth, videoHeight;
// Capture
extern void const* inputBase;
extern int inputWidth, inputHeight, inputStride;
extern bool rotateView;
// global state
extern bool stopping;
extern bool mrRunning;
extern int frameCount;
extern pthread_t stoppingThread;
int startRecording(char *config);
void setupInput();
void updateInput();
void updateTexImage(); // check if it can't be removed after moving updateInput() invocation
void stop(int error, const char* message);
void stop(int error, bool fromMainThread, const char* message);
void closeInput();
int64_t getTimeMs();
void trim(char* str);
bool fixOutputName();
class ScrOutput {
public:
ScrOutput() {}
virtual ~ScrOutput() {}
virtual void setupOutput() = 0;
virtual void renderFrame() = 0;
virtual void closeOutput(bool fromMainThread) = 0;
};
void shellSetState(const char* state);
void shellSetError(int errorCode);
#endif