/**
* gst_protection_select_system:
- * @system_identifiers: (transfer none): A null terminated array of strings
+ * @system_identifiers: (transfer none) (array zero-terminated=1): A null terminated array of strings
* that contains the UUID values of each protection system that is to be
* checked.
*
* an element that supports one of the supplied UUIDs. If more than one
* element matches, the system ID of the highest ranked element is selected.
*
- * Returns: (transfer none): One of the strings from @system_identifiers that
- * indicates the highest ranked element that implements the protection system
- * indicated by that system ID, or %NULL if no element has been found.
+ * Returns: (transfer none) (nullable): One of the strings from
+ * @system_identifiers that indicates the highest ranked element that
+ * implements the protection system indicated by that system ID, or %NULL if no
+ * element has been found.
*
* Since: 1.6
*/
return retval;
}
+/**
+ * gst_protection_filter_systems_by_available_decryptors:
+ * @system_identifiers: (transfer none) (array zero-terminated=1):
+ * A null terminated array of strings that contains the UUID values of each
+ * protection system that is to be checked.
+ *
+ * Iterates the supplied list of UUIDs and checks the GstRegistry for
+ * all the decryptors supporting one of the supplied UUIDs.
+ *
+ * Returns: (transfer full) (array zero-terminated=1) (nullable):
+ * A null terminated array containing all
+ * the @system_identifiers supported by the set of available decryptors, or
+ * %NULL if no matches were found.
+ *
+ * Since: 1.14
+ */
+gchar **
+gst_protection_filter_systems_by_available_decryptors (const gchar **
+ system_identifiers)
+{
+ GList *decryptors, *walk;
+ gchar **retval = NULL;
+ guint i = 0, decryptors_number;
+
+ decryptors =
+ gst_element_factory_list_get_elements (GST_ELEMENT_FACTORY_TYPE_DECRYPTOR,
+ GST_RANK_MARGINAL);
+
+ decryptors_number = g_list_length (decryptors);
+
+ GST_TRACE ("found %u decrytors", decryptors_number);
+
+ if (decryptors_number == 0)
+ goto beach;
+
+ retval = g_new (gchar *, decryptors_number + 1);
+
+ for (walk = decryptors; walk; walk = g_list_next (walk)) {
+ GstElementFactory *fact = (GstElementFactory *) walk->data;
+ const char *found_sys_id =
+ gst_protection_factory_check (fact, system_identifiers);
+
+ GST_DEBUG ("factory %s is valid for %s", GST_OBJECT_NAME (fact),
+ found_sys_id);
+
+ if (found_sys_id) {
+ retval[i++] = g_strdup (found_sys_id);
+ }
+ }
+ retval[i] = NULL;
+
+ if (retval[0] == NULL) {
+ g_free (retval);
+ retval = NULL;
+ }
+
+beach:
+ gst_plugin_feature_list_free (decryptors);
+
+ return retval;
+}
+
static const gchar *
gst_protection_factory_check (GstElementFactory * fact,
const gchar ** system_identifiers)