summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8549f9c)
raw | patch | inline | side by side (parent: 8549f9c)
author | Vincent Penquerc'h <vincent.penquerch@collabora.co.uk> | |
Mon, 9 Jul 2012 10:54:57 +0000 (10:54 +0000) | ||
committer | Nikhil Devshatwar <a0132237@ti.com> | |
Wed, 15 May 2013 13:18:07 +0000 (18:48 +0530) |
When a video with crop rectangle was used, the window was created with
the uncropped size, and kept that way after the crop event was received,
leading to a slight scaling of the video (and likely slight aspect ratio
change as well).
This is fixed by resizing the window to the cropped size when it changes.
the uncropped size, and kept that way after the crop event was received,
leading to a slight scaling of the video (and likely slight aspect ratio
change as well).
This is fixed by resizing the window to the cropped size when it changes.
sys/pvr2d/gstpvrvideosink.c | patch | blob | history |
index 54ef681910b3570bc3ee69b4d23611b62a566c0f..3e7b7aa9c7361805cc14fbf53df8f981905a706e 100644 (file)
/* Element stuff */
+static void
+gst_pvrvideosink_resize_window (GstPVRVideoSink * pvrvideosink, gint width,
+ gint height)
+{
+ XResizeWindow (pvrvideosink->dcontext->x_display,
+ pvrvideosink->xwindow->window, width, height);
+ gst_pvrvideosink_xwindow_update_geometry (pvrvideosink);
+}
+
static gboolean
gst_pvrvideosink_configure_overlay (GstPVRVideoSink * pvrvideosink, gint width,
gint height, gint video_par_n, gint video_par_d, gint display_par_n,
@@ -1122,6 +1131,8 @@ gst_pvrvideosink_configure_overlay (GstPVRVideoSink * pvrvideosink, gint width,
{
guint calculated_par_n;
guint calculated_par_d;
+ gint old_sink_width = GST_VIDEO_SINK_WIDTH (pvrvideosink);
+ gint old_sink_height = GST_VIDEO_SINK_HEIGHT (pvrvideosink);
if (!gst_video_calculate_display_ratio (&calculated_par_n, &calculated_par_d,
width, height, video_par_n, video_par_d, display_par_n,
@@ -1161,6 +1172,19 @@ gst_pvrvideosink_configure_overlay (GstPVRVideoSink * pvrvideosink, gint width,
GST_VIDEO_SINK_WIDTH (pvrvideosink),
GST_VIDEO_SINK_HEIGHT (pvrvideosink));
+ if (old_sink_width != GST_VIDEO_SINK_WIDTH (pvrvideosink)
+ || old_sink_height != GST_VIDEO_SINK_HEIGHT (pvrvideosink)) {
+ g_mutex_lock (pvrvideosink->flow_lock);
+ if (pvrvideosink->xwindow) {
+ GST_DEBUG_OBJECT (pvrvideosink,
+ "Resizing window to match new overlay size");
+ gst_pvrvideosink_resize_window (pvrvideosink,
+ GST_VIDEO_SINK_WIDTH (pvrvideosink),
+ GST_VIDEO_SINK_HEIGHT (pvrvideosink));
+ }
+ g_mutex_unlock (pvrvideosink->flow_lock);
+ }
+
return TRUE;
}