Go to the documentation of this file.
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>
22 #include <unordered_map>
25 namespace bnb {
namespace interfaces {
27 class analytics_listener;
28 class camera_poi_listener;
29 class debug_interface;
30 class effect_activation_completion_listener;
31 class effect_info_listener;
33 class face_number_listener;
34 class frame_data_listener;
35 class frame_duration_listener;
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;
274 virtual void capture_blit(int32_t capture_width, int32_t capture_height) = 0;
287 virtual ::bnb::data_t
read_pixels(int32_t width, int32_t height) = 0;
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;
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;
358 virtual void playback_pause() = 0;
360 virtual void playback_stop() = 0;
397 virtual void start_video_processing(int64_t screen_width, int64_t screen_height, camera_orientation orientation,
bool reset_effect,
bool offline_mode) = 0;
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;
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;
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;
453 virtual void process_recorded_audio(
const std::string & in_filename,
const std::string & out_filename,
float mix_volume) = 0;
510 virtual void stop_analytics_capture() = 0;
virtual void set_render_consistency_mode(consistency_mode value)=0
Thread-safe.
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.
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 ¶ms)=0
Process an image with current effect.
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.
virtual void start_framedata_capture(const std::string &folder, const std::optional< std::string > &filename)=0
Request to start framedata capture process.
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 ¶ms)=0
Process image with current effect.
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.
virtual std::shared_ptr<::bnb::interfaces::effect_manager > effect_manager()=0
Get effect manager object Thread-safe.
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.
virtual void add_frame_duration_listener(const std::shared_ptr< frame_duration_listener > &frame_duration_listener)=0
Add callback to receive FPS information.
Callback interface to receive effect info changes.
virtual void on_video_record_start(bool play_audio_while_recording)=0
Trigger record start events in EP and Effect.
virtual std::shared_ptr< input_manager > get_input_manager()=0
Get interface to control user iterations.
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.
Configuration for EffectPlayer.
virtual void push_frame(::bnb::full_image_t full_image)=0
Provides image to process and to play effect.
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.
virtual void set_external_camera_texture(int32_t name, int32_t width, int32_t height)=0
Set OpenGL name of input external texture.
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.
virtual void surface_changed(int32_t width, int32_t height)=0
Notify about rendering surface being resized.
Callback interface to receive FPS timings.
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...
static int32_t version_major()
Get major version of EffectPlayer.
virtual ::bnb::data_t read_pixels(int32_t width, int32_t height)=0
Receive the last rendered frame in binary form.
virtual void remove_frame_duration_listener(const std::shared_ptr< frame_duration_listener > &frame_duration_listener)=0
Remove callback to receive FPS information.
virtual int64_t draw()=0
Draw the current effect into the current OpenGL framebuffer.
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,...
virtual void enable_audio(bool enable)=0
Set audio enabled.
static int32_t version_minor()
Get minor version of EffectPlayer.
virtual void on_video_record_end()=0
Triggers record stop events in EP and Effect.
virtual void set_effect_volume(float volume)=0
Set effect audio volume.
virtual effect_player_playback_state get_playback_state()=0
Thread-safe.
virtual std::shared_ptr<::bnb::interfaces::frame_data > process_video_frame(::bnb::full_image_t input_image, const process_image_params ¶ms, std::optional< int32_t > recognizer_iterations)=0
Provide frame to evaluate video processing.
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.
virtual void write_recorded_audio(const std::string &filename, int64_t length_ms)=0
Save recorded audio.
virtual void set_max_faces(int32_t max_faces)=0
Sets maximum allowed face results, if face tracking feature is present.
virtual void capture_blit(int32_t capture_width, int32_t capture_height)=0
Record last rendering ("draw_()") result into current OpenGL framebuffer.
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.
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,...
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.
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.
Callback to get center of square bounding the face.
virtual ::bnb::data_t process_image(::bnb::full_image_t input_image, ::bnb::interfaces::pixel_format output_pixel_format, const process_image_params ¶ms)=0
Process an image with current effect.
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.
virtual void set_recognizer_offline_mode(bool on)=0
Force recognizer offline mode Thread-safe.
virtual void surface_destroyed()=0
This method should be called right before an active context will become invalid.
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.
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.
Callback to get face number detected.
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.
getters throw exceptions when data are not available android NNs usually output gpu masks
Callback to get freshly processed frame_data.
virtual void stop_video_processing(bool reset_effect)=0
Finish processing and return renderer to normal state.
virtual bool is_device_nn_compatible()=0
Check is device compatible with Neural Networks player Thread-safe.
virtual void push_frame_data(const std::shared_ptr<::bnb::interfaces::frame_data > &frame_data)=0
Provides FrameData to process and to play effect.
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.
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 ¶ms, std::optional< int32_t > recognizer_iterations)=0
Provide frame data to evaluate video processing.
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.
The EffectPlayer class provides ability to play AR effects on set of images or video.
Callback interface to receive effect activation notification.
virtual void stop_framedata_capture()=0
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.
virtual bool is_voice_changer_configured()=0
Thread-safe.
virtual void set_face_search_mode(::bnb::interfaces::face_search_mode face_search)=0
Change face search mode Thread-safe.
virtual void playback_play()=0
MUST be called from the main(render) thread.
virtual void set_use_ext_cam_tex(bool value)=0
Use external texture as input source.
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.
virtual std::shared_ptr<::bnb::interfaces::debug_interface > debug_interface()=0
For internal usage only.