mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-18 21:35:44 +00:00
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.
This commit is contained in:
parent
92ac25bdb3
commit
892716e076
1 changed files with 11 additions and 10 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue