win-dshow: Add "Default" color range setting

VIDEO_RANGE_DEFAULT uses partial range for YUV and full range for RGB.
Previous default was always partial.
master
jpark37 2019-07-10 23:40:53 -07:00
parent 617086b040
commit 1fc0a357d2
2 changed files with 9 additions and 3 deletions

View File

@ -4,6 +4,7 @@ Device="Device"
ColorSpace="Color Space" ColorSpace="Color Space"
ColorSpace.Default="Default" ColorSpace.Default="Default"
ColorRange="Color Range" ColorRange="Color Range"
ColorRange.Default="Default"
ColorRange.Partial="Partial" ColorRange.Partial="Partial"
ColorRange.Full="Full" ColorRange.Full="Full"
ConfigureAudio="Configure Audio" ConfigureAudio="Configure Audio"

View File

@ -75,6 +75,7 @@ using namespace DShow;
#define TEXT_COLOR_SPACE obs_module_text("ColorSpace") #define TEXT_COLOR_SPACE obs_module_text("ColorSpace")
#define TEXT_COLOR_DEFAULT obs_module_text("ColorSpace.Default") #define TEXT_COLOR_DEFAULT obs_module_text("ColorSpace.Default")
#define TEXT_COLOR_RANGE obs_module_text("ColorRange") #define TEXT_COLOR_RANGE obs_module_text("ColorRange")
#define TEXT_RANGE_DEFAULT obs_module_text("ColorRange.Default")
#define TEXT_RANGE_PARTIAL obs_module_text("ColorRange.Partial") #define TEXT_RANGE_PARTIAL obs_module_text("ColorRange.Partial")
#define TEXT_RANGE_FULL obs_module_text("ColorRange.Full") #define TEXT_RANGE_FULL obs_module_text("ColorRange.Full")
#define TEXT_DWNS obs_module_text("DeactivateWhenNotShowing") #define TEXT_DWNS obs_module_text("DeactivateWhenNotShowing")
@ -1049,8 +1050,11 @@ DShowInput::GetColorRange(obs_data_t *settings) const
{ {
const char *range = obs_data_get_string(settings, COLOR_RANGE); const char *range = obs_data_get_string(settings, COLOR_RANGE);
return astrcmpi(range, "full") == 0 ? VIDEO_RANGE_FULL if (astrcmpi(range, "full") == 0)
: VIDEO_RANGE_PARTIAL; return VIDEO_RANGE_FULL;
if (astrcmpi(range, "partial") == 0)
return VIDEO_RANGE_PARTIAL;
return VIDEO_RANGE_DEFAULT;
} }
inline bool DShowInput::Activate(obs_data_t *settings) inline bool DShowInput::Activate(obs_data_t *settings)
@ -1139,7 +1143,7 @@ static void GetDShowDefaults(obs_data_t *settings)
obs_data_set_default_int(settings, VIDEO_FORMAT, (int)VideoFormat::Any); obs_data_set_default_int(settings, VIDEO_FORMAT, (int)VideoFormat::Any);
obs_data_set_default_bool(settings, "active", true); obs_data_set_default_bool(settings, "active", true);
obs_data_set_default_string(settings, COLOR_SPACE, "default"); obs_data_set_default_string(settings, COLOR_SPACE, "default");
obs_data_set_default_string(settings, COLOR_RANGE, "partial"); obs_data_set_default_string(settings, COLOR_RANGE, "default");
obs_data_set_default_int(settings, AUDIO_OUTPUT_MODE, obs_data_set_default_int(settings, AUDIO_OUTPUT_MODE,
(int)AudioMode::Capture); (int)AudioMode::Capture);
} }
@ -1873,6 +1877,7 @@ static obs_properties_t *GetDShowProperties(void *obj)
p = obs_properties_add_list(ppts, COLOR_RANGE, TEXT_COLOR_RANGE, p = obs_properties_add_list(ppts, COLOR_RANGE, TEXT_COLOR_RANGE,
OBS_COMBO_TYPE_LIST, OBS_COMBO_TYPE_LIST,
OBS_COMBO_FORMAT_STRING); OBS_COMBO_FORMAT_STRING);
obs_property_list_add_string(p, TEXT_RANGE_DEFAULT, "default");
obs_property_list_add_string(p, TEXT_RANGE_PARTIAL, "partial"); obs_property_list_add_string(p, TEXT_RANGE_PARTIAL, "partial");
obs_property_list_add_string(p, TEXT_RANGE_FULL, "full"); obs_property_list_add_string(p, TEXT_RANGE_FULL, "full");