xvimagesink: calculate target rectangle correctly

Use the negotiated size and PAR to center the image into the target window.

See https://bugzilla.gnome.org/show_bug.cgi?id=680093
This commit is contained in:
Wim Taymans 2012-07-24 12:02:34 +02:00
parent 17ff2b0643
commit 9572ec0481

View 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 {