Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
update patches to compatible with ffmpeg master and 4.2
mmal-add-vp8-mjpeg-wmv3.patch was incompatible with ffmpeg4.2, and
because of git shadow clone in ci, ffmpeg version can not be detected,
so get mmal symbol errors.
also remove unused(merged) patches
  • Loading branch information
wang-bin committed Sep 13, 2019
1 parent b041307 commit 24dc673
Show file tree
Hide file tree
Showing 20 changed files with 63 additions and 138 deletions.
@@ -1,7 +1,7 @@
From c638bd31311bb1c0696ffab04f2a03045eb9d700 Mon Sep 17 00:00:00 2001
From 4f867afb425d45f8db9e4c31e67bafe62890bfe2 Mon Sep 17 00:00:00 2001
From: wang-bin <wbsecg1@gmail.com>
Date: Sat, 28 Oct 2017 20:26:50 +0800
Subject: [PATCH 01/22] use CreateMutexEx instead of CreateMutex to fix win8
Subject: [PATCH 01/17] use CreateMutexEx instead of CreateMutex to fix win8
store app link error

---
Expand Down
4 changes: 2 additions & 2 deletions patches-master/0002-mmal-enable-0-copy-for-egl-interop.patch
@@ -1,7 +1,7 @@
From 01481f958b1346086c47adaa4fb112e8fbb58bb7 Mon Sep 17 00:00:00 2001
From 1d96a672e07f7ae0981664908a34878583b9974a Mon Sep 17 00:00:00 2001
From: wang-bin <wbsecg1@gmail.com>
Date: Sun, 29 Oct 2017 23:19:07 +0800
Subject: [PATCH 02/22] mmal: enable 0-copy for egl interop
Subject: [PATCH 02/17] mmal: enable 0-copy for egl interop

---
libavcodec/mmaldec.c | 5 ++++-
Expand Down
@@ -1,17 +1,17 @@
From 5eb9021a47c230a4fe5f57084d97437e07b43b99 Mon Sep 17 00:00:00 2001
From c89375f8955b824a803fabc3493b331d3f54ffee Mon Sep 17 00:00:00 2001
From: wang-bin <wbsecg1@gmail.com>
Date: Sun, 29 Oct 2017 23:22:25 +0800
Subject: [PATCH 03/22] configure: fix mmal probing in cross build
Subject: [PATCH 03/17] configure: fix mmal probing in cross build

---
configure | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 51dc77c780..1e8f542cd8 100755
index 8413826f9e..b2f5969d91 100755
--- a/configure
+++ b/configure
@@ -6333,11 +6333,11 @@ enabled mbedtls && { check_pkg_config mbedtls mbedtls mbedtls/x509_crt
@@ -6337,11 +6337,11 @@ enabled mbedtls && { check_pkg_config mbedtls mbedtls mbedtls/x509_crt
check_lib mbedtls mbedtls/ssl.h mbedtls_ssl_init -lmbedtls -lmbedx509 -lmbedcrypto ||
die "ERROR: mbedTLS not found"; }
enabled mediacodec && { enabled jni || die "ERROR: mediacodec requires --enable-jni"; }
Expand Down
@@ -1,7 +1,7 @@
From 58c883f93902301a56fd16ddf2898e33e7a0d720 Mon Sep 17 00:00:00 2001
From c5dd0b76fffb4462e61443fbbd610fc925cd9562 Mon Sep 17 00:00:00 2001
From: wang-bin <wbsecg1@gmail.com>
Date: Sun, 29 Oct 2017 23:35:28 +0800
Subject: [PATCH 04/22] videotoolbox: check runtime availability
Subject: [PATCH 04/17] videotoolbox: check runtime availability

fix warnings/errors for new compiler (since xcode9) if targeting
macOS<10.8
Expand All @@ -10,7 +10,7 @@ macOS<10.8
1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index acaeef77dd..a7027e6895 100644
index 67e5b54932..11ed305243 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -34,6 +34,10 @@
Expand Down
@@ -1,14 +1,14 @@
From 47160885b9c1c30a7815c34b57c458427c47a005 Mon Sep 17 00:00:00 2001
From cdbde111cc21f82189207abe5fbd6f6c13ee5067 Mon Sep 17 00:00:00 2001
From: wang-bin <wbsecg1@gmail.com>
Date: Sun, 29 Oct 2017 23:52:35 +0800
Subject: [PATCH 05/22] mediacodec: check whether cropping is set before use
Subject: [PATCH 05/17] mediacodec: check whether cropping is set before use

---
libavcodec/mediacodecdec_common.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c
index 1656cd6664..7f90449afa 100644
index f0752fa626..7743823b65 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -408,13 +408,15 @@ static int mediacodec_dec_parse_format(AVCodecContext *avctx, MediaCodecDecConte
Expand Down
@@ -1,7 +1,7 @@
From 55c8be52f9a7e8467c8d86cf33d8afd76603e938 Mon Sep 17 00:00:00 2001
From a6b5272febef5901eeff61b584a7806a1711ee15 Mon Sep 17 00:00:00 2001
From: wang-bin <wbsecg1@gmail.com>
Date: Thu, 9 Nov 2017 14:56:53 +0800
Subject: [PATCH 06/22] avcodec: add AV_HWACCEL_FLAG_ALLOW_SOFTWARE
Subject: [PATCH 06/17] avcodec: add AV_HWACCEL_FLAG_ALLOW_SOFTWARE

a hw decoder may have software or hybrid implementation, for example videotoolbox hevc.
the performance may be better than ffmpeg sw decoder.
Expand All @@ -11,10 +11,10 @@ the performance may be better than ffmpeg sw decoder.
2 files changed, 5 insertions(+)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index d234271c5b..ff79ee1e0f 100644
index de4feb6a65..ab0637a319 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3844,6 +3844,10 @@ typedef struct AVHWAccel {
@@ -3845,6 +3845,10 @@ typedef struct AVHWAccel {
*/
#define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH (1 << 2)

Expand All @@ -26,10 +26,10 @@ index d234271c5b..ff79ee1e0f 100644
* @}
*/
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 4a266eca16..e31c9bbcb3 100644
index c3a500a629..ed2128c587 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -479,6 +479,7 @@ static const AVOption avcodec_options[] = {
@@ -480,6 +480,7 @@ static const AVOption avcodec_options[] = {
{"ignore_level", "ignore level even if the codec level used is unknown or higher than the maximum supported level reported by the hardware driver", 0, AV_OPT_TYPE_CONST, { .i64 = AV_HWACCEL_FLAG_IGNORE_LEVEL }, INT_MIN, INT_MAX, V | D, "hwaccel_flags" },
{"allow_high_depth", "allow to output YUV pixel formats with a different chroma sampling than 4:2:0 and/or other than 8 bits per component", 0, AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH }, INT_MIN, INT_MAX, V | D, "hwaccel_flags"},
{"allow_profile_mismatch", "attempt to decode anyway if HW accelerated decoder's supported profiles do not exactly match the stream", 0, AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH }, INT_MIN, INT_MAX, V | D, "hwaccel_flags"},
Expand Down
@@ -1,7 +1,7 @@
From b71ed2e125eec8361ad33baecbe5f9088a6a6408 Mon Sep 17 00:00:00 2001
From 1ea5e20a5a55a2f0aa501b16b8dd66b0bc053483 Mon Sep 17 00:00:00 2001
From: wang-bin <wbsecg1@gmail.com>
Date: Thu, 9 Nov 2017 15:05:26 +0800
Subject: [PATCH 07/22] videotoolbox: allow software implementation
Subject: [PATCH 07/17] videotoolbox: allow software implementation

hevc is supported on macOS 10.12+ and iOS11+. sw implementaion is
provided for old devices. vt sw decoder is more energy effecient than
Expand All @@ -13,7 +13,7 @@ compatiblility attribute is disabled)
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index a7027e6895..1905520fc6 100644
index 11ed305243..48c047e5fb 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -724,9 +724,9 @@ static CFDictionaryRef videotoolbox_decoder_config_create(CMVideoCodecType codec
Expand Down
4 changes: 2 additions & 2 deletions patches-master/0008-h264-increase-MAX_SLICES-to-64.patch
@@ -1,7 +1,7 @@
From 5d1350fb1c6f87c1d00741420459bb9425f5287c Mon Sep 17 00:00:00 2001
From fb24acc69c64488180ed09464e27ee34f31b7e9b Mon Sep 17 00:00:00 2001
From: wang-bin <wbsecg1@gmail.com>
Date: Mon, 13 Nov 2017 12:23:10 +0800
Subject: [PATCH 08/22] h264: increase MAX_SLICES to 64
Subject: [PATCH 08/17] h264: increase MAX_SLICES to 64

lavfilters is 256. 64 can fix corrupt decoded frames
https://github.com/wang-bin/QtAV/issues/923
Expand Down
@@ -1,7 +1,7 @@
From b3ab0bd08f2d49b03b61bd45031723c561b1159b Mon Sep 17 00:00:00 2001
From 0a8e2482ed6dc6896b1023b67fbe5962dc32b22e Mon Sep 17 00:00:00 2001
From: wang-bin <wbsecg1@gmail.com>
Date: Mon, 13 Nov 2017 15:14:26 +0800
Subject: [PATCH 10/22] mmal: add vp8, mjpeg, wmv3
Subject: [PATCH 09/17] mmal: add vp8, mjpeg, wmv3

---
configure | 3 +++
Expand All @@ -10,26 +10,26 @@ Subject: [PATCH 10/22] mmal: add vp8, mjpeg, wmv3
3 files changed, 32 insertions(+)

diff --git a/configure b/configure
index 1e8f542cd8..e0cca6b17d 100755
index b2f5969d91..b9613d5c73 100755
--- a/configure
+++ b/configure
@@ -3042,6 +3042,7 @@ hevc_v4l2m2m_decoder_deps="v4l2_m2m hevc_v4l2_m2m"
@@ -3043,6 +3043,7 @@ hevc_vaapi_encoder_select="cbs_h265 vaapi_encode"
hevc_v4l2m2m_decoder_deps="v4l2_m2m hevc_v4l2_m2m"
hevc_v4l2m2m_decoder_select="hevc_mp4toannexb_bsf"
hevc_v4l2m2m_encoder_deps="v4l2_m2m hevc_v4l2_m2m"
mjpeg_cuvid_decoder_deps="cuvid"
+mjpeg_mmal_decoder_deps="mmal"
mjpeg_cuvid_decoder_deps="cuvid"
mjpeg_qsv_decoder_select="qsvdec"
mjpeg_qsv_encoder_deps="libmfx"
mjpeg_qsv_encoder_select="qsvenc"
@@ -3074,6 +3075,7 @@ vc1_qsv_decoder_select="qsvdec"
@@ -3074,6 +3075,7 @@ vc1_cuvid_decoder_deps="cuvid"
vc1_mmal_decoder_deps="mmal"
vc1_qsv_decoder_select="qsvdec"
vc1_v4l2m2m_decoder_deps="v4l2_m2m vc1_v4l2_m2m"
+vp8_mmal_decoder_deps="mmal"
vp8_cuvid_decoder_deps="cuvid"
vp8_mediacodec_decoder_deps="mediacodec"
+vp8_mmal_decoder_deps="mmal"
vp8_qsv_decoder_select="qsvdec"
vp8_rkmpp_decoder_deps="rkmpp"
vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
@@ -3088,6 +3090,7 @@ vp9_vaapi_encoder_deps="VAEncPictureParameterBufferVP9"
@@ -3090,6 +3092,7 @@ vp9_vaapi_encoder_deps="VAEncPictureParameterBufferVP9"
vp9_vaapi_encoder_select="vaapi_encode"
vp9_v4l2m2m_decoder_deps="v4l2_m2m vp9_v4l2_m2m"
wmv3_crystalhd_decoder_select="crystalhd"
Expand All @@ -38,26 +38,26 @@ index 1e8f542cd8..e0cca6b17d 100755
# parsers
aac_parser_select="adts_header"
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 22985325e0..288f95632d 100644
index 5130fca026..76470cfd2a 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -337,6 +337,7 @@ extern AVCodec ff_vp6a_decoder;
@@ -338,6 +338,7 @@ extern AVCodec ff_vp6a_decoder;
extern AVCodec ff_vp6f_decoder;
extern AVCodec ff_vp7_decoder;
extern AVCodec ff_vp8_decoder;
+extern AVCodec ff_vp8_mmal_decoder;
extern AVCodec ff_vp8_rkmpp_decoder;
extern AVCodec ff_vp8_v4l2m2m_decoder;
extern AVCodec ff_vp9_decoder;
@@ -353,6 +354,7 @@ extern AVCodec ff_wmv2_encoder;
@@ -354,6 +355,7 @@ extern AVCodec ff_wmv2_encoder;
extern AVCodec ff_wmv2_decoder;
extern AVCodec ff_wmv3_decoder;
extern AVCodec ff_wmv3_crystalhd_decoder;
+extern AVCodec ff_wmv3_mmal_decoder;
extern AVCodec ff_wmv3image_decoder;
extern AVCodec ff_wnv1_decoder;
extern AVCodec ff_xan_wc3_decoder;
@@ -762,6 +764,7 @@ extern AVCodec ff_hevc_vaapi_encoder;
@@ -763,6 +765,7 @@ extern AVCodec ff_hevc_vaapi_encoder;
extern AVCodec ff_hevc_videotoolbox_encoder;
extern AVCodec ff_libkvazaar_encoder;
extern AVCodec ff_mjpeg_cuvid_decoder;
Expand Down
24 changes: 0 additions & 24 deletions patches-master/0009-videotoolbox-add-p010.patch

This file was deleted.

@@ -1,7 +1,7 @@
From acd324776047a40919820d235dbca817abdf6abf Mon Sep 17 00:00:00 2001
From d1e4a6b41a29a730517a1b011a68561d880f7bec Mon Sep 17 00:00:00 2001
From: wang-bin <wbsecg1@gmail.com>
Date: Fri, 17 Nov 2017 14:54:23 +0800
Subject: [PATCH 11/22] mmal: add option copy_frame to support retrieving sw
Subject: [PATCH 10/17] mmal: add option copy_frame to support retrieving sw
frames w/o copy

mmal buffer->data is already in host memory. AFAIK decoders implemented in omx must
Expand Down
@@ -1,7 +1,7 @@
From 8877d4e8b98d4e30a885dd61bb7462720d3698d1 Mon Sep 17 00:00:00 2001
From ae6679b3b25270d7167d2fa267f00ecb0ff2b18f Mon Sep 17 00:00:00 2001
From: wang-bin <wbsecg1@gmail.com>
Date: Fri, 15 Dec 2017 11:34:06 +0800
Subject: [PATCH 12/22] videotoolbox: remove opengl compatibility attribute
Subject: [PATCH 11/17] videotoolbox: remove opengl compatibility attribute

1. a cvpixelbuffer backed by iosurface can always be converted to an opengl texture, using CGLTexImageIOSurface2D for macOS, and undocumented api texImageIOSurface(which is internally used by public api CVOpenGLESTextureCacheCreateTextureFromImage) for iOS4.0+.
2. enabling the attribute can slow down decoding speed a lot. I tested many video clips on my macbook air. for example: ffmpeg -ss 00:00:00 -t 00:03:00 -hwaccel videotoolbox -an -i big_buck_bunny_1080p_h264.mov -f null ->/dev/null, result with the attribute
Expand All @@ -12,7 +12,7 @@ disabled: frame= 2031 fps=104 q=-0.0 Lsize=N/A time=00:03:00.00 bitrate=N/A spee
1 file changed, 5 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 1905520fc6..c04d90cb99 100644
index 48c047e5fb..fe733b6200 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -701,11 +701,6 @@ static CFDictionaryRef videotoolbox_buffer_attributes_create(int width,
Expand Down
@@ -1,7 +1,7 @@
From 22eec185c11fdca4792569e7abc7f309c7c877d0 Mon Sep 17 00:00:00 2001
From 669a820b9594b1f3facfedb213fab3477f3efb1a Mon Sep 17 00:00:00 2001
From: wang-bin <wbsecg1@gmail.com>
Date: Thu, 29 Mar 2018 15:21:04 +0800
Subject: [PATCH 14/22] mediacodec: remove unused MediaCodec.getName
Subject: [PATCH 12/17] mediacodec: remove unused MediaCodec.getName

it's introduced in android 4.3. we can safely remove it and let
mediacodec support android<4.3
Expand Down
@@ -1,17 +1,17 @@
From 69dc7abffd6e30609790b81c3a72a9c72cd04417 Mon Sep 17 00:00:00 2001
From 6f2973eae5cc232eef530fc4229b263519a24596 Mon Sep 17 00:00:00 2001
From: wang-bin <wbsecg1@gmail.com>
Date: Fri, 30 Mar 2018 10:46:43 +0800
Subject: [PATCH 15/22] configure: do not filter -libpath for msvc
Subject: [PATCH 13/17] configure: do not filter -libpath for msvc

---
configure | 1 +
1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 483a99011a..161e2b0211 100755
index b9613d5c73..5873a0e2ab 100755
--- a/configure
+++ b/configure
@@ -4386,6 +4386,7 @@ msvc_common_flags(){
@@ -4389,6 +4389,7 @@ msvc_common_flags(){
-lz) echo zlib.lib ;;
-lx264) echo libx264.lib ;;
-lstdc++) ;;
Expand Down
@@ -1,17 +1,17 @@
From 8e7434862b89edd75aab56dda3ba316e792cedd5 Mon Sep 17 00:00:00 2001
From d0ed88866de84a9deece9861866e99bb482f5254 Mon Sep 17 00:00:00 2001
From: wang-bin <wbsecg1@gmail.com>
Date: Tue, 11 Sep 2018 23:16:49 +0800
Subject: [PATCH 19/22] configure: enable icf
Subject: [PATCH 14/17] configure: enable icf

---
configure | 3 +++
1 file changed, 3 insertions(+)

diff --git a/configure b/configure
index 3a704d365f..912bee52dd 100755
index 5873a0e2ab..0397b02552 100755
--- a/configure
+++ b/configure
@@ -6769,6 +6769,9 @@ test_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
@@ -6778,6 +6778,9 @@ test_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
int x;
EOF

Expand Down
@@ -1,7 +1,7 @@
From 90b31efe313b802628e1fe4d33eba07ed43c4733 Mon Sep 17 00:00:00 2001
From a8ad6fb4f1cb991bc6cdbb095ab666c7eecf9610 Mon Sep 17 00:00:00 2001
From: wang-bin <wbsecg1@gmail.com>
Date: Mon, 24 Dec 2018 16:06:30 +0800
Subject: [PATCH 20/22] clang-cl: fix undeclared _byteswap_ulong
Subject: [PATCH 15/17] clang-cl: fix undeclared _byteswap_ulong

---
libavutil/x86/bswap.h | 1 +
Expand Down
@@ -1,17 +1,17 @@
From 9948ea13c674734728d42eea9c141e181d19681b Mon Sep 17 00:00:00 2001
From 5db594e3afbbec79a709d05926b4d8b0cf4e054e Mon Sep 17 00:00:00 2001
From: wang-bin <wbsecg1@gmail.com>
Date: Sun, 14 Apr 2019 11:42:42 +0800
Subject: [PATCH 21/22] configure: suppor static build via clang-cl
Subject: [PATCH 16/17] configure: suppor static build via clang-cl

---
configure | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 912bee52dd..722f8296b1 100755
index 0397b02552..6829b0aeb7 100755
--- a/configure
+++ b/configure
@@ -5382,7 +5382,15 @@ case $target_os in
@@ -5386,7 +5386,15 @@ case $target_os in
SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
enabled x86_64 && objformat="win64" || objformat="win32"
Expand Down

This file was deleted.

@@ -1,7 +1,7 @@
From 8fcd95900b1946f1bde51ac47d6d3ff8bcb8eb71 Mon Sep 17 00:00:00 2001
From 58a718dc670ec346e083a56ef60e5eb68f5c98b3 Mon Sep 17 00:00:00 2001
From: wang-bin <wbsecg1@gmail.com>
Date: Wed, 12 Jun 2019 10:43:50 +0800
Subject: [PATCH 22/22] nvenc: use runtime api version to work with old drivers
Subject: [PATCH 17/17] nvenc: use runtime api version to work with old drivers

the document recommends to use build version, so using latest nvenc
headers requires latest driver version. But api and abi change rarely,
Expand Down

0 comments on commit 24dc673

Please sign in to comment.