kumquat-buildroot/package/bento4/0006-Implement-SPS-Frame-parser.patch

68 lines
2.3 KiB
Diff
Raw Normal View History

package/bento4: new package Needed for the upcoming Nexus version of kodi-inputstream-adaptive, the bundled version of bento4 was removed upstream: https://github.com/xbmc/inputstream.adaptive/commit/70625e76702186c73ddb43440f44262c48e14755 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>
2021-12-12 14:49:55 +01:00
From 441247d84e8493a49d234fe062100b049956de90 Mon Sep 17 00:00:00 2001
From: peak3d <pfau@peak3d.de>
Date: Thu, 22 Jul 2021 10:34:42 +0200
Subject: [PATCH] Implement SPS Frame parser
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
Source/C++/Codecs/Ap4AvcParser.cpp | 26 ++++++++++++++++++++++++++
Source/C++/Codecs/Ap4AvcParser.h | 5 +++++
2 files changed, 31 insertions(+)
diff --git a/Source/C++/Codecs/Ap4AvcParser.cpp b/Source/C++/Codecs/Ap4AvcParser.cpp
index 7f4fc34..cfa841d 100644
--- a/Source/C++/Codecs/Ap4AvcParser.cpp
+++ b/Source/C++/Codecs/Ap4AvcParser.cpp
@@ -1112,6 +1112,32 @@ AP4_AvcFrameParser::AppendNalUnitData(const unsigned char* data, unsigned int da
m_AccessUnitData.Append(new AP4_DataBuffer(data, data_size));
}
+/*----------------------------------------------------------------------
+| AP4_AvcFrameParser::Feed
++---------------------------------------------------------------------*/
+AP4_Result AP4_AvcFrameParser::ParseFrameForSPS(const AP4_Byte* data, AP4_Size data_size, AP4_UI08 naluLengthSize, AP4_AvcSequenceParameterSet &sps)
+{
+ if (data_size < naluLengthSize)
+ return AP4_ERROR_EOS;
+
+ while (data_size > naluLengthSize)
+ {
+ AP4_Size nalSize(0);
+ for (unsigned int i(0); i < naluLengthSize; ++i) { nalSize = (nalSize << 8) + *data++; };
+ data_size -= naluLengthSize;
+ if (nalSize > data_size)
+ return AP4_ERROR_INVALID_PARAMETERS;
+
+ if ((*data & 0x1F) == AP4_AVC_NAL_UNIT_TYPE_SPS)
+ {
+ AP4_AvcFrameParser fp;
+ return fp.ParseSPS(data, data_size, sps);
+ }
+ data_size -= nalSize;
+ }
+ return AP4_SUCCESS;
+}
+
/*----------------------------------------------------------------------
| AP4_AvcFrameParser::Feed
+---------------------------------------------------------------------*/
diff --git a/Source/C++/Codecs/Ap4AvcParser.h b/Source/C++/Codecs/Ap4AvcParser.h
index 431a294..99c5320 100644
--- a/Source/C++/Codecs/Ap4AvcParser.h
+++ b/Source/C++/Codecs/Ap4AvcParser.h
@@ -258,6 +258,11 @@ public:
AP4_AvcFrameParser();
~AP4_AvcFrameParser();
+ static AP4_Result ParseFrameForSPS(const AP4_Byte* data,
+ AP4_Size data_size,
+ AP4_UI08 naluLengthSize,
+ AP4_AvcSequenceParameterSet &sps);
+
/**
* Feed some data to the parser and look for the next NAL Unit.
*
--
2.30.2