libs: surface: surfacepool: Add allocation flags in constructors.

This commit is contained in:
Víctor Manuel Jáquez Leal 2020-01-24 22:08:50 +01:00
parent 3ff51a6e52
commit 8c08ef31a5
9 changed files with 25 additions and 15 deletions

View file

@ -171,7 +171,7 @@ context_ensure_surfaces (GstVaapiContext * context)
for (i = context->surfaces->len; i < num_surfaces; i++) {
if (format != GST_VIDEO_FORMAT_UNKNOWN) {
surface = gst_vaapi_surface_new_with_format (display, format, cip->width,
cip->height);
cip->height, 0);
} else {
surface = gst_vaapi_surface_new (display, cip->chroma_type, cip->width,
cip->height);
@ -204,7 +204,7 @@ context_create_surfaces (GstVaapiContext * context)
if (!context->surfaces_pool) {
context->surfaces_pool =
gst_vaapi_surface_pool_new_with_chroma_type (display, cip->chroma_type,
cip->width, cip->height);
cip->width, cip->height, 0);
if (!context->surfaces_pool)
return FALSE;

View file

@ -426,6 +426,7 @@ error:
* @format: the surface format
* @width: the requested surface width
* @height: the requested surface height
* @surface_allocation_flags: (optional) allocation flags
*
* Creates a new #GstVaapiSurface with the specified pixel format and
* dimensions.
@ -436,12 +437,13 @@ error:
*/
GstVaapiSurface *
gst_vaapi_surface_new_with_format (GstVaapiDisplay * display,
GstVideoFormat format, guint width, guint height)
GstVideoFormat format, guint width, guint height,
guint surface_allocation_flags)
{
GstVideoInfo vi;
gst_video_info_set_format (&vi, format, width, height);
return gst_vaapi_surface_new_full (display, &vi, 0);
return gst_vaapi_surface_new_full (display, &vi, surface_allocation_flags);
}
/**

View file

@ -216,7 +216,8 @@ gst_vaapi_surface_new_full (GstVaapiDisplay * display,
GstVaapiSurface *
gst_vaapi_surface_new_with_format (GstVaapiDisplay * display,
GstVideoFormat format, guint width, guint height);
GstVideoFormat format, guint width, guint height,
guint surface_allocation_flags);
GstVaapiSurface *
gst_vaapi_surface_new_from_buffer_proxy (GstVaapiDisplay * display,

View file

@ -147,7 +147,7 @@ create_surface_from_egl_image (GstVaapiDisplayEGL * display,
GST_VAAPI_CHROMA_TYPE_YUV420, width, height);
} else {
out_surface = gst_vaapi_surface_new_with_format (base_display,
GST_VIDEO_INFO_FORMAT (vip), width, height);
GST_VIDEO_INFO_FORMAT (vip), width, height, 0);
}
if (!out_surface)
goto error_create_surface;

View file

@ -108,6 +108,7 @@ gst_vaapi_surface_pool_class (void)
* @format: a #GstVideoFormat
* @width: the desired width, in pixels
* @height: the desired height, in pixels
* @surface_allocation_flags: (optional) allocation flags
*
* Creates a new #GstVaapiVideoPool of #GstVaapiSurface with the specified
* format and dimensions. If @format is GST_VIDEO_FORMAT_ENCODED, then
@ -118,7 +119,7 @@ gst_vaapi_surface_pool_class (void)
*/
GstVaapiVideoPool *
gst_vaapi_surface_pool_new (GstVaapiDisplay * display, GstVideoFormat format,
guint width, guint height)
guint width, guint height, guint surface_allocation_flags)
{
GstVideoInfo vi;
@ -127,7 +128,8 @@ gst_vaapi_surface_pool_new (GstVaapiDisplay * display, GstVideoFormat format,
g_return_val_if_fail (height > 0, NULL);
gst_video_info_set_format (&vi, format, width, height);
return gst_vaapi_surface_pool_new_full (display, &vi, 0);
return gst_vaapi_surface_pool_new_full (display, &vi,
surface_allocation_flags);
}
/**
@ -176,6 +178,7 @@ error:
* @chroma_type: a #GstVaapiChromatype
* @width: the desired width, in pixels
* @height: the desired height, in pixels
* @surface_allocation_flags: (optional) allocation flags
*
* Creates a new #GstVaapiVideoPool of #GstVaapiSurface with the specified
* chroma type and dimensions. The underlying format of the surfaces is
@ -185,7 +188,8 @@ error:
*/
GstVaapiVideoPool *
gst_vaapi_surface_pool_new_with_chroma_type (GstVaapiDisplay * display,
GstVaapiChromaType chroma_type, guint width, guint height)
GstVaapiChromaType chroma_type, guint width, guint height,
guint surface_allocation_flags)
{
GstVaapiVideoPool *pool;
GstVideoInfo vi;
@ -197,7 +201,8 @@ gst_vaapi_surface_pool_new_with_chroma_type (GstVaapiDisplay * display,
gst_video_info_set_format (&vi, GST_VIDEO_FORMAT_ENCODED, width, height);
pool = gst_vaapi_surface_pool_new_full (display, &vi, 0);
pool =
gst_vaapi_surface_pool_new_full (display, &vi, surface_allocation_flags);
if (!pool)
return NULL;

View file

@ -38,7 +38,7 @@ typedef struct _GstVaapiSurfacePool GstVaapiSurfacePool;
GstVaapiVideoPool *
gst_vaapi_surface_pool_new (GstVaapiDisplay * display, GstVideoFormat format,
guint width, guint height);
guint width, guint height, guint surface_allocation_flags);
GstVaapiVideoPool *
gst_vaapi_surface_pool_new_full (GstVaapiDisplay * display,
@ -46,7 +46,8 @@ gst_vaapi_surface_pool_new_full (GstVaapiDisplay * display,
GstVaapiVideoPool *
gst_vaapi_surface_pool_new_with_chroma_type (GstVaapiDisplay * display,
GstVaapiChromaType chroma_type, guint width, guint height);
GstVaapiChromaType chroma_type, guint width, guint height,
guint surface_allocation_flags);
G_END_DECLS

View file

@ -109,7 +109,7 @@ 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);
GST_VIDEO_FORMAT_NV12, window->width, window->height, 0);
if (!window->surface_pool) {
GST_WARNING ("failed to create surface pool for conversion");
return FALSE;

View file

@ -106,7 +106,8 @@ create_test_surface (GstVaapiDisplay * display, guint width, guint height,
goto error_invalid_format;
}
surface = gst_vaapi_surface_new_with_format (display, format, width, height);
surface =
gst_vaapi_surface_new_with_format (display, format, width, height, 0);
if (!surface)
goto error_create_surface;

View file

@ -60,7 +60,7 @@ main (int argc, char *argv[])
gst_vaapi_surface_unref (surface);
pool = gst_vaapi_surface_pool_new (display, GST_VIDEO_FORMAT_ENCODED,
width, height);
width, height, 0);
if (!pool)
g_error ("could not create Gst/VA surface pool");