Banuba SDK
effect.hpp
Go to the documentation of this file.
1 /// \file
2 /// \addtogroup EffectPlayer
3 /// @{
4 ///
5 // AUTOGENERATED FILE - DO NOT MODIFY!
6 // This file was generated by Djinni from effect_player.djinni
7 
8 #pragma once
9 
10 #include "bnb/scene/interfaces/scene.hpp"
11 #include <bnb/utils/defs.hpp>
12 #include <cstdint>
13 #include <memory>
14 #include <string>
15 
16 namespace bnb { namespace interfaces {
17 
18 class js_callback;
19 
20 class BNB_EXPORT effect {
21 public:
22  virtual ~effect() {}
23 
24  /** Thread-safe. May be called from any thread */
25  virtual std::string url() = 0;
26 
27  /**
28  * Call js method in effect.
29  * @param method_name JS global function name. Member functions are not supported.
30  * @param params Function arguments.
31  * @depreacted Use `evalJs` instead.
32  */
33  virtual void call_js_method(const std::string & method_name, const std::string & params) = 0;
34 
35  /**
36  * Evaluate the `script` in effect. This method is thread safe.
37  * @param sctipt JS string to execute
38  * @param js_callback Callback for result, will be called in render thread.
39  */
40  virtual void eval_js(const std::string & script, const std::shared_ptr<js_callback> & result_callback) = 0;
41 
42  /**
43  * Evaluate the `script` in effect.
44  * MUST be called from the render thread
45  * @param sctipt JS string to execute
46  * @return JS evaluation result
47  */
48  virtual std::string eval_js_sync(const std::string & script) = 0;
49 
50  /**
51  * Reset effect state
52  * MUST be called from the render thread
53  */
54  virtual void reset() = 0;
55 
56  /**
57  * Update effect state (evaluate scheduled JS calls)
58  * MUST be called from the render thread
59  */
60  virtual void update() = 0;
61 
62  /**
63  * If effect is based on Scene engine and it is activated completly - returns Scene object from the effect.
64  * Otherwise returns null.
65  * MUST be called from the render thread
66  * Returned Scene object MUST be used only from the render thread and only while the effect is in the activated state.
67  */
68  virtual std::shared_ptr<::bnb::interfaces::scene> scene() = 0;
69 
70  /**
71  * deserialize effect from config.json.
72  * can be called from any thread
73  */
74  virtual void deserialize(const std::string & resolved_url) = 0;
75 
76  /**
77  * activate current effect
78  * MUST be called from the render thread for OpenGL backends.
79  */
80  virtual void activate(int32_t fx_width, int32_t fx_height, int32_t surface_width, int32_t surface_height) = 0;
81 
82  virtual void dump_fs(const std::string & out_dir) = 0;
83 
84  virtual void dump() = 0;
85 
86  virtual std::string dump_json() = 0;
87 };
88 
89 } } // namespace bnb::interfaces
90 /// @}
91 
bnb::interfaces::effect
Definition: effect.hpp:20