From ed5ee5aae2a508e2000fc2aabac75a4fa1fe78a5 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Mon, 8 Jan 2018 19:04:40 -0800 Subject: [PATCH] decklink: Fix bug with old channel formats There were cases where the channel format could be set to 7, which used to be a valid format but now no longer is. If that format is set, just use SPEAKERS_7POINT1 instead. --- plugins/decklink/plugin-main.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/decklink/plugin-main.cpp b/plugins/decklink/plugin-main.cpp index 3c5fe869e..7af76be33 100644 --- a/plugins/decklink/plugin-main.cpp +++ b/plugins/decklink/plugin-main.cpp @@ -74,8 +74,15 @@ static void decklink_update(void *data, obs_data_t *settings) COLOR_SPACE); video_range_type colorRange = (video_range_type)obs_data_get_int(settings, COLOR_RANGE); - speaker_layout channelFormat = (speaker_layout)obs_data_get_int(settings, - CHANNEL_FORMAT); + int chFmtInt = (int)obs_data_get_int(settings, CHANNEL_FORMAT); + + if (chFmtInt == 7) { + chFmtInt = SPEAKERS_7POINT1; + } else if (chFmtInt < SPEAKERS_UNKNOWN || chFmtInt > SPEAKERS_7POINT1) { + chFmtInt = 2; + } + + speaker_layout channelFormat = (speaker_layout)chFmtInt; decklink_enable_buffering(decklink, obs_data_get_bool(settings, BUFFERING));