diff --git a/source/source-mirror.cpp b/source/source-mirror.cpp index 294fc97a..4e8562c4 100644 --- a/source/source-mirror.cpp +++ b/source/source-mirror.cpp @@ -308,6 +308,11 @@ void Source::Mirror::update(obs_data_t* data) { void Source::Mirror::activate() { m_active = true; + if (!m_mirrorSource) { + obs_data_t* ref = obs_source_get_settings(m_source); + update(ref); + obs_data_release(ref); + } } void Source::Mirror::deactivate() { @@ -315,8 +320,9 @@ void Source::Mirror::deactivate() { } void Source::Mirror::video_tick(float) { - if (m_mirrorSource) + if (m_mirrorSource) { m_mirrorName = obs_source_get_name(m_mirrorSource->get_object()); + } } void Source::Mirror::video_render(gs_effect_t*) { diff --git a/source/source-mirror.h b/source/source-mirror.h index 3421be51..f24d4766 100644 --- a/source/source-mirror.h +++ b/source/source-mirror.h @@ -23,6 +23,7 @@ #include "gs-sampler.h" #include "gfx-source-texture.h" #include +#include namespace Source { class MirrorAddon { @@ -48,23 +49,24 @@ namespace Source { static void deactivate(void *); static void video_tick(void *, float); static void video_render(void *, gs_effect_t *); - static void enum_active_sources(void *data, obs_source_enum_proc_t enum_callback, void *param); + static void enum_active_sources(void *, obs_source_enum_proc_t, void *); }; class Mirror { bool m_active; obs_source_t* m_source = nullptr; + // Input Source + std::string m_mirrorName; + std::unique_ptr m_mirrorSource; + // Scaling bool m_rescale = false; - bool m_keepOriginalSize = false; uint32_t m_width, m_height; + gs_effect_t* m_scalingEffect = nullptr; + bool m_keepOriginalSize = false; std::unique_ptr m_renderTargetScale; std::shared_ptr m_sampler; - gs_effect_t* m_scalingEffect = nullptr; - - std::unique_ptr m_mirrorSource; - std::string m_mirrorName; public: Mirror(obs_data_t*, obs_source_t*); @@ -78,6 +80,6 @@ namespace Source { void deactivate(); void video_tick(float); void video_render(gs_effect_t*); - void enum_active_sources(obs_source_enum_proc_t enum_callback, void *param); + void enum_active_sources(obs_source_enum_proc_t, void *); }; };