From 4f037a036bf138607df201e73ff3ff0f8fa449b4 Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Wed, 19 Oct 2016 15:09:34 +0100 Subject: [PATCH] libs: surface: add gst_vaapi_surface_{set,peek}_buffer_proxy() These functions are useful when a dmabuf-based memory is instantiated in order to relate the generated buffer @proxy with the processed @surface. https://bugzilla.gnome.org/show_bug.cgi?id=755072 --- gst-libs/gst/vaapi/gstvaapisurface.c | 33 ++++++++++++++++++++++++++++ gst-libs/gst/vaapi/gstvaapisurface.h | 7 ++++++ 2 files changed, 40 insertions(+) diff --git a/gst-libs/gst/vaapi/gstvaapisurface.c b/gst-libs/gst/vaapi/gstvaapisurface.c index 64add345ba..4c4bbeeb66 100644 --- a/gst-libs/gst/vaapi/gstvaapisurface.c +++ b/gst-libs/gst/vaapi/gstvaapisurface.c @@ -1039,3 +1039,36 @@ gst_vaapi_surface_set_subpictures_from_composition (GstVaapiSurface * surface, } return TRUE; } + +/** + * gst_vaapi_surface_set_buffer_proxy: + * @surface: a #GstVaapiSurface + * @proxy: an external #GstVaapiBufferProxy + * + * Replaces the external buffer proxy in @surface with @proxy. + * + * This is useful when a dmabuf-based memory is instantiated in order + * to relate the generated buffer @proxy with the processed @surface. + **/ +void +gst_vaapi_surface_set_buffer_proxy (GstVaapiSurface * surface, + GstVaapiBufferProxy * proxy) +{ + gst_vaapi_buffer_proxy_replace (&surface->extbuf_proxy, proxy); +} + +/** + * gst_vaapi_surface_peek_buffer_proxy: + * @surface: a #GstVaapiSurface + * + * This is useful when a dmabuf-based memory is instantiated in order + * to relate the generated buffer @proxy with the processed @surface. + * + * Returns: (transfer none): the associated external + * #GstVaapiBufferProxy + **/ +GstVaapiBufferProxy * +gst_vaapi_surface_peek_buffer_proxy (GstVaapiSurface * surface) +{ + return surface->extbuf_proxy; +} diff --git a/gst-libs/gst/vaapi/gstvaapisurface.h b/gst-libs/gst/vaapi/gstvaapisurface.h index b176a2cdfe..eaed6f8e60 100644 --- a/gst-libs/gst/vaapi/gstvaapisurface.h +++ b/gst-libs/gst/vaapi/gstvaapisurface.h @@ -233,6 +233,13 @@ gboolean gst_vaapi_surface_set_subpictures_from_composition (GstVaapiSurface * surface, GstVideoOverlayComposition * composition, gboolean propagate_context); +void +gst_vaapi_surface_set_buffer_proxy (GstVaapiSurface * surface, + GstVaapiBufferProxy * proxy); + +GstVaapiBufferProxy * +gst_vaapi_surface_peek_buffer_proxy (GstVaapiSurface * surface); + G_END_DECLS #endif /* GST_VAAPI_SURFACE_H */