Banuba SDK
Loading...
Searching...
No Matches
bnb::player_api::interfaces::player Class Referenceabstract

Class manages the lifecycle of the EffectPlayer and is responsible for drawing FrameData that comes from Input, then processing frame and sending it to Output (or Outputs). More...

#include <player.hpp>

Inheritance diagram for bnb::player_api::interfaces::player:
bnb::player_api::player

Public Types

enum class  render_mode : int32_t { loop , manual }

Public Member Functions

virtual void set_render_mode (render_mode new_render_mode)=0
 Set rendering mode to another.
virtual void play ()=0
 Resume the playback of the effect.
virtual void pause ()=0
 Pause the playback of the effect.
virtual effect_player_sptr get_effect_player ()=0
 Get an instance of the EffectPlayer.
virtual playeruse (const input_sptr &input)=0
 Use the new input to replace the old one.
virtual playeruse (const output_sptr &output)=0
 Add a new one output to output list.
virtual playerunuse (const output_sptr &output=nullptr)=0
 Remove one output.
virtual effect_sptr load (const std::string &url)=0
 Synchronous loading of an effect by name.
virtual effect_sptr load_async (const std::string &url)=0
 Load effect asynchronously by name.
virtual void eval_js (const std::string &script, js_callback_sptr callback)=0
 Evaluate the script in effect.
virtual int64_t render ()=0
 Draw and present rendered result synchronously, can be used only in manual rendering mode.

Detailed Description

Class manages the lifecycle of the EffectPlayer and is responsible for drawing FrameData that comes from Input, then processing frame and sending it to Output (or Outputs).

Owns and manages the render thread.

Definition at line 33 of file player.hpp.

Member Enumeration Documentation

◆ render_mode

Enumerator
loop 

Render in display linked loop with defined fps.

manual 

Render manually by render call.

Definition at line 36 of file player.hpp.

37 {
38 /**
39 *Render in display linked loop with defined `fps`
40 */
41 loop,
42 /**
43 * Render manually by `render` call
44 */
45 manual
46 };

Member Function Documentation

◆ eval_js()

virtual void bnb::player_api::interfaces::player::eval_js ( const std::string & script,
js_callback_sptr callback )
pure virtual

Evaluate the script in effect.

Parameters
scriptJS string to execute
resultCallbackCallback for result, will be called in render thread.

◆ load()

virtual effect_sptr bnb::player_api::interfaces::player::load ( const std::string & url)
pure virtual

Synchronous loading of an effect by name.

Parameters
urlpath to the effect or effect name

◆ load_async()

virtual effect_sptr bnb::player_api::interfaces::player::load_async ( const std::string & url)
pure virtual

Load effect asynchronously by name.

Parameters
urlpath to the effect or effect name

◆ render()

virtual int64_t bnb::player_api::interfaces::player::render ( )
pure virtual

Draw and present rendered result synchronously, can be used only in manual rendering mode.

Returns
returns the number of the drawn frame, or -1 if nothing could be drawn.

◆ set_render_mode()

virtual void bnb::player_api::interfaces::player::set_render_mode ( render_mode new_render_mode)
pure virtual

Set rendering mode to another.

By default, the render mode is set to LOOP.

Parameters
new_render_modenew rendering mode

◆ unuse()

virtual player & bnb::player_api::interfaces::player::unuse ( const output_sptr & output = nullptr)
pure virtual

Remove one output.

If the output nullptr is passed as an output, then all outputs are removed.

Parameters
outputdelete this output from outputs

◆ use() [1/2]

virtual player & bnb::player_api::interfaces::player::use ( const input_sptr & input)
pure virtual

Use the new input to replace the old one.

Parameters
inputframes will be receive from it

◆ use() [2/2]

virtual player & bnb::player_api::interfaces::player::use ( const output_sptr & output)
pure virtual

Add a new one output to output list.

Parameters
outputprocessed frames will be push to it

The documentation for this class was generated from the following file: