Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:StefanBruens:branches:multimedia:libs
gstreamer-plugins-good
0001-qtdemux-Allow-omitted-adrm-box-for-new-AAX...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-qtdemux-Allow-omitted-adrm-box-for-new-AAXC-Audible-.patch of Package gstreamer-plugins-good
From aabd879dfa535cc08c2ab0c73924e5afe82940c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de> Date: Sun, 10 Dec 2023 01:26:33 +0100 Subject: [PATCH] qtdemux: Allow omitted adrm box for new AAXC Audible encrypted audio Audible has added a variant of the "aavd" encryptions scheme where the keys are no longer embedded as "adrm" box but must be retrieved from the web servers. Files are identified by their ASIN, available from the "PASN" metadata tag. --- .../gst-plugins-good/gst/isomp4/fourcc.h | 1 + .../gst-plugins-good/gst/isomp4/qtdemux.c | 41 +++++++++++++------ .../gst/isomp4/qtdemux_tags.c | 1 + .../gst/isomp4/qtdemux_types.c | 1 + 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/gst/isomp4/fourcc.h b/gst/isomp4/fourcc.h index 0831b4cf2a..ce80eb1918 100644 --- a/gst/isomp4/fourcc.h +++ b/gst/isomp4/fourcc.h @@ -429,6 +429,7 @@ G_BEGIN_DECLS /* Audible AAX encrypted audio */ #define FOURCC_aavd GST_MAKE_FOURCC('a','a','v','d') #define FOURCC_adrm GST_MAKE_FOURCC('a','d','r','m') +#define FOURCC_PASN GST_MAKE_FOURCC('P','A','S','N') #define FOURCC_metx GST_MAKE_FOURCC('m','e','t','x') diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index 23eafe0de6..31e4017387 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -10783,18 +10783,8 @@ qtdemux_parse_protection_aavd (GstQTDemux * qtdemux, QtDemuxStream * stream, GNode * container, guint32 * original_fmt) { GNode *adrm; - guint32 adrm_size; - GstBuffer *adrm_buf = NULL; QtDemuxAavdEncryptionInfo *info; - adrm = qtdemux_tree_get_child_by_type (container, FOURCC_adrm); - if (G_UNLIKELY (!adrm)) { - GST_ERROR_OBJECT (qtdemux, "aavd box does not contain mandatory adrm box"); - return FALSE; - } - adrm_size = QT_UINT32 (adrm->data); - adrm_buf = gst_buffer_new_memdup (adrm->data, adrm_size); - stream->protection_scheme_type = FOURCC_aavd; if (!stream->protection_scheme_info) @@ -10805,11 +10795,36 @@ qtdemux_parse_protection_aavd (GstQTDemux * qtdemux, if (info->default_properties) gst_structure_free (info->default_properties); info->default_properties = gst_structure_new ("application/x-aavd", - "encrypted", G_TYPE_BOOLEAN, TRUE, - "adrm", GST_TYPE_BUFFER, adrm_buf, NULL); - gst_buffer_unref (adrm_buf); + "encrypted", G_TYPE_BOOLEAN, TRUE, NULL); *original_fmt = FOURCC_mp4a; + + adrm = qtdemux_tree_get_child_by_type (container, FOURCC_adrm); + if (adrm) { + guint32 adrm_size = QT_UINT32 (adrm->data); + GstBuffer *adrm_buf = gst_buffer_new_memdup (adrm->data, adrm_size); + + GST_DEBUG_OBJECT (qtdemux, "Got adrm data"); + gst_structure_set(info->default_properties, "adrm", GST_TYPE_BUFFER, adrm_buf, NULL); + gst_buffer_unref (adrm_buf); + } else { + GNode *udta, *meta, *ilst, *pasn; + + udta = qtdemux_tree_get_child_by_type (qtdemux->moov_node, FOURCC_udta); + meta = udta ? qtdemux_tree_get_child_by_type (udta, FOURCC_meta) : NULL; + ilst = meta ? qtdemux_tree_get_child_by_type (meta, FOURCC_ilst) : NULL; + pasn = ilst ? qtdemux_tree_get_child_by_type (ilst, FOURCC_PASN) : NULL; + if (pasn) { + guint32 pasn_size = QT_UINT32 (pasn->data); + GstBuffer *pasn_buf = + gst_buffer_new_wrapped (g_memdup (pasn->data, pasn_size), pasn_size); + + GST_DEBUG_OBJECT (qtdemux, "Got PASN data"); + gst_structure_set(info->default_properties, "PASN", GST_TYPE_BUFFER, pasn_buf, NULL); + gst_buffer_unref (pasn_buf); + } + } + return TRUE; } diff --git a/gst/isomp4/qtdemux_tags.c b/gst/isomp4/qtdemux_tags.c index f2b384d692..a7a097e549 100644 --- a/gst/isomp4/qtdemux_tags.c +++ b/gst/isomp4/qtdemux_tags.c @@ -975,6 +975,7 @@ static const struct FOURCC__mak, GST_TAG_DEVICE_MANUFACTURER, NULL, qtdemux_tag_add_str}, { FOURCC__mod, GST_TAG_DEVICE_MODEL, NULL, qtdemux_tag_add_str}, { FOURCC__swr, GST_TAG_APPLICATION_NAME, NULL, qtdemux_tag_add_str}, { + FOURCC_PASN, GST_TAG_APPLICATION_DATA, NULL, qtdemux_tag_add_str}, { /* This is a special case, some tags are stored in this * 'reverse dns naming', according to: diff --git a/gst/isomp4/qtdemux_types.c b/gst/isomp4/qtdemux_types.c index 5e6d735c96..eb8e21c5c9 100644 --- a/gst/isomp4/qtdemux_types.c +++ b/gst/isomp4/qtdemux_types.c @@ -245,6 +245,7 @@ static const QtNodeType qt_node_types[] = { {FOURCC_vttc, "VTTCueBox 14496-30", QT_FLAG_CONTAINER}, {FOURCC_metx, "XML MetaData Sample Entry", 0}, {FOURCC_cstb, "Correct Start Time Box", 0}, + {FOURCC_PASN, "Audible ASIN", 0}, {0, "unknown", 0,}, }; -- 2.42.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor