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>
This commit is contained in:
Víctor Manuel Jáquez Leal 2020-05-17 09:55:42 +02:00
parent ab475c22d5
commit df06398917
3 changed files with 16 additions and 15 deletions

View file

@ -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;

View file

@ -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

View file

@ -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