From 3259a6831b4b5e8ac913a55ba77f6f5461829f7b Mon Sep 17 00:00:00 2001 From: jp9000 Date: Thu, 1 Jan 2015 14:48:50 -0800 Subject: [PATCH] obs-x264: Fix color space/range not being set I originally had it set the color space and color range in the video info callback, but I forgot that it's a function that's called after the encoder is initialized. You can change the color space and color range, but you have to reconfigure the encoder, and there's no real reason to do that. --- plugins/obs-x264/obs-x264.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/plugins/obs-x264/obs-x264.c b/plugins/obs-x264/obs-x264.c index 1ee7e7249..9eb3e5d15 100644 --- a/plugins/obs-x264/obs-x264.c +++ b/plugins/obs-x264/obs-x264.c @@ -52,9 +52,6 @@ struct obs_x264 { size_t sei_size; os_performance_token_t *performance_token; - - enum video_colorspace colorspace; - enum video_range_type range; }; /* ------------------------------------------------------------------------- */ @@ -346,13 +343,13 @@ static void update_params(struct obs_x264 *obsx264, obs_data_t *settings, obsx264->params.i_log_level = X264_LOG_WARNING; obsx264->params.vui.i_transfer = - get_x264_cs_val(obsx264->colorspace, x264_transfer_names); + get_x264_cs_val(voi->colorspace, x264_transfer_names); obsx264->params.vui.i_colmatrix = - get_x264_cs_val(obsx264->colorspace, x264_colmatrix_names); + get_x264_cs_val(voi->colorspace, x264_colmatrix_names); obsx264->params.vui.i_colorprim = - get_x264_cs_val(obsx264->colorspace, x264_colorprim_names); + get_x264_cs_val(voi->colorspace, x264_colorprim_names); obsx264->params.vui.b_fullrange = - obsx264->range == VIDEO_RANGE_FULL; + voi->range == VIDEO_RANGE_FULL; /* use the new filler method for CBR to allow real-time adjusting of * the bitrate */ @@ -609,9 +606,6 @@ static bool obs_x264_video_info(void *data, struct video_scale_info *info) video_t *video = obs_encoder_video(obsx264->encoder); const struct video_output_info *vid_info = video_output_get_info(video); - obsx264->colorspace = vid_info->colorspace; - obsx264->range = vid_info->range; - if (vid_info->format == VIDEO_FORMAT_I420 || vid_info->format == VIDEO_FORMAT_NV12) return false; @@ -619,11 +613,9 @@ static bool obs_x264_video_info(void *data, struct video_scale_info *info) info->format = VIDEO_FORMAT_NV12; info->width = vid_info->width; info->height = vid_info->height; - info->range = VIDEO_RANGE_PARTIAL; - info->colorspace = VIDEO_CS_709; + info->range = vid_info->range; + info->colorspace = vid_info->colorspace; - obsx264->colorspace = info->colorspace; - obsx264->range = info->range; return true; }