obs-ffmpeg: Use video_output_info in amf_create_encoder()

The frame rate used to initialize an AMF encoder should be aligned
with the derived frame rate in video_output_info instead of the global
obs_video_info structure. With this change, IDRs can be aligned when
multiple renditions are being encoded.

Using video_output_info members for the format, colorspace, and range
parameters in addition to the frame rate provides a single source for
this information and obs_video_info is no longer needed.
This commit is contained in:
Alex Luccisano 2024-02-15 15:01:56 -05:00 committed by Lain
parent 3b87098508
commit c0f71f002c

View file

@ -991,13 +991,12 @@ try {
/* ------------------------------------ */
/* get video info */
struct obs_video_info ovi;
obs_get_video_info(&ovi);
struct video_scale_info info;
info.format = ovi.output_format;
info.colorspace = ovi.colorspace;
info.range = ovi.range;
video_t *video = obs_encoder_video(enc->encoder);
const struct video_output_info *voi = video_output_get_info(video);
info.format = voi->format;
info.colorspace = voi->colorspace;
info.range = voi->range;
if (enc->fallback) {
if (enc->codec == amf_codec_type::AVC)
@ -1010,9 +1009,9 @@ try {
enc->cx = obs_encoder_get_width(enc->encoder);
enc->cy = obs_encoder_get_height(enc->encoder);
enc->amf_frame_rate = AMFConstructRate(ovi.fps_num, ovi.fps_den);
enc->fps_num = (int)ovi.fps_num;
enc->fps_den = (int)ovi.fps_den;
enc->amf_frame_rate = AMFConstructRate(voi->fps_num, voi->fps_den);
enc->fps_num = (int)voi->fps_num;
enc->fps_den = (int)voi->fps_den;
enc->full_range = info.range == VIDEO_RANGE_FULL;
switch (info.colorspace) {