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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user