x(v)imagesink: take new size from event thread and do not poll for every frame

We can update the geometry in ConfigureNotify (unless we disable event-
handling). If event handling is disabled, one should use _expose() to trigger a
redraw and update the geometry.
This commit is contained in:
Stefan Kost 2010-02-16 12:06:08 +02:00
parent 7050c0e7cd
commit 7b13aeee32
2 changed files with 10 additions and 5 deletions

View file

@ -719,8 +719,6 @@ gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstXImageBuffer * ximage)
}
}
gst_ximagesink_xwindow_update_geometry (ximagesink, ximagesink->xwindow);
src.w = ximage->width;
src.h = ximage->height;
dst.w = ximagesink->xwindow->width;
@ -1079,6 +1077,10 @@ gst_ximagesink_handle_xevents (GstXImageSink * ximagesink)
exposed = TRUE;
break;
case ConfigureNotify:
g_mutex_unlock (ximagesink->x_lock);
gst_ximagesink_xwindow_update_geometry (ximagesink,
ximagesink->xwindow);
g_mutex_lock (ximagesink->x_lock);
configured = TRUE;
break;
default:
@ -1805,7 +1807,6 @@ gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
}
/* What is our geometry */
gst_ximagesink_xwindow_update_geometry (ximagesink, ximagesink->xwindow);
dst.w = ximagesink->xwindow->width;
dst.h = ximagesink->xwindow->height;
@ -2061,6 +2062,7 @@ gst_ximagesink_expose (GstXOverlay * overlay)
{
GstXImageSink *ximagesink = GST_XIMAGESINK (overlay);
gst_ximagesink_xwindow_update_geometry (ximagesink, ximagesink->xwindow);
gst_ximagesink_ximage_put (ximagesink, NULL);
}

View file

@ -808,8 +808,6 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink,
}
}
gst_xvimagesink_xwindow_update_geometry (xvimagesink, xvimagesink->xwindow);
/* We use the calculated geometry from _setcaps as a source to respect
source and screen pixel aspect ratios. */
src.w = GST_VIDEO_SINK_WIDTH (xvimagesink);
@ -1266,6 +1264,10 @@ gst_xvimagesink_handle_xevents (GstXvImageSink * xvimagesink)
exposed = TRUE;
break;
case ConfigureNotify:
g_mutex_unlock (xvimagesink->x_lock);
gst_xvimagesink_xwindow_update_geometry (xvimagesink,
xvimagesink->xwindow);
g_mutex_lock (xvimagesink->x_lock);
configured = TRUE;
break;
default:
@ -2809,6 +2811,7 @@ gst_xvimagesink_expose (GstXOverlay * overlay)
{
GstXvImageSink *xvimagesink = GST_XVIMAGESINK (overlay);
gst_xvimagesink_xwindow_update_geometry (xvimagesink, xvimagesink->xwindow);
gst_xvimagesink_xvimage_put (xvimagesink, NULL);
}