diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2015-03-27 15:02:33 +0100 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2015-11-25 14:32:28 -0500 |
commit | cf29e6c0b7b42577b653834a1b9c097d91d151a7 (patch) | |
tree | 04c8170f1aac6956dbe77b90c66ecb6772a58718 | |
parent | 1435974c2df581b23555850dd6d1f2610ac4d0d7 (diff) |
v4l2: add gst_v4l2_object_probe_caps
Add a variant of gst_v4l2_object_get_caps that bypasses the probed_caps cache.
https://bugzilla.gnome.org/show_bug.cgi?id=733827
-rw-r--r-- | sys/v4l2/gstv4l2object.c | 58 | ||||
-rw-r--r-- | sys/v4l2/gstv4l2object.h | 2 |
2 files changed, 38 insertions, 22 deletions
diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index ab37b8f87..8fbeb3fe9 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -3560,44 +3560,58 @@ done: } GstCaps * -gst_v4l2_object_get_caps (GstV4l2Object * v4l2object, GstCaps * filter) +gst_v4l2_object_probe_caps (GstV4l2Object * v4l2object, GstCaps * filter) { GstCaps *ret; GSList *walk; GSList *formats; - if (v4l2object->probed_caps == NULL) { - formats = gst_v4l2_object_get_format_list (v4l2object); + formats = gst_v4l2_object_get_format_list (v4l2object); - ret = gst_caps_new_empty (); + ret = gst_caps_new_empty (); - for (walk = formats; walk; walk = walk->next) { - struct v4l2_fmtdesc *format; - GstStructure *template; + for (walk = formats; walk; walk = walk->next) { + struct v4l2_fmtdesc *format; + GstStructure *template; - format = (struct v4l2_fmtdesc *) walk->data; + format = (struct v4l2_fmtdesc *) walk->data; - template = - gst_v4l2_object_v4l2fourcc_to_bare_struct (format->pixelformat); + template = + gst_v4l2_object_v4l2fourcc_to_bare_struct (format->pixelformat); - if (template) { - GstCaps *tmp; + if (template) { + GstCaps *tmp; - tmp = gst_v4l2_object_probe_caps_for_format (v4l2object, - format->pixelformat, template); - if (tmp) - gst_caps_append (ret, tmp); + tmp = gst_v4l2_object_probe_caps_for_format (v4l2object, + format->pixelformat, template); + if (tmp) + gst_caps_append (ret, tmp); - gst_structure_free (template); - } else { - GST_DEBUG_OBJECT (v4l2object->element, "unknown format %u", - format->pixelformat); - } + gst_structure_free (template); + } else { + GST_DEBUG_OBJECT (v4l2object->element, "unknown format %u", + format->pixelformat); } - v4l2object->probed_caps = ret; } if (filter) { + ret = gst_caps_intersect_full (filter, ret, GST_CAPS_INTERSECT_FIRST); + } else { + ret = gst_caps_ref (ret); + } + + return ret; +} + +GstCaps * +gst_v4l2_object_get_caps (GstV4l2Object * v4l2object, GstCaps * filter) +{ + GstCaps *ret; + + if (v4l2object->probed_caps == NULL) + v4l2object->probed_caps = gst_v4l2_object_probe_caps (v4l2object, NULL); + + if (filter) { ret = gst_caps_intersect_full (filter, v4l2object->probed_caps, GST_CAPS_INTERSECT_FIRST); } else { diff --git a/sys/v4l2/gstv4l2object.h b/sys/v4l2/gstv4l2object.h index 177a86b1b..e3728c477 100644 --- a/sys/v4l2/gstv4l2object.h +++ b/sys/v4l2/gstv4l2object.h @@ -260,6 +260,8 @@ gboolean gst_v4l2_object_unlock_stop (GstV4l2Object * v4l2object); gboolean gst_v4l2_object_stop (GstV4l2Object * v4l2object); +GstCaps * gst_v4l2_object_probe_caps (GstV4l2Object * v4l2object, + GstCaps * filter); GstCaps * gst_v4l2_object_get_caps (GstV4l2Object * v4l2object, GstCaps * filter); |