mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-04 10:33:30 +00:00
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:
parent
3b87098508
commit
c0f71f002c
|
@ -991,13 +991,12 @@ try {
|
||||||
/* ------------------------------------ */
|
/* ------------------------------------ */
|
||||||
/* get video info */
|
/* get video info */
|
||||||
|
|
||||||
struct obs_video_info ovi;
|
|
||||||
obs_get_video_info(&ovi);
|
|
||||||
|
|
||||||
struct video_scale_info info;
|
struct video_scale_info info;
|
||||||
info.format = ovi.output_format;
|
video_t *video = obs_encoder_video(enc->encoder);
|
||||||
info.colorspace = ovi.colorspace;
|
const struct video_output_info *voi = video_output_get_info(video);
|
||||||
info.range = ovi.range;
|
info.format = voi->format;
|
||||||
|
info.colorspace = voi->colorspace;
|
||||||
|
info.range = voi->range;
|
||||||
|
|
||||||
if (enc->fallback) {
|
if (enc->fallback) {
|
||||||
if (enc->codec == amf_codec_type::AVC)
|
if (enc->codec == amf_codec_type::AVC)
|
||||||
|
@ -1010,9 +1009,9 @@ try {
|
||||||
|
|
||||||
enc->cx = obs_encoder_get_width(enc->encoder);
|
enc->cx = obs_encoder_get_width(enc->encoder);
|
||||||
enc->cy = obs_encoder_get_height(enc->encoder);
|
enc->cy = obs_encoder_get_height(enc->encoder);
|
||||||
enc->amf_frame_rate = AMFConstructRate(ovi.fps_num, ovi.fps_den);
|
enc->amf_frame_rate = AMFConstructRate(voi->fps_num, voi->fps_den);
|
||||||
enc->fps_num = (int)ovi.fps_num;
|
enc->fps_num = (int)voi->fps_num;
|
||||||
enc->fps_den = (int)ovi.fps_den;
|
enc->fps_den = (int)voi->fps_den;
|
||||||
enc->full_range = info.range == VIDEO_RANGE_FULL;
|
enc->full_range = info.range == VIDEO_RANGE_FULL;
|
||||||
|
|
||||||
switch (info.colorspace) {
|
switch (info.colorspace) {
|
||||||
|
|
Loading…
Reference in a new issue