diff options
author | Chris White <cxwembedded@gmail.com> | 2021-03-30 20:24:07 -0400 |
---|---|---|
committer | Chris White <cxwembedded@gmail.com> | 2021-04-01 20:55:13 -0400 |
commit | 96b10c158fc7429ddeae11207c9a3cead3504d19 (patch) | |
tree | d260bbddb617d5414d447de690e43417d2464a04 | |
parent | 7954eaaf2571f2751b300a37ba6ef136289604c9 (diff) |
caps: Add gst_caps_features_new_single()
For use with a single feature now that gst_caps_features_new() is
G_GNUC_NULL_TERMINATED.
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/774#note_855357
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/774>
-rw-r--r-- | gst/gstcapsfeatures.c | 23 | ||||
-rw-r--r-- | gst/gstcapsfeatures.h | 3 |
2 files changed, 26 insertions, 0 deletions
diff --git a/gst/gstcapsfeatures.c b/gst/gstcapsfeatures.c index 3e02a8cc88..0911fff0ef 100644 --- a/gst/gstcapsfeatures.c +++ b/gst/gstcapsfeatures.c @@ -214,6 +214,29 @@ gst_caps_features_new_any (void) } /** + * gst_caps_features_new_single: + * @feature: The feature + * + * Creates a new, ANY #GstCapsFeatures. This will be equal + * to any other #GstCapsFeatures but caps with these are + * unfixed. + * + * Returns: (transfer full): a new #GstCapsFeatures + * + * Since: 1.20 + */ +GstCapsFeatures * +gst_caps_features_new_single (const gchar * feature) +{ + GstCapsFeatures *features; + g_return_val_if_fail (feature != NULL, NULL); + + features = gst_caps_features_new_empty (); + gst_caps_features_add (features, feature); + return features; +} + +/** * gst_caps_features_new: * @feature1: name of first feature to set * @...: additional features diff --git a/gst/gstcapsfeatures.h b/gst/gstcapsfeatures.h index aa5e72b042..cdf7755080 100644 --- a/gst/gstcapsfeatures.h +++ b/gst/gstcapsfeatures.h @@ -58,6 +58,9 @@ GST_API GstCapsFeatures * gst_caps_features_new_any (void); GST_API +GstCapsFeatures * gst_caps_features_new_single (const gchar *feature) G_GNUC_MALLOC; + +GST_API GstCapsFeatures * gst_caps_features_new (const gchar *feature1, ...) G_GNUC_NULL_TERMINATED; GST_API |