Commit abc323c5 authored by Jean-Paul Saman's avatar Jean-Paul Saman

src/xvba_video_glx.c: Use the window as provided by the user.

The code now assumes a window has been created by the client applications.
That window is used directly as an output for video pictures. This changes
makes it possible to draw an overlay ontop of the output window. The previous
code did not allow for this, since the video output window would always over
write the overlay.
parent 6665fe36
......@@ -1811,15 +1811,6 @@ glx_output_surface_destroy(
}
if (obj_output->gl_window.xid != None) {
#if 0
/* User's XDestroyWindow() on the parent window will destroy
our child windows too */
if (!obj_output->parent) {
XUnmapWindow(driver_data->x11_dpy, obj_output->gl_window.xid);
x11_wait_event(driver_data->x11_dpy, obj_output->gl_window.xid, UnmapNotify);
XDestroyWindow(driver_data->x11_dpy, obj_output->gl_window.xid);
}
#endif
obj_output->gl_window.xid = None;
}
......@@ -1886,69 +1877,10 @@ glx_output_surface_create(
}
}
static GLint gl_visual_attr[] = {
GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DOUBLEBUFFER,
GL_NONE
};
XWindowAttributes wattr;
XGetWindowAttributes(driver_data->x11_dpy, window, &wattr);
int depth = wattr.depth;
if (depth != 15 && depth != 16 && depth != 24 && depth != 32)
depth = 24;
obj_output->gl_window.vi = glXChooseVisual(
driver_data->x11_dpy,
driver_data->x11_screen,
gl_visual_attr
);
if (!obj_output->gl_window.vi)
goto error;
obj_output->gl_window.cmap = XCreateColormap(
driver_data->x11_dpy,
RootWindow(driver_data->x11_dpy, driver_data->x11_screen),
obj_output->gl_window.vi->visual,
AllocNone
);
if (obj_output->gl_window.cmap == None)
goto error;
x11_get_window_colorkey(driver_data->x11_dpy, window, 0, 0, &obj_output->bgcolor);
if (driver_data->va_background_color)
obj_output->bgcolor = driver_data->va_background_color->value;
XSetWindowAttributes xswa;
unsigned long xswa_mask = CWBorderPixel | CWBackPixel | CWColormap;
xswa.border_pixel = BlackPixel(driver_data->x11_dpy, driver_data->x11_screen);
xswa.background_pixel = obj_output->bgcolor;
xswa.colormap = obj_output->gl_window.cmap;
obj_output->gl_window.xid = XCreateWindow(
driver_data->x11_dpy,
window,
0,
0,
width,
height,
0,
depth,
InputOutput,
obj_output->gl_window.vi->visual,
xswa_mask, &xswa
);
obj_output->gl_window.xid = window;
if (obj_output->gl_window.xid == None)
goto error;
XSelectInput(driver_data->x11_dpy, obj_output->gl_window.xid, StructureNotifyMask);
XMapWindow(driver_data->x11_dpy, obj_output->gl_window.xid);
XLowerWindow(driver_data->x11_dpy, obj_output->gl_window.xid);
x11_wait_event(driver_data->x11_dpy, obj_output->gl_window.xid, MapNotify);
/* XXX: assume the program will only be using vaPutSurface() and
doesn't have any other GLX context managed itself */
ASSERT(driver_data->va_display_type == VA_DISPLAY_X11);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment