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
// Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm
#ifndef ANDROIDAPPLICATION_H_
#define ANDROIDAPPLICATION_H_
#include <thread>
#include <mutex>
#include "NvAppBase/android/NvAndroidNativeAppGlue.h"
#include "NvEGLUtil/NvEGLUtil.h"
using namespace VideoStitch;
typedef NvEGLWinUtil NvEGLUtil;
typedef struct {
double x;
double y;
} vector2d;
class NativeApp {
public:
// Application state
enum State { INITIALIZATION, SELECTION, MAIN_LOOP, EXIT };
NativeApp(android_app *app, NvEGLUtil *egl);
virtual ~NativeApp();
void renderFrame(void);
State getState(void) const;
private:
// Handle commands
void handleCommand(int cmd);
// Handle inputs
int handleInput(AInputEvent const *event);
// Wrapper to handle commands generated by the UI
static void HandleCommand(android_app *app, int32_t cmd);
// Wrapper to handle input events generated by the UI
static int32_t HandleInput(android_app *app, AInputEvent *event);
void launchStitcher(void *outBuffer, std::mutex &outMutex, const char *fileName);
int stitchRun(VideoStitch::Core::Controller *controller, VideoStitch::Core::StitchOutput *stitchOutput,
const int firstFrame, const int lastFrame);
// Handler to plain texture fragment program
GLint mPlainTextureProgram;
// flag to notify screenPress
bool mScreenPressed;
// Handler to source texture
// GLuint mInputImageTexture;
// Handler to output texture
GLuint mOutputImageTexture;
// width of input image
int mTextureWidth;
// height of input image
int mTextureHeight;
// Box Filter
// gpu_bf::BoxFilterDemo boxfilter;
// Holds a point to EGL wrapper
NvEGLUtil *mEgl;
// Holds a pointer to android native activity instance
android_app *mNativeAppInstance;
// Holds application state
State mCurrentApplicationState;
// mStitcherBuffer for holding output from kernel
unsigned int *mStitcherBuffer;
std::mutex mStitcherMutex;
std::thread *mStitcherThread;
std::mutex mOrientationMutex;
bool mOrientationFlag;
double mYaw;
double mPitch;
double mRoll;
float mColorChannels[3];
float mAlphaStep;
vector2d mPos;
};
#endif /* ANDROIDAPPLICATION_H_ */