source-mirror: Correctly check for Audio and Video source

Previously this would not do anything correctly, as the call to obs_source_get_flags does not return anything for most sources. Instead obs_source_get_output_flags should be used to verify that we actually have a video or audio capable source to work with.
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2019-04-02 20:12:38 +02:00
parent 4d66938832
commit 381aa3ecd4

View file

@ -350,7 +350,7 @@ void source::mirror::mirror_instance::acquire_input(std::string source_name)
this->m_source = std::move(new_source);
this->m_source->events.rename += std::bind(&source::mirror::mirror_instance::on_source_rename, this,
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
if (m_audio_enabled) {
if ((obs_source_get_output_flags(this->m_source->get()) & OBS_SOURCE_AUDIO) != 0) {
this->m_source->events.audio_data +=
std::bind(&source::mirror::mirror_instance::on_audio_data, this, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
@ -540,7 +540,7 @@ void source::mirror::mirror_instance::video_render(gs_effect_t* effect)
}
// Don't bother rendering sources that aren't video.
if (obs_source_get_flags(this->m_source->get()) & OBS_SOURCE_VIDEO) {
if ((obs_source_get_output_flags(this->m_source->get()) & OBS_SOURCE_VIDEO) == 0) {
return;
}