diff options
author | Hyunjun Ko <zzoon@igalia.com> | 2020-06-19 09:21:16 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2020-07-31 14:02:33 +0200 |
commit | a362d99e9e3bb705f4c4fd1e1e3aa869d86ec342 (patch) | |
tree | 8cca97e276cde6f8d59057acb832a839f33d162d /gst-libs | |
parent | a5f37a21ec4c56e0237793c51f441c1de1c0bf08 (diff) |
libs: window: implements gst_vaapi_window_set_render_rectangle
Implements new vmethod gst_vaapi_window_set_render_rectangle,
which is doing set the information of the rendered rectangle set by
user.
This is necessary on wayland at least to get exact information of
external surface.
And vaapisink calls this when gst_video_overlay_set_render_rectangle is
called.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/342>
Diffstat (limited to 'gst-libs')
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiwindow.c | 26 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiwindow.h | 4 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiwindow_priv.h | 1 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiwindow_wayland.c | 12 |
4 files changed, 43 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiwindow.c b/gst-libs/gst/vaapi/gstvaapiwindow.c index 01514038..7fd4502f 100644 --- a/gst-libs/gst/vaapi/gstvaapiwindow.c +++ b/gst-libs/gst/vaapi/gstvaapiwindow.c @@ -414,6 +414,32 @@ gst_vaapi_window_get_fullscreen (GstVaapiWindow * window) } /** + * gst_vaapi_window_set_render_rectangle: + * @window: a #GstVaapiWindow + * @x: the horizontal offset of the render area inside the window + * @y: the vertical offset of the render area inside the window + * @width: the width of the render area inside the window + * @height: the height of the render area inside the window + * + * Set information of the render area. + * + * Since: 1.18 + */ +void +gst_vaapi_window_set_render_rectangle (GstVaapiWindow * window, gint x, gint y, + gint width, gint height) +{ + const GstVaapiWindowClass *klass; + + g_return_if_fail (window != NULL); + + klass = GST_VAAPI_WINDOW_GET_CLASS (window); + + if (klass->set_render_rect) + klass->set_render_rect (window, x, y, width, height); +} + +/** * gst_vaapi_window_set_fullscreen: * @window: a #GstVaapiWindow * @fullscreen: %TRUE to request window to get fullscreen diff --git a/gst-libs/gst/vaapi/gstvaapiwindow.h b/gst-libs/gst/vaapi/gstvaapiwindow.h index 56344396..c1628f79 100644 --- a/gst-libs/gst/vaapi/gstvaapiwindow.h +++ b/gst-libs/gst/vaapi/gstvaapiwindow.h @@ -85,6 +85,10 @@ gst_vaapi_window_set_height (GstVaapiWindow * window, guint height); void gst_vaapi_window_set_size (GstVaapiWindow * window, guint width, guint height); +void +gst_vaapi_window_set_render_rectangle (GstVaapiWindow * window, gint x, gint y, + gint width, gint height); + gboolean gst_vaapi_window_put_surface (GstVaapiWindow * window, GstVaapiSurface * surface, const GstVaapiRectangle * src_rect, diff --git a/gst-libs/gst/vaapi/gstvaapiwindow_priv.h b/gst-libs/gst/vaapi/gstvaapiwindow_priv.h index a0b05827..168e002c 100644 --- a/gst-libs/gst/vaapi/gstvaapiwindow_priv.h +++ b/gst-libs/gst/vaapi/gstvaapiwindow_priv.h @@ -129,6 +129,7 @@ struct _GstVaapiWindowClass guintptr (*get_colormap) (GstVaapiWindow * window); gboolean (*unblock) (GstVaapiWindow * window); gboolean (*unblock_cancel) (GstVaapiWindow * window); + void (*set_render_rect) (GstVaapiWindow * window, gint x, gint y, gint width, gint height); }; GstVaapiWindow * diff --git a/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c b/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c index 4cf76a15..0f596e59 100644 --- a/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c +++ b/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c @@ -531,6 +531,17 @@ gst_vaapi_window_wayland_resize (GstVaapiWindow * window, return TRUE; } +void +gst_vaapi_window_wayland_set_render_rect (GstVaapiWindow * window, gint x, + gint y, gint width, gint height) +{ + GstVaapiWindowWaylandPrivate *const priv = + GST_VAAPI_WINDOW_WAYLAND_GET_PRIVATE (window); + + if (priv->video_subsurface) + wl_subsurface_set_position (priv->video_subsurface, x, y); +} + static inline gboolean frame_done (FrameState * frame) { @@ -991,6 +1002,7 @@ gst_vaapi_window_wayland_class_init (GstVaapiWindowWaylandClass * klass) window_class->set_fullscreen = gst_vaapi_window_wayland_set_fullscreen; window_class->unblock = gst_vaapi_window_wayland_unblock; window_class->unblock_cancel = gst_vaapi_window_wayland_unblock_cancel; + window_class->set_render_rect = gst_vaapi_window_wayland_set_render_rect; signals[SIZE_CHANGED] = g_signal_new ("size-changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, |