From 9ccdbce4bdf9cbd25db202ca81a1e5d89c180aee Mon Sep 17 00:00:00 2001 From: Sreerenj Balachandran Date: Mon, 1 Jan 2001 04:59:28 +0200 Subject: [PATCH] gstvaapisurfacepool: Add new API to create surface pool based on chroma type This new API gst_vaapi_surface_pool_new_with_chroma_type() is for creating a new GstVaapiVideoPool of GstVaapiSurfaces with the specified chroam type and dimensions. The underlying format of the surfaces is implementation (driver) defined. --- gst-libs/gst/vaapi/gstvaapisurfacepool.c | 36 ++++++++++++++++++++++++++++++++ gst-libs/gst/vaapi/gstvaapisurfacepool.h | 4 ++++ 2 files changed, 40 insertions(+) diff --git a/gst-libs/gst/vaapi/gstvaapisurfacepool.c b/gst-libs/gst/vaapi/gstvaapisurfacepool.c index 02c0606..65bc65c 100644 --- a/gst-libs/gst/vaapi/gstvaapisurfacepool.c +++ b/gst-libs/gst/vaapi/gstvaapisurfacepool.c @@ -164,3 +164,39 @@ error: gst_vaapi_mini_object_unref (GST_VAAPI_MINI_OBJECT (pool)); return NULL; } + +/** + * gst_vaapi_surface_pool_new_with_chroma_type: + * @display: a #GstVaapiDisplay + * @chroma_type: a #GstVaapiChromatype + * @width: the desired width, in pixels + * @height: the desired height, in pixels + * + * Creates a new #GstVaapiVideoPool of #GstVaapiSurface with the specified + * chroam type and dimensions. The underlying format of the surfaces is + * implementation (driver) defined. + * + * Return value: the newly allocated #GstVaapiVideoPool + */ +GstVaapiVideoPool * +gst_vaapi_surface_pool_new_with_chroma_type (GstVaapiDisplay * display, + GstVaapiChromaType chroma_type, guint width, guint height) +{ + GstVaapiVideoPool *pool; + GstVideoInfo vi; + + g_return_val_if_fail (display != NULL, NULL); + g_return_val_if_fail (chroma_type > 0, NULL); + g_return_val_if_fail (width > 0, NULL); + g_return_val_if_fail (height > 0, NULL); + + gst_video_info_set_format (&vi, GST_VIDEO_FORMAT_ENCODED, width, height); + + pool = gst_vaapi_surface_pool_new_full (display, &vi, 0); + if (!pool) + return NULL; + + GST_VAAPI_SURFACE_POOL (pool)->chroma_type = chroma_type; + + return pool; +} diff --git a/gst-libs/gst/vaapi/gstvaapisurfacepool.h b/gst-libs/gst/vaapi/gstvaapisurfacepool.h index e0529a2..8c5a1ef 100644 --- a/gst-libs/gst/vaapi/gstvaapisurfacepool.h +++ b/gst-libs/gst/vaapi/gstvaapisurfacepool.h @@ -44,6 +44,10 @@ GstVaapiVideoPool * gst_vaapi_surface_pool_new_full (GstVaapiDisplay * display, const GstVideoInfo * vip, guint flags); +GstVaapiVideoPool * +gst_vaapi_surface_pool_new_with_chroma_type (GstVaapiDisplay * display, + GstVaapiChromaType chroma_type, guint width, guint height); + G_END_DECLS #endif /* GST_VAAPI_SURFACE_POOL_H */ -- 2.7.4