gst/videoscale/gstvideoscale.c: PAR can be non-fixed when not provided as argument (#162626).

Original commit message from CVS:
* gst/videoscale/gstvideoscale.c: (gst_videoscale_link):
PAR can be non-fixed when not provided as argument (#162626).
This commit is contained in:
Ronald S. Bultje 2005-01-29 13:24:33 +00:00
parent be8b0be739
commit a1e2e9442d
2 changed files with 19 additions and 8 deletions

View file

@ -1,3 +1,8 @@
2005-01-29 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst/videoscale/gstvideoscale.c: (gst_videoscale_link):
PAR can be non-fixed when not provided as argument (#162626).
2005-01-29 David Moore <dcm@acm.org>
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>

View file

@ -263,14 +263,20 @@ gst_videoscale_link (GstPad * pad, const GstCaps * caps)
otherstructure = gst_caps_get_structure (othercaps, 0);
otherpar = gst_structure_get_value (otherstructure, "pixel-aspect-ratio");
if (par && otherpar) {
gint num = gst_value_get_fraction_numerator (par),
den = gst_value_get_fraction_denominator (par),
onum = gst_value_get_fraction_numerator (otherpar),
oden = gst_value_get_fraction_denominator (otherpar);
gboolean keep_h,
w_align = (width * num * oden % (den * onum) == 0),
h_align = (height * den * onum % (num * oden) == 0),
w_inc = (num * oden > den * onum);
gint num, den, onum, oden;
gboolean keep_h, w_align, h_align, w_inc;
/* otherpar can be a list */
if (G_VALUE_TYPE (otherpar) == GST_TYPE_LIST)
otherpar = gst_value_list_get_value (otherpar, 0);
num = gst_value_get_fraction_numerator (par);
den = gst_value_get_fraction_denominator (par);
onum = gst_value_get_fraction_numerator (otherpar);
oden = gst_value_get_fraction_denominator (otherpar);
w_align = (width * num * oden % (den * onum) == 0);
h_align = (height * den * onum % (num * oden) == 0);
w_inc = (num * oden > den * onum);
/* decide whether to change width or height */
if (w_align && w_inc)