Title: [232060] trunk/Tools
Revision
232060
Author
[email protected]
Date
2018-05-22 04:37:15 -0700 (Tue, 22 May 2018)

Log Message

[GStreamer] Update to GStreamer 1.14.1 in jhbuild
https://bugs.webkit.org/show_bug.cgi?id=185689

Patch by Thibault Saunier <[email protected]> on 2018-05-22
Reviewed by Philippe Normand.

And update the patches, removing the ones that have been merged upstream.

* gstreamer/jhbuild.modules:
* gstreamer/patches/gst-plugins-good-0001-gstgdkpixbufdec-stop-pretending-to-decode-gifs.patch: Removed.
* gstreamer/patches/gst-plugins-good-0001-souphttpsrc-cookie-jar-and-context-query-support.patch: Removed. Not needed anymore and closed as OBSELETE upstream.
* gstreamer/patches/gst-plugins-good-0002-qtdemux-add-context-for-a-preferred-protection.patch: Renamed from Tools/gstreamer/patches/gst-plugins-good-0006-qtdemux-add-context-for-a-preferred-protection.patch
This patch has now been merged in GStreamer master and will be there in GStreamer 1.16.
* gstreamer/patches/gst-plugins-good-0003-qtdemux-also-push-buffers-without-encryption-info-in.patch: Renamed from Tools/gstreamer/patches/gst-plugins-good-0008-qtdemux-also-push-buffers-without-encryption-info-in.patch.
This patch has now been merged in GStreamer master and will be there in GStreamer 1.16.
* gstreamer/patches/gst-plugins-good-0009-qtdemux-fix-assert-when-moof-contains-one-sample.patch: Removed.
* gstreamer/patches/gstreamer-0001-protection-added-function-to-filter-system-ids.patch: Removed.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Tools/ChangeLog (232059 => 232060)


--- trunk/Tools/ChangeLog	2018-05-22 10:49:17 UTC (rev 232059)
+++ trunk/Tools/ChangeLog	2018-05-22 11:37:15 UTC (rev 232060)
@@ -1,3 +1,22 @@
+2018-05-22  Thibault Saunier  <[email protected]>
+
+        [GStreamer] Update to GStreamer 1.14.1 in jhbuild
+        https://bugs.webkit.org/show_bug.cgi?id=185689
+
+        Reviewed by Philippe Normand.
+
+        And update the patches, removing the ones that have been merged upstream.
+
+        * gstreamer/jhbuild.modules:
+        * gstreamer/patches/gst-plugins-good-0001-gstgdkpixbufdec-stop-pretending-to-decode-gifs.patch: Removed.
+        * gstreamer/patches/gst-plugins-good-0001-souphttpsrc-cookie-jar-and-context-query-support.patch: Removed. Not needed anymore and closed as OBSELETE upstream.
+        * gstreamer/patches/gst-plugins-good-0002-qtdemux-add-context-for-a-preferred-protection.patch: Renamed from Tools/gstreamer/patches/gst-plugins-good-0006-qtdemux-add-context-for-a-preferred-protection.patch
+        This patch has now been merged in GStreamer master and will be there in GStreamer 1.16.
+        * gstreamer/patches/gst-plugins-good-0003-qtdemux-also-push-buffers-without-encryption-info-in.patch: Renamed from Tools/gstreamer/patches/gst-plugins-good-0008-qtdemux-also-push-buffers-without-encryption-info-in.patch.
+        This patch has now been merged in GStreamer master and will be there in GStreamer 1.16.
+        * gstreamer/patches/gst-plugins-good-0009-qtdemux-fix-assert-when-moof-contains-one-sample.patch: Removed.
+        * gstreamer/patches/gstreamer-0001-protection-added-function-to-filter-system-ids.patch: Removed.
+
 2018-05-21  Yusuke Suzuki  <[email protected]>
 
         Use more C++17

Modified: trunk/Tools/gstreamer/jhbuild.modules (232059 => 232060)


--- trunk/Tools/gstreamer/jhbuild.modules	2018-05-22 10:49:17 UTC (rev 232059)
+++ trunk/Tools/gstreamer/jhbuild.modules	2018-05-22 11:37:15 UTC (rev 232060)
@@ -44,10 +44,7 @@
     <dependencies>
       <dep package="orc"/>
     </dependencies>
-    <branch module="gstreamer/gstreamer-${version}.tar.xz" version="1.12.4"
-            repo="gstreamer"
-            hash="sha256:5a8704aa4c2eeb04da192c4a9942f94f860ac1a585de90d9f914bac26a970674">
-      <patch file="gstreamer-0001-protection-added-function-to-filter-system-ids.patch" strip="1"/>
+    <branch hash="sha:28d82b0d261544a9bf85b429399929e4986eb00efcf1ce16cc71d269a4c3186c" module="gstreamer/gstreamer-${version}.tar.xz" repo="gstreamer" version="1.14.1">
     </branch>
   </autotools>
 
@@ -60,9 +57,7 @@
     <dependencies>
       <dep package="gstreamer"/>
     </dependencies>
-    <branch module="gst-plugins-base/gst-plugins-base-${version}.tar.xz" version="1.12.4"
-            repo="gstreamer"
-            hash="sha256:4c306b03df0212f1b8903784e29bb3493319ba19ebebf13b0c56a17870292282"/>
+    <branch hash="sha:1026c7c3082d825d9b5d034c1a6dd8a4ebab60eb3738b0a0afde4ad2dc0b0db5" module="gst-plugins-base/gst-plugins-base-${version}.tar.xz" repo="gstreamer" version="1.14.1" />
   </autotools>
 
   <autotools id="gst-plugins-good" autogen-sh="configure" autogenargs="--disable-examples --disable-gtk-doc --disable-introspection">
@@ -71,14 +66,9 @@
       <dep package="libvpx"/>
     </dependencies>
 
-    <branch module="gst-plugins-good/gst-plugins-good-${version}.tar.xz" version="1.12.4"
-            repo="gstreamer"
-            hash="sha256:649f49bec60892d47ee6731b92266974c723554da1c6649f21296097715eb957">
-      <patch file="gst-plugins-good-0001-gstgdkpixbufdec-stop-pretending-to-decode-gifs.patch" strip="1"/>
-      <patch file="gst-plugins-good-0005-souphttpsrc-cookie-jar-and-context-query-support.patch" strip="1"/>
-      <patch file="gst-plugins-good-0006-qtdemux-add-context-for-a-preferred-protection.patch" strip="1"/>
-      <patch file="gst-plugins-good-0008-qtdemux-also-push-buffers-without-encryption-info-in.patch" strip="1"/>
-      <patch file="gst-plugins-good-0009-qtdemux-fix-assert-when-moof-contains-one-sample.patch" strip="1"/>
+    <branch hash="sha:34ec062ddb766a32377532e039781f4a16fbc3e8b449e642605bacab26a99172" module="gst-plugins-good/gst-plugins-good-${version}.tar.xz" repo="gstreamer" version="1.14.1">
+      <patch file="gst-plugins-good-0002-qtdemux-add-context-for-a-preferred-protection.patch" strip="1" /> <!-- Merged as ee4b45da24cb7465b416c230597f8efc7b2c45cb -->
+      <patch file="gst-plugins-good-0003-qtdemux-also-push-buffers-without-encryption-info-in.patch" strip="1" /> <!-- Merged as 844423ff99e281fc831303b92861ed43ce5c1518 -->
     </branch>
   </autotools>
 
@@ -88,9 +78,7 @@
       <dep package="gst-plugins-base"/>
       <dep package="openh264"/>
     </dependencies>
-    <branch module="gst-plugins-bad/gst-plugins-bad-${version}.tar.xz" version="1.12.4"
-            repo="gstreamer"
-            hash="sha256:0c7857be16686d5c1ba6e34bd338664d3d4599d32714a8eca5c8a41a101e2d08"/>
+    <branch hash="sha:2a77c6908032aafdf2cd2e5823fec948f16a25c2d1497a953828d762dc20d61a" module="gst-plugins-bad/gst-plugins-bad-${version}.tar.xz" repo="gstreamer" version="1.14.1" />
   </autotools>
 
   <autotools id="gst-libav" autogen-sh="configure" autogenargs="--with-libav-extra-configure='--disable-yasm' --disable-gtk-doc">
@@ -97,15 +85,11 @@
     <dependencies>
       <dep package="gst-plugins-base"/>
     </dependencies>
-    <branch module="gst-libav/gst-libav-${version}.tar.xz" version="1.12.4"
-            repo="gstreamer"
-            hash="sha256:2a56aa5d2d8cd912f2bce17f174713d2c417ca298f1f9c28ee66d4aa1e1d9e62"/>
+    <branch hash="sha:eff80a02d2f2fb9f34b67e9a26e9954d3218c7aa18e863f2a47805fa7066029d" module="gst-libav/gst-libav-${version}.tar.xz" repo="gstreamer" version="1.14.1" />
   </autotools>
 
   <autotools id="gstreamer-vaapi">
-    <branch module="gstreamer-vaapi/gstreamer-vaapi-${version}.tar.xz" version="1.12.4"
-            repo="gstreamer"
-            hash="sha256:1c2d77242e1f30c4d1394636cae9f6877228a017960fca96881e0080d8b6e9c9"/>
+    <branch hash="sha:585c3ddb0c39220de0a33e5d0ed6196a108b8407ec3538d7c64617713b4434e8" module="gstreamer-vaapi/gstreamer-vaapi-${version}.tar.xz" repo="gstreamer" version="1.14.1" />
     <dependencies>
       <dep package="gstreamer"/>
       <dep package="gst-plugins-base"/>

Deleted: trunk/Tools/gstreamer/patches/gst-plugins-good-0001-gstgdkpixbufdec-stop-pretending-to-decode-gifs.patch (232059 => 232060)


--- trunk/Tools/gstreamer/patches/gst-plugins-good-0001-gstgdkpixbufdec-stop-pretending-to-decode-gifs.patch	2018-05-22 10:49:17 UTC (rev 232059)
+++ trunk/Tools/gstreamer/patches/gst-plugins-good-0001-gstgdkpixbufdec-stop-pretending-to-decode-gifs.patch	2018-05-22 11:37:15 UTC (rev 232060)
@@ -1,30 +0,0 @@
-From c7a172517deb7ca8920b6c910998cfecd8b1893d Mon Sep 17 00:00:00 2001
-From: Mathieu Duponchelle <[email protected]>
-Date: Tue, 13 Jun 2017 18:51:32 +0200
-Subject: [PATCH] gstgdkpixbufdec: stop pretending to decode gifs.
-
-If you can't decode an animated gif, you can't decode a gif,
-so stop squatting GST_RANK_SECONDARY for that format, libav
-does a better job.
-
-https://bugzilla.gnome.org/show_bug.cgi?id=784683
----
- ext/gdk_pixbuf/gstgdkpixbufdec.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/ext/gdk_pixbuf/gstgdkpixbufdec.c b/ext/gdk_pixbuf/gstgdkpixbufdec.c
-index 1598c53be..09211bf17 100644
---- a/ext/gdk_pixbuf/gstgdkpixbufdec.c
-+++ b/ext/gdk_pixbuf/gstgdkpixbufdec.c
-@@ -38,7 +38,7 @@ static GstStaticPadTemplate gst_gdk_pixbuf_dec_sink_template =
-     GST_PAD_ALWAYS,
-     GST_STATIC_CAPS ("image/png; "
-         /* "image/jpeg; " disabled because we can't handle MJPEG */
--        "image/gif; "
-+        /*"image/gif; " disabled because we can't handle animated gifs */
-         "image/x-icon; "
-         "application/x-navi-animation; "
-         "image/x-cmu-raster; "
--- 
-2.15.1
-

Copied: trunk/Tools/gstreamer/patches/gst-plugins-good-0002-qtdemux-add-context-for-a-preferred-protection.patch (from rev 232059, trunk/Tools/gstreamer/patches/gst-plugins-good-0006-qtdemux-add-context-for-a-preferred-protection.patch) (0 => 232060)


--- trunk/Tools/gstreamer/patches/gst-plugins-good-0002-qtdemux-add-context-for-a-preferred-protection.patch	                        (rev 0)
+++ trunk/Tools/gstreamer/patches/gst-plugins-good-0002-qtdemux-add-context-for-a-preferred-protection.patch	2018-05-22 11:37:15 UTC (rev 232060)
@@ -0,0 +1,330 @@
+From 0ba62ba4805e2cdbed17fa9934762d685be42fd4 Mon Sep 17 00:00:00 2001
+From: Xabier Rodriguez Calvar <[email protected]>
+Date: Wed, 21 Jun 2017 17:59:21 +0200
+Subject: [PATCH 2/7] qtdemux: add context for a preferred protection
+
+qtdemux selected the first system corresponding to a working GStreamer
+decryptor. With this change, before selecting that decryptor, qtdemux
+will check if it has context (a preferred decryptor id) and if not, it
+will request it.
+
+The request includes track-id, available key system ids for the
+available decryptors and even the events so that the init data is
+accessible.
+
+[[email protected]: select the preferred protection system even if not available]
+
+Test "4. ClearKeyVideo" in YouTube leanback EME conformance tests 2016 for
+H.264[1] uses a media file[2] with cenc encryption which embeds 'pssh' boxes
+with the init data for the Playready and Widevine encryption systems, but not
+for the ClearKey encryption system (as defined by the EMEv0.1b spec[3] and with
+the encryption system id defined in [4]).
+
+Instead, the ClearKey encryption system is manually selected by the web page
+code (even if not originally detected by qtdemux) and the proper decryption key
+is dispatched to the decryptor, which can then decrypt the video successfully.
+
+[1] http://yt-dash-mse-test.commondatastorage.googleapis.com/unit-tests/2016.html?test_type=encryptedmedia-test&webm=false
+[2] http://yt-dash-mse-test.commondatastorage.googleapis.com/unit-tests/media/car_cenc-20120827-86.mp4
+[3] https://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1b/encrypted-media/encrypted-media.html#simple-decryption-clear-key
+[4] https://www.w3.org/Bugs/Public/show_bug.cgi?id=24027#c2
+
+https://bugzilla.gnome.org/show_bug.cgi?id=770107
+---
+ gst/isomp4/qtdemux.c | 200 +++++++++++++++++++++++++++++++++++++++++--
+ gst/isomp4/qtdemux.h |   1 +
+ 2 files changed, 195 insertions(+), 6 deletions(-)
+
+diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c
+index 705bdf7ca..da22463f8 100644
+--- a/gst/isomp4/qtdemux.c
++++ b/gst/isomp4/qtdemux.c
+@@ -511,6 +511,8 @@ static GstIndex *gst_qtdemux_get_index (GstElement * element);
+ #endif
+ static GstStateChangeReturn gst_qtdemux_change_state (GstElement * element,
+     GstStateChange transition);
++static void gst_qtdemux_set_context (GstElement * element,
++    GstContext * context);
+ static gboolean qtdemux_sink_activate (GstPad * sinkpad, GstObject * parent);
+ static gboolean qtdemux_sink_activate_mode (GstPad * sinkpad,
+     GstObject * parent, GstPadMode mode, gboolean active);
+@@ -600,6 +602,7 @@ gst_qtdemux_class_init (GstQTDemuxClass * klass)
+   gstelement_class->set_index = GST_DEBUG_FUNCPTR (gst_qtdemux_set_index);
+   gstelement_class->get_index = GST_DEBUG_FUNCPTR (gst_qtdemux_get_index);
+ #endif
++  gstelement_class->set_context = GST_DEBUG_FUNCPTR (gst_qtdemux_set_context);
+ 
+   gst_tag_register_musicbrainz_tags ();
+ 
+@@ -658,6 +661,7 @@ gst_qtdemux_init (GstQTDemux * qtdemux)
+   qtdemux->cenc_aux_info_sizes = NULL;
+   qtdemux->cenc_aux_sample_count = 0;
+   qtdemux->protection_system_ids = NULL;
++  qtdemux->preferred_protection_system_id = NULL;
+   g_queue_init (&qtdemux->protection_event_queue);
+   gst_segment_init (&qtdemux->segment, GST_FORMAT_TIME);
+   qtdemux->tag_list = gst_tag_list_new_empty ();
+@@ -2121,6 +2125,10 @@ gst_qtdemux_reset (GstQTDemux * qtdemux, gboolean hard)
+       g_ptr_array_free (qtdemux->protection_system_ids, TRUE);
+       qtdemux->protection_system_ids = NULL;
+     }
++    if (qtdemux->preferred_protection_system_id) {
++      g_free (qtdemux->preferred_protection_system_id);
++      qtdemux->preferred_protection_system_id = NULL;
++    }
+   } else if (qtdemux->mss_mode) {
+     gst_flow_combiner_reset (qtdemux->flowcombiner);
+     for (n = 0; n < qtdemux->n_streams; n++)
+@@ -2606,6 +2614,28 @@ gst_qtdemux_change_state (GstElement * element, GstStateChange transition)
+   return result;
+ }
+ 
++static void
++gst_qtdemux_set_context (GstElement * element, GstContext * context)
++{
++  GstQTDemux *qtdemux = GST_QTDEMUX (element);
++
++  g_return_if_fail (GST_IS_CONTEXT (context));
++
++  if (gst_context_has_context_type (context,
++          "drm-preferred-decryption-system-id")) {
++    const GstStructure *s;
++
++    s = gst_context_get_structure (context);
++    g_free (qtdemux->preferred_protection_system_id);
++    qtdemux->preferred_protection_system_id =
++        g_strdup (gst_structure_get_string (s, "decryption-system-id"));
++    GST_DEBUG_OBJECT (element, "set preferred decryption system to %s",
++        qtdemux->preferred_protection_system_id);
++  }
++
++  GST_ELEMENT_CLASS (parent_class)->set_context (element, context);
++}
++
+ static void
+ qtdemux_parse_ftyp (GstQTDemux * qtdemux, const guint8 * buffer, gint length)
+ {
+@@ -3847,6 +3877,8 @@ qtdemux_parse_pssh (GstQTDemux * qtdemux, GNode * node)
+   event = gst_event_new_protection (sysid_string, pssh,
+       (parent_box_type == FOURCC_moov) ? "isobmff/moov" : "isobmff/moof");
+   for (i = 0; i < qtdemux->n_streams; ++i) {
++    GST_TRACE_OBJECT (qtdemux,
++        "adding protection event for stream %d and system %s", i, sysid_string);
+     g_queue_push_tail (&qtdemux->streams[i]->protection_scheme_event_queue,
+         gst_event_ref (event));
+   }
+@@ -5563,6 +5595,8 @@ gst_qtdemux_decorate_and_push_buffer (GstQTDemux * qtdemux,
+     GstEvent *event;
+ 
+     while ((event = g_queue_pop_head (&stream->protection_scheme_event_queue))) {
++      GST_TRACE_OBJECT (stream->pad, "pushing protection event: %"
++          GST_PTR_FORMAT, event);
+       gst_pad_push_event (stream->pad, event);
+     }
+ 
+@@ -7756,12 +7790,142 @@ qtdemux_do_allocation (GstQTDemux * qtdemux, QtDemuxStream * stream)
+ #endif
+ }
+ 
++static gboolean
++pad_query (const GValue * item, GValue * value, gpointer user_data)
++{
++  GstPad *pad = g_value_get_object (item);
++  GstQuery *query = user_data;
++  gboolean res;
++
++  res = gst_pad_peer_query (pad, query);
++
++  if (res) {
++    g_value_set_boolean (value, TRUE);
++    return FALSE;
++  }
++
++  GST_INFO_OBJECT (pad, "pad peer query failed");
++  return TRUE;
++}
++
++static gboolean
++gst_qtdemux_run_query (GstElement * element, GstQuery * query,
++    GstPadDirection direction)
++{
++  GstIterator *it;
++  GstIteratorFoldFunction func = pad_query;
++  GValue res = { 0, };
++
++  g_value_init (&res, G_TYPE_BOOLEAN);
++  g_value_set_boolean (&res, FALSE);
++
++  /* Ask neighbor */
++  if (direction == GST_PAD_SRC)
++    it = gst_element_iterate_src_pads (element);
++  else
++    it = gst_element_iterate_sink_pads (element);
++
++  while (gst_iterator_fold (it, func, &res, query) == GST_ITERATOR_RESYNC)
++    gst_iterator_resync (it);
++
++  gst_iterator_free (it);
++
++  return g_value_get_boolean (&res);
++}
++
++static void
++gst_qtdemux_request_protection_context (GstQTDemux * qtdemux,
++    QtDemuxStream * stream)
++{
++  GstQuery *query;
++  GstContext *ctxt;
++  GstElement *element = GST_ELEMENT (qtdemux);
++  GstStructure *st;
++  gchar **filtered_sys_ids;
++  GValue event_list = G_VALUE_INIT;
++  GList *walk;
++
++  /* 1. Check if we already have the context. */
++  if (qtdemux->preferred_protection_system_id != NULL) {
++    GST_LOG_OBJECT (element,
++        "already have the protection context, no need to request it again");
++    return;
++  }
++
++  g_ptr_array_add (qtdemux->protection_system_ids, NULL);
++  filtered_sys_ids = gst_protection_filter_systems_by_available_decryptors (
++      (const gchar **) qtdemux->protection_system_ids->pdata);
++  g_ptr_array_remove_index (qtdemux->protection_system_ids,
++      qtdemux->protection_system_ids->len - 1);
++  GST_TRACE_OBJECT (qtdemux, "detected %u protection systems, we have "
++      "decryptors for %u of them, running context request",
++      qtdemux->protection_system_ids->len, g_strv_length (filtered_sys_ids));
++
++  if (stream->protection_scheme_event_queue.length) {
++    GST_TRACE_OBJECT (qtdemux, "using stream event queue, length %u",
++        stream->protection_scheme_event_queue.length);
++    walk = stream->protection_scheme_event_queue.tail;
++  } else {
++    GST_TRACE_OBJECT (qtdemux, "using demuxer event queue, length %u",
++        qtdemux->protection_event_queue.length);
++    walk = qtdemux->protection_event_queue.tail;
++  }
++
++  g_value_init (&event_list, GST_TYPE_LIST);
++  for (; walk; walk = g_list_previous (walk)) {
++    GValue *event_value = g_new0 (GValue, 1);
++    g_value_init (event_value, GST_TYPE_EVENT);
++    g_value_set_boxed (event_value, walk->data);
++    gst_value_list_append_and_take_value (&event_list, event_value);
++  }
++
++  /*  2a) Query downstream with GST_QUERY_CONTEXT for the context and
++   *      check if downstream already has a context of the specific type
++   *  2b) Query upstream as above.
++   */
++  query = gst_query_new_context ("drm-preferred-decryption-system-id");
++  st = gst_query_writable_structure (query);
++  gst_structure_set (st, "track-id", G_TYPE_UINT, stream->track_id,
++      "stream-encryption-systems", G_TYPE_STRV, filtered_sys_ids, NULL);
++  gst_structure_set_value (st, "stream-encryption-events", &event_list);
++  if (gst_qtdemux_run_query (element, query, GST_PAD_SRC)) {
++    gst_query_parse_context (query, &ctxt);
++    GST_INFO_OBJECT (element, "found context (%p) in downstream query", ctxt);
++    gst_element_set_context (element, ctxt);
++  } else if (gst_qtdemux_run_query (element, query, GST_PAD_SINK)) {
++    gst_query_parse_context (query, &ctxt);
++    GST_INFO_OBJECT (element, "found context (%p) in upstream query", ctxt);
++    gst_element_set_context (element, ctxt);
++  } else {
++    /* 3) Post a GST_MESSAGE_NEED_CONTEXT message on the bus with
++     *    the required context type and afterwards check if a
++     *    usable context was set now as in 1). The message could
++     *    be handled by the parent bins of the element and the
++     *    application.
++     */
++    GstMessage *msg;
++
++    GST_INFO_OBJECT (element, "posting need context message");
++    msg = gst_message_new_need_context (GST_OBJECT_CAST (element),
++        "drm-preferred-decryption-system-id");
++    st = (GstStructure *) gst_message_get_structure (msg);
++    gst_structure_set (st, "track-id", G_TYPE_UINT, stream->track_id,
++        "stream-encryption-systems", G_TYPE_STRV, filtered_sys_ids, NULL);
++    gst_structure_set_value (st, "stream-encryption-events", &event_list);
++    gst_element_post_message (element, msg);
++  }
++
++  g_strfreev (filtered_sys_ids);
++  g_value_unset (&event_list);
++  gst_query_unref (query);
++}
++
+ static gboolean
+ gst_qtdemux_configure_protected_caps (GstQTDemux * qtdemux,
+     QtDemuxStream * stream)
+ {
+   GstStructure *s;
+-  const gchar *selected_system;
++  const gchar *selected_system = NULL;
+ 
+   g_return_val_if_fail (qtdemux != NULL, FALSE);
+   g_return_val_if_fail (stream != NULL, FALSE);
+@@ -7777,17 +7941,41 @@ gst_qtdemux_configure_protected_caps (GstQTDemux * qtdemux,
+         "cenc protection system information has been found");
+     return FALSE;
+   }
+-  g_ptr_array_add (qtdemux->protection_system_ids, NULL);
+-  selected_system = gst_protection_select_system ((const gchar **)
+-      qtdemux->protection_system_ids->pdata);
+-  g_ptr_array_remove_index (qtdemux->protection_system_ids,
+-      qtdemux->protection_system_ids->len - 1);
++
++  gst_qtdemux_request_protection_context (qtdemux, stream);
++  if (qtdemux->preferred_protection_system_id != NULL) {
++    const gchar *preferred_system_array[] =
++        { qtdemux->preferred_protection_system_id, NULL };
++
++    selected_system = gst_protection_select_system (preferred_system_array);
++
++    if (selected_system) {
++      GST_TRACE_OBJECT (qtdemux, "selected preferred system %s",
++          qtdemux->preferred_protection_system_id);
++    } else {
++      GST_WARNING_OBJECT (qtdemux, "could not select preferred system %s "
++          "because there is no available decryptor",
++          qtdemux->preferred_protection_system_id);
++    }
++  }
++
++  if (!selected_system) {
++    g_ptr_array_add (qtdemux->protection_system_ids, NULL);
++    selected_system = gst_protection_select_system ((const gchar **)
++        qtdemux->protection_system_ids->pdata);
++    g_ptr_array_remove_index (qtdemux->protection_system_ids,
++        qtdemux->protection_system_ids->len - 1);
++  }
++
+   if (!selected_system) {
+     GST_ERROR_OBJECT (qtdemux, "stream is protected, but no "
+         "suitable decryptor element has been found");
+     return FALSE;
+   }
+ 
++  GST_DEBUG_OBJECT (qtdemux, "selected protection system is %s",
++      selected_system);
++
+   s = gst_caps_get_structure (CUR_STREAM (stream)->caps, 0);
+   if (!gst_structure_has_name (s, "application/x-cenc")) {
+     gst_structure_set (s,
+diff --git a/gst/isomp4/qtdemux.h b/gst/isomp4/qtdemux.h
+index ad4da3ef2..079372356 100644
+--- a/gst/isomp4/qtdemux.h
++++ b/gst/isomp4/qtdemux.h
+@@ -151,6 +151,7 @@ struct _GstQTDemux {
+   guint64 cenc_aux_info_offset;
+   guint8 *cenc_aux_info_sizes;
+   guint32 cenc_aux_sample_count;
++  gchar *preferred_protection_system_id;
+ 
+ 
+   /*
+-- 
+2.17.0
+

Copied: trunk/Tools/gstreamer/patches/gst-plugins-good-0003-qtdemux-also-push-buffers-without-encryption-info-in.patch (from rev 232059, trunk/Tools/gstreamer/patches/gst-plugins-good-0008-qtdemux-also-push-buffers-without-encryption-info-in.patch) (0 => 232060)


--- trunk/Tools/gstreamer/patches/gst-plugins-good-0003-qtdemux-also-push-buffers-without-encryption-info-in.patch	                        (rev 0)
+++ trunk/Tools/gstreamer/patches/gst-plugins-good-0003-qtdemux-also-push-buffers-without-encryption-info-in.patch	2018-05-22 11:37:15 UTC (rev 232060)
@@ -0,0 +1,63 @@
+From 762e9c645ec13513c62eb5a3800d7406e01cdcb7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Enrique=20Oca=C3=B1a=20Gonz=C3=A1lez?= <[email protected]>
+Date: Mon, 24 Apr 2017 17:22:02 +0000
+Subject: [PATCH 3/7] qtdemux: also push buffers without encryption info
+ instead of dropping them
+
+---
+ gst/isomp4/qtdemux.c | 39 +++++++++++++++++++--------------------
+ 1 file changed, 19 insertions(+), 20 deletions(-)
+
+diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c
+index da22463f8..8e9f5b9ae 100644
+--- a/gst/isomp4/qtdemux.c
++++ b/gst/isomp4/qtdemux.c
+@@ -5600,26 +5600,25 @@ gst_qtdemux_decorate_and_push_buffer (GstQTDemux * qtdemux,
+       gst_pad_push_event (stream->pad, event);
+     }
+ 
+-    if (info->crypto_info == NULL) {
+-      GST_DEBUG_OBJECT (qtdemux, "cenc metadata hasn't been parsed yet");
+-      gst_buffer_unref (buf);
+-      goto exit;
+-    }
+-
+-    /* The end of the crypto_info array matches our n_samples position,
+-     * so count backward from there */
+-    index = stream->sample_index - stream->n_samples + info->crypto_info->len;
+-    if (G_LIKELY (index >= 0 && index < info->crypto_info->len)) {
+-      /* steal structure from array */
+-      crypto_info = g_ptr_array_index (info->crypto_info, index);
+-      g_ptr_array_index (info->crypto_info, index) = NULL;
+-      GST_LOG_OBJECT (qtdemux, "attaching cenc metadata [%u/%u]", index,
+-          info->crypto_info->len);
+-      if (!crypto_info || !gst_buffer_add_protection_meta (buf, crypto_info))
+-        GST_ERROR_OBJECT (qtdemux, "failed to attach cenc metadata to buffer");
+-    } else {
+-      GST_INFO_OBJECT (qtdemux, "No crypto info with index %d and sample %d",
+-          index, stream->sample_index);
++
++    if (info->crypto_info == NULL)
++      GST_DEBUG_OBJECT (qtdemux, "cenc metadata hasn't been parsed yet, pushing buffer as if it wasn't encrypted");
++    else {
++      /* The end of the crypto_info array matches our n_samples position,
++       * so count backward from there */
++      index = stream->sample_index - stream->n_samples + info->crypto_info->len;
++      if (G_LIKELY (index >= 0 && index < info->crypto_info->len)) {
++        /* steal structure from array */
++        crypto_info = g_ptr_array_index (info->crypto_info, index);
++        g_ptr_array_index (info->crypto_info, index) = NULL;
++        GST_LOG_OBJECT (qtdemux, "attaching cenc metadata [%u/%u]", index,
++            info->crypto_info->len);
++        if (!crypto_info || !gst_buffer_add_protection_meta (buf, crypto_info))
++          GST_ERROR_OBJECT (qtdemux, "failed to attach cenc metadata to buffer");
++      } else {
++        GST_INFO_OBJECT (qtdemux, "No crypto info with index %d and sample %d",
++            index, stream->sample_index);
++      }
+     }
+   }
+ 
+-- 
+2.17.0
+

Deleted: trunk/Tools/gstreamer/patches/gst-plugins-good-0005-souphttpsrc-cookie-jar-and-context-query-support.patch (232059 => 232060)


--- trunk/Tools/gstreamer/patches/gst-plugins-good-0005-souphttpsrc-cookie-jar-and-context-query-support.patch	2018-05-22 10:49:17 UTC (rev 232059)
+++ trunk/Tools/gstreamer/patches/gst-plugins-good-0005-souphttpsrc-cookie-jar-and-context-query-support.patch	2018-05-22 11:37:15 UTC (rev 232060)
@@ -1,120 +0,0 @@
-From 5495e154c5ba05c7e254865e2ff6d1068f2dc6ca Mon Sep 17 00:00:00 2001
-From: Philippe Normand <[email protected]>
-Date: Wed, 28 Oct 2015 12:00:09 +0100
-Subject: [PATCH] souphttpsrc: cookie jar and context query support
-
-Use a volatile Cookie jar to store cookies and handle the context
-query so that session data can be shared with other elements (like
-adaptivedemux).
-
-https://bugzilla.gnome.org/show_bug.cgi?id=726314
----
- ext/soup/gstsouphttpsrc.c | 41 +++++++++++++++++++++++++++++++++++++++--
- ext/soup/gstsouphttpsrc.h |  1 +
- 2 files changed, 40 insertions(+), 2 deletions(-)
-
-diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c
-index 52c1b8182..ac41692a5 100644
---- a/ext/soup/gstsouphttpsrc.c
-+++ b/ext/soup/gstsouphttpsrc.c
-@@ -481,6 +481,7 @@ gst_soup_http_src_init (GstSoupHTTPSrc * src)
-   src->cookies = NULL;
-   src->iradio_mode = DEFAULT_IRADIO_MODE;
-   src->session = NULL;
-+  src->cookie_jar = NULL;
-   src->msg = NULL;
-   src->timeout = DEFAULT_TIMEOUT;
-   src->log_level = DEFAULT_SOUP_LOG_LEVEL;
-@@ -942,6 +943,9 @@ gst_soup_http_src_session_open (GstSoupHTTPSrc * src)
-     soup_session_remove_feature_by_type (src->session,
-         SOUP_TYPE_CONTENT_DECODER);
- 
-+  src->cookie_jar = soup_cookie_jar_new ();
-+  soup_session_add_feature (src->session,
-+      SOUP_SESSION_FEATURE (src->cookie_jar));
-   return TRUE;
- }
- 
-@@ -957,6 +961,11 @@ gst_soup_http_src_session_close (GstSoupHTTPSrc * src)
-     src->msg = NULL;
-   }
- 
-+  if (src->cookie_jar) {
-+    g_object_unref (src->cookie_jar);
-+    src->cookie_jar = NULL;
-+  }
-+
-   if (src->session) {
-     soup_session_abort (src->session);
-     g_object_unref (src->session);
-@@ -1372,11 +1381,12 @@ gst_soup_http_src_build_message (GstSoupHTTPSrc * src, const gchar * method)
-   }
-   if (src->cookies) {
-     gchar **cookie;
-+    SoupURI *uri = soup_uri_new (src->location);
- 
-     for (cookie = src->cookies; *cookie != NULL; cookie++) {
--      soup_message_headers_append (src->msg->request_headers, "Cookie",
--          *cookie);
-+      soup_cookie_jar_set_cookie (src->cookie_jar, uri, *cookie);
-     }
-+    soup_uri_free (uri);
-   }
- 
-   soup_message_set_flags (src->msg, SOUP_MESSAGE_OVERWRITE_CHUNKS |
-@@ -1888,6 +1898,12 @@ gst_soup_http_src_query (GstBaseSrc * bsrc, GstQuery * query)
-   gboolean ret;
-   GstSchedulingFlags flags;
-   gint minsize, maxsize, align;
-+  GstContext *context;
-+  GstStructure *context_structure;
-+  char *cookie;
-+  const gchar *cookies[2];
-+  const gchar *context_type;
-+  SoupURI *uri;
- 
-   switch (GST_QUERY_TYPE (query)) {
-     case GST_QUERY_URI:
-@@ -1899,6 +1915,27 @@ gst_soup_http_src_query (GstBaseSrc * bsrc, GstQuery * query)
-       }
-       ret = TRUE;
-       break;
-+    case GST_QUERY_CONTEXT:
-+      if (gst_query_parse_context_type (query, &context_type)
-+          && !g_strcmp0 (context_type, "http-headers")) {
-+        uri = soup_uri_new (src->location);
-+        cookie = soup_cookie_jar_get_cookies (src->cookie_jar, uri, TRUE);
-+        context = gst_context_new ("http-headers", FALSE);
-+        gst_context_make_writable (context);
-+        context_structure = gst_context_writable_structure (context);
-+        if (cookie != NULL) {
-+          cookies[0] = cookie;
-+          cookies[1] = NULL;
-+          gst_structure_set (context_structure, "cookies", G_TYPE_STRV, cookies,
-+              NULL);
-+          g_free (cookie);
-+        }
-+        gst_query_set_context (query, context);
-+        soup_uri_free (uri);
-+        ret = TRUE;
-+        break;
-+      }
-+
-     default:
-       ret = FALSE;
-       break;
-diff --git a/ext/soup/gstsouphttpsrc.h b/ext/soup/gstsouphttpsrc.h
-index f140f80c5..52b32c768 100644
---- a/ext/soup/gstsouphttpsrc.h
-+++ b/ext/soup/gstsouphttpsrc.h
-@@ -60,6 +60,7 @@ struct _GstSoupHTTPSrc {
-   gchar *proxy_pw;             /* Authentication user password for proxy URI. */
-   gchar **cookies;             /* HTTP request cookies. */
-   SoupSession *session;        /* Async context. */
-+  SoupCookieJar *cookie_jar;   /* Volatile HTTP cookie storage */
-   SoupMessage *msg;            /* Request message. */
-   gint retry_count;            /* Number of retries since we received data */
-   gint max_retries;            /* Maximum number of retries */
--- 
-2.11.0
-

Deleted: trunk/Tools/gstreamer/patches/gst-plugins-good-0006-qtdemux-add-context-for-a-preferred-protection.patch (232059 => 232060)


--- trunk/Tools/gstreamer/patches/gst-plugins-good-0006-qtdemux-add-context-for-a-preferred-protection.patch	2018-05-22 10:49:17 UTC (rev 232059)
+++ trunk/Tools/gstreamer/patches/gst-plugins-good-0006-qtdemux-add-context-for-a-preferred-protection.patch	2018-05-22 11:37:15 UTC (rev 232060)
@@ -1,329 +0,0 @@
-From e09ab95ad39264783bf0e57dfb89165ad9b83802 Mon Sep 17 00:00:00 2001
-From: Xabier Rodriguez Calvar <[email protected]>
-Date: Wed, 21 Jun 2017 17:59:21 +0200
-Subject: [PATCH] qtdemux: add context for a preferred protection
-
-qtdemux selected the first system corresponding to a working GStreamer
-decryptor. With this change, before selecting that decryptor, qtdemux
-will check if it has context (a preferred decryptor id) and if not, it
-will request it.
-
-The request includes track-id, available key system ids for the
-available decryptors and even the events so that the init data is
-accessible.
-
-[[email protected]: select the preferred protection system even if not available]
-
-Test "4. ClearKeyVideo" in YouTube leanback EME conformance tests 2016 for
-H.264[1] uses a media file[2] with cenc encryption which embeds 'pssh' boxes
-with the init data for the Playready and Widevine encryption systems, but not
-for the ClearKey encryption system (as defined by the EMEv0.1b spec[3] and with
-the encryption system id defined in [4]).
-
-Instead, the ClearKey encryption system is manually selected by the web page
-code (even if not originally detected by qtdemux) and the proper decryption key
-is dispatched to the decryptor, which can then decrypt the video successfully.
-
-[1] http://yt-dash-mse-test.commondatastorage.googleapis.com/unit-tests/2016.html?test_type=encryptedmedia-test&webm=false
-[2] http://yt-dash-mse-test.commondatastorage.googleapis.com/unit-tests/media/car_cenc-20120827-86.mp4
-[3] https://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1b/encrypted-media/encrypted-media.html#simple-decryption-clear-key
-[4] https://www.w3.org/Bugs/Public/show_bug.cgi?id=24027#c2
-
-https://bugzilla.gnome.org/show_bug.cgi?id=770107
----
- gst/isomp4/qtdemux.c | 200 +++++++++++++++++++++++++++++++++++++++++++++++++--
- gst/isomp4/qtdemux.h |   1 +
- 2 files changed, 195 insertions(+), 6 deletions(-)
-
-diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c
-index f0f8320e2..f710d2685 100644
---- a/gst/isomp4/qtdemux.c
-+++ b/gst/isomp4/qtdemux.c
-@@ -513,6 +513,8 @@ static GstIndex *gst_qtdemux_get_index (GstElement * element);
- #endif
- static GstStateChangeReturn gst_qtdemux_change_state (GstElement * element,
-     GstStateChange transition);
-+static void gst_qtdemux_set_context (GstElement * element,
-+    GstContext * context);
- static gboolean qtdemux_sink_activate (GstPad * sinkpad, GstObject * parent);
- static gboolean qtdemux_sink_activate_mode (GstPad * sinkpad,
-     GstObject * parent, GstPadMode mode, gboolean active);
-@@ -602,6 +604,7 @@ gst_qtdemux_class_init (GstQTDemuxClass * klass)
-   gstelement_class->set_index = GST_DEBUG_FUNCPTR (gst_qtdemux_set_index);
-   gstelement_class->get_index = GST_DEBUG_FUNCPTR (gst_qtdemux_get_index);
- #endif
-+  gstelement_class->set_context = GST_DEBUG_FUNCPTR (gst_qtdemux_set_context);
- 
-   gst_tag_register_musicbrainz_tags ();
- 
-@@ -660,6 +663,7 @@ gst_qtdemux_init (GstQTDemux * qtdemux)
-   qtdemux->cenc_aux_info_sizes = NULL;
-   qtdemux->cenc_aux_sample_count = 0;
-   qtdemux->protection_system_ids = NULL;
-+  qtdemux->preferred_protection_system_id = NULL;
-   g_queue_init (&qtdemux->protection_event_queue);
-   gst_segment_init (&qtdemux->segment, GST_FORMAT_TIME);
-   qtdemux->tag_list = gst_tag_list_new_empty ();
-@@ -2114,6 +2118,10 @@ gst_qtdemux_reset (GstQTDemux * qtdemux, gboolean hard)
-       g_ptr_array_free (qtdemux->protection_system_ids, TRUE);
-       qtdemux->protection_system_ids = NULL;
-     }
-+    if (qtdemux->preferred_protection_system_id) {
-+      g_free (qtdemux->preferred_protection_system_id);
-+      qtdemux->preferred_protection_system_id = NULL;
-+    }
-   } else if (qtdemux->mss_mode) {
-     gst_flow_combiner_reset (qtdemux->flowcombiner);
-     for (n = 0; n < qtdemux->n_streams; n++)
-@@ -2600,6 +2608,28 @@ gst_qtdemux_change_state (GstElement * element, GstStateChange transition)
- }
- 
- static void
-+gst_qtdemux_set_context (GstElement * element, GstContext * context)
-+{
-+  GstQTDemux *qtdemux = GST_QTDEMUX (element);
-+
-+  g_return_if_fail (GST_IS_CONTEXT (context));
-+
-+  if (gst_context_has_context_type (context,
-+          "drm-preferred-decryption-system-id")) {
-+    const GstStructure *s;
-+
-+    s = gst_context_get_structure (context);
-+    g_free (qtdemux->preferred_protection_system_id);
-+    qtdemux->preferred_protection_system_id =
-+        g_strdup (gst_structure_get_string (s, "decryption-system-id"));
-+    GST_DEBUG_OBJECT (element, "set preferred decryption system to %s",
-+        qtdemux->preferred_protection_system_id);
-+  }
-+
-+  GST_ELEMENT_CLASS (parent_class)->set_context (element, context);
-+}
-+
-+static void
- qtdemux_parse_ftyp (GstQTDemux * qtdemux, const guint8 * buffer, gint length)
- {
-   /* counts as header data */
-@@ -3829,6 +3859,8 @@ qtdemux_parse_pssh (GstQTDemux * qtdemux, GNode * node)
-   event = gst_event_new_protection (sysid_string, pssh,
-       (parent_box_type == FOURCC_moov) ? "isobmff/moov" : "isobmff/moof");
-   for (i = 0; i < qtdemux->n_streams; ++i) {
-+    GST_TRACE_OBJECT (qtdemux,
-+        "adding protection event for stream %d and system %s", i, sysid_string);
-     g_queue_push_tail (&qtdemux->streams[i]->protection_scheme_event_queue,
-         gst_event_ref (event));
-   }
-@@ -5538,6 +5570,8 @@ gst_qtdemux_decorate_and_push_buffer (GstQTDemux * qtdemux,
-     GstEvent *event;
- 
-     while ((event = g_queue_pop_head (&stream->protection_scheme_event_queue))) {
-+      GST_TRACE_OBJECT (stream->pad, "pushing protection event: %"
-+          GST_PTR_FORMAT, event);
-       gst_pad_push_event (stream->pad, event);
-     }
- 
-@@ -7696,11 +7730,141 @@ qtdemux_do_allocation (GstQTDemux * qtdemux, QtDemuxStream * stream)
- }
- 
- static gboolean
-+pad_query (const GValue * item, GValue * value, gpointer user_data)
-+{
-+  GstPad *pad = g_value_get_object (item);
-+  GstQuery *query = user_data;
-+  gboolean res;
-+
-+  res = gst_pad_peer_query (pad, query);
-+
-+  if (res) {
-+    g_value_set_boolean (value, TRUE);
-+    return FALSE;
-+  }
-+
-+  GST_INFO_OBJECT (pad, "pad peer query failed");
-+  return TRUE;
-+}
-+
-+static gboolean
-+gst_qtdemux_run_query (GstElement * element, GstQuery * query,
-+    GstPadDirection direction)
-+{
-+  GstIterator *it;
-+  GstIteratorFoldFunction func = pad_query;
-+  GValue res = { 0, };
-+
-+  g_value_init (&res, G_TYPE_BOOLEAN);
-+  g_value_set_boolean (&res, FALSE);
-+
-+  /* Ask neighbor */
-+  if (direction == GST_PAD_SRC)
-+    it = gst_element_iterate_src_pads (element);
-+  else
-+    it = gst_element_iterate_sink_pads (element);
-+
-+  while (gst_iterator_fold (it, func, &res, query) == GST_ITERATOR_RESYNC)
-+    gst_iterator_resync (it);
-+
-+  gst_iterator_free (it);
-+
-+  return g_value_get_boolean (&res);
-+}
-+
-+static void
-+gst_qtdemux_request_protection_context (GstQTDemux * qtdemux,
-+    QtDemuxStream * stream)
-+{
-+  GstQuery *query;
-+  GstContext *ctxt;
-+  GstElement *element = GST_ELEMENT (qtdemux);
-+  GstStructure *st;
-+  gchar **filtered_sys_ids;
-+  GValue event_list = G_VALUE_INIT;
-+  GList *walk;
-+
-+  /* 1. Check if we already have the context. */
-+  if (qtdemux->preferred_protection_system_id != NULL) {
-+    GST_LOG_OBJECT (element,
-+        "already have the protection context, no need to request it again");
-+    return;
-+  }
-+
-+  g_ptr_array_add (qtdemux->protection_system_ids, NULL);
-+  filtered_sys_ids = gst_protection_filter_systems_by_available_decryptors (
-+      (const gchar **) qtdemux->protection_system_ids->pdata);
-+  g_ptr_array_remove_index (qtdemux->protection_system_ids,
-+      qtdemux->protection_system_ids->len - 1);
-+  GST_TRACE_OBJECT (qtdemux, "detected %u protection systems, we have "
-+      "decryptors for %u of them, running context request",
-+      qtdemux->protection_system_ids->len, g_strv_length (filtered_sys_ids));
-+
-+  if (stream->protection_scheme_event_queue.length) {
-+    GST_TRACE_OBJECT (qtdemux, "using stream event queue, length %u",
-+        stream->protection_scheme_event_queue.length);
-+    walk = stream->protection_scheme_event_queue.tail;
-+  } else {
-+    GST_TRACE_OBJECT (qtdemux, "using demuxer event queue, length %u",
-+        qtdemux->protection_event_queue.length);
-+    walk = qtdemux->protection_event_queue.tail;
-+  }
-+
-+  g_value_init (&event_list, GST_TYPE_LIST);
-+  for (; walk; walk = g_list_previous (walk)) {
-+    GValue *event_value = g_new0 (GValue, 1);
-+    g_value_init (event_value, GST_TYPE_EVENT);
-+    g_value_set_boxed (event_value, walk->data);
-+    gst_value_list_append_and_take_value (&event_list, event_value);
-+  }
-+
-+  /*  2a) Query downstream with GST_QUERY_CONTEXT for the context and
-+   *      check if downstream already has a context of the specific type
-+   *  2b) Query upstream as above.
-+   */
-+  query = gst_query_new_context ("drm-preferred-decryption-system-id");
-+  st = gst_query_writable_structure (query);
-+  gst_structure_set (st, "track-id", G_TYPE_UINT, stream->track_id,
-+      "stream-encryption-systems", G_TYPE_STRV, filtered_sys_ids, NULL);
-+  gst_structure_set_value (st, "stream-encryption-events", &event_list);
-+  if (gst_qtdemux_run_query (element, query, GST_PAD_SRC)) {
-+    gst_query_parse_context (query, &ctxt);
-+    GST_INFO_OBJECT (element, "found context (%p) in downstream query", ctxt);
-+    gst_element_set_context (element, ctxt);
-+  } else if (gst_qtdemux_run_query (element, query, GST_PAD_SINK)) {
-+    gst_query_parse_context (query, &ctxt);
-+    GST_INFO_OBJECT (element, "found context (%p) in upstream query", ctxt);
-+    gst_element_set_context (element, ctxt);
-+  } else {
-+    /* 3) Post a GST_MESSAGE_NEED_CONTEXT message on the bus with
-+     *    the required context type and afterwards check if a
-+     *    usable context was set now as in 1). The message could
-+     *    be handled by the parent bins of the element and the
-+     *    application.
-+     */
-+    GstMessage *msg;
-+
-+    GST_INFO_OBJECT (element, "posting need context message");
-+    msg = gst_message_new_need_context (GST_OBJECT_CAST (element),
-+        "drm-preferred-decryption-system-id");
-+    st = (GstStructure *) gst_message_get_structure (msg);
-+    gst_structure_set (st, "track-id", G_TYPE_UINT, stream->track_id,
-+        "stream-encryption-systems", G_TYPE_STRV, filtered_sys_ids, NULL);
-+    gst_structure_set_value (st, "stream-encryption-events", &event_list);
-+    gst_element_post_message (element, msg);
-+  }
-+
-+  g_strfreev (filtered_sys_ids);
-+  g_value_unset (&event_list);
-+  gst_query_unref (query);
-+}
-+
-+static gboolean
- gst_qtdemux_configure_protected_caps (GstQTDemux * qtdemux,
-     QtDemuxStream * stream)
- {
-   GstStructure *s;
--  const gchar *selected_system;
-+  const gchar *selected_system = NULL;
- 
-   g_return_val_if_fail (qtdemux != NULL, FALSE);
-   g_return_val_if_fail (stream != NULL, FALSE);
-@@ -7716,17 +7880,41 @@ gst_qtdemux_configure_protected_caps (GstQTDemux * qtdemux,
-         "cenc protection system information has been found");
-     return FALSE;
-   }
--  g_ptr_array_add (qtdemux->protection_system_ids, NULL);
--  selected_system = gst_protection_select_system ((const gchar **)
--      qtdemux->protection_system_ids->pdata);
--  g_ptr_array_remove_index (qtdemux->protection_system_ids,
--      qtdemux->protection_system_ids->len - 1);
-+
-+  gst_qtdemux_request_protection_context (qtdemux, stream);
-+  if (qtdemux->preferred_protection_system_id != NULL) {
-+    const gchar *preferred_system_array[] =
-+        { qtdemux->preferred_protection_system_id, NULL };
-+
-+    selected_system = gst_protection_select_system (preferred_system_array);
-+
-+    if (selected_system) {
-+      GST_TRACE_OBJECT (qtdemux, "selected preferred system %s",
-+          qtdemux->preferred_protection_system_id);
-+    } else {
-+      GST_WARNING_OBJECT (qtdemux, "could not select preferred system %s "
-+          "because there is no available decryptor",
-+          qtdemux->preferred_protection_system_id);
-+    }
-+  }
-+
-+  if (!selected_system) {
-+    g_ptr_array_add (qtdemux->protection_system_ids, NULL);
-+    selected_system = gst_protection_select_system ((const gchar **)
-+        qtdemux->protection_system_ids->pdata);
-+    g_ptr_array_remove_index (qtdemux->protection_system_ids,
-+        qtdemux->protection_system_ids->len - 1);
-+  }
-+
-   if (!selected_system) {
-     GST_ERROR_OBJECT (qtdemux, "stream is protected, but no "
-         "suitable decryptor element has been found");
-     return FALSE;
-   }
- 
-+  GST_DEBUG_OBJECT (qtdemux, "selected protection system is %s",
-+      selected_system);
-+
-   s = gst_caps_get_structure (CUR_STREAM (stream)->caps, 0);
-   if (!gst_structure_has_name (s, "application/x-cenc")) {
-     gst_structure_set (s,
-diff --git a/gst/isomp4/qtdemux.h b/gst/isomp4/qtdemux.h
-index ebd725871..b3d64a4e8 100644
---- a/gst/isomp4/qtdemux.h
-+++ b/gst/isomp4/qtdemux.h
-@@ -154,6 +154,7 @@ struct _GstQTDemux {
-   guint64 cenc_aux_info_offset;
-   guint8 *cenc_aux_info_sizes;
-   guint32 cenc_aux_sample_count;
-+  gchar *preferred_protection_system_id;
- 
- 
-   /*
--- 
-2.11.0
-

Deleted: trunk/Tools/gstreamer/patches/gst-plugins-good-0008-qtdemux-also-push-buffers-without-encryption-info-in.patch (232059 => 232060)


--- trunk/Tools/gstreamer/patches/gst-plugins-good-0008-qtdemux-also-push-buffers-without-encryption-info-in.patch	2018-05-22 10:49:17 UTC (rev 232059)
+++ trunk/Tools/gstreamer/patches/gst-plugins-good-0008-qtdemux-also-push-buffers-without-encryption-info-in.patch	2018-05-22 11:37:15 UTC (rev 232060)
@@ -1,63 +0,0 @@
-From 78559bc5db3495f12b0284e4be5fc8bfcd7041e2 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Enrique=20Oca=C3=B1a=20Gonz=C3=A1lez?= <[email protected]>
-Date: Mon, 24 Apr 2017 17:22:02 +0000
-Subject: [PATCH] qtdemux: also push buffers without encryption info instead of
- dropping them
-
----
- gst/isomp4/qtdemux.c | 26 ++++++++++++--------------
- 1 file changed, 12 insertions(+), 14 deletions(-)
-
-diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c
-index f0f8320..3f2c016 100644
---- a/gst/isomp4/qtdemux.c
-+++ b/gst/isomp4/qtdemux.c
-@@ -5541,26 +5541,25 @@ gst_qtdemux_decorate_and_push_buffer (GstQTDemux * qtdemux,
-       gst_pad_push_event (stream->pad, event);
-     }
- 
--    if (info->crypto_info == NULL) {
--      GST_DEBUG_OBJECT (qtdemux, "cenc metadata hasn't been parsed yet");
--      gst_buffer_unref (buf);
--      goto exit;
--    }
--
--    /* The end of the crypto_info array matches our n_samples position,
--     * so count backward from there */
--    index = stream->sample_index - stream->n_samples + info->crypto_info->len;
--    if (G_LIKELY (index >= 0 && index < info->crypto_info->len)) {
--      /* steal structure from array */
--      crypto_info = g_ptr_array_index (info->crypto_info, index);
--      g_ptr_array_index (info->crypto_info, index) = NULL;
--      GST_LOG_OBJECT (qtdemux, "attaching cenc metadata [%u/%u]", index,
--          info->crypto_info->len);
--      if (!crypto_info || !gst_buffer_add_protection_meta (buf, crypto_info))
--        GST_ERROR_OBJECT (qtdemux, "failed to attach cenc metadata to buffer");
--    } else {
--      GST_INFO_OBJECT (qtdemux, "No crypto info with index %d and sample %d",
--          index, stream->sample_index);
-+
-+    if (info->crypto_info == NULL)
-+      GST_DEBUG_OBJECT (qtdemux, "cenc metadata hasn't been parsed yet, pushing buffer as if it wasn't encrypted");
-+    else {
-+      /* The end of the crypto_info array matches our n_samples position,
-+       * so count backward from there */
-+      index = stream->sample_index - stream->n_samples + info->crypto_info->len;
-+      if (G_LIKELY (index >= 0 && index < info->crypto_info->len)) {
-+        /* steal structure from array */
-+        crypto_info = g_ptr_array_index (info->crypto_info, index);
-+        g_ptr_array_index (info->crypto_info, index) = NULL;
-+        GST_LOG_OBJECT (qtdemux, "attaching cenc metadata [%u/%u]", index,
-+            info->crypto_info->len);
-+        if (!crypto_info || !gst_buffer_add_protection_meta (buf, crypto_info))
-+          GST_ERROR_OBJECT (qtdemux, "failed to attach cenc metadata to buffer");
-+      } else {
-+        GST_INFO_OBJECT (qtdemux, "No crypto info with index %d and sample %d",
-+            index, stream->sample_index);
-+      }
-     }
-   }
- 
--- 
-2.11.0
-

Deleted: trunk/Tools/gstreamer/patches/gst-plugins-good-0009-qtdemux-fix-assert-when-moof-contains-one-sample.patch (232059 => 232060)


--- trunk/Tools/gstreamer/patches/gst-plugins-good-0009-qtdemux-fix-assert-when-moof-contains-one-sample.patch	2018-05-22 10:49:17 UTC (rev 232059)
+++ trunk/Tools/gstreamer/patches/gst-plugins-good-0009-qtdemux-fix-assert-when-moof-contains-one-sample.patch	2018-05-22 11:37:15 UTC (rev 232060)
@@ -1,31 +0,0 @@
-From e667ac33dcc039698ee311c22d7b37bedf48df3c Mon Sep 17 00:00:00 2001
-From: Nael Ouedraogo <[email protected]>
-Date: Fri, 22 Sep 2017 18:41:52 +0200
-Subject: [PATCH] qtdemux: fix assert when moof contains one sample
-
-Avoid computing frame rate when a stream contain moof with only one
-sample, to avoid an assert. The moof is considered as still picture.
-
-[ Merged in upstream commit 728a1629cf9fd7f4a728477bda1d13a1ecc219bb ]
-
----
- gst/isomp4/qtdemux.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c
-index 5f4de422e..f839d82f6 100644
---- a/gst/isomp4/qtdemux.c
-+++ b/gst/isomp4/qtdemux.c
-@@ -7531,7 +7531,8 @@ gst_qtdemux_configure_stream (GstQTDemux * qtdemux, QtDemuxStream * stream)
-      * qt does not have a fixed framerate. */
-     gboolean fps_available = TRUE;
- 
--    if ((stream->n_samples == 1) && (stream->first_duration == 0)) {
-+    if ((stream->n_samples == 1 && stream->first_duration == 0)
-+        || (qtdemux->fragmented && stream->n_samples_moof == 1)) {
-       /* still frame */
-       stream->fps_n = 0;
-       stream->fps_d = 1;
--- 
-2.14.1
-

Deleted: trunk/Tools/gstreamer/patches/gstreamer-0001-protection-added-function-to-filter-system-ids.patch (232059 => 232060)


--- trunk/Tools/gstreamer/patches/gstreamer-0001-protection-added-function-to-filter-system-ids.patch	2018-05-22 10:49:17 UTC (rev 232059)
+++ trunk/Tools/gstreamer/patches/gstreamer-0001-protection-added-function-to-filter-system-ids.patch	2018-05-22 11:37:15 UTC (rev 232060)
@@ -1,77 +0,0 @@
-From 7772eb350591682b6a315c8a87a58131f731f1d4 Mon Sep 17 00:00:00 2001
-From: Xabier Rodriguez Calvar <[email protected]>
-Date: Wed, 19 Oct 2016 16:44:16 +0200
-Subject: [PATCH] protection: added 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 avaible
-decryptors for them so the ones you get are the ones that you should be
-able to decrypt.
----
- gst/gstprotection.c | 36 ++++++++++++++++++++++++++++++++++++
- gst/gstprotection.h |  2 ++
- 2 files changed, 38 insertions(+)
-
-diff --git a/gst/gstprotection.c b/gst/gstprotection.c
-index 8ee52ea..2d7e5e0 100644
---- a/gst/gstprotection.c
-+++ b/gst/gstprotection.c
-@@ -191,6 +191,42 @@ gst_protection_select_system (const gchar ** system_identifiers)
-   return retval;
- }
- 
-+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);
-+  retval = g_new (gchar *, decryptors_number + 1);
-+
-+  GST_TRACE ("found %u decrytors", decryptors_number);
-+
-+  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_TRACE ("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;
-+
-+  gst_plugin_feature_list_free (decryptors);
-+
-+  return retval;
-+}
-+
- static const gchar *
- gst_protection_factory_check (GstElementFactory * fact,
-     const gchar ** system_identifiers)
-diff --git a/gst/gstprotection.h b/gst/gstprotection.h
-index f2f54c4..95976c5 100644
---- a/gst/gstprotection.h
-+++ b/gst/gstprotection.h
-@@ -66,6 +66,8 @@ GstProtectionMeta *gst_buffer_add_protection_meta (GstBuffer * buffer,
-     GstStructure * info);
- 
- const gchar *gst_protection_select_system (const gchar ** system_identifiers);
-+gchar ** gst_protection_filter_systems_by_available_decryptors (
-+    const gchar ** system_identifiers);
- 
- G_END_DECLS
- #endif /* __GST_PROTECTION_META_H__ */
--- 
-2.10.2
-
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to