summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <bilboed@bilboed.com>2010-06-01 20:45:29 +0200
committerEdward Hervey <bilboed@bilboed.com>2010-06-01 20:45:29 +0200
commit59dcdc37a0b73ec96cc6e0f23ad1cce28be42381 (patch)
tree27849d9660eaf5c0fb1f8e90c053865eb3eb4ee6
parentbfaeffcfd0e99f67921ed46f5ff3e1aa81bf7e48 (diff)
videomixer: filter caps returned from downstream with our pad template.
-rw-r--r--gst/videomixer/videomixer.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/gst/videomixer/videomixer.c b/gst/videomixer/videomixer.c
index 6725cdfe1..63e84a3f8 100644
--- a/gst/videomixer/videomixer.c
+++ b/gst/videomixer/videomixer.c
@@ -380,6 +380,7 @@ gst_videomixer_pad_sink_getcaps (GstPad * pad)
GstVideoMixer *mix;
GstVideoMixerPad *mixpad;
GstCaps *res = NULL;
+ GstCaps *tmp;
int ncaps, i;
GstStructure *st;
@@ -389,13 +390,18 @@ gst_videomixer_pad_sink_getcaps (GstPad * pad)
if (!mixpad)
goto beach;
- res = gst_pad_peer_get_caps (mix->srcpad);
- if (G_UNLIKELY (res == NULL)) {
+ tmp = gst_pad_peer_get_caps (mix->srcpad);
+ if (G_UNLIKELY (tmp == NULL)) {
/* If no peer, then return template */
res = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
goto beach;
}
+ /* Intersect with template caps, downstream might be returning formats
+ * or width/height/framerate/par combinations we don't handle */
+ res = gst_caps_intersect (tmp, gst_pad_get_pad_template_caps (pad));
+ gst_caps_unref (tmp);
+
ncaps = gst_caps_get_size (res);
/* This Upstream can only produce:
@@ -418,13 +424,6 @@ gst_videomixer_pad_sink_getcaps (GstPad * pad)
G_MAXINT32, 1, "pixel-aspect-ratio", GST_TYPE_FRACTION, mix->par_n,
mix->par_d, NULL);
}
- } else {
- GstCaps *tmp;
- /* If we don't have configured values, just intersect with our
- * pad template */
- tmp = res;
- res = gst_caps_intersect (res, gst_pad_get_pad_template_caps (pad));
- gst_caps_unref (tmp);
}
GST_VIDEO_MIXER_STATE_UNLOCK (mix);