-
Notifications
You must be signed in to change notification settings - Fork 184
/
CameraFrameInputPluginModule.hpp
executable file
·101 lines (78 loc) · 4.13 KB
/
CameraFrameInputPluginModule.hpp
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
95
96
97
98
99
100
101
//
// CameraFrameInputPluginModule.hpp
// WikitudeUniversalSDK
//
// Created by Andreas Schacherbauer on 28.02.18.
// Copyright © 2018 Wikitude. All rights reserved.
//
#ifndef CameraFrameInputPluginModule_hpp
#define CameraFrameInputPluginModule_hpp
#ifdef __cplusplus
#include <cstdint>
#include <functional>
#include "Error.hpp"
#include "ErrorHandling.hpp"
#include "CameraFocusMode.hpp"
#include "CameraFrame.hpp"
#include "CompilerAttributes.hpp"
#include "PluginModule.hpp"
namespace wikitude { namespace sdk {
namespace impl {
class WT_EXPORT_API CameraFrameInputPluginModule : public PluginModule {
public:
CameraFrameInputPluginModule() noexcept = default;
virtual ~CameraFrameInputPluginModule() = default;
/**
* Override/implement this method to know when the default platform camera is fully released and this camera frame input plugin module can safely access all platform camera resources
*/
virtual void onCameraReleased() = 0; // should we rename it to startCameraFrameUpdates()
virtual void onCameraReleaseFailed(const sdk::Error& error_) = 0; // should we rename it to
/**
* Implement this method if this plugin module supports suspending camera frame updates while the surrounding SDK is still running.
* This would be the case if PlatformCameraModule::setEnabled(false) is called while WikitudeUniversalSDK::isRunning is true.
*
* In case PlatformCameraModule::setEnabled(true) is called, ::startCameraFrameUpdates() is called again.
*
* In case PlatformCameraModule::setEnabled(true) is called while WikitudeUniversalSDK::isRunning is false, it's up to subclasses of this to handle this state correctly
*/
virtual void pauseCameraFrameUpdates();
virtual void resumeCameraFrameUpdates();
/**
* Implement this method if this plugin module supports camera focus mode changes.
*/
virtual sdk::CallStatus setFocusMode(CameraFocusMode focusMode_);
/**
* Default: false
*/
bool requestsCameraFrameRendering();
/* Called from the Wikitude SDK */
void registerOnPluginCameraReleasedHandler(std::function<void()> onPluginCameraReleasedHandler_);
void registerNotifyNewUnmanagedCameraFrameHandler(std::function<void(const sdk::CameraFrame& cameraFrame_)> notifyNewUnmanagedCameraFrameHandler_);
void registerCameraToSurfaceAngleChangedHandler(std::function<void(float cameraToSurfaceAngle_)> cameraToSurfaceAngleChangedHandler_);
void registerOnPluginCameraErrorHandler(std::function<void(const sdk::Error& error_)> onPluginCameraErrorHandler_);
protected:
/**
* Call this method to notify a new camera frame to the SDK
*/
void notifyNewUnmanagedCameraFrameToSDK(const sdk::CameraFrame& cameraFrame_);
/**
* Call this method to notify the SDK that this camer frame input plugin module fully released all platform camera resources.
*
*/
void notifyPluginCameraReleased();
void setCameraToSurfaceAngle(float cameraToSurfaceAngle_);
void onPluginCameraError(const sdk::Error& error_);
protected:
bool _requestsCameraFrameRendering = false;
bool _userDisabledCameraFrameUpdates = false;
private:
std::function<void()> _onPluginCameraReleasedHandler;
std::function<void(const sdk::CameraFrame&)> _notifyNewUnmanagedCameraFrameHandler;
std::function<void(float)> _cameraToSurfaceAngleChangedHandler;
std::function<void(const sdk::Error&)> _onPluginCameraErrorHandler;
};
}
using impl::CameraFrameInputPluginModule;
}}
#endif /* __cplusplus */
#endif /* CameraFrameInputPluginModule_hpp */