10#include "bnb/scene/interfaces/render_backend_type.hpp"
14#include <bnb/types/base_types.hpp>
15#include <bnb/types/full_image.hpp>
16#include <bnb/utils/defs.hpp>
23namespace bnb {
namespace interfaces {
25class camera_poi_listener;
26class effect_activation_completion_listener;
27class effect_info_listener;
29class effect_player_configuration;
30class face_number_listener;
31class frame_data_listener;
32class frame_duration_listener;
35enum class camera_orientation;
89 static std::shared_ptr<effect_player> create(
const std::shared_ptr<effect_player_configuration> & configuration);
242 virtual void capture_blit(int32_t capture_width, int32_t capture_height) = 0;
277 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) = 0;
287 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) = 0;
318 virtual void playback_pause() = 0;
320 virtual void playback_stop() = 0;
355 virtual std::shared_ptr<::bnb::interfaces::frame_data>
process_video_frame_data(
const std::shared_ptr<::bnb::interfaces::frame_data> & input_frame_data, std::optional<int32_t> recognizer_iterations) = 0;
375 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;
381 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;
436 virtual void set_frame_processor(
const std::shared_ptr<::bnb::interfaces::frame_processor> & processor) = 0;
444 static void set_render_backend(::bnb::interfaces::render_backend_type backend_type);
446 static ::bnb::interfaces::render_backend_type get_current_render_backend_type();
basis is the base basis: for y/rgb basis use .basis or get_subchannel_basis_transform(1); for uv basi...
Callback to get center of square bounding the face.
Callback interface to receive effect activation notification.
Callback interface to receive effect info changes.
The EffectPlayer class provides ability to play AR effects on set of images or video.
virtual void set_max_faces(int32_t max_faces)=0
Sets maximum allowed face results, if face tracking feature is present.
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)=0
Process image with current effect.
virtual void playback_play()=0
MUST be called from the main(render) thread.
virtual void push_frame_data_with_number(const std::shared_ptr<::bnb::interfaces::frame_data > &frame_data, int64_t frame_number)=0
Provides FrameData with frame number 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::bnb::data_t process_image(::bnb::full_image_t input_image, ::bnb::interfaces::pixel_format output_pixel_format)=0
Process an image with current effect.
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 std::shared_ptr<::bnb::interfaces::frame_data > process_video_frame(::bnb::full_image_t input_image, std::optional< int32_t > recognizer_iterations)=0
Provide frame to evaluate video processing.
virtual void push_frame(::bnb::full_image_t full_image)=0
Provides image 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 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.
virtual void set_frame_processor(const std::shared_ptr<::bnb::interfaces::frame_processor > &processor)=0
Set frame processor as current Thread-safe.
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.
virtual void surface_destroyed()=0
This method should be called right before an active context will become invalid.
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.
virtual::bnb::interfaces::pixel_buffer read_pixels()=0
Receive the last rendered frame in binary form.
virtual void surface_changed(int32_t width, int32_t height)=0
Notify about rendering surface being resized.
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 on_video_record_end()=0
Triggers record stop events in EP and Effect.
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 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 void write_recorded_audio(const std::string &filename, int64_t length_ms)=0
Save recorded audio.
virtual void on_video_record_start(bool play_audio_while_recording)=0
Trigger record start events in EP and Effect.
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 void add_frame_duration_listener(const std::shared_ptr< frame_duration_listener > &frame_duration_listener)=0
Add callback to receive FPS information.
virtual std::shared_ptr<::bnb::interfaces::frame_processor > frame_processor()=0
Get current frame processor Thread-safe.
virtual void capture_blit(int32_t capture_width, int32_t capture_height)=0
Record last rendering ("draw_()") result into current OpenGL framebuffer.
virtual effect_player_playback_state get_playback_state()=0
Thread-safe.
virtual void set_use_ext_cam_tex(bool value)=0
Use external texture as input source.
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.
virtual void set_recognizer_use_future_interpolate(bool on)=0
Set future frame interpolation mode.
virtual std::shared_ptr<::bnb::interfaces::frame_data > process_video_frame_data(const std::shared_ptr<::bnb::interfaces::frame_data > &input_frame_data, std::optional< int32_t > recognizer_iterations)=0
Provide frame data to evaluate video processing.
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_recognizer_use_future_filter(bool on)=0
Set future frame filtrarion mode.
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::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.
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 void set_external_camera_texture(int32_t name, int32_t width, int32_t height)=0
Set OpenGL name of input external texture.
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)=0
Process an image with current effect.
virtual int64_t draw()=0
Draw the current effect into the current OpenGL framebuffer.
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 std::shared_ptr< input_manager > get_input_manager()=0
Get interface to control user iterations.
virtual void stop_video_processing(bool reset_effect)=0
Finish processing and return renderer to normal state.
virtual std::shared_ptr<::bnb::interfaces::effect_manager > effect_manager()=0
Get effect manager object Thread-safe.
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 set_recognizer_offline_mode(bool on)=0
Force recognizer offline mode Thread-safe.
virtual void remove_frame_duration_listener(const std::shared_ptr< frame_duration_listener > &frame_duration_listener)=0
Remove callback to receive FPS information.
virtual void set_render_consistency_mode(consistency_mode value)=0
Thread-safe.
Callback to get face number detected.
Callback to get freshly processed frame_data.
getters throw exceptions when data are not available android NNs usually output gpu masks
Callback interface to receive FPS timings.
consistency_mode
These modes describe the relationship between processing loop and render loop frames.
effect_player_playback_state
The EffectPlayerPlaybackState enum values are available states of effect player playback life cycle.
camera_orientation
camera image layout is top-left, 0 orientation is portrait, rotation is counterclockwise