mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-13 07:15:06 +00:00
obs-tools: Add child_source helper class
This commit is contained in:
parent
03930b6b42
commit
40369bf72d
2 changed files with 28 additions and 0 deletions
|
@ -179,3 +179,19 @@ bool obs::tools::obs_properties_remove_by_name(obs_properties_t* props, const ch
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
obs::tools::child_source::child_source(obs_source_t* parent, std::shared_ptr<obs_source_t> child)
|
||||||
|
: _parent(parent), _child(child)
|
||||||
|
{
|
||||||
|
obs_source_add_active_child(_parent, _child.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
obs::tools::child_source::~child_source()
|
||||||
|
{
|
||||||
|
obs_source_remove_active_child(_parent, _child.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<obs_source_t> obs::tools::child_source::get()
|
||||||
|
{
|
||||||
|
return _child;
|
||||||
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
// OBS
|
// OBS
|
||||||
|
@ -39,6 +40,17 @@ namespace obs {
|
||||||
bool scene_contains_source(obs_scene_t* scene, obs_source_t* source);
|
bool scene_contains_source(obs_scene_t* scene, obs_source_t* source);
|
||||||
|
|
||||||
bool obs_properties_remove_by_name(obs_properties_t* props, const char* name);
|
bool obs_properties_remove_by_name(obs_properties_t* props, const char* name);
|
||||||
|
|
||||||
|
class child_source {
|
||||||
|
obs_source_t* _parent;
|
||||||
|
std::shared_ptr<obs_source_t> _child;
|
||||||
|
|
||||||
|
public:
|
||||||
|
child_source(obs_source_t* parent, std::shared_ptr<obs_source_t> child);
|
||||||
|
virtual ~child_source();
|
||||||
|
|
||||||
|
std::shared_ptr<obs_source_t> get();
|
||||||
|
};
|
||||||
} // namespace tools
|
} // namespace tools
|
||||||
|
|
||||||
static void obs_source_deleter(obs_source_t* v)
|
static void obs_source_deleter(obs_source_t* v)
|
||||||
|
|
Loading…
Reference in a new issue