ffmpeg: drop kodi patch

Signed-off-by: Matthias Reichl <hias@horus.com>
This commit is contained in:
Matthias Reichl 2023-02-16 10:01:55 +01:00
parent 8f8e40c3af
commit c57e7bc283
2 changed files with 1 additions and 216 deletions

View File

@ -10,7 +10,7 @@ PKG_SITE="https://ffmpeg.org"
PKG_URL="http://ffmpeg.org/releases/ffmpeg-${PKG_VERSION}.tar.xz"
PKG_DEPENDS_TARGET="toolchain zlib bzip2 openssl speex"
PKG_LONGDESC="FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video."
PKG_PATCH_DIRS="kodi libreelec"
PKG_PATCH_DIRS="libreelec"
case "${PROJECT}" in
Amlogic)

View File

@ -1,215 +0,0 @@
From c4b5aa630053c59eac2c2fe52071cd26c570107a Mon Sep 17 00:00:00 2001
From: marc <mhocking@ubuntu-desktop.(none)>
Date: Mon, 18 Feb 2013 17:18:18 +0000
Subject: [PATCH 1/6] dxva-h264: Fix an AMD driver issue with playback of
streams that don't start with an I-Frame
---
libavcodec/dxva2_h264.c | 8 ++++++++
libavcodec/h264_slice.c | 1 +
libavcodec/h264dec.c | 1 +
libavcodec/h264dec.h | 2 ++
4 files changed, 12 insertions(+)
diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c
index 6300b1418d..9e53355fae 100644
--- a/libavcodec/dxva2_h264.c
+++ b/libavcodec/dxva2_h264.c
@@ -506,6 +506,14 @@ static int dxva2_h264_end_frame(AVCodecContext *avctx)
if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0)
return -1;
+
+ // Wait for an I-frame before start decoding. Workaround for ATI UVD and UVD+ GPUs
+ if (!h->got_first_iframe) {
+ if (!(ctx_pic->pp.wBitFields & (1 << 15)))
+ return -1;
+ h->got_first_iframe = 1;
+ }
+
ret = ff_dxva2_common_end_frame(avctx, h->cur_pic_ptr->f,
&ctx_pic->pp, sizeof(ctx_pic->pp),
&ctx_pic->qm, sizeof(ctx_pic->qm),
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index d56722a5c2..a94a5a1784 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -971,6 +971,7 @@ static int h264_slice_header_init(H264Context *h)
h->first_field = 0;
h->prev_interlaced_frame = 1;
+ h->got_first_iframe = 0;
init_scan_tables(h);
ret = ff_h264_alloc_tables(h);
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 2a5b53ea56..8689b462d1 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -448,6 +448,7 @@ void ff_h264_flush_change(H264Context *h)
h->next_outputed_poc = INT_MIN;
h->prev_interlaced_frame = 1;
+ h->got_first_iframe = 0;
idr(h);
h->poc.prev_frame_num = -1;
diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h
index 9a1ec1bace..eab495cdd0 100644
--- a/libavcodec/h264dec.h
+++ b/libavcodec/h264dec.h
@@ -532,6 +532,8 @@ typedef struct H264Context {
* slices) anymore */
int setup_finished;
+ int got_first_iframe;
+
int cur_chroma_format_idc;
int cur_bit_depth_luma;
int16_t slice_row[MAX_SLICES]; ///< to detect when MAX_SLICES is too low
From df996a4c35b85b61c73fa7cabc587299ed6b3957 Mon Sep 17 00:00:00 2001
From: Rechi <Rechi@users.noreply.github.com>
Date: Tue, 21 Nov 2017 08:16:53 +0100
Subject: [PATCH 2/6] use Kodi as extra version
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 61f79e27ae..7ab083fd70 100644
--- a/Makefile
+++ b/Makefile
@@ -137,7 +137,7 @@ GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
.version: M=@
libavutil/ffversion.h .version:
- $(M)$(VERSION_SH) $(SRC_PATH) libavutil/ffversion.h $(EXTRA_VERSION)
+ $(M)$(VERSION_SH) $(SRC_PATH) libavutil/ffversion.h Kodi
$(Q)touch .version
# force version.sh to run whenever version might have changed
From e02f5681f78b18d886af512d0ad5d553faa8968d Mon Sep 17 00:00:00 2001
From: Rechi <Rechi@users.noreply.github.com>
Date: Tue, 21 Nov 2017 08:16:53 +0100
Subject: [PATCH 3/6] common.mak: never ignore an error if strip doesn't
succeed
---
ffbuild/common.mak | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ffbuild/common.mak b/ffbuild/common.mak
index f52473453e..85f1d43bb8 100644
--- a/ffbuild/common.mak
+++ b/ffbuild/common.mak
@@ -101,7 +101,7 @@ COMPILE_LASX = $(call COMPILE,CC,LASXFLAGS)
%.o: %.asm
$(COMPILE_X86ASM)
- -$(if $(ASMSTRIPFLAGS), $(STRIP) $(ASMSTRIPFLAGS) $@)
+ $(if $(STRIP), $(if $(ASMSTRIPFLAGS), $(STRIP) $(ASMSTRIPFLAGS) $@))
%.o: %.rc
$(WINDRES) $(IFLAGS) $(foreach ARG,$(CC_DEPFLAGS),--preprocessor-arg "$(ARG)") -o $@ $<
From 43ad570ce0dd168bdcc206244594302f922d95f2 Mon Sep 17 00:00:00 2001
From: wsnipex <wsnipex@a1.net>
Date: Tue, 21 Nov 2017 08:16:53 +0100
Subject: [PATCH 4/6] only check for a git rev if the src tree is in a git repo
fixes the version string when building from the kodi depends src tree
---
ffbuild/version.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/ffbuild/version.sh b/ffbuild/version.sh
index edc4dd33c5..239a138ca7 100755
--- a/ffbuild/version.sh
+++ b/ffbuild/version.sh
@@ -2,6 +2,7 @@
# Usage: version.sh <ffmpeg-root-dir> <output-version.h> <extra-version>
+if [ -d $1/.git ]; then # only check for a git rev, if the src tree is in a git repo
# check for git short hash
if ! test "$revision"; then
if (cd "$1" && grep git RELEASE 2> /dev/null >/dev/null) ; then
@@ -27,6 +28,7 @@ if [ -z "$revision" ]; then
git_hash="${srcdir##*-}";;
esac
fi
+fi
# no revision number found
test "$revision" || revision=$(cd "$1" && cat RELEASE 2> /dev/null)
From fec4c2031296c414685477c75e6a4bdff105a3ac Mon Sep 17 00:00:00 2001
From: Anton Fedchin <afedchin at ruswizards.com>
Date: Fri, 11 Jan 2019 10:47:43 +0100
Subject: [PATCH 5/6] after 153b36f there is a possibility to crash when trying
to get index of a surface which points to nirvana.
it may occurs when a stream starts with non i-frame.
---
libavcodec/dxva2.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
index 568d686f39..735127f83a 100644
--- a/libavcodec/dxva2.c
+++ b/libavcodec/dxva2.c
@@ -777,16 +777,18 @@ unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx,
#if CONFIG_D3D11VA
if (avctx->pix_fmt == AV_PIX_FMT_D3D11)
return (intptr_t)frame->data[1];
- if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
+ if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD && surface) {
D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc;
ID3D11VideoDecoderOutputView_GetDesc((ID3D11VideoDecoderOutputView*) surface, &viewDesc);
return viewDesc.Texture2D.ArraySlice;
}
#endif
#if CONFIG_DXVA2
- for (i = 0; i < DXVA_CONTEXT_COUNT(avctx, ctx); i++) {
- if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD && ctx->dxva2.surface[i] == surface)
- return i;
+ if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) {
+ for (i = 0; i < DXVA_CONTEXT_COUNT(avctx, ctx); i++) {
+ if (ctx->dxva2.surface[i] == surface)
+ return i;
+ }
}
#endif
From ca8882fcaf5da0192772733a7ba832765df7c391 Mon Sep 17 00:00:00 2001
From: Rainer Hochecker <fernetmenta@online.de>
Date: Sat, 26 Jan 2019 19:48:35 +0100
Subject: [PATCH 6/6] avcodec/vaapi_h264: skip decode if pic has no slices
This fixes / workarounds https://bugs.freedesktop.org/show_bug.cgi?id=105368.
It was hit frequently when watching h264 channels received via DVB-X.
Corresponding kodi bug: https://github.com/xbmc/xbmc/issues/15704
---
libavcodec/vaapi_h264.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c
index 9332aa6f31..d4494beebf 100644
--- a/libavcodec/vaapi_h264.c
+++ b/libavcodec/vaapi_h264.c
@@ -314,6 +314,11 @@ static int vaapi_h264_end_frame(AVCodecContext *avctx)
H264SliceContext *sl = &h->slice_ctx[0];
int ret;
+ if (pic->nb_slices == 0) {
+ ret = AVERROR_INVALIDDATA;
+ goto finish;
+ }
+
ret = ff_vaapi_decode_issue(avctx, pic);
if (ret < 0)
goto finish;