From 97567606e23edf35da8411209b8232446b1277dc Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 20 Jun 2011 17:49:13 +0200 Subject: [PATCH] videoscale: activate Video meta Configure the allocator with GstMetaVideo because we can handle that using the GstVideoFrame helpers. --- gst/videoscale/gstvideoscale.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c index 8b7c0be..3d03b67 100644 --- a/gst/videoscale/gstvideoscale.c +++ b/gst/videoscale/gstvideoscale.c @@ -76,7 +76,7 @@ #include -#include +#include #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) { -- 2.7.4