#if GST_CHECK_VERSION(1,1,0)
if (decode->has_texture_upload_meta)
- gst_buffer_add_texture_upload_meta(out_frame->output_buffer);
+ gst_buffer_ensure_texture_upload_meta(out_frame->output_buffer);
#endif
#else
out_frame->output_buffer =
config = gst_buffer_pool_get_config(pool);
gst_buffer_pool_config_add_option(config,
GST_BUFFER_POOL_OPTION_VIDEO_META);
- gst_buffer_pool_set_config(pool, config);
#if GST_CHECK_VERSION(1,1,0)
decode->has_texture_upload_meta = gst_query_find_allocation_meta(query,
GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE, NULL);
+ if (decode->has_texture_upload_meta)
+ gst_buffer_pool_config_add_option(config,
+ GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META);
#endif
+ gst_buffer_pool_set_config(pool, config);
}
if (update_pool)
#include "gstvaapivideobufferpool.h"
#include "gstvaapivideobuffer.h"
#include "gstvaapivideomemory.h"
+#if GST_CHECK_VERSION(1,1,0)
+#include "gstvaapivideometa_texture.h"
+#endif
GST_DEBUG_CATEGORY_STATIC(gst_debug_vaapivideopool);
#define GST_CAT_DEFAULT gst_debug_vaapivideopool
guint video_info_index;
GstAllocator *allocator;
GstVaapiDisplay *display;
- guint has_video_meta : 1;
+ guint has_video_meta : 1;
+ guint has_texture_upload_meta : 1;
};
#define GST_VAAPI_VIDEO_BUFFER_POOL_GET_PRIVATE(obj) \
static const gchar *g_options[] = {
GST_BUFFER_POOL_OPTION_VIDEO_META,
GST_BUFFER_POOL_OPTION_VAAPI_VIDEO_META,
+ GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META,
NULL,
};
return g_options;
priv->has_video_meta = gst_buffer_pool_config_has_option(config,
GST_BUFFER_POOL_OPTION_VIDEO_META);
+ priv->has_texture_upload_meta = gst_buffer_pool_config_has_option(config,
+ GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META);
+
return GST_BUFFER_POOL_CLASS(gst_vaapi_video_buffer_pool_parent_class)->
set_config(pool, config);
vmeta->unmap = gst_video_meta_unmap_vaapi_memory;
}
+#if GST_CHECK_VERSION(1,1,0)
+ if (priv->has_texture_upload_meta)
+ gst_buffer_add_texture_upload_meta(buffer);
+#endif
+
*out_buffer_ptr = buffer;
return GST_FLOW_OK;
#define GST_BUFFER_POOL_OPTION_VAAPI_VIDEO_META "GstBufferPoolOptionVaapiVideoMeta"
/**
+ *
+ * GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META:
+ *
+ * An option that can be activated on bufferpool to request gl texture
+ * upload on buffers from the pool.
+ *
+ * When this option is enabled on the bufferpool,
+ * #GST_BUFFER_POOL_OPTION_VIDEO_META should also be enabled.
+ */
+#ifndef GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META
+#define GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META \
+ "GstBufferPoolOptionVideoGLTextureUploadMeta"
+#endif
+
+/**
* GstVaapiVideoBufferPool:
*
* A VA video buffer pool object.
#endif
return meta != NULL;
}
+
+gboolean
+gst_buffer_ensure_texture_upload_meta(GstBuffer *buffer)
+{
+ return gst_buffer_get_video_gl_texture_upload_meta(buffer) ||
+ gst_buffer_add_texture_upload_meta(buffer);
+}
#endif
gboolean
gst_buffer_add_texture_upload_meta(GstBuffer *buffer);
+G_GNUC_INTERNAL
+gboolean
+gst_buffer_ensure_texture_upload_meta(GstBuffer *buffer);
+
G_END_DECLS
#endif /* GST_VAAPI_VIDEO_META_TEXTURE_H */