diff options
author | Víctor Manuel Jáquez Leal <vjaquez@igalia.com> | 2020-05-17 09:55:42 +0200 |
---|---|---|
committer | Víctor Manuel Jáquez Leal <vjaquez@igalia.com> | 2020-05-17 12:42:54 +0200 |
commit | df063989175a7e69ce0538b5f25b128ecb2e4aa9 (patch) | |
tree | 2d6114e216bbd5a1f018441075a3475bc2256e10 | |
parent | ab475c22d59eacce1dab01a3dcfa7d9e9c00c8f9 (diff) |
vaapivideopool: Set pooled flag to added metas.
So this could hint filters how to use these metas.
Had to change the return value for texutre upload meta in order
to flag it.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/326>
-rw-r--r-- | gst/vaapi/gstvaapivideobufferpool.c | 10 | ||||
-rw-r--r-- | gst/vaapi/gstvaapivideometa_texture.c | 19 | ||||
-rw-r--r-- | gst/vaapi/gstvaapivideometa_texture.h | 2 |
3 files changed, 16 insertions, 15 deletions
diff --git a/gst/vaapi/gstvaapivideobufferpool.c b/gst/vaapi/gstvaapivideobufferpool.c index 219b9928..36be263e 100644 --- a/gst/vaapi/gstvaapivideobufferpool.c +++ b/gst/vaapi/gstvaapivideobufferpool.c @@ -385,6 +385,7 @@ gst_vaapi_video_buffer_pool_alloc_buffer (GstBufferPool * pool, goto error_create_meta; buffer = gst_vaapi_video_buffer_new (meta); + GST_META_FLAG_SET (meta, GST_META_FLAG_POOLED); if (!buffer) goto error_create_buffer; @@ -428,10 +429,15 @@ gst_vaapi_video_buffer_pool_alloc_buffer (GstBufferPool * pool, vmeta->map = gst_video_meta_map_vaapi_memory; vmeta->unmap = gst_video_meta_unmap_vaapi_memory; } + + GST_META_FLAG_SET (vmeta, GST_META_FLAG_POOLED); } #if (USE_GLX || USE_EGL) - if (priv->options & GST_VAAPI_VIDEO_BUFFER_POOL_OPTION_GL_TEXTURE_UPLOAD) - gst_buffer_add_texture_upload_meta (buffer); + if (priv->options & GST_VAAPI_VIDEO_BUFFER_POOL_OPTION_GL_TEXTURE_UPLOAD) { + GstMeta *tex_meta = gst_buffer_add_texture_upload_meta (buffer); + if (tex_meta) + GST_META_FLAG_SET (tex_meta, GST_META_FLAG_POOLED); + } #endif *out_buffer_ptr = buffer; diff --git a/gst/vaapi/gstvaapivideometa_texture.c b/gst/vaapi/gstvaapivideometa_texture.c index f840de78..b4cf65bf 100644 --- a/gst/vaapi/gstvaapivideometa_texture.c +++ b/gst/vaapi/gstvaapivideometa_texture.c @@ -218,10 +218,9 @@ gst_vaapi_texture_upload (GstVideoGLTextureUploadMeta * meta, gst_vaapi_video_meta_get_render_flags (vmeta)); } -gboolean +GstMeta * gst_buffer_add_texture_upload_meta (GstBuffer * buffer) { - GstVideoGLTextureUploadMeta *meta = NULL; GstVaapiVideoMetaTexture *meta_texture; if (!buffer) @@ -234,20 +233,16 @@ gst_buffer_add_texture_upload_meta (GstBuffer * buffer) if (!meta_texture_ensure_info_from_buffer (meta_texture, buffer)) goto error; - meta = gst_buffer_add_video_gl_texture_upload_meta (buffer, - GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_NORMAL, - 1, meta_texture->texture_type, gst_vaapi_texture_upload, - meta_texture, (GBoxedCopyFunc) meta_texture_copy, - (GBoxedFreeFunc) meta_texture_free); - if (!meta) - goto error; - return TRUE; + return (GstMeta *) gst_buffer_add_video_gl_texture_upload_meta (buffer, + GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_NORMAL, 1, + meta_texture->texture_type, gst_vaapi_texture_upload, meta_texture, + (GBoxedCopyFunc) meta_texture_copy, (GBoxedFreeFunc) meta_texture_free); /* ERRORS */ error: { meta_texture_free (meta_texture); - return FALSE; + return NULL; } } @@ -259,6 +254,6 @@ gst_buffer_ensure_texture_upload_meta (GstBuffer * buffer) return meta ? meta_texture_ensure_info_from_buffer (meta->user_data, buffer) : - gst_buffer_add_texture_upload_meta (buffer); + (gst_buffer_add_texture_upload_meta (buffer) != NULL); } #endif diff --git a/gst/vaapi/gstvaapivideometa_texture.h b/gst/vaapi/gstvaapivideometa_texture.h index c3341452..bf369ba8 100644 --- a/gst/vaapi/gstvaapivideometa_texture.h +++ b/gst/vaapi/gstvaapivideometa_texture.h @@ -34,7 +34,7 @@ G_BEGIN_DECLS typedef struct _GstVaapiVideoMetaTexture GstVaapiVideoMetaTexture; G_GNUC_INTERNAL -gboolean +GstMeta * gst_buffer_add_texture_upload_meta (GstBuffer * buffer); G_GNUC_INTERNAL |