window: re-indent all GstVaapiWindow related source code.

This commit is contained in:
Gwenole Beauchesne 2014-07-25 16:53:41 +02:00
parent 7c2c4c7a97
commit 3490212988
12 changed files with 1351 additions and 1464 deletions

View file

@ -43,15 +43,13 @@
static void
gst_vaapi_window_ensure_size (GstVaapiWindow * window)
{
const GstVaapiWindowClass * const klass =
GST_VAAPI_WINDOW_GET_CLASS(window);
const GstVaapiWindowClass *const klass = GST_VAAPI_WINDOW_GET_CLASS (window);
if (!window->check_geometry)
return;
if (klass->get_geometry)
klass->get_geometry(window, NULL, NULL,
&window->width, &window->height);
klass->get_geometry (window, NULL, NULL, &window->width, &window->height);
window->check_geometry = FALSE;
window->is_fullscreen = (window->width == window->display_width &&
@ -61,11 +59,8 @@ gst_vaapi_window_ensure_size(GstVaapiWindow *window)
static gboolean
gst_vaapi_window_create (GstVaapiWindow * window, guint width, guint height)
{
gst_vaapi_display_get_size(
GST_VAAPI_OBJECT_DISPLAY(window),
&window->display_width,
&window->display_height
);
gst_vaapi_display_get_size (GST_VAAPI_OBJECT_DISPLAY (window),
&window->display_width, &window->display_height);
if (!GST_VAAPI_WINDOW_GET_CLASS (window)->create (window, &width, &height))
return FALSE;
@ -294,23 +289,24 @@ gst_vaapi_window_get_height(GstVaapiWindow *window)
/**
* gst_vaapi_window_get_size:
* @window: a #GstVaapiWindow
* @pwidth: return location for the width, or %NULL
* @pheight: return location for the height, or %NULL
* @width_ptr: return location for the width, or %NULL
* @height_ptr: return location for the height, or %NULL
*
* Retrieves the dimensions of a #GstVaapiWindow.
*/
void
gst_vaapi_window_get_size(GstVaapiWindow *window, guint *pwidth, guint *pheight)
gst_vaapi_window_get_size (GstVaapiWindow * window, guint * width_ptr,
guint * height_ptr)
{
g_return_if_fail (window != NULL);
gst_vaapi_window_ensure_size (window);
if (pwidth)
*pwidth = window->width;
if (width_ptr)
*width_ptr = window->width;
if (pheight)
*pheight = window->height;
if (height_ptr)
*height_ptr = window->height;
}
/**
@ -406,13 +402,10 @@ get_window_rect(GstVaapiWindow *window, GstVaapiRectangle *rect)
* Return value: %TRUE on success
*/
gboolean
gst_vaapi_window_put_surface(
GstVaapiWindow *window,
gst_vaapi_window_put_surface (GstVaapiWindow * window,
GstVaapiSurface * surface,
const GstVaapiRectangle * src_rect,
const GstVaapiRectangle *dst_rect,
guint flags
)
const GstVaapiRectangle * dst_rect, guint flags)
{
const GstVaapiWindowClass *klass;
GstVaapiRectangle src_rect_default, dst_rect_default;
@ -465,12 +458,9 @@ get_pixmap_rect(GstVaapiPixmap *pixmap, GstVaapiRectangle *rect)
* Return value: %TRUE on success
*/
gboolean
gst_vaapi_window_put_pixmap(
GstVaapiWindow *window,
gst_vaapi_window_put_pixmap (GstVaapiWindow * window,
GstVaapiPixmap * pixmap,
const GstVaapiRectangle *src_rect,
const GstVaapiRectangle *dst_rect
)
const GstVaapiRectangle * src_rect, const GstVaapiRectangle * dst_rect)
{
const GstVaapiWindowClass *klass;
GstVaapiRectangle src_rect_default, dst_rect_default;

View file

@ -72,7 +72,8 @@ guint
gst_vaapi_window_get_height (GstVaapiWindow * window);
void
gst_vaapi_window_get_size(GstVaapiWindow *window, guint *pwidth, guint *pheight);
gst_vaapi_window_get_size (GstVaapiWindow * window, guint * width_ptr,
guint * height_ptr);
void
gst_vaapi_window_set_width (GstVaapiWindow * window, guint width);
@ -84,21 +85,13 @@ void
gst_vaapi_window_set_size (GstVaapiWindow * window, guint width, guint height);
gboolean
gst_vaapi_window_put_surface(
GstVaapiWindow *window,
GstVaapiSurface *surface,
const GstVaapiRectangle *src_rect,
const GstVaapiRectangle *dst_rect,
guint flags
);
gst_vaapi_window_put_surface (GstVaapiWindow * window,
GstVaapiSurface * surface, const GstVaapiRectangle * src_rect,
const GstVaapiRectangle * dst_rect, guint flags);
gboolean
gst_vaapi_window_put_pixmap(
GstVaapiWindow *window,
GstVaapiPixmap *pixmap,
const GstVaapiRectangle *src_rect,
const GstVaapiRectangle *dst_rect
);
gst_vaapi_window_put_pixmap (GstVaapiWindow * window, GstVaapiPixmap * pixmap,
const GstVaapiRectangle * src_rect, const GstVaapiRectangle * dst_rect);
G_END_DECLS

View file

@ -40,7 +40,8 @@ typedef struct _GstVaapiWindowDRMClass GstVaapiWindowDRMClass;
*
* A dummy DRM window abstraction.
*/
struct _GstVaapiWindowDRM {
struct _GstVaapiWindowDRM
{
/*< private >*/
GstVaapiWindow parent_instance;
};
@ -50,7 +51,8 @@ struct _GstVaapiWindowDRM {
*
* A dummy DRM window abstraction class.
*/
struct _GstVaapiWindowDRMClass {
struct _GstVaapiWindowDRMClass
{
/*< private >*/
GstVaapiWindowClass parent_instance;
};
@ -68,33 +70,23 @@ gst_vaapi_window_drm_hide(GstVaapiWindow *window)
}
static gboolean
gst_vaapi_window_drm_create(
GstVaapiWindow *window,
guint *width,
guint *height
)
gst_vaapi_window_drm_create (GstVaapiWindow * window,
guint * width, guint * height)
{
return TRUE;
}
static gboolean
gst_vaapi_window_drm_resize(
GstVaapiWindow * window,
guint width,
guint height
)
gst_vaapi_window_drm_resize (GstVaapiWindow * window, guint width, guint height)
{
return TRUE;
}
static gboolean
gst_vaapi_window_drm_render(
GstVaapiWindow *window,
gst_vaapi_window_drm_render (GstVaapiWindow * window,
GstVaapiSurface * surface,
const GstVaapiRectangle * src_rect,
const GstVaapiRectangle *dst_rect,
guint flags
)
const GstVaapiRectangle * dst_rect, guint flags)
{
return TRUE;
}
@ -102,8 +94,7 @@ gst_vaapi_window_drm_render(
void
gst_vaapi_window_drm_class_init (GstVaapiWindowDRMClass * klass)
{
GstVaapiWindowClass * const window_class =
GST_VAAPI_WINDOW_CLASS(klass);
GstVaapiWindowClass *const window_class = GST_VAAPI_WINDOW_CLASS (klass);
window_class->create = gst_vaapi_window_drm_create;
window_class->show = gst_vaapi_window_drm_show;
@ -117,10 +108,8 @@ gst_vaapi_window_drm_finalize(GstVaapiWindowDRM *window)
{
}
GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE(
GstVaapiWindowDRM,
gst_vaapi_window_drm,
gst_vaapi_window_drm_class_init(&g_class))
GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE (GstVaapiWindowDRM,
gst_vaapi_window_drm, gst_vaapi_window_drm_class_init (&g_class));
/**
* gst_vaapi_window_drm_new:
@ -141,16 +130,13 @@ GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE(
* Return value: the newly allocated #GstVaapiWindow object
*/
GstVaapiWindow *
gst_vaapi_window_drm_new(
GstVaapiDisplay *display,
guint width,
guint height
)
gst_vaapi_window_drm_new (GstVaapiDisplay * display, guint width, guint height)
{
GST_DEBUG ("new window, size %ux%u", width, height);
g_return_val_if_fail (GST_VAAPI_IS_DISPLAY_DRM (display), NULL);
return gst_vaapi_window_new(GST_VAAPI_WINDOW_CLASS(
gst_vaapi_window_drm_class()), display, width, height);
return
gst_vaapi_window_new (GST_VAAPI_WINDOW_CLASS (gst_vaapi_window_drm_class
()), display, width, height);
}

View file

@ -51,7 +51,8 @@
typedef struct _GstVaapiWindowGLXPrivate GstVaapiWindowGLXPrivate;
typedef struct _GstVaapiWindowGLXClass GstVaapiWindowGLXClass;
struct _GstVaapiWindowGLXPrivate {
struct _GstVaapiWindowGLXPrivate
{
Colormap cmap;
GLContextState *gl_context;
};
@ -61,7 +62,8 @@ struct _GstVaapiWindowGLXPrivate {
*
* An X11 #Window suitable for GLX rendering.
*/
struct _GstVaapiWindowGLX {
struct _GstVaapiWindowGLX
{
/*< private >*/
GstVaapiWindowX11 parent_instance;
@ -73,7 +75,8 @@ struct _GstVaapiWindowGLX {
*
* An X11 #Window suitable for GLX rendering.
*/
struct _GstVaapiWindowGLXClass {
struct _GstVaapiWindowGLXClass
{
/*< private >*/
GstVaapiWindowX11Class parent_class;
@ -83,12 +86,8 @@ struct _GstVaapiWindowGLXClass {
/* Fill rectangle coords with capped bounds */
static inline void
fill_rect(
GstVaapiRectangle *dst_rect,
const GstVaapiRectangle *src_rect,
guint width,
guint height
)
fill_rect (GstVaapiRectangle * dst_rect,
const GstVaapiRectangle * src_rect, guint width, guint height)
{
if (src_rect) {
dst_rect->x = src_rect->x > 0 ? src_rect->x : 0;
@ -101,8 +100,7 @@ fill_rect(
dst_rect->height = src_rect->height;
else
dst_rect->height = height - dst_rect->y;
}
else {
} else {
dst_rect->x = 0;
dst_rect->y = 0;
dst_rect->width = width;
@ -125,10 +123,8 @@ _gst_vaapi_window_glx_destroy_context(GstVaapiWindow *window)
}
static gboolean
_gst_vaapi_window_glx_create_context(
GstVaapiWindow *window,
GLXContext foreign_context
)
_gst_vaapi_window_glx_create_context (GstVaapiWindow * window,
GLXContext foreign_context)
{
GstVaapiWindowGLXPrivate *const priv =
GST_VAAPI_WINDOW_GLX_GET_PRIVATE (window);
@ -140,11 +136,8 @@ _gst_vaapi_window_glx_create_context(
parent_cs.context = foreign_context;
GST_VAAPI_OBJECT_LOCK_DISPLAY (window);
priv->gl_context = gl_create_context(
dpy,
GST_VAAPI_OBJECT_XSCREEN(window),
&parent_cs
);
priv->gl_context = gl_create_context (dpy,
GST_VAAPI_OBJECT_XSCREEN (window), &parent_cs);
if (!priv->gl_context) {
GST_DEBUG ("could not create GLX context");
goto end;
@ -165,10 +158,8 @@ end:
}
static gboolean
_gst_vaapi_window_glx_ensure_context(
GstVaapiWindow *window,
GLXContext foreign_context
)
_gst_vaapi_window_glx_ensure_context (GstVaapiWindow * window,
GLXContext foreign_context)
{
GstVaapiWindowGLXPrivate *const priv =
GST_VAAPI_WINDOW_GLX_GET_PRIVATE (window);
@ -182,10 +173,8 @@ _gst_vaapi_window_glx_ensure_context(
}
static gboolean
gst_vaapi_window_glx_ensure_context(
GstVaapiWindow *window,
GLXContext foreign_context
)
gst_vaapi_window_glx_ensure_context (GstVaapiWindow * window,
GLXContext foreign_context)
{
GstVaapiWindowGLXPrivate *const priv =
GST_VAAPI_WINDOW_GLX_GET_PRIVATE (window);
@ -264,16 +253,12 @@ gst_vaapi_window_glx_create_colormap(GstVaapiWindow *window)
x11_trap_errors ();
/* XXX: add a GstVaapiDisplayX11:x11-screen property? */
screen = GST_VAAPI_OBJECT_XSCREEN (window);
priv->cmap = XCreateColormap(
dpy,
priv->cmap = XCreateColormap (dpy,
RootWindow (dpy, screen),
priv->gl_context->visual->visual,
AllocNone
);
priv->gl_context->visual->visual, AllocNone);
success = x11_untrap_errors () == 0;
GST_VAAPI_OBJECT_UNLOCK_DISPLAY (window);
}
else {
} else {
GST_VAAPI_OBJECT_LOCK_DISPLAY (window);
x11_trap_errors ();
XGetWindowAttributes (dpy, GST_VAAPI_OBJECT_ID (window), &wattr);
@ -294,8 +279,7 @@ gst_vaapi_window_glx_get_colormap(GstVaapiWindow *window)
}
static gboolean
gst_vaapi_window_glx_resize(GstVaapiWindow *window,
guint width, guint height)
gst_vaapi_window_glx_resize (GstVaapiWindow * window, guint width, guint height)
{
GstVaapiWindowGLXPrivate *const priv =
GST_VAAPI_WINDOW_GLX_GET_PRIVATE (window);
@ -325,15 +309,14 @@ gst_vaapi_window_glx_finalize(GstVaapiWindowGLX *window)
_gst_vaapi_window_glx_destroy_context (base_window);
gst_vaapi_window_glx_destroy_colormap (base_window);
GST_VAAPI_WINDOW_GLX_GET_CLASS(window)->parent_finalize(
GST_VAAPI_OBJECT(window));
GST_VAAPI_WINDOW_GLX_GET_CLASS (window)->parent_finalize (GST_VAAPI_OBJECT
(window));
}
static void
gst_vaapi_window_glx_class_init (GstVaapiWindowGLXClass * klass)
{
GstVaapiWindowClass * const window_class =
GST_VAAPI_WINDOW_CLASS(klass);
GstVaapiWindowClass *const window_class = GST_VAAPI_WINDOW_CLASS (klass);
GstVaapiWindowX11Class *const xwindow_class =
GST_VAAPI_WINDOW_X11_CLASS (klass);
@ -345,10 +328,8 @@ gst_vaapi_window_glx_class_init(GstVaapiWindowGLXClass *klass)
xwindow_class->get_colormap = gst_vaapi_window_glx_get_colormap;
}
GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE(
GstVaapiWindowGLX,
gst_vaapi_window_glx,
gst_vaapi_window_glx_class_init(&g_class))
GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE (GstVaapiWindowGLX,
gst_vaapi_window_glx, gst_vaapi_window_glx_class_init (&g_class));
/**
* gst_vaapi_window_glx_new:
@ -369,8 +350,9 @@ gst_vaapi_window_glx_new(GstVaapiDisplay *display, guint width, guint height)
g_return_val_if_fail (GST_VAAPI_IS_DISPLAY_GLX (display), NULL);
window = gst_vaapi_window_new(GST_VAAPI_WINDOW_CLASS(
gst_vaapi_window_glx_class()), display, width, height);
window =
gst_vaapi_window_new (GST_VAAPI_WINDOW_CLASS (gst_vaapi_window_glx_class
()), display, width, height);
if (!window)
return NULL;
@ -405,8 +387,9 @@ gst_vaapi_window_glx_new_with_xid(GstVaapiDisplay *display, Window xid)
g_return_val_if_fail (GST_VAAPI_IS_DISPLAY_GLX (display), NULL);
g_return_val_if_fail (xid != None, NULL);
window = gst_vaapi_window_new_from_native(GST_VAAPI_WINDOW_CLASS(
gst_vaapi_window_glx_class()), display, GINT_TO_POINTER(xid));
window =
gst_vaapi_window_new_from_native (GST_VAAPI_WINDOW_CLASS
(gst_vaapi_window_glx_class ()), display, GINT_TO_POINTER (xid));
if (!window)
return NULL;
@ -514,12 +497,9 @@ gst_vaapi_window_glx_swap_buffers(GstVaapiWindowGLX *window)
* Return value: %TRUE on success
*/
gboolean
gst_vaapi_window_glx_put_texture(
GstVaapiWindowGLX *window,
gst_vaapi_window_glx_put_texture (GstVaapiWindowGLX * window,
GstVaapiTexture * texture,
const GstVaapiRectangle *src_rect,
const GstVaapiRectangle *dst_rect
)
const GstVaapiRectangle * src_rect, const GstVaapiRectangle * dst_rect)
{
GstVaapiRectangle tmp_src_rect, tmp_dst_rect;
GLTextureState ts;
@ -535,7 +515,8 @@ gst_vaapi_window_glx_put_texture(
fill_rect (&tmp_src_rect, src_rect, tex_width, tex_height);
src_rect = &tmp_src_rect;
gst_vaapi_window_get_size(GST_VAAPI_WINDOW(window), &win_width, &win_height);
gst_vaapi_window_get_size (GST_VAAPI_WINDOW (window), &win_width,
&win_height);
fill_rect (&tmp_dst_rect, dst_rect, win_width, win_height);
dst_rect = &tmp_dst_rect;
@ -558,10 +539,14 @@ gst_vaapi_window_glx_put_texture(
const float ty2 = (float) (src_rect->y + src_rect->height) / tex_height;
const guint w = dst_rect->width;
const guint h = dst_rect->height;
glTexCoord2f(tx1, ty1); glVertex2i(0, 0);
glTexCoord2f(tx1, ty2); glVertex2i(0, h);
glTexCoord2f(tx2, ty2); glVertex2i(w, h);
glTexCoord2f(tx2, ty1); glVertex2i(w, 0);
glTexCoord2f (tx1, ty1);
glVertex2i (0, 0);
glTexCoord2f (tx1, ty2);
glVertex2i (0, h);
glTexCoord2f (tx2, ty2);
glVertex2i (w, h);
glTexCoord2f (tx2, ty1);
glVertex2i (w, 0);
}
glEnd ();
glPopMatrix ();

View file

@ -56,12 +56,9 @@ void
gst_vaapi_window_glx_swap_buffers (GstVaapiWindowGLX * window);
gboolean
gst_vaapi_window_glx_put_texture(
GstVaapiWindowGLX *window,
GstVaapiTexture *texture,
const GstVaapiRectangle *src_rect,
const GstVaapiRectangle *dst_rect
);
gst_vaapi_window_glx_put_texture (GstVaapiWindowGLX * window,
GstVaapiTexture * texture, const GstVaapiRectangle * src_rect,
const GstVaapiRectangle * dst_rect);
G_END_DECLS

View file

@ -58,7 +58,8 @@ typedef gboolean (*GstVaapiWindowRenderPixmapFunc)(GstVaapiWindow *window,
*
* Base class for system-dependent windows.
*/
struct _GstVaapiWindow {
struct _GstVaapiWindow
{
/*< private >*/
GstVaapiObject parent_instance;
@ -84,7 +85,8 @@ struct _GstVaapiWindow {
*
* Base class for system-dependent windows.
*/
struct _GstVaapiWindowClass {
struct _GstVaapiWindowClass
{
/*< private >*/
GstVaapiObjectClass parent_class;
@ -104,8 +106,8 @@ gst_vaapi_window_new(const GstVaapiWindowClass *window_class,
GstVaapiDisplay * display, guint width, guint height);
GstVaapiWindow *
gst_vaapi_window_new_from_native(const GstVaapiWindowClass *window_class,
GstVaapiDisplay *display, gpointer native_window);
gst_vaapi_window_new_from_native (const GstVaapiWindowClass *
window_class, GstVaapiDisplay * display, gpointer native_window);
/* Inline reference counting for core libgstvaapi library */
#ifdef IN_LIBGSTVAAPI_CORE

View file

@ -50,7 +50,8 @@ typedef struct _GstVaapiWindowWaylandPrivate GstVaapiWindowWaylandPrivate;
typedef struct _GstVaapiWindowWaylandClass GstVaapiWindowWaylandClass;
typedef struct _FrameState FrameState;
struct _FrameState {
struct _FrameState
{
GstVaapiWindow *window;
GstVaapiSurface *surface;
GstVaapiVideoPool *surface_pool;
@ -83,8 +84,7 @@ frame_state_free(FrameState *frame)
if (frame->surface) {
if (frame->surface_pool)
gst_vaapi_video_pool_put_object(frame->surface_pool,
frame->surface);
gst_vaapi_video_pool_put_object (frame->surface_pool, frame->surface);
frame->surface = NULL;
}
gst_vaapi_video_pool_replace (&frame->surface_pool, NULL);
@ -101,7 +101,8 @@ frame_state_free(FrameState *frame)
g_slice_free (FrameState, frame);
}
struct _GstVaapiWindowWaylandPrivate {
struct _GstVaapiWindowWaylandPrivate
{
struct wl_shell_surface *shell_surface;
struct wl_surface *surface;
struct wl_region *opaque_region;
@ -120,7 +121,8 @@ struct _GstVaapiWindowWaylandPrivate {
*
* A Wayland window abstraction.
*/
struct _GstVaapiWindowWayland {
struct _GstVaapiWindowWayland
{
/*< private >*/
GstVaapiWindow parent_instance;
@ -132,7 +134,8 @@ struct _GstVaapiWindowWayland {
*
* An Wayland #Window wrapper class.
*/
struct _GstVaapiWindowWaylandClass {
struct _GstVaapiWindowWaylandClass
{
/*< private >*/
GstVaapiWindowClass parent_class;
};
@ -160,8 +163,7 @@ gst_vaapi_window_wayland_sync(GstVaapiWindow *window)
GST_VAAPI_WINDOW_WAYLAND_GET_PRIVATE (window);
if (priv->frame) {
struct wl_display * const wl_display =
GST_VAAPI_OBJECT_WL_DISPLAY(window);
struct wl_display *const wl_display = GST_VAAPI_OBJECT_WL_DISPLAY (window);
do {
if (wl_display_dispatch_queue (wl_display, priv->event_queue) < 0)
@ -196,7 +198,8 @@ static const struct wl_shell_surface_listener shell_surface_listener = {
};
static gboolean
gst_vaapi_window_wayland_set_fullscreen(GstVaapiWindow *window, gboolean fullscreen)
gst_vaapi_window_wayland_set_fullscreen (GstVaapiWindow * window,
gboolean fullscreen)
{
GstVaapiWindowWaylandPrivate *const priv =
GST_VAAPI_WINDOW_WAYLAND_GET_PRIVATE (window);
@ -209,23 +212,16 @@ gst_vaapi_window_wayland_set_fullscreen(GstVaapiWindow *window, gboolean fullscr
if (!fullscreen)
wl_shell_surface_set_toplevel (priv->shell_surface);
else {
wl_shell_surface_set_fullscreen(
priv->shell_surface,
WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE,
0,
NULL
);
wl_shell_surface_set_fullscreen (priv->shell_surface,
WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE, 0, NULL);
}
return TRUE;
}
static gboolean
gst_vaapi_window_wayland_create(
GstVaapiWindow *window,
guint *width,
guint *height
)
gst_vaapi_window_wayland_create (GstVaapiWindow * window,
guint * width, guint * height)
{
GstVaapiWindowWaylandPrivate *const priv =
GST_VAAPI_WINDOW_WAYLAND_GET_PRIVATE (window);
@ -304,11 +300,8 @@ gst_vaapi_window_wayland_destroy(GstVaapiWindow * window)
}
static gboolean
gst_vaapi_window_wayland_resize(
GstVaapiWindow * window,
guint width,
guint height
)
gst_vaapi_window_wayland_resize (GstVaapiWindow * window,
guint width, guint height)
{
GstVaapiWindowWaylandPrivate *const priv =
GST_VAAPI_WINDOW_WAYLAND_GET_PRIVATE (window);
@ -344,13 +337,10 @@ static const struct wl_callback_listener frame_callback_listener = {
};
static GstVaapiSurface *
vpp_convert(
GstVaapiWindow *window,
vpp_convert (GstVaapiWindow * window,
GstVaapiSurface * surface,
const GstVaapiRectangle * src_rect,
const GstVaapiRectangle *dst_rect,
guint flags
)
const GstVaapiRectangle * dst_rect, guint flags)
{
GstVaapiWindowWaylandPrivate *const priv =
GST_VAAPI_WINDOW_WAYLAND_GET_PRIVATE (window);
@ -388,8 +378,7 @@ vpp_convert(
if (!vpp_surface)
return NULL;
status = gst_vaapi_filter_process(priv->filter, surface, vpp_surface,
flags);
status = gst_vaapi_filter_process (priv->filter, surface, vpp_surface, flags);
if (status != GST_VAAPI_FILTER_STATUS_SUCCESS)
goto error_process_filter;
return vpp_surface;
@ -412,13 +401,10 @@ error_process_filter:
}
static gboolean
gst_vaapi_window_wayland_render(
GstVaapiWindow *window,
gst_vaapi_window_wayland_render (GstVaapiWindow * window,
GstVaapiSurface * surface,
const GstVaapiRectangle * src_rect,
const GstVaapiRectangle *dst_rect,
guint flags
)
const GstVaapiRectangle * dst_rect, guint flags)
{
GstVaapiWindowWaylandPrivate *const priv =
GST_VAAPI_WINDOW_WAYLAND_GET_PRIVATE (window);
@ -447,12 +433,9 @@ gst_vaapi_window_wayland_render(
if (!need_vpp) {
GST_VAAPI_OBJECT_LOCK_DISPLAY (window);
va_flags = from_GstVaapiSurfaceRenderFlags (flags);
status = vaGetSurfaceBufferWl(
GST_VAAPI_DISPLAY_VADISPLAY(display),
status = vaGetSurfaceBufferWl (GST_VAAPI_DISPLAY_VADISPLAY (display),
GST_VAAPI_OBJECT_ID (surface),
va_flags & (VA_TOP_FIELD|VA_BOTTOM_FIELD),
&buffer
);
va_flags & (VA_TOP_FIELD | VA_BOTTOM_FIELD), &buffer);
GST_VAAPI_OBJECT_UNLOCK_DISPLAY (window);
if (status == VA_STATUS_ERROR_FLAG_NOT_SUPPORTED)
need_vpp = TRUE;
@ -475,12 +458,8 @@ gst_vaapi_window_wayland_render(
}
GST_VAAPI_OBJECT_LOCK_DISPLAY (window);
status = vaGetSurfaceBufferWl(
GST_VAAPI_DISPLAY_VADISPLAY(display),
GST_VAAPI_OBJECT_ID(surface),
VA_FRAME_PICTURE,
&buffer
);
status = vaGetSurfaceBufferWl (GST_VAAPI_DISPLAY_VADISPLAY (display),
GST_VAAPI_OBJECT_ID (surface), VA_FRAME_PICTURE, &buffer);
GST_VAAPI_OBJECT_UNLOCK_DISPLAY (window);
if (!vaapi_check_status (status, "vaGetSurfaceBufferWl()"))
return FALSE;
@ -541,10 +520,8 @@ gst_vaapi_window_wayland_class_init(GstVaapiWindowWaylandClass * klass)
#define gst_vaapi_window_wayland_finalize \
gst_vaapi_window_wayland_destroy
GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE(
GstVaapiWindowWayland,
gst_vaapi_window_wayland,
gst_vaapi_window_wayland_class_init(&g_class))
GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE (GstVaapiWindowWayland,
gst_vaapi_window_wayland, gst_vaapi_window_wayland_class_init (&g_class));
/**
* gst_vaapi_window_wayland_new:
@ -559,16 +536,14 @@ GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE(
* Return value: the newly allocated #GstVaapiWindow object
*/
GstVaapiWindow *
gst_vaapi_window_wayland_new(
GstVaapiDisplay *display,
guint width,
guint height
)
gst_vaapi_window_wayland_new (GstVaapiDisplay * display,
guint width, guint height)
{
GST_DEBUG ("new window, size %ux%u", width, height);
g_return_val_if_fail (GST_VAAPI_IS_DISPLAY_WAYLAND (display), NULL);
return gst_vaapi_window_new(GST_VAAPI_WINDOW_CLASS(
gst_vaapi_window_wayland_class()), display, width, height);
return
gst_vaapi_window_new (GST_VAAPI_WINDOW_CLASS
(gst_vaapi_window_wayland_class ()), display, width, height);
}

View file

@ -33,7 +33,8 @@ G_BEGIN_DECLS
typedef struct _GstVaapiWindowWayland GstVaapiWindowWayland;
GstVaapiWindow *
gst_vaapi_window_wayland_new(GstVaapiDisplay *display, guint width, guint height);
gst_vaapi_window_wayland_new (GstVaapiDisplay * display, guint width,
guint height);
G_END_DECLS

View file

@ -68,13 +68,10 @@ send_wmspec_change_state(GstVaapiWindow *window, Atom state, gboolean add)
xclient.data.l[3] = 0;
xclient.data.l[4] = 0;
XSendEvent(
dpy,
XSendEvent (dpy,
DefaultRootWindow (dpy),
False,
SubstructureRedirectMask|SubstructureNotifyMask,
(XEvent *)&xclient
);
SubstructureRedirectMask | SubstructureNotifyMask, (XEvent *) & xclient);
}
static void
@ -96,7 +93,8 @@ wait_event(GstVaapiWindow *window, int type)
}
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)
{
Display *const dpy = GST_VAAPI_OBJECT_XDISPLAY (window);
const Window xid = GST_VAAPI_OBJECT_ID (window);
@ -209,7 +207,8 @@ gst_vaapi_window_x11_hide(GstVaapiWindow *window)
}
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_GET_PRIVATE (window);
@ -227,8 +226,8 @@ gst_vaapi_window_x11_create(GstVaapiWindow *window, guint *width, guint *height)
"_NET_WM_STATE_FULLSCREEN",
};
priv->has_xrender = GST_VAAPI_DISPLAY_HAS_XRENDER(
GST_VAAPI_OBJECT_DISPLAY(window));
priv->has_xrender =
GST_VAAPI_DISPLAY_HAS_XRENDER (GST_VAAPI_OBJECT_DISPLAY (window));
if (window->use_foreign_window && xid) {
GST_VAAPI_OBJECT_LOCK_DISPLAY (window);
@ -248,12 +247,8 @@ gst_vaapi_window_x11_create(GstVaapiWindow *window, guint *width, guint *height)
}
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_FULLSCREEN = atoms[1];
@ -295,12 +290,8 @@ gst_vaapi_window_x11_destroy(GstVaapiWindow *window)
}
static gboolean
gst_vaapi_window_x11_get_geometry(
GstVaapiWindow *window,
gint *px,
gint *py,
guint *pwidth,
guint *pheight)
gst_vaapi_window_x11_get_geometry (GstVaapiWindow * window,
gint * px, gint * py, guint * pwidth, guint * pheight)
{
Display *const dpy = GST_VAAPI_OBJECT_XDISPLAY (window);
const Window xid = GST_VAAPI_OBJECT_ID (window);
@ -309,7 +300,8 @@ gst_vaapi_window_x11_get_geometry(
}
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_GET_PRIVATE (window);
@ -327,38 +319,23 @@ gst_vaapi_window_x11_set_fullscreen(GstVaapiWindow *window, gboolean fullscreen)
if (!priv->is_mapped) {
priv->fullscreen_on_map = TRUE;
XChangeProperty(
dpy,
XChangeProperty (dpy,
xid,
priv->atom_NET_WM_STATE, XA_ATOM, 32,
PropModeReplace,
(unsigned char *)&priv->atom_NET_WM_STATE_FULLSCREEN, 1
);
(unsigned char *) &priv->atom_NET_WM_STATE_FULLSCREEN, 1);
} else {
send_wmspec_change_state (window,
priv->atom_NET_WM_STATE_FULLSCREEN, TRUE);
}
else {
send_wmspec_change_state(
window,
priv->atom_NET_WM_STATE_FULLSCREEN,
TRUE
);
}
}
else {
} else {
if (!priv->is_mapped) {
priv->fullscreen_on_map = FALSE;
XDeleteProperty(
dpy,
xid,
priv->atom_NET_WM_STATE
);
}
else {
send_wmspec_change_state(
window,
priv->atom_NET_WM_STATE_FULLSCREEN,
FALSE
);
XDeleteProperty (dpy, xid, priv->atom_NET_WM_STATE);
} else {
send_wmspec_change_state (window,
priv->atom_NET_WM_STATE_FULLSCREEN, FALSE);
}
}
XSync (dpy, False);
@ -374,15 +351,11 @@ gst_vaapi_window_x11_set_fullscreen(GstVaapiWindow *window, gboolean fullscreen)
end_time = DELAY + ((guint64) now.tv_sec * 1000000 + now.tv_usec);
while (timed_wait_event (window, ConfigureNotify, end_time, &e)) {
if (fullscreen) {
gst_vaapi_display_get_size(
GST_VAAPI_OBJECT_DISPLAY(window),
&width,
&height
);
gst_vaapi_display_get_size (GST_VAAPI_OBJECT_DISPLAY (window),
&width, &height);
if (e.xconfigure.width == width && e.xconfigure.height == height)
return TRUE;
}
else {
} else {
gst_vaapi_window_get_size (window, &width, &height);
if (e.xconfigure.width != width || e.xconfigure.height != height)
return TRUE;
@ -402,25 +375,18 @@ gst_vaapi_window_x11_resize(GstVaapiWindow *window, guint width, guint height)
GST_VAAPI_OBJECT_LOCK_DISPLAY (window);
x11_trap_errors ();
XResizeWindow(
GST_VAAPI_OBJECT_XDISPLAY(window),
GST_VAAPI_OBJECT_ID(window),
width,
height
);
XResizeWindow (GST_VAAPI_OBJECT_XDISPLAY (window),
GST_VAAPI_OBJECT_ID (window), width, height);
has_errors = x11_untrap_errors () != 0;
GST_VAAPI_OBJECT_UNLOCK_DISPLAY (window);
return !has_errors;
}
static gboolean
gst_vaapi_window_x11_render(
GstVaapiWindow *window,
gst_vaapi_window_x11_render (GstVaapiWindow * window,
GstVaapiSurface * surface,
const GstVaapiRectangle * src_rect,
const GstVaapiRectangle *dst_rect,
guint flags
)
const GstVaapiRectangle * dst_rect, guint flags)
{
VASurfaceID surface_id;
VAStatus status;
@ -430,8 +396,7 @@ gst_vaapi_window_x11_render(
return FALSE;
GST_VAAPI_OBJECT_LOCK_DISPLAY (window);
status = vaPutSurface(
GST_VAAPI_OBJECT_VADISPLAY(window),
status = vaPutSurface (GST_VAAPI_OBJECT_VADISPLAY (window),
surface_id,
GST_VAAPI_OBJECT_ID (window),
src_rect->x,
@ -441,9 +406,7 @@ gst_vaapi_window_x11_render(
dst_rect->x,
dst_rect->y,
dst_rect->width,
dst_rect->height,
NULL, 0,
from_GstVaapiSurfaceRenderFlags(flags)
dst_rect->height, NULL, 0, from_GstVaapiSurfaceRenderFlags (flags)
);
GST_VAAPI_OBJECT_UNLOCK_DISPLAY (window);
if (!vaapi_check_status (status, "vaPutSurface()"))
@ -453,12 +416,9 @@ gst_vaapi_window_x11_render(
}
static gboolean
gst_vaapi_window_x11_render_pixmap_xrender(
GstVaapiWindow *window,
gst_vaapi_window_x11_render_pixmap_xrender (GstVaapiWindow * window,
GstVaapiPixmap * pixmap,
const GstVaapiRectangle *src_rect,
const GstVaapiRectangle *dst_rect
)
const GstVaapiRectangle * src_rect, const GstVaapiRectangle * dst_rect)
{
#ifdef HAVE_XRENDER
GstVaapiWindowX11Private *const priv =
@ -541,12 +501,9 @@ gst_vaapi_window_x11_render_pixmap_xrender(
}
static gboolean
gst_vaapi_window_x11_render_pixmap(
GstVaapiWindow *window,
gst_vaapi_window_x11_render_pixmap (GstVaapiWindow * window,
GstVaapiPixmap * pixmap,
const GstVaapiRectangle *src_rect,
const GstVaapiRectangle *dst_rect
)
const GstVaapiRectangle * src_rect, const GstVaapiRectangle * dst_rect)
{
GstVaapiWindowX11Private *const priv =
GST_VAAPI_WINDOW_X11_GET_PRIVATE (window);
@ -562,10 +519,8 @@ gst_vaapi_window_x11_render_pixmap(
void
gst_vaapi_window_x11_class_init (GstVaapiWindowX11Class * klass)
{
GstVaapiObjectClass * const object_class =
GST_VAAPI_OBJECT_CLASS(klass);
GstVaapiWindowClass * const window_class =
GST_VAAPI_WINDOW_CLASS(klass);
GstVaapiObjectClass *const object_class = GST_VAAPI_OBJECT_CLASS (klass);
GstVaapiWindowClass *const window_class = GST_VAAPI_WINDOW_CLASS (klass);
object_class->finalize = (GstVaapiObjectFinalizeFunc)
gst_vaapi_window_x11_destroy;
@ -583,10 +538,8 @@ gst_vaapi_window_x11_class_init(GstVaapiWindowX11Class *klass)
#define gst_vaapi_window_x11_finalize \
gst_vaapi_window_x11_destroy
GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE(
GstVaapiWindowX11,
gst_vaapi_window_x11,
gst_vaapi_window_x11_class_init(&g_class))
GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE (GstVaapiWindowX11,
gst_vaapi_window_x11, gst_vaapi_window_x11_class_init (&g_class));
/**
* gst_vaapi_window_x11_new:
@ -607,8 +560,9 @@ gst_vaapi_window_x11_new(GstVaapiDisplay *display, guint width, guint height)
g_return_val_if_fail (GST_VAAPI_IS_DISPLAY_X11 (display), NULL);
return gst_vaapi_window_new(GST_VAAPI_WINDOW_CLASS(
gst_vaapi_window_x11_class()), display, width, height);
return
gst_vaapi_window_new (GST_VAAPI_WINDOW_CLASS (gst_vaapi_window_x11_class
()), display, width, height);
}
/**
@ -631,8 +585,9 @@ gst_vaapi_window_x11_new_with_xid(GstVaapiDisplay *display, Window xid)
g_return_val_if_fail (GST_VAAPI_IS_DISPLAY_X11 (display), NULL);
g_return_val_if_fail (xid != None, NULL);
return gst_vaapi_window_new_from_native(GST_VAAPI_WINDOW_CLASS(
gst_vaapi_window_x11_class()), display, GINT_TO_POINTER(xid));
return
gst_vaapi_window_new_from_native (GST_VAAPI_WINDOW_CLASS
(gst_vaapi_window_x11_class ()), display, GINT_TO_POINTER (xid));
}
/**

View file

@ -45,7 +45,8 @@ G_BEGIN_DECLS
typedef struct _GstVaapiWindowX11Private GstVaapiWindowX11Private;
typedef struct _GstVaapiWindowX11Class GstVaapiWindowX11Class;
struct _GstVaapiWindowX11Private {
struct _GstVaapiWindowX11Private
{
Atom atom_NET_WM_STATE;
Atom atom_NET_WM_STATE_FULLSCREEN;
#ifdef HAVE_XRENDER
@ -61,7 +62,8 @@ struct _GstVaapiWindowX11Private {
*
* An X11 #Window wrapper.
*/
struct _GstVaapiWindowX11 {
struct _GstVaapiWindowX11
{
/*< private >*/
GstVaapiWindow parent_instance;
@ -77,7 +79,8 @@ struct _GstVaapiWindowX11 {
*
* An X11 #Window wrapper class.
*/
struct _GstVaapiWindowX11Class {
struct _GstVaapiWindowX11Class
{
/*< private >*/
GstVaapiWindowClass parent_class;