summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2011-11-30 13:59:46 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2011-11-30 14:01:22 +0100
commite6d2da7cf85c6fdd6b1c458d8a2c526246060051 (patch)
tree746a6ed4b2ac4f860eea9dd896b9014aa76b8d21
parentc9bd4e4e96fd1953775c8053cf0d9b318968dabe (diff)
basetransform: Always intersect the suggested sink caps with the peer caps
This makes sure that we get correct and complete caps. The suggested caps could be incomplete, e.g. video/x-raw-rgb without any fields, and by intersecting with the peer caps we get something usable. Fixes bug #662199.
-rw-r--r--libs/gst/base/gstbasetransform.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c
index d388932..fbed657 100644
--- a/libs/gst/base/gstbasetransform.c
+++ b/libs/gst/base/gstbasetransform.c
@@ -1882,27 +1882,29 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size,
/* check if we actually handle this format on the sinkpad */
if (sink_suggest) {
const GstCaps *templ;
+ GstCaps *peercaps;
- if (!gst_caps_is_fixed (sink_suggest)) {
- GstCaps *peercaps;
+ /* Always intersect with the peer caps to get correct
+ * and complete caps. The suggested caps could be incomplete,
+ * for example video/x-raw-yuv without any fields at all.
+ */
+ peercaps =
+ gst_pad_peer_get_caps_reffed (GST_BASE_TRANSFORM_SINK_PAD (trans));
+ if (peercaps) {
+ GstCaps *intersect;
+
+ intersect =
+ gst_caps_intersect_full (sink_suggest, peercaps,
+ GST_CAPS_INTERSECT_FIRST);
+ gst_caps_unref (peercaps);
+ gst_caps_unref (sink_suggest);
+ sink_suggest = intersect;
+ }
+ if (!gst_caps_is_fixed (sink_suggest) || gst_caps_is_empty (sink_suggest)) {
GST_DEBUG_OBJECT (trans, "Suggested caps is not fixed: %"
GST_PTR_FORMAT, sink_suggest);
- peercaps =
- gst_pad_peer_get_caps_reffed (GST_BASE_TRANSFORM_SINK_PAD (trans));
- /* try fixating by intersecting with peer caps */
- if (peercaps) {
- GstCaps *intersect;
-
- intersect =
- gst_caps_intersect_full (sink_suggest, peercaps,
- GST_CAPS_INTERSECT_FIRST);
- gst_caps_unref (peercaps);
- gst_caps_unref (sink_suggest);
- sink_suggest = intersect;
- }
-
if (gst_caps_is_empty (sink_suggest))
goto not_supported;