obs: Apply coding guidelines

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2021-06-08 04:36:30 +02:00
parent 82ed11e6c1
commit 015fac588b
14 changed files with 163 additions and 158 deletions

View file

@ -34,7 +34,7 @@ gfx::source_texture::source_texture(obs_source_t* parent)
if (!parent) {
throw std::invalid_argument("_parent must not be null");
}
_parent = std::make_shared<obs::deprecated_source>(parent, false, false);
_parent = std::make_shared<streamfx::obs::deprecated_source>(parent, false, false);
_rt = std::make_shared<gs::rendertarget>(GS_RGBA, GS_ZS_NONE);
}
@ -46,7 +46,7 @@ gfx::source_texture::source_texture(obs_source_t* _source, obs_source_t* _parent
if (!obs_source_add_active_child(_parent, _source)) {
throw std::runtime_error("_parent is contained in _child");
}
_child = std::make_shared<obs::deprecated_source>(_source, true, true);
_child = std::make_shared<streamfx::obs::deprecated_source>(_source, true, true);
}
gfx::source_texture::source_texture(const char* _name, obs_source_t* _parent) : source_texture(_parent)
@ -54,7 +54,7 @@ gfx::source_texture::source_texture(const char* _name, obs_source_t* _parent) :
if (!_name) {
throw std::invalid_argument("name must not be null");
}
_child = std::make_shared<obs::deprecated_source>(_name, true, true);
_child = std::make_shared<streamfx::obs::deprecated_source>(_name, true, true);
if (!obs_source_add_active_child(_parent, _child->get())) {
throw std::runtime_error("_parent is contained in _child");
}
@ -63,8 +63,8 @@ gfx::source_texture::source_texture(const char* _name, obs_source_t* _parent) :
gfx::source_texture::source_texture(std::string _name, obs_source_t* _parent) : source_texture(_name.c_str(), _parent)
{}
gfx::source_texture::source_texture(std::shared_ptr<obs::deprecated_source> pchild,
std::shared_ptr<obs::deprecated_source> pparent)
gfx::source_texture::source_texture(std::shared_ptr<streamfx::obs::deprecated_source> pchild,
std::shared_ptr<streamfx::obs::deprecated_source> pparent)
{
if (!pchild) {
throw std::invalid_argument("_child must not be null");
@ -80,8 +80,8 @@ gfx::source_texture::source_texture(std::shared_ptr<obs::deprecated_source> pchi
this->_rt = std::make_shared<gs::rendertarget>(GS_RGBA, GS_ZS_NONE);
}
gfx::source_texture::source_texture(std::shared_ptr<obs::deprecated_source> _child, obs_source_t* _parent)
: source_texture(_child, std::make_shared<obs::deprecated_source>(_parent, false, false))
gfx::source_texture::source_texture(std::shared_ptr<streamfx::obs::deprecated_source> _child, obs_source_t* _parent)
: source_texture(_child, std::make_shared<streamfx::obs::deprecated_source>(_parent, false, false))
{}
obs_source_t* gfx::source_texture::get_object()

View file

@ -24,8 +24,8 @@
namespace gfx {
class source_texture {
std::shared_ptr<obs::deprecated_source> _parent;
std::shared_ptr<obs::deprecated_source> _child;
std::shared_ptr<streamfx::obs::deprecated_source> _parent;
std::shared_ptr<streamfx::obs::deprecated_source> _child;
std::shared_ptr<gs::rendertarget> _rt;
@ -37,8 +37,9 @@ namespace gfx {
source_texture(const char* name, obs_source_t* parent);
source_texture(std::string name, obs_source_t* parent);
source_texture(std::shared_ptr<obs::deprecated_source> child, std::shared_ptr<obs::deprecated_source> parent);
source_texture(std::shared_ptr<obs::deprecated_source> child, obs_source_t* parent);
source_texture(std::shared_ptr<streamfx::obs::deprecated_source> child,
std::shared_ptr<streamfx::obs::deprecated_source> parent);
source_texture(std::shared_ptr<streamfx::obs::deprecated_source> child, obs_source_t* parent);
public /*copy*/:
source_texture(source_texture const& other) = delete;

View file

@ -262,7 +262,7 @@ bool gfx::shader::shader::on_refresh_properties(obs_properties_t* props, obs_pro
{ // Clear parameter options.
auto grp = obs_property_group_content(obs_properties_get(props, ST_PARAMETERS));
for (auto p = obs_properties_first(grp); p != nullptr; p = obs_properties_first(grp)) {
obs::tools::obs_properties_remove_by_name(grp, obs_property_name(p));
streamfx::obs::tools::obs_properties_remove_by_name(grp, obs_property_name(p));
}
// Rebuild new parameters.
@ -299,7 +299,7 @@ bool gfx::shader::shader::on_shader_or_technique_modified(obs_properties_t* prop
// Clear parameter options.
auto grp = obs_property_group_content(obs_properties_get(props, ST_PARAMETERS));
for (auto p = obs_properties_first(grp); p != nullptr; p = obs_properties_first(grp)) {
obs::tools::obs_properties_remove_by_name(grp, obs_property_name(p));
streamfx::obs::tools::obs_properties_remove_by_name(grp, obs_property_name(p));
}
// Rebuild new parameters.

View file

@ -21,7 +21,7 @@
#include "common.hpp"
#include "plugin.hpp"
namespace obs {
namespace streamfx::obs {
template<class _factory, typename _instance>
class encoder_factory {
public:
@ -350,4 +350,4 @@ namespace obs {
virtual void get_video_info(struct video_scale_info* info) {}
};
} // namespace obs
} // namespace streamfx::obs

View file

@ -21,7 +21,7 @@
#include "common.hpp"
#include "util/util-event.hpp"
namespace obs {
namespace streamfx::obs {
template<typename T>
class signal_handler_base {
protected:
@ -91,4 +91,4 @@ namespace obs {
streamfx::util::event<std::shared_ptr<obs_source_t>, const struct audio_data*, bool> event;
};
} // namespace obs
} // namespace streamfx::obs

View file

@ -21,7 +21,7 @@
#include "common.hpp"
#include "plugin.hpp"
namespace obs {
namespace streamfx::obs {
template<class _factory, typename _instance>
class source_factory {
protected:
@ -640,4 +640,4 @@ namespace obs {
}
};
} // namespace obs
} // namespace streamfx::obs

View file

@ -22,11 +22,11 @@
#include "obs/obs-tools.hpp"
#include "plugin.hpp"
static std::shared_ptr<obs::source_tracker> source_tracker_instance;
static std::shared_ptr<streamfx::obs::source_tracker> source_tracker_instance;
void obs::source_tracker::source_create_handler(void* ptr, calldata_t* data) noexcept
void streamfx::obs::source_tracker::source_create_handler(void* ptr, calldata_t* data) noexcept
try {
obs::source_tracker* self = reinterpret_cast<obs::source_tracker*>(ptr);
streamfx::obs::source_tracker* self = reinterpret_cast<streamfx::obs::source_tracker*>(ptr);
obs_source_t* target = nullptr;
calldata_get_ptr(data, "source", &target);
@ -47,15 +47,15 @@ try {
{
std::unique_lock<std::mutex> ul(self->_lock);
self->_sources.insert({std::string(name), {weak, obs::obs_weak_source_deleter}});
self->_sources.insert({std::string(name), {weak, streamfx::obs::obs_weak_source_deleter}});
}
} catch (...) {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::source_tracker::source_destroy_handler(void* ptr, calldata_t* data) noexcept
void streamfx::obs::source_tracker::source_destroy_handler(void* ptr, calldata_t* data) noexcept
try {
obs::source_tracker* self = reinterpret_cast<obs::source_tracker*>(ptr);
streamfx::obs::source_tracker* self = reinterpret_cast<streamfx::obs::source_tracker*>(ptr);
obs_source_t* target = nullptr;
calldata_get_ptr(data, "source", &target);
@ -81,9 +81,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::source_tracker::source_rename_handler(void* ptr, calldata_t* data) noexcept
void streamfx::obs::source_tracker::source_rename_handler(void* ptr, calldata_t* data) noexcept
try {
obs::source_tracker* self = reinterpret_cast<obs::source_tracker*>(ptr);
streamfx::obs::source_tracker* self = reinterpret_cast<streamfx::obs::source_tracker*>(ptr);
obs_source_t* target = nullptr;
const char* prev_name = nullptr;
@ -106,7 +106,7 @@ try {
if (!weak) {
return;
}
self->_sources.insert({new_name, {weak, obs::obs_weak_source_deleter}});
self->_sources.insert({new_name, {weak, streamfx::obs::obs_weak_source_deleter}});
return;
}
@ -118,22 +118,22 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::source_tracker::initialize()
void streamfx::obs::source_tracker::initialize()
{
source_tracker_instance = std::make_shared<obs::source_tracker>();
source_tracker_instance = std::make_shared<streamfx::obs::source_tracker>();
}
void obs::source_tracker::finalize()
void streamfx::obs::source_tracker::finalize()
{
source_tracker_instance.reset();
}
std::shared_ptr<obs::source_tracker> obs::source_tracker::get()
std::shared_ptr<streamfx::obs::source_tracker> streamfx::obs::source_tracker::get()
{
return source_tracker_instance;
}
obs::source_tracker::source_tracker()
streamfx::obs::source_tracker::source_tracker()
{
auto osi = obs_get_signal_handler();
signal_handler_connect(osi, "source_create", &source_create_handler, this);
@ -141,7 +141,7 @@ obs::source_tracker::source_tracker()
signal_handler_connect(osi, "source_rename", &source_rename_handler, this);
}
obs::source_tracker::~source_tracker()
streamfx::obs::source_tracker::~source_tracker()
{
auto osi = obs_get_signal_handler();
if (osi) {
@ -153,7 +153,7 @@ obs::source_tracker::~source_tracker()
this->_sources.clear();
}
void obs::source_tracker::enumerate(enumerate_cb_t ecb, filter_cb_t fcb)
void streamfx::obs::source_tracker::enumerate(enumerate_cb_t ecb, filter_cb_t fcb)
{
// Need func-local copy, otherwise we risk corruption if a new source is created or destroyed.
decltype(_sources) _clone;
@ -163,8 +163,8 @@ void obs::source_tracker::enumerate(enumerate_cb_t ecb, filter_cb_t fcb)
}
for (auto kv : _clone) {
auto source =
std::shared_ptr<obs_source_t>(obs_weak_source_get_source(kv.second.get()), obs::obs_source_deleter);
auto source = std::shared_ptr<obs_source_t>(obs_weak_source_get_source(kv.second.get()),
streamfx::obs::obs_source_deleter);
if (!source) {
continue;
}
@ -183,29 +183,29 @@ void obs::source_tracker::enumerate(enumerate_cb_t ecb, filter_cb_t fcb)
}
}
bool obs::source_tracker::filter_sources(std::string, obs_source_t* source)
bool streamfx::obs::source_tracker::filter_sources(std::string, obs_source_t* source)
{
return (obs_source_get_type(source) != OBS_SOURCE_TYPE_INPUT);
}
bool obs::source_tracker::filter_audio_sources(std::string, obs_source_t* source)
bool streamfx::obs::source_tracker::filter_audio_sources(std::string, obs_source_t* source)
{
uint32_t flags = obs_source_get_output_flags(source);
return !(flags & OBS_SOURCE_AUDIO) || (obs_source_get_type(source) != OBS_SOURCE_TYPE_INPUT);
}
bool obs::source_tracker::filter_video_sources(std::string, obs_source_t* source)
bool streamfx::obs::source_tracker::filter_video_sources(std::string, obs_source_t* source)
{
uint32_t flags = obs_source_get_output_flags(source);
return !(flags & OBS_SOURCE_VIDEO) || (obs_source_get_type(source) != OBS_SOURCE_TYPE_INPUT);
}
bool obs::source_tracker::filter_transitions(std::string, obs_source_t* source)
bool streamfx::obs::source_tracker::filter_transitions(std::string, obs_source_t* source)
{
return (obs_source_get_type(source) != OBS_SOURCE_TYPE_TRANSITION);
}
bool obs::source_tracker::filter_scenes(std::string, obs_source_t* source)
bool streamfx::obs::source_tracker::filter_scenes(std::string, obs_source_t* source)
{
return (obs_source_get_type(source) != OBS_SOURCE_TYPE_SCENE);
}

View file

@ -23,7 +23,7 @@
#include <map>
#include <mutex>
namespace obs {
namespace streamfx::obs {
class source_tracker {
std::map<std::string, std::shared_ptr<obs_weak_source_t>> _sources;
std::mutex _lock;
@ -33,9 +33,9 @@ namespace obs {
static void source_rename_handler(void* ptr, calldata_t* data) noexcept;
public: // Singleton
static void initialize();
static void finalize();
static std::shared_ptr<obs::source_tracker> get();
static void initialize();
static void finalize();
static std::shared_ptr<streamfx::obs::source_tracker> get();
public:
source_tracker();
@ -69,4 +69,4 @@ namespace obs {
static bool filter_transitions(std::string name, obs_source_t* source);
static bool filter_scenes(std::string name, obs_source_t* source);
};
} // namespace obs
} // namespace streamfx::obs

View file

@ -21,9 +21,9 @@
#include <stdexcept>
#include "plugin.hpp"
void obs::deprecated_source::handle_destroy(void* p, calldata_t* calldata) noexcept
void streamfx::obs::deprecated_source::handle_destroy(void* p, calldata_t* calldata) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
obs_source_t* source;
if (!calldata_get_ptr(calldata, "source", &source)) {
@ -44,9 +44,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_remove(void* p, calldata_t*) noexcept
void streamfx::obs::deprecated_source::handle_remove(void* p, calldata_t*) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.remove) {
return;
}
@ -57,9 +57,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_save(void* p, calldata_t*) noexcept
void streamfx::obs::deprecated_source::handle_save(void* p, calldata_t*) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.save) {
return;
}
@ -70,9 +70,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_load(void* p, calldata_t*) noexcept
void streamfx::obs::deprecated_source::handle_load(void* p, calldata_t*) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.load) {
return;
}
@ -83,9 +83,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_activate(void* p, calldata_t*) noexcept
void streamfx::obs::deprecated_source::handle_activate(void* p, calldata_t*) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.activate) {
return;
}
@ -96,9 +96,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_deactivate(void* p, calldata_t*) noexcept
void streamfx::obs::deprecated_source::handle_deactivate(void* p, calldata_t*) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.deactivate) {
return;
}
@ -109,9 +109,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_show(void* p, calldata_t*) noexcept
void streamfx::obs::deprecated_source::handle_show(void* p, calldata_t*) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.show) {
return;
}
@ -122,9 +122,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_hide(void* p, calldata_t*) noexcept
void streamfx::obs::deprecated_source::handle_hide(void* p, calldata_t*) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.hide) {
return;
}
@ -135,9 +135,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_enable(void* p, calldata_t* calldata) noexcept
void streamfx::obs::deprecated_source::handle_enable(void* p, calldata_t* calldata) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.enable) {
return;
}
@ -154,9 +154,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_push_to_mute_changed(void* p, calldata_t* calldata) noexcept
void streamfx::obs::deprecated_source::handle_push_to_mute_changed(void* p, calldata_t* calldata) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.push_to_mute_changed) {
return;
}
@ -173,9 +173,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_push_to_mute_delay(void* p, calldata_t* calldata) noexcept
void streamfx::obs::deprecated_source::handle_push_to_mute_delay(void* p, calldata_t* calldata) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.push_to_mute_delay) {
return;
}
@ -192,9 +192,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_push_to_talk_changed(void* p, calldata_t* calldata) noexcept
void streamfx::obs::deprecated_source::handle_push_to_talk_changed(void* p, calldata_t* calldata) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.push_to_talk_changed) {
return;
}
@ -211,9 +211,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_push_to_talk_delay(void* p, calldata_t* calldata) noexcept
void streamfx::obs::deprecated_source::handle_push_to_talk_delay(void* p, calldata_t* calldata) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.push_to_talk_delay) {
return;
}
@ -230,9 +230,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_rename(void* p, calldata_t* calldata) noexcept
void streamfx::obs::deprecated_source::handle_rename(void* p, calldata_t* calldata) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.enable) {
return;
}
@ -254,9 +254,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_update_properties(void* p, calldata_t*) noexcept
void streamfx::obs::deprecated_source::handle_update_properties(void* p, calldata_t*) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.update_properties) {
return;
}
@ -267,9 +267,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_update_flags(void* p, calldata_t* calldata) noexcept
void streamfx::obs::deprecated_source::handle_update_flags(void* p, calldata_t* calldata) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.update_flags) {
return;
}
@ -286,9 +286,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_mute(void* p, calldata_t* calldata) noexcept
void streamfx::obs::deprecated_source::handle_mute(void* p, calldata_t* calldata) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.mute) {
return;
}
@ -305,9 +305,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_volume(void* p, calldata_t* calldata) noexcept
void streamfx::obs::deprecated_source::handle_volume(void* p, calldata_t* calldata) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.volume) {
return;
}
@ -326,9 +326,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_audio_sync(void* p, calldata_t* calldata) noexcept
void streamfx::obs::deprecated_source::handle_audio_sync(void* p, calldata_t* calldata) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.audio_sync) {
return;
}
@ -347,9 +347,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_audio_mixers(void* p, calldata_t* calldata) noexcept
void streamfx::obs::deprecated_source::handle_audio_mixers(void* p, calldata_t* calldata) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.audio_mixers) {
return;
}
@ -368,9 +368,10 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_audio_data(void* p, obs_source_t*, const audio_data* audio, bool muted) noexcept
void streamfx::obs::deprecated_source::handle_audio_data(void* p, obs_source_t*, const audio_data* audio,
bool muted) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.audio) {
return;
}
@ -382,9 +383,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_filter_add(void* p, calldata_t* calldata) noexcept
void streamfx::obs::deprecated_source::handle_filter_add(void* p, calldata_t* calldata) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.filter_add) {
return;
}
@ -401,9 +402,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_filter_remove(void* p, calldata_t* calldata) noexcept
void streamfx::obs::deprecated_source::handle_filter_remove(void* p, calldata_t* calldata) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.filter_remove) {
return;
}
@ -420,9 +421,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_reorder_filters(void* p, calldata_t*) noexcept
void streamfx::obs::deprecated_source::handle_reorder_filters(void* p, calldata_t*) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.reorder_filters) {
return;
}
@ -433,9 +434,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_transition_start(void* p, calldata_t*) noexcept
void streamfx::obs::deprecated_source::handle_transition_start(void* p, calldata_t*) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.transition_start) {
return;
}
@ -446,9 +447,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_transition_video_stop(void* p, calldata_t*) noexcept
void streamfx::obs::deprecated_source::handle_transition_video_stop(void* p, calldata_t*) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.transition_video_stop) {
return;
}
@ -459,9 +460,9 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
void obs::deprecated_source::handle_transition_stop(void* p, calldata_t*) noexcept
void streamfx::obs::deprecated_source::handle_transition_stop(void* p, calldata_t*) noexcept
try {
obs::deprecated_source* self = reinterpret_cast<obs::deprecated_source*>(p);
streamfx::obs::deprecated_source* self = reinterpret_cast<streamfx::obs::deprecated_source*>(p);
if (!self->events.transition_stop) {
return;
}
@ -472,7 +473,7 @@ try {
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
}
obs::deprecated_source::~deprecated_source()
streamfx::obs::deprecated_source::~deprecated_source()
{
#ifdef auto_signal_d
#undef auto_signal_d
@ -513,7 +514,7 @@ obs::deprecated_source::~deprecated_source()
this->_self = nullptr;
}
obs::deprecated_source::deprecated_source()
streamfx::obs::deprecated_source::deprecated_source()
{
#ifdef auto_signal_c
#undef auto_signal_c
@ -553,18 +554,20 @@ obs::deprecated_source::deprecated_source()
this->events.audio.set_listen_callback([this]() noexcept {
if (!this->_self)
return;
obs_source_add_audio_capture_callback(this->_self, obs::deprecated_source::handle_audio_data, this);
obs_source_add_audio_capture_callback(this->_self, streamfx::obs::deprecated_source::handle_audio_data,
this);
});
this->events.audio.set_silence_callback([this]() noexcept {
if (!this->_self)
return;
obs_source_remove_audio_capture_callback(this->_self, obs::deprecated_source::handle_audio_data, this);
obs_source_remove_audio_capture_callback(this->_self, streamfx::obs::deprecated_source::handle_audio_data,
this);
});
}
}
obs::deprecated_source::deprecated_source(std::string name, bool ptrack_ownership, bool add_reference)
: ::obs::deprecated_source::deprecated_source()
streamfx::obs::deprecated_source::deprecated_source(std::string name, bool ptrack_ownership, bool add_reference)
: ::streamfx::obs::deprecated_source::deprecated_source()
{
this->_self = obs_get_source_by_name(name.c_str());
if (!this->_self) {
@ -577,8 +580,8 @@ obs::deprecated_source::deprecated_source(std::string name, bool ptrack_ownershi
}
}
obs::deprecated_source::deprecated_source(obs_source_t* source, bool ptrack_ownership, bool add_reference)
: ::obs::deprecated_source::deprecated_source()
streamfx::obs::deprecated_source::deprecated_source(obs_source_t* source, bool ptrack_ownership, bool add_reference)
: ::streamfx::obs::deprecated_source::deprecated_source()
{
this->_self = source;
if (!this->_self) {
@ -689,7 +692,7 @@ obs::deprecated_source& obs::deprecated_source::operator=(deprecated_source cons
}
*/
obs::deprecated_source::deprecated_source(deprecated_source&& other)
streamfx::obs::deprecated_source::deprecated_source(deprecated_source&& other)
: _self(std::move(other._self)), _track_ownership(std::move(other._track_ownership))
{
// Clean out other source
@ -730,7 +733,7 @@ obs::deprecated_source::deprecated_source(deprecated_source&& other)
#undef auto_signal_c
}
obs::deprecated_source& obs::deprecated_source::operator=(deprecated_source&& other)
streamfx::obs::deprecated_source& streamfx::obs::deprecated_source::operator=(deprecated_source&& other)
{
if (this != &other) {
return *this;
@ -782,7 +785,7 @@ obs::deprecated_source& obs::deprecated_source::operator=(deprecated_source&& ot
return *this;
}
obs_source_type obs::deprecated_source::type()
obs_source_type streamfx::obs::deprecated_source::type()
{
if (!_self) {
return static_cast<obs_source_type>(-1);
@ -790,7 +793,7 @@ obs_source_type obs::deprecated_source::type()
return obs_source_get_type(_self);
}
void* obs::deprecated_source::type_data()
void* streamfx::obs::deprecated_source::type_data()
{
if (!_self) {
return nullptr;
@ -798,7 +801,7 @@ void* obs::deprecated_source::type_data()
return obs_source_get_type_data(_self);
}
uint32_t obs::deprecated_source::width()
uint32_t streamfx::obs::deprecated_source::width()
{
if (!_self) {
return 0;
@ -806,7 +809,7 @@ uint32_t obs::deprecated_source::width()
return obs_source_get_width(_self);
}
uint32_t obs::deprecated_source::height()
uint32_t streamfx::obs::deprecated_source::height()
{
if (!_self) {
return 0;
@ -814,17 +817,17 @@ uint32_t obs::deprecated_source::height()
return obs_source_get_height(_self);
}
bool obs::deprecated_source::destroyed()
bool streamfx::obs::deprecated_source::destroyed()
{
return _self == nullptr;
}
void obs::deprecated_source::clear()
void streamfx::obs::deprecated_source::clear()
{
_self = nullptr;
}
obs_source_t* obs::deprecated_source::get()
obs_source_t* streamfx::obs::deprecated_source::get()
{
return _self;
}

View file

@ -21,7 +21,7 @@
#include "common.hpp"
#include "util/util-event.hpp"
namespace obs {
namespace streamfx::obs {
class deprecated_source {
obs_source_t* _self;
bool _track_ownership = false;
@ -89,49 +89,49 @@ namespace obs {
public: // Events
struct {
// Destroy and Remove
streamfx::util::event<obs::deprecated_source*> destroy;
streamfx::util::event<obs::deprecated_source*> remove;
streamfx::util::event<streamfx::obs::deprecated_source*> destroy;
streamfx::util::event<streamfx::obs::deprecated_source*> remove;
// Saving, Loading and Update
streamfx::util::event<obs::deprecated_source*> save;
streamfx::util::event<obs::deprecated_source*> load;
streamfx::util::event<obs::deprecated_source*> update_properties;
streamfx::util::event<streamfx::obs::deprecated_source*> save;
streamfx::util::event<streamfx::obs::deprecated_source*> load;
streamfx::util::event<streamfx::obs::deprecated_source*> update_properties;
// Activate, Deactivate
streamfx::util::event<obs::deprecated_source*> activate;
streamfx::util::event<obs::deprecated_source*> deactivate;
streamfx::util::event<streamfx::obs::deprecated_source*> activate;
streamfx::util::event<streamfx::obs::deprecated_source*> deactivate;
// Show Hide
streamfx::util::event<obs::deprecated_source*> show;
streamfx::util::event<obs::deprecated_source*> hide;
streamfx::util::event<streamfx::obs::deprecated_source*> show;
streamfx::util::event<streamfx::obs::deprecated_source*> hide;
// Other
streamfx::util::event<obs::deprecated_source*, bool> enable;
streamfx::util::event<obs::deprecated_source*, std::string, std::string> rename;
streamfx::util::event<obs::deprecated_source*, long long> update_flags;
streamfx::util::event<streamfx::obs::deprecated_source*, bool> enable;
streamfx::util::event<streamfx::obs::deprecated_source*, std::string, std::string> rename;
streamfx::util::event<streamfx::obs::deprecated_source*, long long> update_flags;
// Hotkeys (PtM, PtT)
streamfx::util::event<obs::deprecated_source*, bool> push_to_mute_changed;
streamfx::util::event<obs::deprecated_source*, long long> push_to_mute_delay;
streamfx::util::event<obs::deprecated_source*, bool> push_to_talk_changed;
streamfx::util::event<obs::deprecated_source*, long long> push_to_talk_delay;
streamfx::util::event<streamfx::obs::deprecated_source*, bool> push_to_mute_changed;
streamfx::util::event<streamfx::obs::deprecated_source*, long long> push_to_mute_delay;
streamfx::util::event<streamfx::obs::deprecated_source*, bool> push_to_talk_changed;
streamfx::util::event<streamfx::obs::deprecated_source*, long long> push_to_talk_delay;
// Audio
streamfx::util::event<obs::deprecated_source*, bool> mute;
streamfx::util::event<obs::deprecated_source*, double&> volume;
streamfx::util::event<obs::deprecated_source*, long long&> audio_sync;
streamfx::util::event<obs::deprecated_source*, long long&> audio_mixers;
streamfx::util::event<obs::deprecated_source*, const audio_data*, bool> audio;
streamfx::util::event<streamfx::obs::deprecated_source*, bool> mute;
streamfx::util::event<streamfx::obs::deprecated_source*, double&> volume;
streamfx::util::event<streamfx::obs::deprecated_source*, long long&> audio_sync;
streamfx::util::event<streamfx::obs::deprecated_source*, long long&> audio_mixers;
streamfx::util::event<streamfx::obs::deprecated_source*, const audio_data*, bool> audio;
// Filters
streamfx::util::event<obs::deprecated_source*, obs_source_t*> filter_add;
streamfx::util::event<obs::deprecated_source*, obs_source_t*> filter_remove;
streamfx::util::event<obs::deprecated_source*> reorder_filters;
streamfx::util::event<streamfx::obs::deprecated_source*, obs_source_t*> filter_add;
streamfx::util::event<streamfx::obs::deprecated_source*, obs_source_t*> filter_remove;
streamfx::util::event<streamfx::obs::deprecated_source*> reorder_filters;
// Transition
streamfx::util::event<obs::deprecated_source*> transition_start;
streamfx::util::event<obs::deprecated_source*> transition_video_stop;
streamfx::util::event<obs::deprecated_source*> transition_stop;
streamfx::util::event<streamfx::obs::deprecated_source*> transition_start;
streamfx::util::event<streamfx::obs::deprecated_source*> transition_video_stop;
streamfx::util::event<streamfx::obs::deprecated_source*> transition_stop;
} events;
};
} // namespace obs
} // namespace streamfx::obs

View file

@ -74,7 +74,7 @@ static bool scs_contains(scs_searchdata& sd, obs_source_t* source)
return true;
}
bool obs::tools::scene_contains_source(obs_scene_t* scene, obs_source_t* source)
bool streamfx::obs::tools::scene_contains_source(obs_scene_t* scene, obs_source_t* source)
{
scs_searchdata sd;
sd.source = source;
@ -113,7 +113,7 @@ struct _hack_obs_properties {
};
}
bool obs::tools::obs_properties_remove_by_name(obs_properties_t* props, const char* name)
bool streamfx::obs::tools::obs_properties_remove_by_name(obs_properties_t* props, const char* name)
{
// Due to a bug in obs_properties_remove_by_name, calling it on the first or last element of a group corrupts the
// obs_properties_t's first and last pointers, which now point at nonsense.
@ -161,7 +161,7 @@ bool obs::tools::obs_properties_remove_by_name(obs_properties_t* props, const ch
}
if (el_cur->type == OBS_PROPERTY_GROUP) {
if (obs::tools::obs_properties_remove_by_name(
if (streamfx::obs::tools::obs_properties_remove_by_name(
obs_property_group_content(reinterpret_cast<obs_property_t*>(el_cur)), name))
return true;
}
@ -170,7 +170,7 @@ bool obs::tools::obs_properties_remove_by_name(obs_properties_t* props, const ch
return false;
}
obs::tools::child_source::child_source(obs_source_t* parent, std::shared_ptr<obs_source_t> child)
streamfx::obs::tools::child_source::child_source(obs_source_t* parent, std::shared_ptr<obs_source_t> child)
: _parent(parent), _child(child)
{
if (!obs_source_add_active_child(_parent, _child.get())) {
@ -178,12 +178,12 @@ obs::tools::child_source::child_source(obs_source_t* parent, std::shared_ptr<obs
}
}
obs::tools::child_source::~child_source()
streamfx::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()
std::shared_ptr<obs_source_t> streamfx::obs::tools::child_source::get()
{
return _child;
}

View file

@ -20,7 +20,7 @@
#pragma once
#include "common.hpp"
namespace obs {
namespace streamfx::obs {
namespace tools {
bool scene_contains_source(obs_scene_t* scene, obs_source_t* source);
@ -96,4 +96,4 @@ namespace obs {
{
obs_data_release(v);
}
} // namespace obs
} // namespace streamfx::obs

View file

@ -87,7 +87,7 @@ try {
_threadpool = std::make_shared<streamfx::util::threadpool>();
// Initialize Source Tracker
obs::source_tracker::initialize();
streamfx::obs::source_tracker::initialize();
// GS Stuff
{
@ -242,7 +242,7 @@ try {
}
// Finalize Source Tracker
obs::source_tracker::finalize();
streamfx::obs::source_tracker::finalize();
// // Auto-Updater
//#ifdef ENABLE_UPDATER

View file

@ -359,7 +359,8 @@ obs_properties_t* mirror_factory::get_properties2(mirror_instance* data)
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
obs_property_list_add_int(p, D_TRANSLATE(ST_I18N_SOURCE_AUDIO_LAYOUT_(Unknown)),
static_cast<int64_t>(SPEAKERS_UNKNOWN));
obs_property_list_add_int(p, D_TRANSLATE(ST_I18N_SOURCE_AUDIO_LAYOUT_(Mono)), static_cast<int64_t>(SPEAKERS_MONO));
obs_property_list_add_int(p, D_TRANSLATE(ST_I18N_SOURCE_AUDIO_LAYOUT_(Mono)),
static_cast<int64_t>(SPEAKERS_MONO));
obs_property_list_add_int(p, D_TRANSLATE(ST_I18N_SOURCE_AUDIO_LAYOUT_(Stereo)),
static_cast<int64_t>(SPEAKERS_STEREO));
obs_property_list_add_int(p, D_TRANSLATE(ST_I18N_SOURCE_AUDIO_LAYOUT_(StereoLFE)),