static GstCaps * gst_gl_mixer_set_caps_features (const GstCaps * caps, const gchar * feature_name) { GstCaps *tmp = gst_caps_copy (caps); guint n = gst_caps_get_size (tmp); guint i = 0; for (i = 0; i < n; i++) { GstCapsFeatures *features = gst_caps_get_features (tmp, i); if (features) { guint n_f = gst_caps_features_get_size (features); guint j = 0; for (j = 0; j < n_f; j++) { gst_caps_features_remove_id (features, gst_caps_features_get_nth_id (features, j)); } } gst_caps_features_add (features, feature_name); gst_caps_set_simple (tmp, "format", G_TYPE_STRING, "RGBA", NULL); } return tmp; }
/** * gst_caps_features_remove: * @features: a #GstCapsFeatures. * @feature: a feature. * * Removes @feature from @features. * * Since: 1.2 */ void gst_caps_features_remove (GstCapsFeatures * features, const gchar * feature) { g_return_if_fail (features != NULL); g_return_if_fail (IS_MUTABLE (features)); g_return_if_fail (feature != NULL); gst_caps_features_remove_id (features, g_quark_from_string (feature)); }
GstCaps * gst_gl_caps_replace_all_caps_features (const GstCaps * caps, const gchar * feature_name) { GstCaps *tmp = gst_caps_copy (caps); guint n = gst_caps_get_size (tmp); guint i = 0; for (i = 0; i < n; i++) { GstCapsFeatures *features = gst_caps_get_features (tmp, i); if (features) { guint n_f = gst_caps_features_get_size (features); guint j = 0; for (j = 0; j < n_f; j++) { gst_caps_features_remove_id (features, gst_caps_features_get_nth_id (features, j)); } } gst_caps_features_add (features, feature_name); } return tmp; }