mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 23:36:38 +00:00
videoscale: Choose the best dimensions for fixed PAR
We might not get an exact match for width or height if stepped ranges are involved.
This commit is contained in:
parent
21d34edb1e
commit
89519e8809
1 changed files with 7 additions and 3 deletions
|
@ -978,10 +978,14 @@ gst_video_scale_fixate_caps (GstBaseTransform * base, GstPadDirection direction,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If all this failed, keep the height that was nearest to the orignal
|
/* If all this failed, keep the dimensions with the DAR that was closest
|
||||||
* height and the nearest possible width. This changes the DAR but
|
* to the correct DAR. This changes the DAR but there's not much else to
|
||||||
* there's not much else to do here.
|
* do here.
|
||||||
*/
|
*/
|
||||||
|
if (set_w * ABS (set_h - h) < ABS (f_w - w) * f_h) {
|
||||||
|
f_h = set_h;
|
||||||
|
f_w = set_w;
|
||||||
|
}
|
||||||
gst_structure_set (outs, "width", G_TYPE_INT, f_w, "height", G_TYPE_INT,
|
gst_structure_set (outs, "width", G_TYPE_INT, f_w, "height", G_TYPE_INT,
|
||||||
f_h, NULL);
|
f_h, NULL);
|
||||||
goto done;
|
goto done;
|
||||||
|
|
Loading…
Reference in a new issue