From 892716e0760b28697342d207b951087c25e8d783 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 1 Dec 2011 15:47:16 +0100 Subject: [PATCH] videoconvert: fix the transform_size function The output size of a buffer does not depend on the input size but simply on the caps of the output buffers. Don't let the base implementation deal with unit_sizes, because input buffers might not be a multiple of that when they have padding or non-default strides. instead, implement a transform size function that simply calculate the natural size of an output buffer based on the caps. --- gst/videoconvert/gstvideoconvert.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/gst/videoconvert/gstvideoconvert.c b/gst/videoconvert/gstvideoconvert.c index 4b81892a9c..3c5eadb00b 100644 --- a/gst/videoconvert/gstvideoconvert.c +++ b/gst/videoconvert/gstvideoconvert.c @@ -79,8 +79,9 @@ static void gst_video_convert_get_property (GObject * object, static gboolean gst_video_convert_set_caps (GstBaseTransform * btrans, GstCaps * incaps, GstCaps * outcaps); -static gboolean gst_video_convert_get_unit_size (GstBaseTransform * btrans, - GstCaps * caps, gsize * size); +static gboolean gst_video_convert_transform_size (GstBaseTransform * btrans, + GstPadDirection direction, GstCaps * caps, gsize size, + GstCaps * othercaps, gsize * othersize); static GstFlowReturn gst_video_convert_transform (GstBaseTransform * btrans, GstBuffer * inbuf, GstBuffer * outbuf); @@ -366,8 +367,8 @@ gst_video_convert_class_init (GstVideoConvertClass * klass) GST_DEBUG_FUNCPTR (gst_video_convert_transform_caps); gstbasetransform_class->set_caps = GST_DEBUG_FUNCPTR (gst_video_convert_set_caps); - gstbasetransform_class->get_unit_size = - GST_DEBUG_FUNCPTR (gst_video_convert_get_unit_size); + gstbasetransform_class->transform_size = + GST_DEBUG_FUNCPTR (gst_video_convert_transform_size); gstbasetransform_class->decide_allocation = GST_DEBUG_FUNCPTR (gst_video_convert_decide_allocation); gstbasetransform_class->transform = @@ -424,18 +425,18 @@ gst_video_convert_get_property (GObject * object, guint property_id, } static gboolean -gst_video_convert_get_unit_size (GstBaseTransform * btrans, GstCaps * caps, - gsize * size) +gst_video_convert_transform_size (GstBaseTransform * btrans, + GstPadDirection direction, GstCaps * caps, gsize size, + GstCaps * othercaps, gsize * othersize) { gboolean ret = TRUE; GstVideoInfo info; g_assert (size); - ret = gst_video_info_from_caps (&info, caps); - if (ret) { - *size = info.size; - } + ret = gst_video_info_from_caps (&info, othercaps); + if (ret) + *othersize = info.size; return ret; }