* basic CameraAppEngine */
| 30 | * basic CameraAppEngine |
| 31 | */ |
| 32 | class CameraEngine { |
| 33 | public: |
| 34 | explicit CameraEngine(android_app* app); |
| 35 | ~CameraEngine(); |
| 36 | |
| 37 | // Interfaces to android application framework |
| 38 | struct android_app* AndroidApp(void) const; |
| 39 | void OnAppInitWindow(void); |
| 40 | void DrawFrame(void); |
| 41 | void OnAppConfigChange(void); |
| 42 | void OnAppTermWindow(void); |
| 43 | |
| 44 | // Native Window handlers |
| 45 | int32_t GetSavedNativeWinWidth(void); |
| 46 | int32_t GetSavedNativeWinHeight(void); |
| 47 | int32_t GetSavedNativeWinFormat(void); |
| 48 | void SaveNativeWinRes(int32_t w, int32_t h, int32_t format); |
| 49 | |
| 50 | // UI handlers |
| 51 | void RequestCameraPermission(); |
| 52 | void OnCameraPermission(jboolean granted); |
| 53 | void EnableUI(void); |
| 54 | void OnTakePhoto(void); |
| 55 | void OnCameraParameterChanged(int32_t code, int64_t val); |
| 56 | |
| 57 | // Manage NDKCamera Object |
| 58 | void CreateCamera(void); |
| 59 | void DeleteCamera(void); |
| 60 | |
| 61 | private: |
| 62 | void OnPhotoTaken(const char* fileName); |
| 63 | int GetDisplayRotation(void); |
| 64 | |
| 65 | struct android_app* app_; |
| 66 | ImageFormat savedNativeWinRes_; |
| 67 | bool cameraGranted_; |
| 68 | int rotation_; |
| 69 | volatile bool cameraReady_; |
| 70 | NDKCamera* camera_; |
| 71 | ImageReader* yuvReader_; |
| 72 | ImageReader* jpgReader_; |
| 73 | }; |
| 74 | |
| 75 | /** |
| 76 | * retrieve global singleton CameraEngine instance |
nothing calls this directly
no outgoing calls
no test coverage detected