diff --git a/ChangeLog b/ChangeLog index bbfc7206c1..11164559ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-09-07 Jan Schmidt + + * gst/gstpad.c: (gst_pad_alloc_buffer): + Catch misbehaving pad_alloc functions that don't + set up caps and do it for them. + 2005-09-07 Stefan Kost * check/pipelines/simple_launch_lines.c: (run_pipeline): diff --git a/gst/gstpad.c b/gst/gstpad.c index 78e2c40ea6..cc542cca45 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -2379,6 +2379,15 @@ gst_pad_alloc_buffer (GstPad * pad, guint64 offset, gint size, GstCaps * caps, if (G_UNLIKELY (*buf == NULL)) goto fallback; + /* If the buffer alloc function didn't set up the caps like it should, + * do it for it */ + if (caps && (GST_BUFFER_CAPS (*buf) == NULL)) { + GST_WARNING ("Buffer allocation function for pad % " GST_PTR_FORMAT + " did not set up caps. Setting", peer); + + gst_buffer_set_caps (*buf, caps); + } + do_caps: gst_object_unref (peer);