From 37a57b57e6fc1890b253433323f31fac02fde95f Mon Sep 17 00:00:00 2001 From: Andoni Morales Alastruey Date: Tue, 8 Apr 2025 15:24:42 +0200 Subject: [PATCH] ges: fix frame position for sources with par < 1 In #8693 the issue was fixed for par > 1 without noticing that it was also broken for par > 1. Given that the natural width and height only changes when par != 1, the logic is simplified to do: * par_n < par_d -> the height is corrected * par_n > par_d -> the width is corrected Part-of: --- .../gst-editing-services/ges/ges-video-uri-source.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/subprojects/gst-editing-services/ges/ges-video-uri-source.c b/subprojects/gst-editing-services/ges/ges-video-uri-source.c index 80ac63d46f..b3044f1a4d 100644 --- a/subprojects/gst-editing-services/ges/ges-video-uri-source.c +++ b/subprojects/gst-editing-services/ges/ges-video-uri-source.c @@ -122,13 +122,11 @@ ges_video_uri_source_get_natural_size (GESVideoSource * source, gint * width, par_n = gst_discoverer_video_info_get_par_num (info); par_d = gst_discoverer_video_info_get_par_denom (info); - if (par_n > 0 && par_d > 0) { - if (*height % par_n == 0) { + if (par_n != par_d && par_n > 0 && par_d > 0) { + if (par_n < par_d) { *height = gst_util_uint64_scale_int (*height, par_d, par_n); - } else if (*width % par_d == 0) { - *width = gst_util_uint64_scale_int (*width, par_n, par_d); } else { - *width = gst_util_uint64_scale_int (*height, par_d, par_n); + *width = gst_util_uint64_scale_int (*width, par_n, par_d); } }