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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8828>
This commit is contained in:
Andoni Morales Alastruey 2025-04-08 15:24:42 +02:00 committed by GStreamer Marge Bot
parent d0e18d6353
commit 37a57b57e6

View File

@ -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);
}
}