Commit ce0be27c authored by Yacine Bandou's avatar Yacine Bandou Committed by GStreamer Marge Bot
Browse files

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: <!1013>
parent 304a75a6
Pipeline #354162 waiting for manual action with stages
in 41 seconds
......@@ -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) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment