mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-27 13:53:01 +00:00
obs/tools: Add active_source and visible_source helpers
These classes help us manage active and showing references to a source, which seem to be necessary for filters.
This commit is contained in:
parent
ad33066cd3
commit
716da4f6cc
1 changed files with 29 additions and 0 deletions
|
@ -36,6 +36,35 @@ namespace obs {
|
|||
|
||||
std::shared_ptr<obs_source_t> get();
|
||||
};
|
||||
|
||||
// Class to manage
|
||||
class active_source {
|
||||
obs_source_t* _child;
|
||||
|
||||
public:
|
||||
active_source(obs_source_t* child) : _child(child)
|
||||
{
|
||||
obs_source_inc_active(_child);
|
||||
}
|
||||
virtual ~active_source()
|
||||
{
|
||||
obs_source_dec_active(_child);
|
||||
}
|
||||
};
|
||||
|
||||
class visible_source {
|
||||
obs_source_t* _child;
|
||||
|
||||
public:
|
||||
visible_source(obs_source_t* child) : _child(child)
|
||||
{
|
||||
obs_source_inc_showing(_child);
|
||||
}
|
||||
virtual ~visible_source()
|
||||
{
|
||||
obs_source_dec_showing(_child);
|
||||
}
|
||||
};
|
||||
} // namespace tools
|
||||
|
||||
inline void obs_source_deleter(obs_source_t* v)
|
||||
|
|
Loading…
Reference in a new issue