Banuba SDK
Loading...
Searching...
No Matches
helpers.hpp
1#pragma once
2
14
15#include <functional>
16#include <memory>
17
18namespace bnb
19{
20 //
21 // Convenient C++ methods for creating interface implementations from std::functions
22 //
23
24 using error_listener_callback = std::function<void(const std::string&, const std::string&)>;
25 using camera_poi_callback = std::function<void(float x, float y)>;
26 using effect_event_callback = std::function<void(
27 const std::string&, const std::unordered_map<std::string, std::string>&
28 )>;
29 using face_number_callback = std::function<void(int32_t)>;
30 using frame_duration_callback = std::function<void(float, float)>;
31 using hint_callback = std::function<void(const std::string&)>;
32 using low_light_callback = std::function<void(bool)>;
33 using frame_data_callback = std::function<void(const std::shared_ptr<interfaces::frame_data>&)>;
34 using effect_activated_callback = std::function<void(const std::string&)>;
35 using effect_info_callback = std::function<void(const interfaces::effect_info&)>;
36
37 std::shared_ptr<interfaces::error_listener>
38 make_error_listener(const error_listener_callback& callback);
39
40 std::shared_ptr<interfaces::camera_poi_listener>
41 make_camera_poi_listener(const camera_poi_callback& callback);
42
43 std::shared_ptr<interfaces::effect_event_listener>
44 make_effect_event_listener(const effect_event_callback& callback);
45
46 std::shared_ptr<interfaces::face_number_listener>
47 make_face_number_listener(const face_number_callback& callback);
48
49 std::shared_ptr<interfaces::frame_duration_listener> make_frame_duration_listener(
50 const frame_duration_callback& recognizer_callback,
51 const frame_duration_callback& camera_callback,
52 const frame_duration_callback& render_callback
53 );
54
55 std::shared_ptr<interfaces::hint_listener> make_hint_listener(const hint_callback& callback);
56
57 std::shared_ptr<interfaces::frame_data_listener>
58 make_frame_data_listener(const frame_data_callback& callback);
59
60 std::shared_ptr<interfaces::effect_activated_listener>
61 make_effect_activated_listener(const effect_activated_callback& callback);
62
63 std::shared_ptr<interfaces::effect_info_listener>
64 make_effect_info_listener(const effect_info_callback& callback);
65} // namespace bnb