mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-27 09:38:17 +00:00
Use the parent display object, no need to maintain another one.
In the end, libgstvaapi-x11 reduced by 1 KB in .text vs. 0.1.1.
This commit is contained in:
parent
56658c7aac
commit
e4775c4e16
1 changed files with 63 additions and 78 deletions
|
@ -43,7 +43,6 @@ G_DEFINE_TYPE(GstVaapiWindowX11, gst_vaapi_window_x11, GST_VAAPI_TYPE_WINDOW);
|
||||||
GstVaapiWindowX11Private))
|
GstVaapiWindowX11Private))
|
||||||
|
|
||||||
struct _GstVaapiWindowX11Private {
|
struct _GstVaapiWindowX11Private {
|
||||||
GstVaapiDisplay *display;
|
|
||||||
Atom atom_NET_WM_STATE;
|
Atom atom_NET_WM_STATE;
|
||||||
Atom atom_NET_WM_STATE_FULLSCREEN;
|
Atom atom_NET_WM_STATE_FULLSCREEN;
|
||||||
guint create_window : 1;
|
guint create_window : 1;
|
||||||
|
@ -59,7 +58,7 @@ static void
|
||||||
send_wmspec_change_state(GstVaapiWindowX11 *window, Atom state, gboolean add)
|
send_wmspec_change_state(GstVaapiWindowX11 *window, Atom state, gboolean add)
|
||||||
{
|
{
|
||||||
GstVaapiWindowX11Private * const priv = window->priv;
|
GstVaapiWindowX11Private * const priv = window->priv;
|
||||||
Display * const dpy = GST_VAAPI_DISPLAY_XDISPLAY(priv->display);
|
Display * const dpy = GST_VAAPI_OBJECT_XDISPLAY(window);
|
||||||
XClientMessageEvent xclient;
|
XClientMessageEvent xclient;
|
||||||
|
|
||||||
memset(&xclient, 0, sizeof(xclient));
|
memset(&xclient, 0, sizeof(xclient));
|
||||||
|
@ -87,16 +86,15 @@ send_wmspec_change_state(GstVaapiWindowX11 *window, Atom state, gboolean add)
|
||||||
static void
|
static void
|
||||||
wait_event(GstVaapiWindow *window, int type)
|
wait_event(GstVaapiWindow *window, int type)
|
||||||
{
|
{
|
||||||
GstVaapiWindowX11Private * const priv = GST_VAAPI_WINDOW_X11(window)->priv;
|
Display * const dpy = GST_VAAPI_OBJECT_XDISPLAY(window);
|
||||||
Display * const dpy = GST_VAAPI_DISPLAY_XDISPLAY(priv->display);
|
const Window xid = GST_VAAPI_OBJECT_ID(window);
|
||||||
const Window xid = GST_VAAPI_OBJECT_ID(window);
|
XEvent e;
|
||||||
XEvent e;
|
Bool got_event;
|
||||||
Bool got_event;
|
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
GST_VAAPI_DISPLAY_LOCK(priv->display);
|
GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
|
||||||
got_event = XCheckTypedWindowEvent(dpy, xid, type, &e);
|
got_event = XCheckTypedWindowEvent(dpy, xid, type, &e);
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(priv->display);
|
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
|
||||||
if (got_event)
|
if (got_event)
|
||||||
break;
|
break;
|
||||||
g_usleep(10);
|
g_usleep(10);
|
||||||
|
@ -106,28 +104,27 @@ wait_event(GstVaapiWindow *window, int type)
|
||||||
static gboolean
|
static gboolean
|
||||||
timed_wait_event(GstVaapiWindow *window, int type, guint64 end_time, XEvent *e)
|
timed_wait_event(GstVaapiWindow *window, int type, guint64 end_time, XEvent *e)
|
||||||
{
|
{
|
||||||
GstVaapiWindowX11Private * const priv = GST_VAAPI_WINDOW_X11(window)->priv;
|
Display * const dpy = GST_VAAPI_OBJECT_XDISPLAY(window);
|
||||||
Display * const dpy = GST_VAAPI_DISPLAY_XDISPLAY(priv->display);
|
const Window xid = GST_VAAPI_OBJECT_ID(window);
|
||||||
const Window xid = GST_VAAPI_OBJECT_ID(window);
|
XEvent tmp_event;
|
||||||
XEvent tmp_event;
|
GTimeVal now;
|
||||||
GTimeVal now;
|
guint64 now_time;
|
||||||
guint64 now_time;
|
Bool got_event;
|
||||||
Bool got_event;
|
|
||||||
|
|
||||||
if (!e)
|
if (!e)
|
||||||
e = &tmp_event;
|
e = &tmp_event;
|
||||||
|
|
||||||
GST_VAAPI_DISPLAY_LOCK(priv->display);
|
GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
|
||||||
got_event = XCheckTypedWindowEvent(dpy, xid, type, e);
|
got_event = XCheckTypedWindowEvent(dpy, xid, type, e);
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(priv->display);
|
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
|
||||||
if (got_event)
|
if (got_event)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
g_usleep(10);
|
g_usleep(10);
|
||||||
GST_VAAPI_DISPLAY_LOCK(priv->display);
|
GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
|
||||||
got_event = XCheckTypedWindowEvent(dpy, xid, type, e);
|
got_event = XCheckTypedWindowEvent(dpy, xid, type, e);
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(priv->display);
|
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
|
||||||
if (got_event)
|
if (got_event)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
g_get_current_time(&now);
|
g_get_current_time(&now);
|
||||||
|
@ -140,15 +137,15 @@ static gboolean
|
||||||
gst_vaapi_window_x11_show(GstVaapiWindow *window)
|
gst_vaapi_window_x11_show(GstVaapiWindow *window)
|
||||||
{
|
{
|
||||||
GstVaapiWindowX11Private * const priv = GST_VAAPI_WINDOW_X11(window)->priv;
|
GstVaapiWindowX11Private * const priv = GST_VAAPI_WINDOW_X11(window)->priv;
|
||||||
Display * const dpy = GST_VAAPI_DISPLAY_XDISPLAY(priv->display);
|
Display * const dpy = GST_VAAPI_OBJECT_XDISPLAY(window);
|
||||||
const Window xid = GST_VAAPI_OBJECT_ID(window);
|
const Window xid = GST_VAAPI_OBJECT_ID(window);
|
||||||
XWindowAttributes wattr;
|
XWindowAttributes wattr;
|
||||||
gboolean has_errors;
|
gboolean has_errors;
|
||||||
|
|
||||||
if (priv->is_mapped)
|
if (priv->is_mapped)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
GST_VAAPI_DISPLAY_LOCK(priv->display);
|
GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
|
||||||
x11_trap_errors();
|
x11_trap_errors();
|
||||||
if (!priv->create_window) {
|
if (!priv->create_window) {
|
||||||
XGetWindowAttributes(dpy, xid, &wattr);
|
XGetWindowAttributes(dpy, xid, &wattr);
|
||||||
|
@ -157,17 +154,17 @@ gst_vaapi_window_x11_show(GstVaapiWindow *window)
|
||||||
}
|
}
|
||||||
XMapWindow(dpy, xid);
|
XMapWindow(dpy, xid);
|
||||||
has_errors = x11_untrap_errors() != 0;
|
has_errors = x11_untrap_errors() != 0;
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(priv->display);
|
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
|
||||||
|
|
||||||
if (!has_errors) {
|
if (!has_errors) {
|
||||||
wait_event(window, MapNotify);
|
wait_event(window, MapNotify);
|
||||||
if (!priv->create_window &&
|
if (!priv->create_window &&
|
||||||
!(wattr.your_event_mask & StructureNotifyMask)) {
|
!(wattr.your_event_mask & StructureNotifyMask)) {
|
||||||
GST_VAAPI_DISPLAY_LOCK(priv->display);
|
GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
|
||||||
x11_trap_errors();
|
x11_trap_errors();
|
||||||
XSelectInput(dpy, xid, wattr.your_event_mask);
|
XSelectInput(dpy, xid, wattr.your_event_mask);
|
||||||
has_errors = x11_untrap_errors() != 0;
|
has_errors = x11_untrap_errors() != 0;
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(priv->display);
|
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
|
||||||
}
|
}
|
||||||
priv->is_mapped = TRUE;
|
priv->is_mapped = TRUE;
|
||||||
|
|
||||||
|
@ -181,15 +178,15 @@ static gboolean
|
||||||
gst_vaapi_window_x11_hide(GstVaapiWindow *window)
|
gst_vaapi_window_x11_hide(GstVaapiWindow *window)
|
||||||
{
|
{
|
||||||
GstVaapiWindowX11Private * const priv = GST_VAAPI_WINDOW_X11(window)->priv;
|
GstVaapiWindowX11Private * const priv = GST_VAAPI_WINDOW_X11(window)->priv;
|
||||||
Display * const dpy = GST_VAAPI_DISPLAY_XDISPLAY(priv->display);
|
Display * const dpy = GST_VAAPI_OBJECT_XDISPLAY(window);
|
||||||
const Window xid = GST_VAAPI_OBJECT_ID(window);
|
const Window xid = GST_VAAPI_OBJECT_ID(window);
|
||||||
XWindowAttributes wattr;
|
XWindowAttributes wattr;
|
||||||
gboolean has_errors;
|
gboolean has_errors;
|
||||||
|
|
||||||
if (!priv->is_mapped)
|
if (!priv->is_mapped)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
GST_VAAPI_DISPLAY_LOCK(priv->display);
|
GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
|
||||||
x11_trap_errors();
|
x11_trap_errors();
|
||||||
if (!priv->create_window) {
|
if (!priv->create_window) {
|
||||||
XGetWindowAttributes(dpy, xid, &wattr);
|
XGetWindowAttributes(dpy, xid, &wattr);
|
||||||
|
@ -198,17 +195,17 @@ gst_vaapi_window_x11_hide(GstVaapiWindow *window)
|
||||||
}
|
}
|
||||||
XUnmapWindow(dpy, xid);
|
XUnmapWindow(dpy, xid);
|
||||||
has_errors = x11_untrap_errors() != 0;
|
has_errors = x11_untrap_errors() != 0;
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(priv->display);
|
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
|
||||||
|
|
||||||
if (!has_errors) {
|
if (!has_errors) {
|
||||||
wait_event(window, UnmapNotify);
|
wait_event(window, UnmapNotify);
|
||||||
if (!priv->create_window &&
|
if (!priv->create_window &&
|
||||||
!(wattr.your_event_mask & StructureNotifyMask)) {
|
!(wattr.your_event_mask & StructureNotifyMask)) {
|
||||||
GST_VAAPI_DISPLAY_LOCK(priv->display);
|
GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
|
||||||
x11_trap_errors();
|
x11_trap_errors();
|
||||||
XSelectInput(dpy, xid, wattr.your_event_mask);
|
XSelectInput(dpy, xid, wattr.your_event_mask);
|
||||||
has_errors = x11_untrap_errors() != 0;
|
has_errors = x11_untrap_errors() != 0;
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(priv->display);
|
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
|
||||||
}
|
}
|
||||||
priv->is_mapped = FALSE;
|
priv->is_mapped = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -219,11 +216,11 @@ static gboolean
|
||||||
gst_vaapi_window_x11_create(GstVaapiWindow *window, guint *width, guint *height)
|
gst_vaapi_window_x11_create(GstVaapiWindow *window, guint *width, guint *height)
|
||||||
{
|
{
|
||||||
GstVaapiWindowX11Private * const priv = GST_VAAPI_WINDOW_X11(window)->priv;
|
GstVaapiWindowX11Private * const priv = GST_VAAPI_WINDOW_X11(window)->priv;
|
||||||
Display * const dpy = GST_VAAPI_DISPLAY_XDISPLAY(priv->display);
|
Display * const dpy = GST_VAAPI_OBJECT_XDISPLAY(window);
|
||||||
Window xid = GST_VAAPI_OBJECT_ID(window);
|
Window xid = GST_VAAPI_OBJECT_ID(window);
|
||||||
XWindowAttributes wattr;
|
XWindowAttributes wattr;
|
||||||
Atom atoms[2];
|
Atom atoms[2];
|
||||||
gboolean ok;
|
gboolean ok;
|
||||||
|
|
||||||
static const char *atom_names[2] = {
|
static const char *atom_names[2] = {
|
||||||
"_NET_WM_STATE",
|
"_NET_WM_STATE",
|
||||||
|
@ -231,15 +228,15 @@ gst_vaapi_window_x11_create(GstVaapiWindow *window, guint *width, guint *height)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!priv->create_window && xid) {
|
if (!priv->create_window && xid) {
|
||||||
GST_VAAPI_DISPLAY_LOCK(priv->display);
|
GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
|
||||||
XGetWindowAttributes(dpy, xid, &wattr);
|
XGetWindowAttributes(dpy, xid, &wattr);
|
||||||
priv->is_mapped = wattr.map_state == IsViewable;
|
priv->is_mapped = wattr.map_state == IsViewable;
|
||||||
ok = x11_get_geometry(dpy, xid, NULL, NULL, width, height);
|
ok = x11_get_geometry(dpy, xid, NULL, NULL, width, height);
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(priv->display);
|
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_VAAPI_DISPLAY_LOCK(priv->display);
|
GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
|
||||||
XInternAtoms(dpy, (char **)atom_names, G_N_ELEMENTS(atom_names), False, atoms);
|
XInternAtoms(dpy, (char **)atom_names, G_N_ELEMENTS(atom_names), False, atoms);
|
||||||
priv->atom_NET_WM_STATE = atoms[0];
|
priv->atom_NET_WM_STATE = atoms[0];
|
||||||
priv->atom_NET_WM_STATE_FULLSCREEN = atoms[1];
|
priv->atom_NET_WM_STATE_FULLSCREEN = atoms[1];
|
||||||
|
@ -247,7 +244,7 @@ gst_vaapi_window_x11_create(GstVaapiWindow *window, guint *width, guint *height)
|
||||||
xid = x11_create_window(dpy, *width, *height);
|
xid = x11_create_window(dpy, *width, *height);
|
||||||
if (xid)
|
if (xid)
|
||||||
XRaiseWindow(dpy, xid);
|
XRaiseWindow(dpy, xid);
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(priv->display);
|
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
|
||||||
|
|
||||||
GST_DEBUG("xid %" GST_VAAPI_ID_FORMAT, GST_VAAPI_ID_ARGS(xid));
|
GST_DEBUG("xid %" GST_VAAPI_ID_FORMAT, GST_VAAPI_ID_ARGS(xid));
|
||||||
GST_VAAPI_OBJECT_ID(window) = xid;
|
GST_VAAPI_OBJECT_ID(window) = xid;
|
||||||
|
@ -258,22 +255,17 @@ static void
|
||||||
gst_vaapi_window_x11_destroy(GstVaapiWindow *window)
|
gst_vaapi_window_x11_destroy(GstVaapiWindow *window)
|
||||||
{
|
{
|
||||||
GstVaapiWindowX11Private * const priv = GST_VAAPI_WINDOW_X11(window)->priv;
|
GstVaapiWindowX11Private * const priv = GST_VAAPI_WINDOW_X11(window)->priv;
|
||||||
Display * const dpy = GST_VAAPI_DISPLAY_XDISPLAY(priv->display);
|
Display * const dpy = GST_VAAPI_OBJECT_XDISPLAY(window);
|
||||||
const Window xid = GST_VAAPI_OBJECT_ID(window);
|
const Window xid = GST_VAAPI_OBJECT_ID(window);
|
||||||
|
|
||||||
if (xid) {
|
if (xid) {
|
||||||
if (priv->create_window) {
|
if (priv->create_window) {
|
||||||
GST_VAAPI_DISPLAY_LOCK(priv->display);
|
GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
|
||||||
XDestroyWindow(dpy, xid);
|
XDestroyWindow(dpy, xid);
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(priv->display);
|
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
|
||||||
}
|
}
|
||||||
GST_VAAPI_OBJECT_ID(window) = None;
|
GST_VAAPI_OBJECT_ID(window) = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->display) {
|
|
||||||
g_object_unref(priv->display);
|
|
||||||
priv->display = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -284,9 +276,8 @@ gst_vaapi_window_x11_get_geometry(
|
||||||
guint *pwidth,
|
guint *pwidth,
|
||||||
guint *pheight)
|
guint *pheight)
|
||||||
{
|
{
|
||||||
GstVaapiWindowX11Private * const priv = GST_VAAPI_WINDOW_X11(window)->priv;
|
Display * const dpy = GST_VAAPI_OBJECT_XDISPLAY(window);
|
||||||
Display * const dpy = GST_VAAPI_DISPLAY_XDISPLAY(priv->display);
|
const Window xid = GST_VAAPI_OBJECT_ID(window);
|
||||||
const Window xid = GST_VAAPI_OBJECT_ID(window);
|
|
||||||
|
|
||||||
return x11_get_geometry(dpy, xid, px, py, pwidth, pheight);
|
return x11_get_geometry(dpy, xid, px, py, pwidth, pheight);
|
||||||
}
|
}
|
||||||
|
@ -295,15 +286,15 @@ static gboolean
|
||||||
gst_vaapi_window_x11_set_fullscreen(GstVaapiWindow *window, gboolean fullscreen)
|
gst_vaapi_window_x11_set_fullscreen(GstVaapiWindow *window, gboolean fullscreen)
|
||||||
{
|
{
|
||||||
GstVaapiWindowX11Private * const priv = GST_VAAPI_WINDOW_X11(window)->priv;
|
GstVaapiWindowX11Private * const priv = GST_VAAPI_WINDOW_X11(window)->priv;
|
||||||
Display * const dpy = GST_VAAPI_DISPLAY_XDISPLAY(priv->display);
|
Display * const dpy = GST_VAAPI_OBJECT_XDISPLAY(window);
|
||||||
const Window xid = GST_VAAPI_OBJECT_ID(window);
|
const Window xid = GST_VAAPI_OBJECT_ID(window);
|
||||||
XEvent e;
|
XEvent e;
|
||||||
guint width, height;
|
guint width, height;
|
||||||
gboolean has_errors;
|
gboolean has_errors;
|
||||||
GTimeVal now;
|
GTimeVal now;
|
||||||
guint64 end_time;
|
guint64 end_time;
|
||||||
|
|
||||||
GST_VAAPI_DISPLAY_LOCK(priv->display);
|
GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
|
||||||
x11_trap_errors();
|
x11_trap_errors();
|
||||||
if (fullscreen) {
|
if (fullscreen) {
|
||||||
if (!priv->is_mapped) {
|
if (!priv->is_mapped) {
|
||||||
|
@ -345,7 +336,7 @@ gst_vaapi_window_x11_set_fullscreen(GstVaapiWindow *window, gboolean fullscreen)
|
||||||
}
|
}
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
has_errors = x11_untrap_errors() != 0;
|
has_errors = x11_untrap_errors() != 0;
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(priv->display);
|
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
|
||||||
if (has_errors)
|
if (has_errors)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -356,7 +347,11 @@ gst_vaapi_window_x11_set_fullscreen(GstVaapiWindow *window, gboolean fullscreen)
|
||||||
end_time = DELAY + ((guint64)now.tv_sec * 1000000 + now.tv_usec);
|
end_time = DELAY + ((guint64)now.tv_sec * 1000000 + now.tv_usec);
|
||||||
while (timed_wait_event(window, ConfigureNotify, end_time, &e)) {
|
while (timed_wait_event(window, ConfigureNotify, end_time, &e)) {
|
||||||
if (fullscreen) {
|
if (fullscreen) {
|
||||||
gst_vaapi_display_get_size(priv->display, &width, &height);
|
gst_vaapi_display_get_size(
|
||||||
|
GST_VAAPI_OBJECT_DISPLAY(window),
|
||||||
|
&width,
|
||||||
|
&height
|
||||||
|
);
|
||||||
if (e.xconfigure.width == width && e.xconfigure.height == height)
|
if (e.xconfigure.width == width && e.xconfigure.height == height)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -373,22 +368,21 @@ gst_vaapi_window_x11_set_fullscreen(GstVaapiWindow *window, gboolean fullscreen)
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_vaapi_window_x11_resize(GstVaapiWindow *window, guint width, guint height)
|
gst_vaapi_window_x11_resize(GstVaapiWindow *window, guint width, guint height)
|
||||||
{
|
{
|
||||||
GstVaapiWindowX11Private * const priv = GST_VAAPI_WINDOW_X11(window)->priv;
|
|
||||||
gboolean has_errors;
|
gboolean has_errors;
|
||||||
|
|
||||||
if (!GST_VAAPI_OBJECT_ID(window))
|
if (!GST_VAAPI_OBJECT_ID(window))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
GST_VAAPI_DISPLAY_LOCK(priv->display);
|
GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
|
||||||
x11_trap_errors();
|
x11_trap_errors();
|
||||||
XResizeWindow(
|
XResizeWindow(
|
||||||
GST_VAAPI_DISPLAY_XDISPLAY(priv->display),
|
GST_VAAPI_OBJECT_XDISPLAY(window),
|
||||||
GST_VAAPI_OBJECT_ID(window),
|
GST_VAAPI_OBJECT_ID(window),
|
||||||
width,
|
width,
|
||||||
height
|
height
|
||||||
);
|
);
|
||||||
has_errors = x11_untrap_errors() != 0;
|
has_errors = x11_untrap_errors() != 0;
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(priv->display);
|
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
|
||||||
return !has_errors;
|
return !has_errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,21 +395,16 @@ gst_vaapi_window_x11_render(
|
||||||
guint flags
|
guint flags
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GstVaapiDisplay *display;
|
|
||||||
VASurfaceID surface_id;
|
VASurfaceID surface_id;
|
||||||
VAStatus status;
|
VAStatus status;
|
||||||
|
|
||||||
display = GST_VAAPI_OBJECT_DISPLAY(surface);
|
|
||||||
if (!display)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
surface_id = GST_VAAPI_OBJECT_ID(surface);
|
surface_id = GST_VAAPI_OBJECT_ID(surface);
|
||||||
if (surface_id == VA_INVALID_ID)
|
if (surface_id == VA_INVALID_ID)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
GST_VAAPI_DISPLAY_LOCK(display);
|
GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
|
||||||
status = vaPutSurface(
|
status = vaPutSurface(
|
||||||
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
GST_VAAPI_OBJECT_VADISPLAY(window),
|
||||||
surface_id,
|
surface_id,
|
||||||
GST_VAAPI_OBJECT_ID(window),
|
GST_VAAPI_OBJECT_ID(window),
|
||||||
src_rect->x,
|
src_rect->x,
|
||||||
|
@ -429,7 +418,7 @@ gst_vaapi_window_x11_render(
|
||||||
NULL, 0,
|
NULL, 0,
|
||||||
get_PutSurface_flags_from_GstVaapiSurfaceRenderFlags(flags)
|
get_PutSurface_flags_from_GstVaapiSurfaceRenderFlags(flags)
|
||||||
);
|
);
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(display);
|
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
|
||||||
if (!vaapi_check_status(status, "vaPutSurface()"))
|
if (!vaapi_check_status(status, "vaPutSurface()"))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -448,9 +437,6 @@ gst_vaapi_window_x11_constructed(GObject *object)
|
||||||
GstVaapiWindowX11 * const window = GST_VAAPI_WINDOW_X11(object);
|
GstVaapiWindowX11 * const window = GST_VAAPI_WINDOW_X11(object);
|
||||||
GObjectClass *parent_class;
|
GObjectClass *parent_class;
|
||||||
|
|
||||||
window->priv->display =
|
|
||||||
g_object_ref(gst_vaapi_window_get_display(GST_VAAPI_WINDOW(window)));
|
|
||||||
|
|
||||||
window->priv->create_window = GST_VAAPI_OBJECT_ID(object) == None;
|
window->priv->create_window = GST_VAAPI_OBJECT_ID(object) == None;
|
||||||
|
|
||||||
parent_class = G_OBJECT_CLASS(gst_vaapi_window_x11_parent_class);
|
parent_class = G_OBJECT_CLASS(gst_vaapi_window_x11_parent_class);
|
||||||
|
@ -485,7 +471,6 @@ gst_vaapi_window_x11_init(GstVaapiWindowX11 *window)
|
||||||
GstVaapiWindowX11Private *priv = GST_VAAPI_WINDOW_X11_GET_PRIVATE(window);
|
GstVaapiWindowX11Private *priv = GST_VAAPI_WINDOW_X11_GET_PRIVATE(window);
|
||||||
|
|
||||||
window->priv = priv;
|
window->priv = priv;
|
||||||
priv->display = NULL;
|
|
||||||
priv->create_window = TRUE;
|
priv->create_window = TRUE;
|
||||||
priv->is_mapped = FALSE;
|
priv->is_mapped = FALSE;
|
||||||
priv->fullscreen_on_map = FALSE;
|
priv->fullscreen_on_map = FALSE;
|
||||||
|
|
Loading…
Reference in a new issue