From ffef7366406bb207134c45353371ae3be3d1dce7 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Mon, 24 Apr 2017 03:18:36 -0700 Subject: [PATCH] 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. --- libobs/obs-internal.h | 2 ++ libobs/obs.c | 20 ++------------------ 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/libobs/obs-internal.h b/libobs/obs-internal.h index e9e0211d9..455efbaf6 100644 --- a/libobs/obs-internal.h +++ b/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; diff --git a/libobs/obs.c b/libobs/obs.c index d6f416c01..d9d8c79ef 100644 --- a/libobs/obs.c +++ b/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; }