+2004-02-17 Julien MOUTTE <julien@moutte.net>
+
+ * sys/ximage/ximagesink.c: (gst_ximagesink_renegotiate_size),
+ (gst_ximagesink_expose): Renegotiate size on expose.
+ * sys/xvimage/xvimagesink.c: (gst_xvimagesink_expose): Update window
+ size on expose.
+
2004-02-16 Benjamin Otte <in7y118@public.uni-hamburg.de>
* testsuite/alsa/sinesrc.c:
{
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
+ if (!ximagesink->xwindow)
+ return;
+
/* Window got resized or moved. We do caps negotiation again to get video
- scaler to fit that new size only if size of the window changed. */
+ scaler to fit that new size only if size of the window differs from our
+ size. */
- if ( (ximagesink->xwindow->width != width) ||
- (ximagesink->xwindow->height != height) )
+ if (GST_VIDEOSINK_WIDTH (ximagesink) != width ||
+ GST_VIDEOSINK_HEIGHT (ximagesink) != height)
{
GstPadLinkReturn r;
ximagesink->xwindow->width = width;
static void
gst_ximagesink_expose (GstXOverlay *overlay)
{
+ XWindowAttributes attr;
GstXImageSink *ximagesink = GST_XIMAGESINK (overlay);
- if (ximagesink->cur_image)
+ if (!ximagesink->xwindow)
+ return;
+
+ /* Update the window geometry */
+ g_mutex_lock (ximagesink->x_lock);
+ XGetWindowAttributes (ximagesink->xcontext->disp,
+ ximagesink->xwindow->win, &attr);
+ g_mutex_unlock (ximagesink->x_lock);
+
+ /* If window is 1x1 it's probably invisible */
+ if (attr.width == 1 && attr.height == 1)
+ return;
+
+ if (gst_pad_is_negotiated (GST_VIDEOSINK_PAD (ximagesink)))
+ gst_ximagesink_renegotiate_size (ximagesink, attr.width, attr.height);
+
+ gst_ximagesink_xwindow_clear (ximagesink, ximagesink->xwindow);
+
+ if (ximagesink->cur_image) {
gst_ximagesink_ximage_put (ximagesink, ximagesink->cur_image);
+ }
}
static void
static void
gst_xvimagesink_expose (GstXOverlay *overlay)
{
+ XWindowAttributes attr;
GstXvImageSink *xvimagesink = GST_XVIMAGESINK (overlay);
+
+ if (!xvimagesink->xwindow)
+ return;
+
+ /* Update the window geometry */
+ g_mutex_lock (xvimagesink->x_lock);
+ XGetWindowAttributes (xvimagesink->xcontext->disp,
+ xvimagesink->xwindow->win, &attr);
+ g_mutex_unlock (xvimagesink->x_lock);
+
+ xvimagesink->xwindow->width = attr.width;
+ xvimagesink->xwindow->height = attr.height;
if (xvimagesink->cur_image) {
gst_xvimagesink_xvimage_put (xvimagesink, xvimagesink->cur_image);