2023-02-28 01:15:26 +00:00
|
|
|
// AUTOGENERATED COPYRIGHT HEADER START
|
|
|
|
// Copyright (C) 2022-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
|
|
|
|
// AUTOGENERATED COPYRIGHT HEADER END
|
2022-05-14 04:29:41 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "common.hpp"
|
|
|
|
#include "obs-source.hpp"
|
|
|
|
#include "obs-tools.hpp"
|
|
|
|
#include "obs-weak-source.hpp"
|
|
|
|
|
|
|
|
namespace streamfx::obs {
|
|
|
|
class source_showing_reference {
|
|
|
|
::streamfx::obs::weak_source _target;
|
|
|
|
|
|
|
|
public:
|
|
|
|
~source_showing_reference()
|
|
|
|
{
|
|
|
|
auto v = _target.lock();
|
|
|
|
if (v) {
|
|
|
|
v.decrement_showing();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
source_showing_reference(::streamfx::obs::source& source) : _target(source)
|
|
|
|
{
|
|
|
|
source.increment_showing();
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
2023-05-13 12:35:46 +00:00
|
|
|
static FORCE_INLINE std::shared_ptr<source_showing_reference> add_showing_reference(::streamfx::obs::source& source)
|
2022-05-14 04:29:41 +00:00
|
|
|
{
|
|
|
|
return std::make_shared<source_showing_reference>(source);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
} // namespace streamfx::obs
|