summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYacine Bandou <yacine.bandou@softathome.com>2021-06-21 13:47:50 +0200
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-07-06 12:12:24 +0000
commitce0be27caf69aa9d96b73bc2b50737451b6f6936 (patch)
tree8e5a655febd6b449e7033fc79c20248994550eba
parent304a75a67a7f036ac18e30e1b36dcda527f5b004 (diff)
downloadgstreamer-plugins-good-ce0be27caf69aa9d96b73bc2b50737451b6f6936.tar.gz
qtdemux: No need for new "application/x-cbcs" caps
Instead of using the new "application/x-cbcs" caps, we are just adding a new structure field "ciphe-mode", to indicate which encryption scheme is used: "cenc", "cbcs", "cbc1" or "cens". Similarly for the protection metadata, we add the "cipher-mode" field to specify the encryption mode with which the buffers are encrypted. "cenc": AES-CTR (no pattern) "cbc1": AES-CBC (no pattern) "cens": AES-CTR (pattern specified) "cbcs": AES-CBC (pattern specified, using a constant IV) Currently only "cenc" and "cbcs" are supported. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1013>
-rw-r--r--gst/isomp4/qtdemux.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c
index 17a909d42..9e15439c2 100644
--- a/gst/isomp4/qtdemux.c
+++ b/gst/isomp4/qtdemux.c
@@ -2689,15 +2689,12 @@ qtdemux_update_default_sample_cenc_settings (GstQTDemux * qtdemux,
guint crypt_byte_block, guint skip_byte_block, guint8 constant_iv_size,
const guint8 * constant_iv)
{
- const gchar *protection_scheme_type_mime =
- protection_scheme_type ==
- FOURCC_cbcs ? "application/x-cbcs" : "application/x-cenc";
GstBuffer *kid_buf = gst_buffer_new_allocate (NULL, 16, NULL);
gst_buffer_fill (kid_buf, 0, kid, 16);
if (info->default_properties)
gst_structure_free (info->default_properties);
info->default_properties =
- gst_structure_new (protection_scheme_type_mime,
+ gst_structure_new ("application/x-cenc",
"iv_size", G_TYPE_UINT, iv_size,
"encrypted", G_TYPE_BOOLEAN, (is_encrypted == 1),
"kid", GST_TYPE_BUFFER, kid_buf, NULL);
@@ -2719,6 +2716,11 @@ qtdemux_update_default_sample_cenc_settings (GstQTDemux * qtdemux,
NULL);
gst_buffer_unref (constant_iv_buf);
}
+ gst_structure_set (info->default_properties, "cipher-mode",
+ G_TYPE_STRING, "cbcs", NULL);
+ } else {
+ gst_structure_set (info->default_properties, "cipher-mode",
+ G_TYPE_STRING, "cenc", NULL);
}
}
@@ -3768,7 +3770,7 @@ qtdemux_gst_structure_free (GstStructure * gststructure)
}
/* Parses auxiliary information relating to samples protected using
- * Common Encryption (cenc and cbcs); the format of this information
+ * Common Encryption (cenc); the format of this information
* is defined in ISO/IEC 23001-7. Returns TRUE if successful; FALSE
* otherwise. */
static gboolean
@@ -8394,13 +8396,13 @@ gst_qtdemux_configure_protected_caps (GstQTDemux * qtdemux,
}
s = gst_caps_get_structure (CUR_STREAM (stream)->caps, 0);
- if (!gst_structure_has_name (s, "application/x-cenc")
- && !gst_structure_has_name (s, "application/x-cbcs")) {
+ if (!gst_structure_has_name (s, "application/x-cenc")) {
gst_structure_set (s,
"original-media-type", G_TYPE_STRING, gst_structure_get_name (s), NULL);
- gst_structure_set_name (s,
- stream->protection_scheme_type ==
- FOURCC_cbcs ? "application/x-cbcs" : "application/x-cenc");
+ gst_structure_set (s, "cipher-mode", G_TYPE_STRING,
+ (stream->protection_scheme_type == FOURCC_cbcs) ? "cbcs" : "cenc",
+ NULL);
+ gst_structure_set_name (s, "application/x-cenc");
}
if (qtdemux->protection_system_ids == NULL) {