Merge pull request #1648 from DougTy/master

linux-v4l2: Add setting to change color range
This commit is contained in:
Colin Edwards 2019-03-09 18:58:19 -06:00 committed by GitHub
commit c4f4b6602b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -8,3 +8,6 @@ Resolution="Resolution"
FrameRate="Frame Rate"
LeaveUnchanged="Leave Unchanged"
UseBuffering="Use Buffering"
ColorRange="Color Range"
ColorRange.Partial="Partial"
ColorRange.Full="Full"

View File

@ -75,6 +75,7 @@ struct v4l2_data {
int dv_timing;
int resolution;
int framerate;
int color_range;
/* internal data */
obs_source_t *source;
@ -112,7 +113,7 @@ static void v4l2_prep_obs_frame(struct v4l2_data *data,
frame->width = data->width;
frame->height = data->height;
frame->format = v4l2_to_obs_video_format(data->pixfmt);
video_format_get_parameters(VIDEO_CS_DEFAULT, VIDEO_RANGE_PARTIAL,
video_format_get_parameters(VIDEO_CS_DEFAULT, data->color_range,
frame->color_matrix, frame->color_range_min,
frame->color_range_max);
@ -231,6 +232,7 @@ static void v4l2_defaults(obs_data_t *settings)
obs_data_set_default_int(settings, "dv_timing", -1);
obs_data_set_default_int(settings, "resolution", -1);
obs_data_set_default_int(settings, "framerate", -1);
obs_data_set_default_int(settings, "color_range", VIDEO_RANGE_PARTIAL);
obs_data_set_default_bool(settings, "buffering", true);
}
@ -763,6 +765,12 @@ static obs_properties_t *v4l2_properties(void *vptr)
"framerate", obs_module_text("FrameRate"),
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
obs_property_t *color_range_list = obs_properties_add_list(props,
"color_range", obs_module_text("ColorRange"),
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
obs_property_list_add_int(color_range_list, obs_module_text("ColorRange.Partial"), VIDEO_RANGE_PARTIAL);
obs_property_list_add_int(color_range_list, obs_module_text("ColorRange.Full"), VIDEO_RANGE_FULL);
obs_properties_add_bool(props,
"buffering", obs_module_text("UseBuffering"));
@ -944,6 +952,7 @@ static void v4l2_update(void *vptr, obs_data_t *settings)
data->dv_timing = obs_data_get_int(settings, "dv_timing");
data->resolution = obs_data_get_int(settings, "resolution");
data->framerate = obs_data_get_int(settings, "framerate");
data->color_range = obs_data_get_int(settings, "color_range");
v4l2_update_source_flags(data, settings);