videoscale: activate Video meta
authorWim Taymans <wim.taymans@collabora.co.uk>
Mon, 20 Jun 2011 15:49:13 +0000 (17:49 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 20 Jun 2011 15:49:13 +0000 (17:49 +0200)
Configure the allocator with GstMetaVideo because we can handle that using the
GstVideoFrame helpers.

gst/videoscale/gstvideoscale.c

index 8b7c0be..3d03b67 100644 (file)
@@ -76,7 +76,7 @@
 
 #include <math.h>
 
-#include <gst/video/video.h>
+#include <gst/video/gstmetavideo.h>
 
 #include "gstvideoscale.h"
 #include "gstvideoscaleorc.h"
@@ -179,6 +179,8 @@ static gboolean gst_video_scale_set_caps (GstBaseTransform * trans,
     GstCaps * in, GstCaps * out);
 static gboolean gst_video_scale_get_unit_size (GstBaseTransform * trans,
     GstCaps * caps, gsize * size);
+static gboolean gst_video_scale_setup_allocation (GstBaseTransform * trans,
+    GstQuery * query);
 static GstFlowReturn gst_video_scale_transform (GstBaseTransform * trans,
     GstBuffer * in, GstBuffer * out);
 static void gst_video_scale_fixate_caps (GstBaseTransform * base,
@@ -228,6 +230,8 @@ gst_video_scale_class_init (GstVideoScaleClass * klass)
   trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_video_scale_set_caps);
   trans_class->get_unit_size =
       GST_DEBUG_FUNCPTR (gst_video_scale_get_unit_size);
+  trans_class->setup_allocation =
+      GST_DEBUG_FUNCPTR (gst_video_scale_setup_allocation);
   trans_class->transform = GST_DEBUG_FUNCPTR (gst_video_scale_transform);
   trans_class->fixate_caps = GST_DEBUG_FUNCPTR (gst_video_scale_fixate_caps);
   trans_class->src_event = GST_DEBUG_FUNCPTR (gst_video_scale_src_event);
@@ -346,6 +350,26 @@ gst_video_scale_transform_caps (GstBaseTransform * trans,
   return ret;
 }
 
+
+static gboolean
+gst_video_scale_setup_allocation (GstBaseTransform * trans, GstQuery * query)
+{
+  GstBufferPool *pool = NULL;
+  guint size, min, max, prefix, alignment;
+
+  gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
+      &alignment, &pool);
+
+  if (pool) {
+    GstStructure *config;
+
+    config = gst_buffer_pool_get_config (pool);
+    gst_buffer_pool_config_add_meta (config, GST_META_API_VIDEO);
+    gst_buffer_pool_set_config (pool, config);
+  }
+  return TRUE;
+}
+
 static gboolean
 gst_video_scale_set_caps (GstBaseTransform * trans, GstCaps * in, GstCaps * out)
 {