Index: gstvideoscale.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst/videoscale/gstvideoscale.c,v
retrieving revision 1.88
diff -u -p -r1.88 gstvideoscale.c
--- gstvideoscale.c	14 Nov 2006 23:08:38 -0000	1.88
+++ gstvideoscale.c	17 Nov 2006 15:45:37 -0000
@@ -355,20 +355,8 @@ gst_video_scale_transform_caps (GstBaseT
 
   /* if pixel aspect ratio, make a range of it */
   if ((par = gst_structure_get_value (structure, "pixel-aspect-ratio"))) {
-    GstCaps *copy;
-    GstStructure *cstruct;
-
-    /* copy input PAR first, this is the prefered PAR */
-    gst_structure_set_value (structure, "pixel-aspect-ratio", par);
-
-    /* then make a copy with a fraction range as a second choice */
-    copy = gst_caps_copy (ret);
-    cstruct = gst_caps_get_structure (copy, 0);
-    gst_structure_set (cstruct,
+    gst_structure_set (structure,
         "pixel-aspect-ratio", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
-
-    /* and append */
-    gst_caps_append (ret, copy);
   }
 
   GST_DEBUG_OBJECT (trans, "returning caps: %" GST_PTR_FORMAT, ret);
@@ -578,19 +566,11 @@ gst_video_scale_fixate_caps (GstBaseTran
     from_par_n = gst_value_get_fraction_numerator (from_par);
     from_par_d = gst_value_get_fraction_denominator (from_par);
 
-    /* fixate the out PAR */
-    if (!gst_value_is_fixed (to_par)) {
-      GST_DEBUG_OBJECT (base, "fixating to_par to %dx%d", from_par_n,
-          from_par_d);
-      gst_structure_fixate_field_nearest_fraction (outs, "pixel-aspect-ratio",
-          from_par_n, from_par_d);
-    }
-
-    to_par_n = gst_value_get_fraction_numerator (to_par);
-    to_par_d = gst_value_get_fraction_denominator (to_par);
+    gst_structure_get_int (ins, "width", &from_w);
+    gst_structure_get_int (ins, "height", &from_h);
 
     /* if both width and height are already fixed, we can't do anything
-     * about it anymore */
+     * about them anymore. */
     if (gst_structure_get_int (outs, "width", &w))
       ++count;
     if (gst_structure_get_int (outs, "height", &h))
@@ -598,11 +578,32 @@ gst_video_scale_fixate_caps (GstBaseTran
     if (count == 2) {
       GST_DEBUG_OBJECT (base, "dimensions already set to %dx%d, not fixating",
           w, h);
+      /* But we can set to_par if it's not fixed */
+      if (!gst_value_is_fixed (to_par)) {
+        /* At this point we have out_width, out_height, in_width, out_width,
+         * and in_par. So, figure out an out_par to match, and try to use it.
+         * Abuse this function, which does the right thing if we pass it the
+         * arguments in this order...
+         */
+        if (gst_video_calculate_display_ratio (&num, &den, from_w, from_h,
+            from_par_n, from_par_d, w, h)) {
+          gst_structure_fixate_field_nearest_fraction (outs, 
+              "pixel-aspect-ratio", num, den);
+        }
+      }
       return;
     }
 
-    gst_structure_get_int (ins, "width", &from_w);
-    gst_structure_get_int (ins, "height", &from_h);
+    /* fixate the out PAR */
+    if (!gst_value_is_fixed (to_par)) {
+      GST_DEBUG_OBJECT (base, "fixating to_par to %dx%d", from_par_n,
+          from_par_d);
+      gst_structure_fixate_field_nearest_fraction (outs, "pixel-aspect-ratio",
+          from_par_n, from_par_d);
+    }
+
+    to_par_n = gst_value_get_fraction_numerator (to_par);
+    to_par_d = gst_value_get_fraction_denominator (to_par);
 
     if (!gst_video_calculate_display_ratio (&num, &den, from_w, from_h,
             from_par_n, from_par_d, to_par_n, to_par_d)) {
