Banuba SDK
effect_player.hpp
Go to the documentation of this file.
1 /// \file
2 /// \addtogroup EffectPlayer
3 /// @{
4 ///
5 // AUTOGENERATED FILE - DO NOT MODIFY!
6 // This file generated by Djinni from effect_player.djinni
7 
8 #pragma once
9 
11 #include "bnb/scene/interfaces/scene.hpp"
15 #include <bnb/types/base_types.hpp>
16 #include <bnb/types/full_image.hpp>
17 #include <bnb/utils/defs.hpp>
18 #include <cstdint>
19 #include <memory>
20 #include <optional>
21 #include <string>
22 #include <unordered_map>
23 #include <vector>
24 
25 namespace bnb { namespace interfaces {
26 
27 class analytics_listener;
28 class camera_poi_listener;
29 class debug_interface;
30 class effect_activation_completion_listener;
31 class effect_info_listener;
32 class effect_manager;
33 class face_number_listener;
34 class frame_data_listener;
35 class frame_duration_listener;
36 class input_manager;
37 class low_light_listener;
38 enum class camera_orientation;
39 enum class consistency_mode;
40 enum class effect_player_playback_state;
41 struct analytics_config;
42 struct effect_player_configuration;
43 struct process_image_params;
44 
45 /**
46  * The EffectPlayer class provides ability to play AR effects on set of images or video.
47  * <h2>Lifecycle</h2>
48  * In order to support an application lifecycle EffectPlayer provides special methods
49  * to control it during application states like pause or losing focus.
50  * <h3>Effect playback</h3>
51  * Initial playback state of newly created Effect Player instance is `active`. With playback
52  * control methods described below, the player can be launched/resumed or paused. State of effect
53  * player becomes stopped/inactive at the moment of surface loss or by calling the
54  * EffectPlayer::playback_stop method.
55  * One can use next three methods to control effect playback:
56  * <br/> - `EffectPlayer.playback_play`. Switching to active state attempt. Possible from
57  * paused or stopped state and has no effect if effect playback is already active. Playback
58  * resumes from the position saved before `EffectPlayer.playbackPause` call.
59  * <br/> - `EffectPlayer.playback_pause`. Suspend current playback attempt. The recognizer thread
60  * is stopped and all the video textures and audio units playback is stopped as well. Effect
61  * player doesn't react on EffectPlayer::pushFrame calls in suspended state except
62  * asynchronous-inconsistent mode.
63  * <br/> - `EffectPlayer.playbackStop`. Switch to inactive state. In addition to pause clears
64  * recognizer's buffer. The next switch to active state will result in total rerun of active
65  * effect which means that it will be started from the very beginning.
66  * <h2>Android usage example</h2>
67  * If you want an application to be active on windowed mode and if the
68  * focus is on another application you can switch EffectPlayer into active state when
69  * `onStart` activity callback occurs and switch to paused when `onStop` occurs. Otherwise you
70  * can suspend `EffectPlayer` on `onPause` and resume on `onResume` callback to make an
71  * instance of the `EffectPlayer` inactive while activity losing focus.
72  * <h2> Context/surface control</h2>
73  * There are two methods that have to be used to ensure correct operating of the
74  * EffectPlayer. Losing context without notifying the EffectPlayer
75  * leads to application crash. Methods for context changes notification:
76  * <br/> - `EffectPlayer.surfaceCreated`
77  * <br/> - `EffectPlayer.surfaceDestroyed`
78  * <h2> Multi-Threading performance and safety. Listeners.</h2>
79  * EffectPlayer allows to call some of its methods from several threads (simultaneously) for convenience and increased performance.
80  * This is allowed only during normal operation, all invocations from other threads MUST finish before
81  * you start destroying the EffectPlayer instance.
82  * Most methods belong to one of the two groups:
83  * <br/> - MUST be called from the "Main" (also "Render") thread ("Not Reentrant, Not Thread-safe")
84  * <br/> - MAY be called from "Any" thread. Most are "Thread-safe"
85  * Listener callbacks can be called back from any thread.
86  * Generally for best performance and responsiveness you'll have 3 threads:
87  * <br/> - Main(render) thread for drawing-related operations
88  * <br/> - "Camera" thread for handling and push()-ing frames into EffectPlayer
89  * <br/> - UI Thread for handling user interactions and other tasks
90  */
91 class BNB_EXPORT effect_player {
92 public:
93  virtual ~effect_player() {}
94 
95  static std::shared_ptr<effect_player> create(const effect_player_configuration & configuration);
96 
97  /**
98  * Get major version of EffectPlayer. Use this method to filter out breaking changes in
99  * implementation of this class.
100  * @note this is not version of SDK.
101  * @see EffectPlayer.versionMinor
102  */
103  static int32_t version_major();
104 
105  /**
106  * Get minor version of EffectPlayer
107  * @see EffectPlayer.versionMajor
108  */
109  static int32_t version_minor();
110 
111  /**
112  * Add callback to receive FPS information.
113  * Thread-safe. May be called from any thread
114  */
115  virtual void add_frame_duration_listener(const std::shared_ptr<frame_duration_listener> & frame_duration_listener) = 0;
116 
117  /**
118  * Remove callback to receive FPS information.
119  * Thread-safe. May be called from any thread
120  */
121  virtual void remove_frame_duration_listener(const std::shared_ptr<frame_duration_listener> & frame_duration_listener) = 0;
122 
123  /**
124  * Add callback to receive faces count in frame.
125  * Thread-safe. May be called from any thread
126  */
127  virtual void add_face_number_listener(const std::shared_ptr<face_number_listener> & face_number_listener) = 0;
128 
129  /**
130  * Remove callback to receive faces count in frame.
131  * Thread-safe. May be called from any thread
132  */
133  virtual void remove_face_number_listener(const std::shared_ptr<face_number_listener> & face_number_listener) = 0;
134 
135  /**
136  * Add callback to receive frame data right after processing in recognizer.
137  * Thread-safe. May be called from any thread
138  */
139  virtual void add_frame_data_listener(const std::shared_ptr<frame_data_listener> & frame_data_listener) = 0;
140 
141  /**
142  * Remove callback to receive frame data right after processing in recognizer.
143  * Thread-safe. May be called from any thread
144  */
145  virtual void remove_frame_data_listener(const std::shared_ptr<frame_data_listener> & frame_data_listener) = 0;
146 
147  /**
148  * Add callback to receive low light info
149  * Thread-safe. May be called from any thread
150  */
151  virtual void add_low_light_listener(const std::shared_ptr<low_light_listener> & low_light_listener) = 0;
152 
153  /**
154  * Remove callback to receive low light info
155  * Thread-safe. May be called from any thread
156  */
157  virtual void remove_low_light_listener(const std::shared_ptr<low_light_listener> & low_light_listener) = 0;
158 
159  /**
160  * Add callback to receive center of the face in frame relative to top-left
161  * corner in [0, 1] space.
162  * Thread-safe. May be called from any thread
163  */
164  virtual void add_camera_poi_listener(const std::shared_ptr<camera_poi_listener> & camera_poi_listener) = 0;
165 
166  /**
167  * Remove callback to receive center of the face in frame relative to top-left
168  * Thread-safe. May be called from any thread
169  */
170  virtual void remove_camera_poi_listener(const std::shared_ptr<camera_poi_listener> & camera_poi_listener) = 0;
171 
172  /**
173  * Add callback to receive current effect info from Effect Player.
174  * Thread-safe. May be called from any thread
175  */
176  virtual void add_effect_info_listener(const std::shared_ptr<effect_info_listener> & effect_info_listener) = 0;
177 
178  /**
179  * Remove callback to receive current effect info from Effect Player.
180  * Thread-safe. May be called from any thread
181  */
182  virtual void remove_effect_info_listener(const std::shared_ptr<effect_info_listener> & effect_info_listener) = 0;
183 
184  /**
185  * Add callback to receive current effect activation notification from Effect Player.
186  * Thread-safe. May be called from any thread
187  */
188  virtual void add_effect_activation_completion_listener(const std::shared_ptr<effect_activation_completion_listener> & effect_activation_completion_listener) = 0;
189 
190  /**
191  * Remove callback to receive current effect activation notification from Effect Player.
192  * Thread-safe. May be called from any thread
193  */
194  virtual void remove_effect_activation_completion_listener(const std::shared_ptr<effect_activation_completion_listener> & effect_activation_completion_listener) = 0;
195 
196  /**
197  * Sets maximum allowed face results, if face tracking feature is present.
198  * Thread-safe. May be called from any thread
199  * This option is relevant only for GLFX effects.
200  */
201  virtual void set_max_faces(int32_t max_faces) = 0;
202 
203  /**
204  * Set OpenGL name of input external texture.
205  * https://developer.android.com/reference/android/graphics/SurfaceTexture .
206  * MUST be called from the render thread
207  *
208  * @param name Texture name
209  * @param width Textute width
210  * @param height Texture height
211  *
212  * @see setUseExtCamTex
213  *
214  * <br/> Note: This function is Android only.
215  * <br/> Note: We use texture size to calculate aspect ratio only.
216  */
217  virtual void set_external_camera_texture(int32_t name, int32_t width, int32_t height) = 0;
218 
219  /**
220  * Use external texture as input source.
221  * MUST be called from the render thread
222  * @see setExternalCameraTexture
223  * @note This function is Android only
224  */
225  virtual void set_use_ext_cam_tex(bool value) = 0;
226 
227  /**
228  * Use to notify the EffectPlayer that the surface exists and effect can be played.
229  * 0, 0 for width and height are valid values.
230  * MUST be called from the render thread
231  */
232  virtual void surface_created(int32_t width, int32_t height) = 0;
233 
234  /**
235  * Notify about rendering surface being resized.
236  * MUST be called from the render thread
237  */
238  virtual void surface_changed(int32_t width, int32_t height) = 0;
239 
240  /**
241  * This method should be called right before an active context will become invalid.
242  * Switches playback state to inactive state. If it's not done an application will be
243  * crashed on next draw iteration. After losing the surface effect playback can't be
244  * resumed from last position.
245  * MUST be called from the render thread
246  */
247  virtual void surface_destroyed() = 0;
248 
249  /**
250  * Draw the current effect into the current OpenGL framebuffer. Uses internal frame_data
251  * object obtained from latest push_frame recognition result.
252  *
253  * Return current frame number if drawing was performed and caller should swap buffers
254  * otherwise `DRAW_SKIPPED`(-1)
255  * MUST be called from the render thread
256  */
257  virtual int64_t draw() = 0;
258 
259  /**
260  * Draw the current effect into the current OpenGL framebuffer. Uses externally provided frame_data
261  * object instead of internal one obtained from latest push_frame recognition result.
262  *
263  * Return frame number from provided frame_data if drawing was performed and caller should swap buffers
264  * otherwise `DRAW_SKIPPED`(-1)
265  * MUST be called from the render thread
266  */
267  virtual int64_t draw_with_external_frame_data(const std::shared_ptr<::bnb::interfaces::frame_data> & frame_data) = 0;
268 
269  /**
270  * Record last rendering ("draw_()") result into current OpenGL framebuffer.
271  * Content is cropped to maintain effect_size() aspect ratio
272  * MUST be called from the render thread
273  */
274  virtual void capture_blit(int32_t capture_width, int32_t capture_height) = 0;
275 
276  /**
277  * Receive the last rendered frame in binary form.
278  *
279  * @param width width of the picture to take, must match the values passed to
280  * `setEffectSize` or `create`
281  * @param height height of the picture to take, must match the values passed to
282  * `setEffectSize` or `create`
283  *
284  * @return RGBA data, size is `width * height * 4`
285  * MUST be called from the render thread
286  */
287  virtual ::bnb::data_t read_pixels(int32_t width, int32_t height) = 0;
288 
289  /** Thread-safe. May be called from any thread */
290  virtual void set_render_consistency_mode(consistency_mode value) = 0;
291 
292  /**
293  * Request display of sub-area of the input image into sub-area of the output surface, with optional x,y flips
294  * image_rect is fitted inside viewport_rect
295  * Resets transform to default if either rect has 0 dimensions
296  * @param image_rect rectangle in input image coordinates(pixels) after applying input rotations and flips
297  * @param viewport_rect rectangle in output surface coordinates(pixels)
298  * MUST be called from the render thread
299  */
300  virtual void set_render_transform(const ::bnb::interfaces::pixel_rect & image_rect, const ::bnb::interfaces::pixel_rect & viewport_rect, bool x_flip, bool y_flip) = 0;
301 
302  /**
303  * Process an image with current effect.
304  *
305  * Must be called from the render thread.
306  *
307  * @param input_image to avoid conversion recommended to use YUV image
308  * @param output_pixel_format to avoid conversion recommended to use RGBA
309  * @param params extra image processing arguments
310  */
311  virtual ::bnb::data_t process_image(::bnb::full_image_t input_image, ::bnb::interfaces::pixel_format output_pixel_format, const process_image_params & params) = 0;
312 
313  /**
314  * Process an image with current effect.
315  * Prefer this method over `processImage` when you have extra input data
316  * besides just an input image.
317  *
318  * Must be called from render thread.
319  *
320  * @param input_frame_data `FrameData` with an image
321  * @param output_pixel_format to avoid conversion recommended to use RGBA
322  * @param params extra image processing arguments
323  */
324  virtual ::bnb::data_t process_image_frame_data(const std::shared_ptr<::bnb::interfaces::frame_data> & input_frame_data, ::bnb::interfaces::pixel_format output_pixel_format, const process_image_params & params) = 0;
325 
326  /**
327  * Process image with current effect.
328  * Must be called from render thread.
329  * NOTE: input_image have copy overhead, preferable to use process_image method
330  * MUST be called from the render thread
331  * @param input_image input image with `width * height * 4` size
332  * @param output_pixel_format to avoid conversion recommended to use RGBA
333  */
334  virtual std::vector<uint8_t> process_image_data(const std::vector<uint8_t> & input_image, int32_t width, int32_t height, camera_orientation orientation, bool is_mirrored, ::bnb::interfaces::pixel_format input_pixel_format, ::bnb::interfaces::pixel_format output_pixel_format, const process_image_params & params) = 0;
335 
336  /**
337  * Provides image to process and to play effect.
338  * Thread-safe. May be called from any thread
339  */
340  virtual void push_frame(::bnb::full_image_t full_image) = 0;
341 
342  /**
343  * Provides image to process and to play effect.
344  * Thread-safe. May be called from any thread
345  */
346  virtual void push_frame_with_number(::bnb::full_image_t full_image, int64_t frame_number) = 0;
347 
348  /**
349  * Provides FrameData to process and to play effect.
350  * Must contain full image.
351  * Thread-safe. May be called from any thread
352  */
353  virtual void push_frame_data(const std::shared_ptr<::bnb::interfaces::frame_data> & frame_data) = 0;
354 
355  /** MUST be called from the main(render) thread */
356  virtual void playback_play() = 0;
357 
358  virtual void playback_pause() = 0;
359 
360  virtual void playback_stop() = 0;
361 
362  /** Thread-safe. May be called from any thread */
363  virtual effect_player_playback_state get_playback_state() = 0;
364 
365  /**
366  * If currently loaded effect is based on new Scene engine and it is loaded completly returns Scene object from the effect.
367  * Otherwise returns null.
368  * MUST be called from the render thread
369  * Returned Scene object MUST be used only from the render thread and only while the effect is in the loaded state.
370  */
371  virtual std::shared_ptr<::bnb::interfaces::scene> get_current_scene() = 0;
372 
373  /**
374  * Set effect audio volume.
375  * Thread-safe. May be called from any thread
376  * @param volume A value in range `[0, 1]`, where `1` means maximum volume.
377  */
378  virtual void set_effect_volume(float volume) = 0;
379 
380  /** Set audio enabled */
381  virtual void enable_audio(bool enable) = 0;
382 
383  /**
384  * Get interface to control user iterations. This events will be passed to effect.
385  * Thread-safe. May be called from any thread
386  */
387  virtual std::shared_ptr<input_manager> get_input_manager() = 0;
388 
389  /**
390  * Initialize video processing. To provide frames use *process_video_frame* methods.
391  * Effect audio is recorded as well and can be accessed using *process_recorded_audio*
392  * and *write_recorded_audio*.
393  * *push_frame* should not be called during processing.
394  * MUST be called from the render thread
395  * @throw Exception Must be aborted with stop_video_processing()
396  */
397  virtual void start_video_processing(int64_t screen_width, int64_t screen_height, camera_orientation orientation, bool reset_effect, bool offline_mode) = 0;
398 
399  /**
400  * Finish processing and return renderer to normal state.
401  * MUST be called from the render thread
402  */
403  virtual void stop_video_processing(bool reset_effect) = 0;
404 
405  /**
406  * Provide frame data to evaluate video processing.
407  * MUST be called from the render thread
408  * @param input_frame_data Frame Data to process.
409  * @param params Processing params.
410  * @param recognizer_iterations Number of processing iterations. Higher number means higher processing quality, but lower speed. Must be greater than 1. Pass null value for default number.
411  * @return Frame data with frame processing results.
412  */
413  virtual std::shared_ptr<::bnb::interfaces::frame_data> process_video_frame_data(const std::shared_ptr<::bnb::interfaces::frame_data> & input_frame_data, const process_image_params & params, std::optional<int32_t> recognizer_iterations) = 0;
414 
415  /**
416  * Provide frame to evaluate video processing.
417  * MUST be called from the render thread
418  * @param input_image Image to process.
419  * @param params Processing params.
420  * @param recognizer_iterations Number of processing iterations. Higher number means higher processing quality, but lower speed. Must be greater than 1. Pass null value for default number.
421  * @return Frame data with frame processing results.
422  */
423  virtual std::shared_ptr<::bnb::interfaces::frame_data> process_video_frame(::bnb::full_image_t input_image, const process_image_params & params, std::optional<int32_t> recognizer_iterations) = 0;
424 
425  /**
426  * Draw processed frame to image buffer.
427  * MUST be called from the render thread
428  * @param input_frame_data FrameData to draw.
429  * @param time_ns Frame position on timeline.
430  * @param output_pixel_format Output image format.
431  * @return Buffer with processed image in selected format.
432  */
433  virtual ::bnb::data_t draw_video_frame(const std::shared_ptr<::bnb::interfaces::frame_data> & input_frame_data, int64_t time_ns, ::bnb::interfaces::pixel_format output_pixel_format) = 0;
434 
435  /**
436  * The same as *draw_video_frame* but accepts preallocated buffer to avoid recreation for every frame.
437  * MUST be called from the render thread
438  */
439  virtual ::bnb::data_t draw_video_frame_allocated(const std::shared_ptr<::bnb::interfaces::frame_data> & input_frame_data, int64_t time_ns, ::bnb::interfaces::pixel_format output_pixel_format, ::bnb::data_t allocated_buffer) = 0;
440 
441  /** Thread-safe. May be called from any thread */
442  virtual bool is_voice_changer_configured() = 0;
443 
444  /**
445  * Process recorded voice with voice changer effects mixing with recorded sounds.
446  * Copies in->out if no voice changer or effect is active.
447  * Not thread-safe but can be called from any thread.
448  * Recorded sounds have the same lifetime as the effect(e.g reset after load_effect, etc.).
449  * @param in_filename Input filename.
450  * @param out_filename Must have ".wav" extension.
451  * @param mix_volume Relative volume for mixing in sounds, [0..1].
452  */
453  virtual void process_recorded_audio(const std::string & in_filename, const std::string & out_filename, float mix_volume) = 0;
454 
455  /**
456  * Save recorded audio.
457  * Not thread-safe but can be called from any thread.
458  * @param filename ".wav" extension must be used.
459  * @param length_ms Track length. Set to '0' to use full duration.
460  */
461  virtual void write_recorded_audio(const std::string & filename, int64_t length_ms) = 0;
462 
463  /**
464  * Trigger record start events in EP and Effect.
465  * Records all sounds during recording
466  * to be replayed by `processRecordedAudio`.
467  * If @param play_audio_while_recording is true, the audio will continue to play. Otherwise, the audio will be muted.
468  * Thread-safe. May be called from any thread
469  */
470  virtual void on_video_record_start(bool play_audio_while_recording) = 0;
471 
472  /**
473  * Triggers record stop events in EP and Effect.
474  * Thread-safe. May be called from any thread
475  */
476  virtual void on_video_record_end() = 0;
477 
478  /**
479  * Check is device compatible with Neural Networks player
480  * Thread-safe. May be called from any thread
481  * On some platforms (e.g. Android) may require the first invocation to be on the render thread
482  */
483  virtual bool is_device_nn_compatible() = 0;
484 
485  /**
486  * Request to start framedata capture process. Output file is in CBOR format.
487  * Thread-safe. May be called from any thread
488  * @param folder Output folder.
489  * @param filename Output filename. If the value is an empty string, filename is generated based on
490  * date and time.
491  */
492  virtual void start_framedata_capture(const std::string & folder, const std::optional<std::string> & filename) = 0;
493 
494  /** @see startFramedataCapture */
495  virtual void stop_framedata_capture() = 0;
496 
497  /**
498  * Request to start analytics capture process.
499  * Analytics supports two business cases:
500  * 1. Capture high resolution photo with face (bigger than 720p).
501  * 2. Capture N frames with face (N is configurable, if N=0 capturer will skip this case).
502  * Result is a path to CBOR file with images and face recognition results, compressed with zlib.
503  * Thread-safe. May be called from any thread
504  * @param device_info Any user specific information to attach in analytics report.
505  * @param config Setup configurable properties (like frames counter and delay before capture).
506  * @param listener Callback which is fired in one of two above mentioned cases.
507  */
508  virtual void start_analytics_capture(const std::unordered_map<std::string, std::string> & device_info, const analytics_config & config, const std::shared_ptr<analytics_listener> & listener) = 0;
509 
510  virtual void stop_analytics_capture() = 0;
511 
512  /**
513  * Get effect manager object
514  * Thread-safe. May be called from any thread
515  */
516  virtual std::shared_ptr<::bnb::interfaces::effect_manager> effect_manager() = 0;
517 
518  /** For internal usage only */
519  virtual std::shared_ptr<::bnb::interfaces::debug_interface> debug_interface() = 0;
520 
521  /**
522  * Force recognizer offline mode
523  * Thread-safe. May be called from any thread
524  */
525  virtual void set_recognizer_offline_mode(bool on) = 0;
526 
527  /**
528  * Change face search mode
529  * Thread-safe. May be called from any thread
530  */
531  virtual void set_face_search_mode(::bnb::interfaces::face_search_mode face_search) = 0;
532 };
533 
534 } } // namespace bnb::interfaces
535 /// @}
536 
frame_data.hpp
bnb::interfaces::effect_player::set_render_consistency_mode
virtual void set_render_consistency_mode(consistency_mode value)=0
Thread-safe.
bnb::interfaces::effect_player::add_face_number_listener
virtual void add_face_number_listener(const std::shared_ptr< face_number_listener > &face_number_listener)=0
Add callback to receive faces count in frame.
bnb::interfaces::effect_player::process_image_frame_data
virtual ::bnb::data_t process_image_frame_data(const std::shared_ptr<::bnb::interfaces::frame_data > &input_frame_data, ::bnb::interfaces::pixel_format output_pixel_format, const process_image_params &params)=0
Process an image with current effect.
bnb::interfaces::effect_player::process_recorded_audio
virtual void process_recorded_audio(const std::string &in_filename, const std::string &out_filename, float mix_volume)=0
Process recorded voice with voice changer effects mixing with recorded sounds.
bnb::interfaces::effect_player::start_framedata_capture
virtual void start_framedata_capture(const std::string &folder, const std::optional< std::string > &filename)=0
Request to start framedata capture process.
bnb::interfaces::effect_player::process_image_data
virtual std::vector< uint8_t > process_image_data(const std::vector< uint8_t > &input_image, int32_t width, int32_t height, camera_orientation orientation, bool is_mirrored, ::bnb::interfaces::pixel_format input_pixel_format, ::bnb::interfaces::pixel_format output_pixel_format, const process_image_params &params)=0
Process image with current effect.
bnb::interfaces::effect_player::draw_with_external_frame_data
virtual int64_t draw_with_external_frame_data(const std::shared_ptr<::bnb::interfaces::frame_data > &frame_data)=0
Draw the current effect into the current OpenGL framebuffer.
bnb::interfaces::effect_player::effect_manager
virtual std::shared_ptr<::bnb::interfaces::effect_manager > effect_manager()=0
Get effect manager object Thread-safe.
bnb::interfaces::low_light_listener
internal
Definition: low_light_listener.hpp:15
bnb::interfaces::effect_player::add_effect_info_listener
virtual void add_effect_info_listener(const std::shared_ptr< effect_info_listener > &effect_info_listener)=0
Add callback to receive current effect info from Effect Player.
bnb::interfaces::effect_player::add_frame_duration_listener
virtual void add_frame_duration_listener(const std::shared_ptr< frame_duration_listener > &frame_duration_listener)=0
Add callback to receive FPS information.
bnb::interfaces::effect_info_listener
Callback interface to receive effect info changes.
Definition: effect_info_listener.hpp:17
bnb::interfaces::effect_player::on_video_record_start
virtual void on_video_record_start(bool play_audio_while_recording)=0
Trigger record start events in EP and Effect.
pixel_rect.hpp
bnb::interfaces::effect_player::get_input_manager
virtual std::shared_ptr< input_manager > get_input_manager()=0
Get interface to control user iterations.
bnb::interfaces::effect_player::start_video_processing
virtual void start_video_processing(int64_t screen_width, int64_t screen_height, camera_orientation orientation, bool reset_effect, bool offline_mode)=0
Initialize video processing.
bnb::interfaces::effect_player_configuration
Configuration for EffectPlayer.
Definition: effect_player_configuration.hpp:18
bnb::interfaces::effect_player::push_frame
virtual void push_frame(::bnb::full_image_t full_image)=0
Provides image to process and to play effect.
bnb::interfaces::effect_player::remove_face_number_listener
virtual void remove_face_number_listener(const std::shared_ptr< face_number_listener > &face_number_listener)=0
Remove callback to receive faces count in frame.
bnb::interfaces::effect_player::set_external_camera_texture
virtual void set_external_camera_texture(int32_t name, int32_t width, int32_t height)=0
Set OpenGL name of input external texture.
bnb::interfaces::effect_player::remove_low_light_listener
virtual void remove_low_light_listener(const std::shared_ptr< low_light_listener > &low_light_listener)=0
Remove callback to receive low light info Thread-safe.
bnb::interfaces::effect_player::surface_changed
virtual void surface_changed(int32_t width, int32_t height)=0
Notify about rendering surface being resized.
bnb::interfaces::frame_duration_listener
Callback interface to receive FPS timings.
Definition: frame_duration_listener.hpp:15
bnb::interfaces::effect_player::get_current_scene
virtual std::shared_ptr<::bnb::interfaces::scene > get_current_scene()=0
If currently loaded effect is based on new Scene engine and it is loaded completly returns Scene obje...
bnb::interfaces::effect_player::version_major
static int32_t version_major()
Get major version of EffectPlayer.
bnb::interfaces::effect_player::read_pixels
virtual ::bnb::data_t read_pixels(int32_t width, int32_t height)=0
Receive the last rendered frame in binary form.
bnb::interfaces::effect_player::remove_frame_duration_listener
virtual void remove_frame_duration_listener(const std::shared_ptr< frame_duration_listener > &frame_duration_listener)=0
Remove callback to receive FPS information.
bnb::interfaces::effect_player::draw
virtual int64_t draw()=0
Draw the current effect into the current OpenGL framebuffer.
bnb::interfaces::effect_player::add_camera_poi_listener
virtual void add_camera_poi_listener(const std::shared_ptr< camera_poi_listener > &camera_poi_listener)=0
Add callback to receive center of the face in frame relative to top-left corner in [0,...
bnb::interfaces::effect_player::enable_audio
virtual void enable_audio(bool enable)=0
Set audio enabled.
bnb::interfaces::effect_player::version_minor
static int32_t version_minor()
Get minor version of EffectPlayer.
bnb::interfaces::effect_player::on_video_record_end
virtual void on_video_record_end()=0
Triggers record stop events in EP and Effect.
bnb::interfaces::effect_player::set_effect_volume
virtual void set_effect_volume(float volume)=0
Set effect audio volume.
bnb::interfaces::effect_player::get_playback_state
virtual effect_player_playback_state get_playback_state()=0
Thread-safe.
bnb::interfaces::effect_player::process_video_frame
virtual std::shared_ptr<::bnb::interfaces::frame_data > process_video_frame(::bnb::full_image_t input_image, const process_image_params &params, std::optional< int32_t > recognizer_iterations)=0
Provide frame to evaluate video processing.
bnb::interfaces::effect_player::draw_video_frame_allocated
virtual ::bnb::data_t draw_video_frame_allocated(const std::shared_ptr<::bnb::interfaces::frame_data > &input_frame_data, int64_t time_ns, ::bnb::interfaces::pixel_format output_pixel_format, ::bnb::data_t allocated_buffer)=0
The same as draw_video_frame but accepts preallocated buffer to avoid recreation for every frame.
bnb::interfaces::effect_player::write_recorded_audio
virtual void write_recorded_audio(const std::string &filename, int64_t length_ms)=0
Save recorded audio.
bnb::interfaces::effect_player::set_max_faces
virtual void set_max_faces(int32_t max_faces)=0
Sets maximum allowed face results, if face tracking feature is present.
bnb::interfaces::effect_player::capture_blit
virtual void capture_blit(int32_t capture_width, int32_t capture_height)=0
Record last rendering ("draw_()") result into current OpenGL framebuffer.
bnb::interfaces::effect_player::push_frame_with_number
virtual void push_frame_with_number(::bnb::full_image_t full_image, int64_t frame_number)=0
Provides image to process and to play effect.
bnb::interfaces::process_image_params
Definition: process_image_params.hpp:18
bnb::interfaces::effect_player::set_render_transform
virtual void set_render_transform(const ::bnb::interfaces::pixel_rect &image_rect, const ::bnb::interfaces::pixel_rect &viewport_rect, bool x_flip, bool y_flip)=0
Request display of sub-area of the input image into sub-area of the output surface,...
bnb::interfaces::effect_player::start_analytics_capture
virtual void start_analytics_capture(const std::unordered_map< std::string, std::string > &device_info, const analytics_config &config, const std::shared_ptr< analytics_listener > &listener)=0
Request to start analytics capture process.
bnb::interfaces::effect_player::remove_effect_info_listener
virtual void remove_effect_info_listener(const std::shared_ptr< effect_info_listener > &effect_info_listener)=0
Remove callback to receive current effect info from Effect Player.
pixel_format.hpp
bnb::interfaces::camera_poi_listener
Callback to get center of square bounding the face.
Definition: camera_poi_listener.hpp:15
bnb::interfaces::effect_player::process_image
virtual ::bnb::data_t process_image(::bnb::full_image_t input_image, ::bnb::interfaces::pixel_format output_pixel_format, const process_image_params &params)=0
Process an image with current effect.
bnb::interfaces::effect_player::add_frame_data_listener
virtual void add_frame_data_listener(const std::shared_ptr< frame_data_listener > &frame_data_listener)=0
Add callback to receive frame data right after processing in recognizer.
bnb::interfaces::effect_player::set_recognizer_offline_mode
virtual void set_recognizer_offline_mode(bool on)=0
Force recognizer offline mode Thread-safe.
bnb::interfaces::effect_player::surface_destroyed
virtual void surface_destroyed()=0
This method should be called right before an active context will become invalid.
bnb::interfaces::effect_player::remove_frame_data_listener
virtual void remove_frame_data_listener(const std::shared_ptr< frame_data_listener > &frame_data_listener)=0
Remove callback to receive frame data right after processing in recognizer.
bnb::interfaces::effect_player::surface_created
virtual void surface_created(int32_t width, int32_t height)=0
Use to notify the EffectPlayer that the surface exists and effect can be played.
bnb::interfaces::face_number_listener
Callback to get face number detected.
Definition: face_number_listener.hpp:16
bnb::interfaces::effect_player::add_effect_activation_completion_listener
virtual void add_effect_activation_completion_listener(const std::shared_ptr< effect_activation_completion_listener > &effect_activation_completion_listener)=0
Add callback to receive current effect activation notification from Effect Player.
bnb::interfaces::frame_data
getters throw exceptions when data are not available android NNs usually output gpu masks
Definition: frame_data.hpp:37
bnb::interfaces::frame_data_listener
Callback to get freshly processed frame_data.
Definition: frame_data_listener.hpp:17
bnb::interfaces::effect_player::stop_video_processing
virtual void stop_video_processing(bool reset_effect)=0
Finish processing and return renderer to normal state.
bnb::interfaces::effect_player::is_device_nn_compatible
virtual bool is_device_nn_compatible()=0
Check is device compatible with Neural Networks player Thread-safe.
bnb::interfaces::effect_player::push_frame_data
virtual void push_frame_data(const std::shared_ptr<::bnb::interfaces::frame_data > &frame_data)=0
Provides FrameData to process and to play effect.
bnb::interfaces::effect_player::remove_camera_poi_listener
virtual void remove_camera_poi_listener(const std::shared_ptr< camera_poi_listener > &camera_poi_listener)=0
Remove callback to receive center of the face in frame relative to top-left Thread-safe.
bnb::interfaces::effect_player::process_video_frame_data
virtual std::shared_ptr<::bnb::interfaces::frame_data > process_video_frame_data(const std::shared_ptr<::bnb::interfaces::frame_data > &input_frame_data, const process_image_params &params, std::optional< int32_t > recognizer_iterations)=0
Provide frame data to evaluate video processing.
bnb::interfaces::effect_player::draw_video_frame
virtual ::bnb::data_t draw_video_frame(const std::shared_ptr<::bnb::interfaces::frame_data > &input_frame_data, int64_t time_ns, ::bnb::interfaces::pixel_format output_pixel_format)=0
Draw processed frame to image buffer.
bnb::interfaces::analytics_config
internal
Definition: analytics_config.hpp:17
bnb::interfaces::effect_player
The EffectPlayer class provides ability to play AR effects on set of images or video.
Definition: effect_player.hpp:91
bnb::interfaces::effect_activation_completion_listener
Callback interface to receive effect activation notification.
Definition: effect_activation_completion_listener.hpp:16
bnb::interfaces::effect_player::stop_framedata_capture
virtual void stop_framedata_capture()=0
bnb::interfaces::effect_player::add_low_light_listener
virtual void add_low_light_listener(const std::shared_ptr< low_light_listener > &low_light_listener)=0
Add callback to receive low light info Thread-safe.
bnb::interfaces::effect_player::is_voice_changer_configured
virtual bool is_voice_changer_configured()=0
Thread-safe.
bnb::interfaces::effect_player::set_face_search_mode
virtual void set_face_search_mode(::bnb::interfaces::face_search_mode face_search)=0
Change face search mode Thread-safe.
bnb::interfaces::effect_player::playback_play
virtual void playback_play()=0
MUST be called from the main(render) thread.
face_search_mode.hpp
bnb::interfaces::effect_player::set_use_ext_cam_tex
virtual void set_use_ext_cam_tex(bool value)=0
Use external texture as input source.
bnb::interfaces::effect_player::remove_effect_activation_completion_listener
virtual void remove_effect_activation_completion_listener(const std::shared_ptr< effect_activation_completion_listener > &effect_activation_completion_listener)=0
Remove callback to receive current effect activation notification from Effect Player.
bnb::interfaces::effect_player::debug_interface
virtual std::shared_ptr<::bnb::interfaces::debug_interface > debug_interface()=0
For internal usage only.