videopool: only do alignment when videometa is enabled
authorWim Taymans <wim.taymans@collabora.co.uk>
Thu, 8 Mar 2012 12:03:22 +0000 (13:03 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Thu, 8 Mar 2012 12:03:22 +0000 (13:03 +0100)
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
gst-libs/gst/video/gstvideopool.h

index 5d2bb45..91d07eb 100644 (file)
@@ -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),
index 40e3915..a573f18 100644 (file)
@@ -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"