Fix video rendering rect within an embedder window (Totem).

This commit is contained in:
gb 2010-05-17 08:55:51 +00:00 committed by Gwenole Beauchesne
parent 643d08ef23
commit 28f85a916d
2 changed files with 54 additions and 1 deletions

1
NEWS
View file

@ -2,6 +2,7 @@ gst-vaapi NEWS -- summary of changes. 2010-05-DD
Copyright (C) 2010 Splitted-Desktop Systems
Version 0.2.4 - DD.May.2010
* Fix video rendering rect within an embedder window (Totem)
* Disable GLX rendering when vaapisink uses a foreign X window
Version 0.2.3 - 16.May.2010

View file

@ -186,6 +186,57 @@ gst_vaapisink_destroy(GstVaapiSink *sink)
}
}
/* Checks whether a ConfigureNotify event is in the queue */
typedef struct _ConfigureNotifyEventPendingArgs ConfigureNotifyEventPendingArgs;
struct _ConfigureNotifyEventPendingArgs {
Window window;
guint width;
guint height;
gboolean match;
};
static Bool
configure_notify_event_pending_cb(Display *dpy, XEvent *xev, XPointer arg)
{
ConfigureNotifyEventPendingArgs * const args =
(ConfigureNotifyEventPendingArgs *)arg;
if (xev->type == ConfigureNotify &&
xev->xconfigure.window == args->window &&
xev->xconfigure.width == args->width &&
xev->xconfigure.height == args->height)
args->match = TRUE;
/* XXX: this is a hack to traverse the whole queue because we
can't use XPeekIfEvent() since it could block */
return False;
}
static gboolean
configure_notify_event_pending(
GstVaapiSink *sink,
Window window,
guint width,
guint height
)
{
ConfigureNotifyEventPendingArgs args;
XEvent xev;
args.window = window;
args.width = width;
args.height = height;
args.match = FALSE;
/* XXX: don't use XPeekIfEvent() because it might block */
XCheckIfEvent(
gst_vaapi_display_x11_get_display(GST_VAAPI_DISPLAY_X11(sink->display)),
&xev,
configure_notify_event_pending_cb, (XPointer)&args
);
return args.match;
}
static inline gboolean
gst_vaapisink_ensure_display(GstVaapiSink *sink)
{
@ -319,7 +370,8 @@ gst_vaapisink_ensure_window_xid(GstVaapiSink *sink, XID xid)
);
gst_vaapi_display_unlock(sink->display);
if (width != sink->window_width || height != sink->window_height) {
if ((width != sink->window_width || height != sink->window_height) &&
!configure_notify_event_pending(sink, xid, width, height)) {
if (!gst_vaapisink_ensure_render_rect(sink, width, height))
return FALSE;
sink->window_width = width;