소스 검색

libobs: Pass exact data when calling obs_get_video_info

Originally, obs_get_video_info would recreate the obs_video_info
structure that was originally passed to it from obs_reset_video.  This
changes that to just store a copy of the obs_video_info when calling
obs_reset_video, and then copying that to the parameter of
obs_get_video_info when called.
jp9000 8 년 전
부모
커밋
ffef736640
2개의 변경된 파일4개의 추가작업 그리고 18개의 파일을 삭제
  1. 2 0
      libobs/obs-internal.h
  2. 2 18
      libobs/obs.c

+ 2 - 0
libobs/obs-internal.h

@@ -275,6 +275,8 @@ struct obs_core_video {
 	gs_effect_t                     *deinterlace_blend_2x_effect;
 	gs_effect_t                     *deinterlace_yadif_effect;
 	gs_effect_t                     *deinterlace_yadif_2x_effect;
+
+	struct obs_video_info           ovi;
 };
 
 struct audio_monitor;

+ 2 - 18
libobs/obs.c

@@ -390,6 +390,7 @@ static int obs_init_video(struct obs_video_info *ovi)
 		return OBS_VIDEO_FAIL;
 
 	video->thread_initialized = true;
+	video->ovi = *ovi;
 	return OBS_VIDEO_SUCCESS;
 }
 
@@ -1008,28 +1009,11 @@ bool obs_reset_audio(const struct obs_audio_info *oai)
 bool obs_get_video_info(struct obs_video_info *ovi)
 {
 	struct obs_core_video *video = &obs->video;
-	const struct video_output_info *info;
 
 	if (!obs || !video->graphics)
 		return false;
 
-	info = video_output_get_info(video->video);
-	if (!info)
-		return false;
-
-	memset(ovi, 0, sizeof(struct obs_video_info));
-	ovi->base_width    = video->base_width;
-	ovi->base_height   = video->base_height;
-	ovi->gpu_conversion= video->gpu_conversion;
-	ovi->scale_type    = video->scale_type;
-	ovi->colorspace    = info->colorspace;
-	ovi->range         = info->range;
-	ovi->output_width  = info->width;
-	ovi->output_height = info->height;
-	ovi->output_format = info->format;
-	ovi->fps_num       = info->fps_num;
-	ovi->fps_den       = info->fps_den;
-
+	*ovi = video->ovi;
 	return true;
 }