mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 03:01:03 +00:00
protection: add function to filter system ids
gst_protection_filter_systems_by_available_decryptors() takes an array of strings and returns a new array of strings filtered by the available decryptors for them so the ones you get are the ones that you should be able to decrypt. https://bugzilla.gnome.org/show_bug.cgi?id=770107
This commit is contained in:
parent
3683a0753a
commit
bda8440f1f
4 changed files with 66 additions and 0 deletions
|
@ -2461,6 +2461,7 @@ GstProtectionMeta
|
|||
gst_buffer_add_protection_meta
|
||||
gst_buffer_get_protection_meta
|
||||
gst_protection_select_system
|
||||
gst_protection_filter_systems_by_available_decryptors
|
||||
GST_PROTECTION_SYSTEM_ID_CAPS_FIELD
|
||||
<SUBSECTION Standard>
|
||||
GST_PROTECTION_META_API_TYPE
|
||||
|
|
|
@ -193,6 +193,66 @@ gst_protection_select_system (const gchar ** system_identifiers)
|
|||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_protection_filter_systems_by_available_decryptors:
|
||||
* @system_identifiers: (transfer none): 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): 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;
|
||||
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)
|
||||
return NULL;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
gst_plugin_feature_list_free (decryptors);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
gst_protection_factory_check (GstElementFactory * fact,
|
||||
const gchar ** system_identifiers)
|
||||
|
|
|
@ -71,5 +71,9 @@ GstProtectionMeta * gst_buffer_add_protection_meta (GstBuffer * buffer,
|
|||
GST_EXPORT
|
||||
const gchar * gst_protection_select_system (const gchar ** system_identifiers);
|
||||
|
||||
GST_EXPORT
|
||||
gchar ** gst_protection_filter_systems_by_available_decryptors (
|
||||
const gchar ** system_identifiers);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __GST_PROTECTION_META_H__ */
|
||||
|
|
|
@ -1078,6 +1078,7 @@ EXPORTS
|
|||
gst_printerrln
|
||||
gst_println
|
||||
gst_progress_type_get_type
|
||||
gst_protection_filter_systems_by_available_decryptors
|
||||
gst_protection_meta_api_get_type
|
||||
gst_protection_meta_get_info
|
||||
gst_protection_select_system
|
||||
|
|
Loading…
Reference in a new issue