mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-20 13:08:50 +02:00
obs-x264: Call video info func to get format
Call the video information function to determine the video format that needs to be used to prevent having to use the same code in the update function.
This commit is contained in:
parent
f7f79cc689
commit
62b2d60580
@ -346,11 +346,20 @@ static inline int get_x264_cs_val(enum video_colorspace cs,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void obs_x264_video_info(void *data, struct video_scale_info *info);
|
||||
|
||||
static void update_params(struct obs_x264 *obsx264, obs_data_t *settings,
|
||||
char **params)
|
||||
{
|
||||
video_t *video = obs_encoder_video(obsx264->encoder);
|
||||
const struct video_output_info *voi = video_output_get_info(video);
|
||||
struct video_scale_info info;
|
||||
|
||||
info.format = voi->format;
|
||||
info.colorspace = voi->colorspace;
|
||||
info.range = voi->range;
|
||||
|
||||
obs_x264_video_info(obsx264, &info);
|
||||
|
||||
int bitrate = (int)obs_data_get_int(settings, "bitrate");
|
||||
int buffer_size = (int)obs_data_get_int(settings, "buffer_size");
|
||||
@ -381,13 +390,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(voi->colorspace, x264_transfer_names);
|
||||
get_x264_cs_val(info.colorspace, x264_transfer_names);
|
||||
obsx264->params.vui.i_colmatrix =
|
||||
get_x264_cs_val(voi->colorspace, x264_colmatrix_names);
|
||||
get_x264_cs_val(info.colorspace, x264_colmatrix_names);
|
||||
obsx264->params.vui.i_colorprim =
|
||||
get_x264_cs_val(voi->colorspace, x264_colorprim_names);
|
||||
get_x264_cs_val(info.colorspace, x264_colorprim_names);
|
||||
obsx264->params.vui.b_fullrange =
|
||||
voi->range == VIDEO_RANGE_FULL;
|
||||
info.range == VIDEO_RANGE_FULL;
|
||||
|
||||
/* use the new filler method for CBR to allow real-time adjusting of
|
||||
* the bitrate */
|
||||
@ -405,11 +414,11 @@ static void update_params(struct obs_x264 *obsx264, obs_data_t *settings,
|
||||
obsx264->params.rc.f_rf_constant = (float)crf;
|
||||
}
|
||||
|
||||
if (voi->format == VIDEO_FORMAT_NV12)
|
||||
if (info.format == VIDEO_FORMAT_NV12)
|
||||
obsx264->params.i_csp = X264_CSP_NV12;
|
||||
else if (voi->format == VIDEO_FORMAT_I420)
|
||||
else if (info.format == VIDEO_FORMAT_I420)
|
||||
obsx264->params.i_csp = X264_CSP_I420;
|
||||
else if (voi->format == VIDEO_FORMAT_I444)
|
||||
else if (info.format == VIDEO_FORMAT_I444)
|
||||
obsx264->params.i_csp = X264_CSP_I444;
|
||||
else
|
||||
obsx264->params.i_csp = X264_CSP_NV12;
|
||||
|
Loading…
Reference in New Issue
Block a user