v4l: Make sure to return a subset of the filter caps in getcaps

This commit is contained in:
Sebastian Dröge 2011-05-16 17:44:44 +02:00
parent a477837ffe
commit 330456456e

View file

@ -371,12 +371,30 @@ gst_v4lsrc_get_caps (GstBaseSrc * src, GstCaps * filter)
GList *item;
if (!GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lsrc))) {
return gst_v4lsrc_get_any_caps ();
GstCaps *caps, *intersection;
caps = gst_v4lsrc_get_any_caps ();
if (filter) {
intersection =
gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (caps);
caps = intersection;
}
return caps;
}
if (!v4lsrc->autoprobe) {
GstCaps *caps, *intersection;
/* FIXME: query current caps and return those, with _any appended */
return gst_v4lsrc_get_any_caps ();
caps = gst_v4lsrc_get_any_caps ();
if (filter) {
intersection =
gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (caps);
caps = intersection;
}
return caps;
}
if (!v4lsrc->colorspaces) {
@ -451,6 +469,15 @@ gst_v4lsrc_get_caps (GstBaseSrc * src, GstCaps * filter)
gst_caps_append (list, one);
}
if (filter) {
GstCaps *intersection;
intersection =
gst_caps_intersect_full (filter, list, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (list);
list = intersection;
}
return list;
}