xvimagesink: calculate target rectangle correctly
authorWim Taymans <wim.taymans@collabora.co.uk>
Tue, 24 Jul 2012 10:02:34 +0000 (12:02 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Tue, 24 Jul 2012 10:02:34 +0000 (12:02 +0200)
Use the negotiated size and PAR to center the image into the target window.

See https://bugzilla.gnome.org/show_bug.cgi?id=680093

sys/xvimage/xvimagesink.c

index 2acecec..1c63c45 100644 (file)
@@ -333,10 +333,17 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink, GstBuffer * xvimage)
   }
 
   if (xvimagesink->keep_aspect) {
+    GstVideoRectangle s;
+
+    /* We take the size of the source material as it was negotiated and
+     * corrected for DAR. This size can be different from the cropped size in
+     * which case the image will be scaled to fit the negotiated size. */
+    s.w = GST_VIDEO_SINK_WIDTH (xvimagesink);
+    s.h = GST_VIDEO_SINK_HEIGHT (xvimagesink);
     dst.w = xvimagesink->render_rect.w;
     dst.h = xvimagesink->render_rect.h;
 
-    gst_video_sink_center_rect (src, dst, &result, TRUE);
+    gst_video_sink_center_rect (s, dst, &result, TRUE);
     result.x += xvimagesink->render_rect.x;
     result.y += xvimagesink->render_rect.y;
   } else {