plugins/elements/gstcapsfilter.c: Fix capsfilter for cases where the caps set on capsfilter will provide additional i...

Original commit message from CVS:
* plugins/elements/gstcapsfilter.c: (gst_capsfilter_class_init),
(gst_capsfilter_transform_size), (gst_capsfilter_prepare_buf):
Fix capsfilter for cases where the caps set on capsfilter will provide
additional information.
Fixes #449197
This commit is contained in:
Edward Hervey 2007-07-24 12:32:31 +00:00
parent 6a246a8954
commit 44dbaa02d5
2 changed files with 29 additions and 1 deletions

View file

@ -1,3 +1,11 @@
2007-07-24 Edward Hervey <bilboed@bilboed.com>
* plugins/elements/gstcapsfilter.c: (gst_capsfilter_class_init),
(gst_capsfilter_transform_size), (gst_capsfilter_prepare_buf):
Fix capsfilter for cases where the caps set on capsfilter will provide
additional information.
Fixes #449197
2007-07-24 Stefan Kost <ensonic@users.sf.net> 2007-07-24 Stefan Kost <ensonic@users.sf.net>
* gst/gsttypefindfactory.c: * gst/gsttypefindfactory.c:

View file

@ -74,6 +74,9 @@ static GstFlowReturn gst_capsfilter_transform_ip (GstBaseTransform * base,
GstBuffer * buf); GstBuffer * buf);
static GstFlowReturn gst_capsfilter_prepare_buf (GstBaseTransform * trans, static GstFlowReturn gst_capsfilter_prepare_buf (GstBaseTransform * trans,
GstBuffer * input, gint size, GstCaps * caps, GstBuffer ** buf); GstBuffer * input, gint size, GstCaps * caps, GstBuffer ** buf);
static gboolean gst_capsfilter_transform_size (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps, guint size,
GstCaps * othercaps, guint * othersize);
static void static void
gst_capsfilter_base_init (gpointer g_class) gst_capsfilter_base_init (gpointer g_class)
@ -112,6 +115,7 @@ gst_capsfilter_class_init (GstCapsFilterClass * klass)
trans_class->transform_caps = gst_capsfilter_transform_caps; trans_class->transform_caps = gst_capsfilter_transform_caps;
trans_class->transform_ip = gst_capsfilter_transform_ip; trans_class->transform_ip = gst_capsfilter_transform_ip;
trans_class->prepare_output_buffer = gst_capsfilter_prepare_buf; trans_class->prepare_output_buffer = gst_capsfilter_prepare_buf;
trans_class->transform_size = gst_capsfilter_transform_size;
} }
static void static void
@ -192,6 +196,17 @@ gst_capsfilter_transform_caps (GstBaseTransform * base,
return ret; return ret;
} }
static gboolean
gst_capsfilter_transform_size (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps, guint size,
GstCaps * othercaps, guint * othersize)
{
/* return the same size */
*othersize = size;
return TRUE;
}
static GstFlowReturn static GstFlowReturn
gst_capsfilter_transform_ip (GstBaseTransform * base, GstBuffer * buf) gst_capsfilter_transform_ip (GstBaseTransform * base, GstBuffer * buf)
{ {
@ -216,7 +231,12 @@ gst_capsfilter_prepare_buf (GstBaseTransform * trans, GstBuffer * input,
{ {
if (GST_BUFFER_CAPS (input) != NULL) { if (GST_BUFFER_CAPS (input) != NULL) {
/* Output buffer already has caps */ /* Output buffer already has caps */
GST_DEBUG_OBJECT (trans, "Input buffer already has caps"); GST_DEBUG_OBJECT (trans,
"Input buffer already has caps (implicitely fixed)");
/* FIXME : Move this behaviour to basetransform. The given caps are the ones
* of the source pad, therefore our outgoing buffers should always have
* those caps. */
gst_buffer_set_caps (input, caps);
gst_buffer_ref (input); gst_buffer_ref (input);
*buf = input; *buf = input;
} else { } else {