Banuba SDK
Loading...
Searching...
No Matches
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
15namespace bnb { namespace interfaces {
16
17class js_callback;
18enum class effect_status;
19
20class BNB_EXPORT effect {
21public:
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 effect_status status() = 0;
80
81 virtual int64_t get_native_context() = 0;
82};
83
84} } // namespace bnb::interfaces
85/// @}
86
virtual void reset()=0
Reset effect state MUST be called from the render thread.
virtual std::string url()=0
Thread-safe.
virtual void eval_js(const std::string &script, const std::shared_ptr< js_callback > &result_callback)=0
Evaluate the script in effect.
virtual void activate(int32_t fx_width, int32_t fx_height, int32_t surface_width, int32_t surface_height)=0
activate current effect MUST be called from the render thread for OpenGL backends.
virtual void deserialize(const std::string &resolved_url, const std::string &config_override)=0
Deserialize effect from the provided resoved_url.
virtual void call_js_method(const std::string &method_name, const std::string &params)=0
Call js method in effect.
virtual std::string eval_js_sync(const std::string &script)=0
Evaluate the script in effect.
virtual void update()=0
Update effect state (evaluate scheduled JS calls) MUST be called from the render thread.