mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-19 17:49:14 +00:00
UI: Use config file for color format/space/range
Allows the color format, color space, and color range to be set by the user. This will need user interface for in the future, though it'll have to be an advanced setting that's hidden from the user by default because I don't feel comfortable exposing this to a typical user.
This commit is contained in:
parent
e8f2d1baba
commit
f58ca29484
|
@ -472,6 +472,10 @@ bool OBSBasic::InitBasicConfigDefaults()
|
|||
config_set_default_uint (basicConfig, "Video", "FPSNum", 30);
|
||||
config_set_default_uint (basicConfig, "Video", "FPSDen", 1);
|
||||
config_set_default_string(basicConfig, "Video", "ScaleType", "bicubic");
|
||||
config_set_default_string(basicConfig, "Video", "ColorFormat", "NV12");
|
||||
config_set_default_string(basicConfig, "Video", "ColorSpace", "709");
|
||||
config_set_default_string(basicConfig, "Video", "ColorRange",
|
||||
"Partial");
|
||||
|
||||
config_set_default_uint (basicConfig, "Audio", "SampleRate", 44100);
|
||||
config_set_default_string(basicConfig, "Audio", "ChannelSetup",
|
||||
|
@ -1355,6 +1359,24 @@ static inline enum obs_scale_type GetScaleType(ConfigFile &basicConfig)
|
|||
return OBS_SCALE_BICUBIC;
|
||||
}
|
||||
|
||||
static inline enum video_format GetVideoFormatFromName(const char *name)
|
||||
{
|
||||
if (astrcmpi(name, "I420") == 0)
|
||||
return VIDEO_FORMAT_I420;
|
||||
else if (astrcmpi(name, "NV12") == 0)
|
||||
return VIDEO_FORMAT_NV12;
|
||||
#if 0 //currently unsupported
|
||||
else if (astrcmpi(name, "YVYU") == 0)
|
||||
return VIDEO_FORMAT_YVYU;
|
||||
else if (astrcmpi(name, "YUY2") == 0)
|
||||
return VIDEO_FORMAT_YUY2;
|
||||
else if (astrcmpi(name, "UYVY") == 0)
|
||||
return VIDEO_FORMAT_UYVY;
|
||||
#endif
|
||||
else
|
||||
return VIDEO_FORMAT_BGRA;
|
||||
}
|
||||
|
||||
int OBSBasic::ResetVideo()
|
||||
{
|
||||
struct obs_video_info ovi;
|
||||
|
@ -1362,6 +1384,13 @@ int OBSBasic::ResetVideo()
|
|||
|
||||
GetConfigFPS(ovi.fps_num, ovi.fps_den);
|
||||
|
||||
const char *colorFormat = config_get_string(basicConfig, "Video",
|
||||
"ColorFormat");
|
||||
const char *colorSpace = config_get_string(basicConfig, "Video",
|
||||
"ColorSpace");
|
||||
const char *colorRange = config_get_string(basicConfig, "Video",
|
||||
"ColorRange");
|
||||
|
||||
ovi.graphics_module = App()->GetRenderModule();
|
||||
ovi.base_width = (uint32_t)config_get_uint(basicConfig,
|
||||
"Video", "BaseCX");
|
||||
|
@ -1371,9 +1400,11 @@ int OBSBasic::ResetVideo()
|
|||
"Video", "OutputCX");
|
||||
ovi.output_height = (uint32_t)config_get_uint(basicConfig,
|
||||
"Video", "OutputCY");
|
||||
ovi.output_format = VIDEO_FORMAT_NV12;
|
||||
ovi.colorspace = VIDEO_CS_709;
|
||||
ovi.range = VIDEO_RANGE_FULL;
|
||||
ovi.output_format = GetVideoFormatFromName(colorFormat);
|
||||
ovi.colorspace = astrcmpi(colorSpace, "601") == 0 ?
|
||||
VIDEO_CS_601 : VIDEO_CS_709;
|
||||
ovi.range = astrcmpi(colorRange, "Full") == 0 ?
|
||||
VIDEO_RANGE_FULL : VIDEO_RANGE_PARTIAL;
|
||||
ovi.adapter = 0;
|
||||
ovi.gpu_conversion = true;
|
||||
ovi.scale_type = GetScaleType(basicConfig);
|
||||
|
|
Loading…
Reference in a new issue