|
| 1 | +From 9ab7d685a56f41c73ef511294a331c027867a617 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Philippe Normand < [email protected]> |
| 3 | +Date: Mon, 12 Jul 2021 12:08:20 +0100 |
| 4 | +Subject: [PATCH] dash: Store entire ContentProtection node in protection event |
| 5 | + data |
| 6 | + |
| 7 | +Some manifests use the ContentProtection node to store additional information |
| 8 | +such as the license server url. Our MPD parser used to process the |
| 9 | +ContentProtection node, extracting Playready PSSH boxes. However for other DRM |
| 10 | +systems, only the `value` attribute was passed down to the protection event, so |
| 11 | +for example, Widevine data was not parsed at all and "Widevine" was passed to |
| 12 | +the event, which is not very useful for decryptors that require a PSSH init |
| 13 | +data. |
| 14 | + |
| 15 | +Parsing should now be done by decryptors which will receive the entire |
| 16 | +ContentProtection XML node as a string. This gives more "freedom" to the |
| 17 | +decryptor which can then detect and parse custom nodes as well. |
| 18 | + |
| 19 | +Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2400> |
| 20 | +Signed-off-by: Xabier Rodriguez Calvar < [email protected]> |
| 21 | +--- |
| 22 | + ext/dash/gstmpdparser.c | 38 +++++++++----------------------------- |
| 23 | + 1 file changed, 9 insertions(+), 29 deletions(-) |
| 24 | + |
| 25 | +diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c |
| 26 | +index 6535cae52..a876b3f45 100644 |
| 27 | +--- a/ext/dash/gstmpdparser.c |
| 28 | ++++ b/ext/dash/gstmpdparser.c |
| 29 | +@@ -1783,35 +1783,15 @@ error: |
| 30 | + static void |
| 31 | + gst_mpdparser_parse_content_protection_node (GList ** list, xmlNode * a_node) |
| 32 | + { |
| 33 | +- gchar *value = NULL; |
| 34 | +- if (gst_mpdparser_get_xml_prop_string (a_node, "value", &value)) { |
| 35 | +- if (!g_strcmp0 (value, "MSPR 2.0")) { |
| 36 | +- xmlNode *cur_node; |
| 37 | +- for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) { |
| 38 | +- if (cur_node->type == XML_ELEMENT_NODE) { |
| 39 | +- if (xmlStrcmp (cur_node->name, (xmlChar *) "pro") == 0) { |
| 40 | +- GstDescriptorType *new_descriptor; |
| 41 | +- new_descriptor = g_slice_new0 (GstDescriptorType); |
| 42 | +- *list = g_list_append (*list, new_descriptor); |
| 43 | +- |
| 44 | +- gst_mpdparser_get_xml_prop_string_stripped (a_node, "schemeIdUri", |
| 45 | +- &new_descriptor->schemeIdUri); |
| 46 | +- |
| 47 | +- gst_mpdparser_get_xml_node_content (cur_node, |
| 48 | +- &new_descriptor->value); |
| 49 | +- goto beach; |
| 50 | +- } |
| 51 | +- } |
| 52 | +- } |
| 53 | +- } else { |
| 54 | +- gst_mpdparser_parse_descriptor_type_node (list, a_node); |
| 55 | +- } |
| 56 | +- } else { |
| 57 | +- gst_mpdparser_parse_descriptor_type_node (list, a_node); |
| 58 | +- } |
| 59 | +-beach: |
| 60 | +- if (value) |
| 61 | +- g_free (value); |
| 62 | ++ GstDescriptorType *new_descriptor; |
| 63 | ++ |
| 64 | ++ new_descriptor = g_slice_new0 (GstDescriptorType); |
| 65 | ++ *list = g_list_append (*list, new_descriptor); |
| 66 | ++ |
| 67 | ++ GST_LOG ("attributes of %s node:", a_node->name); |
| 68 | ++ gst_mpdparser_get_xml_prop_string_stripped (a_node, "schemeIdUri", |
| 69 | ++ &new_descriptor->schemeIdUri); |
| 70 | ++ gst_mpdparser_get_xml_node_as_string (a_node, &new_descriptor->value); |
| 71 | + } |
| 72 | + |
| 73 | + static void |
| 74 | +-- |
| 75 | +2.30.2 |
| 76 | + |
0 commit comments