Skip to content

Commit

Permalink
video-presets: Ignore preset activation when no signal
Browse files Browse the repository at this point in the history
  • Loading branch information
leikareipa committed Sep 26, 2020
1 parent 364e893 commit 364b124
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/capture/video_presets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ bool kvideopreset_remove_preset(const unsigned presetId)

static video_preset_s* strongest_activating_preset(void)
{
if (kc_capture_api().has_no_signal())
{
ACTIVE_PRESET_ID = -1;
return nullptr;
}

const resolution_s resolution = kc_capture_api().get_resolution();
const refresh_rate_s refreshRate = kc_capture_api().get_refresh_rate();

Expand Down Expand Up @@ -92,17 +98,29 @@ void kvideopreset_remove_all_presets(void)

void kvideoparam_preset_video_params_changed(const unsigned presetId)
{
if (kc_capture_api().has_no_signal())
{
return;
}

const video_preset_s *thisPreset = kvideopreset_get_preset_ptr(presetId);
const video_preset_s *activePreset = strongest_activating_preset();

if (thisPreset == activePreset)
{
kc_capture_api().set_video_signal_parameters(thisPreset->videoParameters);
}

return;
}

void kvideopreset_apply_current_active_preset(void)
{
if (kc_capture_api().has_no_signal())
{
return;
}

const video_preset_s *activePreset = strongest_activating_preset();

if (activePreset)
Expand Down Expand Up @@ -137,6 +155,11 @@ video_preset_s* kvideopreset_get_preset_ptr(const unsigned presetId)

void kvideopreset_activate_keyboard_shortcut(const std::string &shortcutString)
{
if (kc_capture_api().has_no_signal())
{
return;
}

for (auto *preset: PRESETS)
{
if (preset->activates_with_shortcut(shortcutString))
Expand Down

0 comments on commit 364b124

Please sign in to comment.