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/utils/defs.hpp>
11 #include <cstdint>
12 #include <memory>
13 #include <string>
14 
15 namespace bnb { namespace interfaces {
16 
17 class js_callback;
18 enum class effect_status;
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  virtual std::string name() = 0;
28 
29  /**
30  * Call js method in effect.
31  * @param method_name JS global function name. Member functions are not supported.
32  * @param params Function arguments.
33  * @depreacted Use `evalJs` instead.
34  */
35  virtual void call_js_method(const std::string & method_name, const std::string & params) = 0;
36 
37  /**
38  * Evaluate the `script` in effect. This method is thread safe.
39  * @param sctipt JS string to execute
40  * @param js_callback Callback for result, will be called in render thread.
41  */
42  virtual void eval_js(const std::string & script, const std::shared_ptr<js_callback> & result_callback) = 0;
43 
44  /**
45  * Evaluate the `script` in effect.
46  * MUST be called from the render thread
47  * @param sctipt JS string to execute
48  * @return JS evaluation result
49  */
50  virtual std::string eval_js_sync(const std::string & script) = 0;
51 
52  /**
53  * Reset effect state
54  * MUST be called from the render thread
55  */
56  virtual void reset() = 0;
57 
58  /**
59  * Update effect state (evaluate scheduled JS calls)
60  * MUST be called from the render thread
61  */
62  virtual void update() = 0;
63 
64  /**
65  * Deserialize effect from the provided `resoved_url`. If `config_override` is an
66  * empty string, will use `config.json` under provided `resolved_url`, otherwise
67  * content of `config_override` will be used.
68  *
69  * Can be called from any thread.
70  */
71  virtual void deserialize(const std::string & resolved_url, const std::string & config_override) = 0;
72 
73  /**
74  * activate current effect
75  * MUST be called from the render thread for OpenGL backends.
76  */
77  virtual void activate(int32_t fx_width, int32_t fx_height, int32_t surface_width, int32_t surface_height) = 0;
78 
79  virtual void dump_fs(const std::string & out_dir) = 0;
80 
81  virtual void dump() = 0;
82 
83  virtual std::string dump_json() = 0;
84 
85  virtual effect_status status() = 0;
86 
87  virtual int64_t get_native_context() = 0;
88 };
89 
90 } } // namespace bnb::interfaces
91 /// @}
92 
bnb::interfaces::effect
Definition: effect.hpp:20