qtdemux: add context for a preferred protection
authorXabier Rodriguez Calvar <calvaris@igalia.com>
Wed, 21 Jun 2017 15:59:21 +0000 (17:59 +0200)
committerThibault Saunier <tsaunier@igalia.com>
Mon, 21 May 2018 15:36:17 +0000 (17:36 +0200)
commitee4b45da24cb7465b416c230597f8efc7b2c45cb
tree2fe9697cfdad8dd7cfc88c1da032283eb04e131e
parent844423ff99e281fc831303b92861ed43ce5c1518
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.

[eocanha@igalia.com: 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
gst/isomp4/qtdemux.h