mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 08:41:07 +00:00
x11: handle new bufferpool metadata api
Provide a method to list the supported metadata apis. Activate the video metadata on buffers when a downstream element configured the bufferpool to support that api.
This commit is contained in:
parent
6d9e76f2de
commit
cf91192668
2 changed files with 27 additions and 4 deletions
|
@ -440,6 +440,14 @@ struct _GstXImageBufferPoolPrivate
|
||||||
G_DEFINE_TYPE (GstXImageBufferPool, gst_ximage_buffer_pool,
|
G_DEFINE_TYPE (GstXImageBufferPool, gst_ximage_buffer_pool,
|
||||||
GST_TYPE_BUFFER_POOL);
|
GST_TYPE_BUFFER_POOL);
|
||||||
|
|
||||||
|
static const gchar **
|
||||||
|
ximage_buffer_pool_get_metas (GstBufferPool * pool)
|
||||||
|
{
|
||||||
|
static const gchar *metas[] = { "GstMetaVideo", NULL };
|
||||||
|
|
||||||
|
return metas;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
ximage_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
ximage_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
{
|
{
|
||||||
|
@ -467,8 +475,10 @@ ximage_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
if (priv->caps)
|
if (priv->caps)
|
||||||
gst_caps_unref (priv->caps);
|
gst_caps_unref (priv->caps);
|
||||||
priv->caps = gst_caps_copy (caps);
|
priv->caps = gst_caps_copy (caps);
|
||||||
/* FIXME, configure based on config of the bufferpool */
|
|
||||||
priv->add_metavideo = FALSE;
|
/* check for the configured metadata */
|
||||||
|
priv->add_metavideo =
|
||||||
|
gst_buffer_pool_config_has_meta (config, GST_META_API_VIDEO);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
@ -557,6 +567,7 @@ gst_ximage_buffer_pool_class_init (GstXImageBufferPoolClass * klass)
|
||||||
|
|
||||||
gobject_class->finalize = gst_ximage_buffer_pool_finalize;
|
gobject_class->finalize = gst_ximage_buffer_pool_finalize;
|
||||||
|
|
||||||
|
gstbufferpool_class->get_metas = ximage_buffer_pool_get_metas;
|
||||||
gstbufferpool_class->set_config = ximage_buffer_pool_set_config;
|
gstbufferpool_class->set_config = ximage_buffer_pool_set_config;
|
||||||
gstbufferpool_class->alloc_buffer = ximage_buffer_pool_alloc;
|
gstbufferpool_class->alloc_buffer = ximage_buffer_pool_alloc;
|
||||||
gstbufferpool_class->free_buffer = ximage_buffer_pool_free;
|
gstbufferpool_class->free_buffer = ximage_buffer_pool_free;
|
||||||
|
|
|
@ -473,6 +473,14 @@ struct _GstXvImageBufferPoolPrivate
|
||||||
G_DEFINE_TYPE (GstXvImageBufferPool, gst_xvimage_buffer_pool,
|
G_DEFINE_TYPE (GstXvImageBufferPool, gst_xvimage_buffer_pool,
|
||||||
GST_TYPE_BUFFER_POOL);
|
GST_TYPE_BUFFER_POOL);
|
||||||
|
|
||||||
|
static const gchar **
|
||||||
|
xvimage_buffer_pool_get_metas (GstBufferPool * pool)
|
||||||
|
{
|
||||||
|
static const gchar *metas[] = { "GstMetaVideo", NULL };
|
||||||
|
|
||||||
|
return metas;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
xvimage_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
xvimage_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
{
|
{
|
||||||
|
@ -502,8 +510,11 @@ xvimage_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
priv->caps = gst_caps_copy (caps);
|
priv->caps = gst_caps_copy (caps);
|
||||||
priv->im_format =
|
priv->im_format =
|
||||||
gst_xvimagesink_get_format_from_caps (xvpool->sink, (GstCaps *) caps);
|
gst_xvimagesink_get_format_from_caps (xvpool->sink, (GstCaps *) caps);
|
||||||
/* FIXME, enable metadata based on config of the pool */
|
|
||||||
priv->add_metavideo = FALSE;
|
/* enable metadata based on config of the pool */
|
||||||
|
priv->add_metavideo =
|
||||||
|
gst_buffer_pool_config_has_meta (config, GST_META_API_VIDEO);
|
||||||
|
|
||||||
if (priv->im_format == -1)
|
if (priv->im_format == -1)
|
||||||
goto unknown_format;
|
goto unknown_format;
|
||||||
|
|
||||||
|
@ -605,6 +616,7 @@ gst_xvimage_buffer_pool_class_init (GstXvImageBufferPoolClass * klass)
|
||||||
|
|
||||||
gobject_class->finalize = gst_xvimage_buffer_pool_finalize;
|
gobject_class->finalize = gst_xvimage_buffer_pool_finalize;
|
||||||
|
|
||||||
|
gstbufferpool_class->get_metas = xvimage_buffer_pool_get_metas;
|
||||||
gstbufferpool_class->set_config = xvimage_buffer_pool_set_config;
|
gstbufferpool_class->set_config = xvimage_buffer_pool_set_config;
|
||||||
gstbufferpool_class->alloc_buffer = xvimage_buffer_pool_alloc;
|
gstbufferpool_class->alloc_buffer = xvimage_buffer_pool_alloc;
|
||||||
gstbufferpool_class->free_buffer = xvimage_buffer_pool_free;
|
gstbufferpool_class->free_buffer = xvimage_buffer_pool_free;
|
||||||
|
|
Loading…
Reference in a new issue