From fdc2ebf980abe37a6a9e6910df4a1bda71a3a63e Mon Sep 17 00:00:00 2001 From: Palana Date: Wed, 2 Jul 2014 18:32:26 +0200 Subject: [PATCH] Add FPS/VideoFormat to name conversion helpers --- plugins/win-dshow/win-dshow.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/plugins/win-dshow/win-dshow.cpp b/plugins/win-dshow/win-dshow.cpp index 530e3cde8..e0170a3b4 100644 --- a/plugins/win-dshow/win-dshow.cpp +++ b/plugins/win-dshow/win-dshow.cpp @@ -786,6 +786,36 @@ static bool ResTypeChanged(obs_properties_t props, obs_property_t p, return true; } +static DStr GetFPSName(long long interval) +{ + DStr name; + + for (const FPSFormat &format : validFPSFormats) { + if (format.interval != interval) + continue; + + dstr_cat(name, format.text); + return name; + } + + dstr_cat(name, to_string(10000000. / interval).c_str()); + return name; +} + +static DStr GetVideoFormatName(VideoFormat format) +{ + DStr name; + for (const VideoFormatName &format_ : videoFormatNames) { + if (format_.format == format) { + dstr_cat(name, format_.name); + return name; + } + } + + dstr_catf(name, "Unknown (%lld)", (long long)format); + return name; +} + static bool DeviceIntervalChanged(obs_properties_t props, obs_property_t p, obs_data_t settings) {