summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2020-07-21 10:03:19 +0200
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-07-27 15:02:19 +0000
commit72d32a91d25e2b6ca5e2508f8a46c0dca25d172f (patch)
tree9fa75c527bd5f6055cab491ee17fb1ea9f847d20
parent856b9d59808dee22673be096470e70bfdad19ae9 (diff)
downloadgstreamer-vaapi-72d32a91d25e2b6ca5e2508f8a46c0dca25d172f.tar.gz
libs: window: allow choosing the format for the vpp pool
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/346>
-rw-r--r--gst-libs/gst/vaapi/gstvaapiwindow.c18
-rw-r--r--gst-libs/gst/vaapi/gstvaapiwindow_priv.h6
2 files changed, 23 insertions, 1 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiwindow.c b/gst-libs/gst/vaapi/gstvaapiwindow.c
index 35ba42cf..19085408 100644
--- a/gst-libs/gst/vaapi/gstvaapiwindow.c
+++ b/gst-libs/gst/vaapi/gstvaapiwindow.c
@@ -98,6 +98,19 @@ error_unsupported_format:
}
}
+void
+gst_vaapi_window_set_vpp_format_internal (GstVaapiWindow * window,
+ GstVideoFormat format, guint flags)
+{
+ if (window->surface_pool_format == format &&
+ window->surface_pool_flags == flags)
+ return;
+
+ gst_vaapi_video_pool_replace (&window->surface_pool, NULL);
+ window->surface_pool_format = format;
+ window->surface_pool_flags = flags;
+}
+
static gboolean
ensure_filter_surface_pool (GstVaapiWindow * window)
{
@@ -109,7 +122,8 @@ ensure_filter_surface_pool (GstVaapiWindow * window)
/* Ensure VA surface pool is created */
/* XXX: optimize the surface format to use. e.g. YUY2 */
window->surface_pool = gst_vaapi_surface_pool_new (display,
- GST_VIDEO_FORMAT_NV12, window->width, window->height, 0);
+ window->surface_pool_format, window->width, window->height,
+ window->surface_pool_flags);
if (!window->surface_pool) {
GST_WARNING ("failed to create surface pool for conversion");
return FALSE;
@@ -229,6 +243,8 @@ gst_vaapi_window_new_internal (GType type, GstVaapiDisplay * display,
if (!window)
return NULL;
+ window->surface_pool_format = GST_VIDEO_FORMAT_NV12;
+
window->use_foreign_window = id != GST_VAAPI_ID_INVALID;
GST_VAAPI_WINDOW_ID (window) = window->use_foreign_window ? id : 0;
diff --git a/gst-libs/gst/vaapi/gstvaapiwindow_priv.h b/gst-libs/gst/vaapi/gstvaapiwindow_priv.h
index 09be19c3..a0b05827 100644
--- a/gst-libs/gst/vaapi/gstvaapiwindow_priv.h
+++ b/gst-libs/gst/vaapi/gstvaapiwindow_priv.h
@@ -83,6 +83,8 @@ struct _GstVaapiWindow
guint check_geometry:1;
/* for conversion */
+ GstVideoFormat surface_pool_format;
+ guint surface_pool_flags;
GstVaapiVideoPool *surface_pool;
GstVaapiFilter *filter;
gboolean has_vpp;
@@ -138,6 +140,10 @@ gst_vaapi_window_vpp_convert_internal (GstVaapiWindow * window,
GstVaapiSurface * surface, const GstVaapiRectangle * src_rect,
const GstVaapiRectangle * dst_rect, guint flags);
+void
+gst_vaapi_window_set_vpp_format_internal (GstVaapiWindow * window,
+ GstVideoFormat format, guint flags);
+
G_END_DECLS
#endif /* GST_VAAPI_WINDOW_PRIV_H */