Quellcode durchsuchen

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.
Alex Luccisano vor 1 Jahr
Ursprung
Commit
c0f71f002c
1 geänderte Dateien mit 8 neuen und 9 gelöschten Zeilen
  1. 8 9
      plugins/obs-ffmpeg/texture-amf.cpp

+ 8 - 9
plugins/obs-ffmpeg/texture-amf.cpp

@@ -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) {