From 8ebd13ee5efad33199f010e2335ee6f8bf27aab4 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 8 Mar 2012 13:03:22 +0100 Subject: [PATCH] videopool: only do alignment when videometa is enabled We require the videometa activated before we can implement the alignment of buffers. Users of the bufferpool should do this manually based on the results of the allocation query. --- gst-libs/gst/video/gstvideopool.c | 11 ++++------- gst-libs/gst/video/gstvideopool.h | 3 +++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gst-libs/gst/video/gstvideopool.c b/gst-libs/gst/video/gstvideopool.c index 5d2bb455a0..91d07ebe3e 100644 --- a/gst-libs/gst/video/gstvideopool.c +++ b/gst-libs/gst/video/gstvideopool.c @@ -142,7 +142,7 @@ struct _GstVideoBufferPoolPrivate GstCaps *caps; GstVideoInfo info; GstVideoAlignment video_align; - gboolean add_metavideo; + gboolean add_videometa; gboolean need_alignment; guint prefix; guint align; @@ -198,7 +198,7 @@ video_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config) priv->align = align; /* enable metadata based on config of the pool */ - priv->add_metavideo = + priv->add_videometa = gst_buffer_pool_config_has_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META); @@ -206,13 +206,10 @@ video_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config) priv->need_alignment = gst_buffer_pool_config_has_option (config, GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT); - if (priv->need_alignment) { + if (priv->need_alignment && priv->add_videometa) { /* get an apply the alignment to the info */ gst_buffer_pool_config_get_video_alignment (config, &priv->video_align); gst_video_info_align (&info, &priv->video_align); - - /* we need the video metadata too now */ - priv->add_metavideo = TRUE; } priv->info = info; @@ -260,7 +257,7 @@ video_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer, gst_memory_resize (mem, priv->prefix, info->size); gst_buffer_take_memory (*buffer, -1, mem); - if (priv->add_metavideo) { + if (priv->add_videometa) { GST_DEBUG_OBJECT (pool, "adding GstVideoMeta"); gst_buffer_add_video_meta_full (*buffer, 0, GST_VIDEO_INFO_FORMAT (info), diff --git a/gst-libs/gst/video/gstvideopool.h b/gst-libs/gst/video/gstvideopool.h index 40e3915c0f..a573f18bbe 100644 --- a/gst-libs/gst/video/gstvideopool.h +++ b/gst-libs/gst/video/gstvideopool.h @@ -39,6 +39,9 @@ G_BEGIN_DECLS * * A bufferpool option to enable extra padding. When a bufferpool supports this * option, gst_buffer_pool_config_set_video_alignment() can be called. + * + * When this option is enabled on the bufferpool, + * #GST_BUFFER_POOL_OPTION_VIDEO_META should also be enabled. */ #define GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT "GstBufferPoolOptionVideoAlignment"