From a1e2e9442d977e1a5ced2fba18d634af9138e02f Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sat, 29 Jan 2005 13:24:33 +0000 Subject: [PATCH] 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). --- ChangeLog | 5 +++++ gst/videoscale/gstvideoscale.c | 22 ++++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index aba6885..8bd470e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-01-29 Ronald S. Bultje + + * gst/videoscale/gstvideoscale.c: (gst_videoscale_link): + PAR can be non-fixed when not provided as argument (#162626). + 2005-01-29 David Moore Reviewed by: Ronald S. Bultje diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c index febb5cc..b458726 100644 --- a/gst/videoscale/gstvideoscale.c +++ b/gst/videoscale/gstvideoscale.c @@ -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) -- 2.7.4