6dbb40955f
Needed for the upcoming Nexus version of kodi-inputstream-adaptive,
the bundled version of bento4 was removed upstream:
70625e7670
Backported upstream commit to fix cmake install as patch 0001.
Added feature- and bugfix-patches from kodi, they were sent upstream:
https://github.com/axiomatic-systems/Bento4/issues/648
Build-tested using this defconfig:
BR2_PACKAGE_BENTO4=y
andes-nds32 [ 1/45]: SKIPPED
arm-aarch64 [ 2/45]: OK
bootlin-aarch64-glibc [ 3/45]: OK
bootlin-arcle-hs38-uclibc [ 4/45]: OK
bootlin-armv5-uclibc [ 5/45]: OK
bootlin-armv7-glibc [ 6/45]: OK
bootlin-armv7m-uclibc [ 7/45]: OK
bootlin-armv7-musl [ 8/45]: OK
bootlin-m68k-5208-uclibc [ 9/45]: OK
bootlin-m68k-68040-uclibc [10/45]: OK
bootlin-microblazeel-uclibc [11/45]: OK
bootlin-mipsel32r6-glibc [12/45]: OK
bootlin-mipsel-uclibc [13/45]: OK
bootlin-nios2-glibc [14/45]: OK
bootlin-openrisc-uclibc [15/45]: OK
bootlin-powerpc64le-power8-glibc [16/45]: OK
bootlin-powerpc-e500mc-uclibc [17/45]: OK
bootlin-riscv32-glibc [18/45]: OK
bootlin-riscv64-glibc [19/45]: OK
bootlin-riscv64-musl [20/45]: OK
bootlin-sh4-uclibc [21/45]: OK
bootlin-sparc64-glibc [22/45]: OK
bootlin-sparc-uclibc [23/45]: OK
bootlin-x86-64-glibc [24/45]: OK
bootlin-x86-64-musl [25/45]: OK
bootlin-x86-64-uclibc [26/45]: OK
bootlin-xtensa-uclibc [27/45]: OK
br-arm-basic [28/45]: SKIPPED
br-arm-full-nothread [29/45]: OK
br-arm-full-static [30/45]: OK
br-i386-pentium4-full [31/45]: OK
br-i386-pentium-mmx-musl [32/45]: OK
br-mips64-n64-full [33/45]: OK
br-mips64r6-el-hf-glibc [34/45]: OK
br-powerpc-603e-basic-cpp [35/45]: OK
br-powerpc64-power7-glibc [36/45]: OK
linaro-aarch64-be [37/45]: OK
linaro-aarch64 [38/45]: OK
linaro-arm [39/45]: OK
sourcery-arm-armv4t [40/45]: OK
sourcery-arm [41/45]: OK
sourcery-arm-thumb2 [42/45]: OK
sourcery-mips64 [43/45]: OK
sourcery-mips [44/45]: OK
sourcery-nios2 [45/45]: OK
45 builds, 2 skipped, 0 build failed, 0 legal-info failed
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
180 lines
9.3 KiB
Diff
180 lines
9.3 KiB
Diff
From 7bb5120b52814e4471a165e295acdc6b6155259e Mon Sep 17 00:00:00 2001
|
|
From: peak3d <pfau@peak3d.de>
|
|
Date: Thu, 22 Jul 2021 11:01:12 +0200
|
|
Subject: [PATCH] Add argument to reuse single sample decrypter
|
|
|
|
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
|
|
---
|
|
Source/C++/Core/Ap4CommonEncryption.cpp | 36 ++++++++++++++++++-------
|
|
Source/C++/Core/Ap4CommonEncryption.h | 8 +++++-
|
|
Source/C++/Core/Ap4Protection.cpp | 3 ++-
|
|
3 files changed, 35 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/Source/C++/Core/Ap4CommonEncryption.cpp b/Source/C++/Core/Ap4CommonEncryption.cpp
|
|
index 5308200..cb5c328 100644
|
|
--- a/Source/C++/Core/Ap4CommonEncryption.cpp
|
|
+++ b/Source/C++/Core/Ap4CommonEncryption.cpp
|
|
@@ -1967,6 +1967,7 @@ AP4_CencSampleDecrypter::Create(AP4_ProtectedSampleDescription* sample_descripti
|
|
const AP4_UI08* key,
|
|
AP4_Size key_size,
|
|
AP4_BlockCipherFactory* block_cipher_factory,
|
|
+ AP4_CencSingleSampleDecrypter* singlesample_decrypter,
|
|
AP4_CencSampleDecrypter*& decrypter)
|
|
{
|
|
AP4_SaioAtom* saio = NULL;
|
|
@@ -1982,6 +1983,7 @@ AP4_CencSampleDecrypter::Create(AP4_ProtectedSampleDescription* sample_descripti
|
|
saio,
|
|
saiz,
|
|
sample_encryption_atom,
|
|
+ singlesample_decrypter,
|
|
decrypter);
|
|
}
|
|
|
|
@@ -1999,6 +2001,7 @@ AP4_CencSampleDecrypter::Create(AP4_ProtectedSampleDescription* sample_descripti
|
|
AP4_SaioAtom*& saio,
|
|
AP4_SaizAtom*& saiz,
|
|
AP4_CencSampleEncryption*& sample_encryption_atom,
|
|
+ AP4_CencSingleSampleDecrypter* singlesample_decrypter,
|
|
AP4_CencSampleDecrypter*& decrypter)
|
|
{
|
|
// default return values
|
|
@@ -2032,6 +2035,7 @@ AP4_CencSampleDecrypter::Create(AP4_ProtectedSampleDescription* sample_descripti
|
|
key_size,
|
|
block_cipher_factory,
|
|
reset_iv_at_each_subsample,
|
|
+ singlesample_decrypter,
|
|
decrypter);
|
|
}
|
|
|
|
@@ -2045,6 +2049,7 @@ AP4_CencSampleDecrypter::Create(AP4_CencSampleInfoTable* sample_info_table,
|
|
AP4_Size key_size,
|
|
AP4_BlockCipherFactory* block_cipher_factory,
|
|
bool reset_iv_at_each_subsample,
|
|
+ AP4_CencSingleSampleDecrypter* singlesample_decrypter,
|
|
AP4_CencSampleDecrypter*& decrypter)
|
|
{
|
|
// default return value
|
|
@@ -2074,15 +2079,23 @@ AP4_CencSampleDecrypter::Create(AP4_CencSampleInfoTable* sample_info_table,
|
|
|
|
// create a single-sample decrypter
|
|
AP4_CencSingleSampleDecrypter* single_sample_decrypter = NULL;
|
|
- AP4_Result result = AP4_CencSingleSampleDecrypter::Create(cipher_type,
|
|
- key,
|
|
- key_size,
|
|
- sample_info_table->GetCryptByteBlock(),
|
|
- sample_info_table->GetSkipByteBlock(),
|
|
- block_cipher_factory,
|
|
- reset_iv_at_each_subsample,
|
|
- single_sample_decrypter);
|
|
- if (AP4_FAILED(result)) return result;
|
|
+ if (!singlesample_decrypter)
|
|
+ {
|
|
+ AP4_Result result = AP4_CencSingleSampleDecrypter::Create(cipher_type,
|
|
+ key,
|
|
+ key_size,
|
|
+ sample_info_table->GetCryptByteBlock(),
|
|
+ sample_info_table->GetSkipByteBlock(),
|
|
+ block_cipher_factory,
|
|
+ reset_iv_at_each_subsample,
|
|
+ single_sample_decrypter);
|
|
+
|
|
+ if (AP4_FAILED(result)) return result;
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ single_sample_decrypter = singlesample_decrypter;
|
|
+ }
|
|
|
|
// create the decrypter
|
|
decrypter = new AP4_CencSampleDecrypter(single_sample_decrypter, sample_info_table);
|
|
@@ -2333,7 +2346,9 @@ AP4_CencFragmentDecrypter::ProcessSample(AP4_DataBuffer& data_in,
|
|
| AP4_CencDecryptingProcessor::AP4_CencDecryptingProcessor
|
|
+---------------------------------------------------------------------*/
|
|
AP4_CencDecryptingProcessor::AP4_CencDecryptingProcessor(const AP4_ProtectionKeyMap* key_map,
|
|
- AP4_BlockCipherFactory* block_cipher_factory) :
|
|
+ AP4_BlockCipherFactory* block_cipher_factory,
|
|
+ AP4_CencSingleSampleDecrypter *cenc_singlesample_decrypter) :
|
|
+ m_CencSingleSampleDecrypter(cenc_singlesample_decrypter),
|
|
m_KeyMap(key_map)
|
|
{
|
|
if (block_cipher_factory) {
|
|
@@ -2483,6 +2498,7 @@ AP4_CencDecryptingProcessor::CreateFragmentHandler(AP4_TrakAtom* trak,
|
|
saio,
|
|
saiz,
|
|
sample_encryption_atom,
|
|
+ m_CencSingleSampleDecrypter,
|
|
sample_decrypter);
|
|
if (AP4_FAILED(result)) return NULL;
|
|
|
|
diff --git a/Source/C++/Core/Ap4CommonEncryption.h b/Source/C++/Core/Ap4CommonEncryption.h
|
|
index 580de66..a6b20ce 100644
|
|
--- a/Source/C++/Core/Ap4CommonEncryption.h
|
|
+++ b/Source/C++/Core/Ap4CommonEncryption.h
|
|
@@ -48,6 +48,7 @@ class AP4_SaioAtom;
|
|
class AP4_CencSampleInfoTable;
|
|
class AP4_AvcFrameParser;
|
|
class AP4_HevcFrameParser;
|
|
+class AP4_CencSingleSampleDecrypter;
|
|
|
|
/*----------------------------------------------------------------------
|
|
| constants
|
|
@@ -654,7 +655,8 @@ class AP4_CencDecryptingProcessor : public AP4_Processor
|
|
public:
|
|
// constructor
|
|
AP4_CencDecryptingProcessor(const AP4_ProtectionKeyMap* key_map,
|
|
- AP4_BlockCipherFactory* block_cipher_factory = NULL);
|
|
+ AP4_BlockCipherFactory* block_cipher_factory = NULL,
|
|
+ AP4_CencSingleSampleDecrypter* cenc_singlesample_decrypter = NULL);
|
|
|
|
// AP4_Processor methods
|
|
virtual AP4_Processor::TrackHandler* CreateTrackHandler(AP4_TrakAtom* trak);
|
|
@@ -670,6 +672,7 @@ protected:
|
|
|
|
// members
|
|
AP4_BlockCipherFactory* m_BlockCipherFactory;
|
|
+ AP4_CencSingleSampleDecrypter* m_CencSingleSampleDecrypter;
|
|
const AP4_ProtectionKeyMap* m_KeyMap;
|
|
};
|
|
|
|
@@ -752,6 +755,7 @@ public:
|
|
AP4_SaioAtom*& saio_atom, // [out]
|
|
AP4_SaizAtom*& saiz_atom, // [out]
|
|
AP4_CencSampleEncryption*& sample_encryption_atom, // [out]
|
|
+ AP4_CencSingleSampleDecrypter* singlesample_decrypter,
|
|
AP4_CencSampleDecrypter*& decrypter);
|
|
|
|
static AP4_Result Create(AP4_ProtectedSampleDescription* sample_description,
|
|
@@ -761,6 +765,7 @@ public:
|
|
const AP4_UI08* key,
|
|
AP4_Size key_size,
|
|
AP4_BlockCipherFactory* block_cipher_factory,
|
|
+ AP4_CencSingleSampleDecrypter* singlesample_decrypter,
|
|
AP4_CencSampleDecrypter*& decrypter);
|
|
|
|
static AP4_Result Create(AP4_CencSampleInfoTable* sample_info_table,
|
|
@@ -769,6 +774,7 @@ public:
|
|
AP4_Size key_size,
|
|
AP4_BlockCipherFactory* block_cipher_factory,
|
|
bool reset_iv_at_each_subsample,
|
|
+ AP4_CencSingleSampleDecrypter* singlesample_decrypter,
|
|
AP4_CencSampleDecrypter*& decrypter);
|
|
|
|
// methods
|
|
diff --git a/Source/C++/Core/Ap4Protection.cpp b/Source/C++/Core/Ap4Protection.cpp
|
|
index fd421e9..80bb9f0 100644
|
|
--- a/Source/C++/Core/Ap4Protection.cpp
|
|
+++ b/Source/C++/Core/Ap4Protection.cpp
|
|
@@ -812,7 +812,8 @@ AP4_SampleDecrypter::Create(AP4_ProtectedSampleDescription* sample_description,
|
|
aux_info_data_offset,
|
|
key,
|
|
key_size,
|
|
- block_cipher_factory,
|
|
+ block_cipher_factory,
|
|
+ NULL,
|
|
decrypter);
|
|
if (AP4_FAILED(result)) return NULL;
|
|
return decrypter;
|
|
--
|
|
2.30.2
|
|
|