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>
This commit is contained in:
Chris White 2021-03-30 20:24:07 -04:00
parent 7954eaaf25
commit 96b10c158f
2 changed files with 26 additions and 0 deletions

View file

@ -213,6 +213,29 @@ gst_caps_features_new_any (void)
return features;
}
/**
* 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

View file

@ -57,6 +57,9 @@ GstCapsFeatures * gst_caps_features_new_empty (void);
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;