diff --git a/packages/multimedia/ffmpeg/package.mk b/packages/multimedia/ffmpeg/package.mk index 7447ef2a7f..46b4e3cbf5 100644 --- a/packages/multimedia/ffmpeg/package.mk +++ b/packages/multimedia/ffmpeg/package.mk @@ -3,9 +3,9 @@ # Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) PKG_NAME="ffmpeg" -# Current branch is: release/4.0-kodi -PKG_VERSION="4.0.4-Leia-18.4" -PKG_SHA256="e11e7594af35f36ab2711252c3d6bb106908f26605498aef4a9be2d7bc001db2" +# Current branch is: release/4.2-kodi +PKG_VERSION="4.2.2-Matrix-Alpha1" +PKG_SHA256="0dba571f9809588cfbdc29d6a551dab4cd5736701653d9263847c9ac67bcde86" PKG_LICENSE="LGPLv2.1+" PKG_SITE="https://ffmpeg.org" PKG_URL="https://github.com/xbmc/FFmpeg/archive/${PKG_VERSION}.tar.gz" diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1001-Call-get_format-to-fix-an-issue-with-MMAL-ren.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1001-Call-get_format-to-fix-an-issue-with-MMAL-ren.patch index 37b53e8fb6..6e99dbce4a 100644 --- a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1001-Call-get_format-to-fix-an-issue-with-MMAL-ren.patch +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1001-Call-get_format-to-fix-an-issue-with-MMAL-ren.patch @@ -1,26 +1,18 @@ -From 7adc8f706efab65d8d7e5f960690faca3d5c190d Mon Sep 17 00:00:00 2001 +From 85417a4ba42360248b4999e458a6e05c1c2f9b17 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 4 Mar 2017 19:24:02 +0000 Subject: [PATCH] ffmpeg: Call get_format to fix an issue with MMAL rendering --- - libavcodec/dvdec.c | 7 +++++++ + libavcodec/dvdec.c | 6 ++++++ libavcodec/rv34.c | 6 +++++- - 2 files changed, 12 insertions(+), 1 deletion(-) + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c -index 0b4c1bc..00081ef 100644 +index 89864f2edc..b5f9224d72 100644 --- a/libavcodec/dvdec.c +++ b/libavcodec/dvdec.c -@@ -49,6 +49,7 @@ - #include "internal.h" - #include "put_bits.h" - #include "simple_idct.h" -+#include "thread.h" - - typedef struct BlockInfo { - const uint32_t *factor_table; -@@ -196,6 +197,12 @@ static av_cold int dvvideo_decode_init(AVCodecContext *avctx) +@@ -197,6 +197,12 @@ static av_cold int dvvideo_decode_init(AVCodecContext *avctx) s->idct_put[0] = idsp.idct_put; s->idct_put[1] = ff_simple_idct248_put; @@ -34,10 +26,10 @@ index 0b4c1bc..00081ef 100644 } diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c -index aca8382..f473f6c 100644 +index d171e6e1bd..f6f0aa1f74 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c -@@ -1493,7 +1493,11 @@ av_cold int ff_rv34_decode_init(AVCodecContext *avctx) +@@ -1499,7 +1499,11 @@ av_cold int ff_rv34_decode_init(AVCodecContext *avctx) ff_mpv_decode_init(s, avctx); s->out_format = FMT_H263; @@ -51,5 +43,5 @@ index aca8382..f473f6c 100644 s->low_delay = 0; -- -2.7.4 +2.20.1 diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1002-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1002-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch index 6721c8d3be..8b6565f2c1 100644 --- a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1002-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1002-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch @@ -1,4 +1,4 @@ -From d8bdcc8791c501921ee8961f3b0de0bd47668ebf Mon Sep 17 00:00:00 2001 +From 848de6c1923820f1de49ed7875d6c8877d0c321c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 5 Jun 2015 22:48:33 +0100 Subject: [PATCH] mpeg4video: Signal unsupported GMC with more than one warp @@ -10,10 +10,10 @@ Subject: [PATCH] mpeg4video: Signal unsupported GMC with more than one warp 2 files changed, 5 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h -index c26b6d607c..6c4b011b5c 100644 +index a36b675fba..880284d5bd 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h -@@ -2965,6 +2965,7 @@ typedef struct AVCodecContext { +@@ -2612,6 +2612,7 @@ typedef struct AVCodecContext { #define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders. #define FF_BUG_TRUNCATED 16384 #define FF_BUG_IEDGE 32768 @@ -22,10 +22,10 @@ index c26b6d607c..6c4b011b5c 100644 /** * strictly follow the standard (MPEG-4, ...). diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c -index cd39131d55..d8c8227cb4 100644 +index 055afabc7e..fa208660c8 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c -@@ -2250,6 +2250,9 @@ int ff_mpeg4_workaround_bugs(AVCodecContext *avctx) +@@ -2662,6 +2662,9 @@ int ff_mpeg4_workaround_bugs(AVCodecContext *avctx) if (ctx->divx_version >= 0) s->workaround_bugs |= FF_BUG_HPEL_CHROMA; @@ -35,7 +35,7 @@ index cd39131d55..d8c8227cb4 100644 } if (s->workaround_bugs & FF_BUG_STD_QPEL) { -@@ -2274,6 +2277,7 @@ int ff_mpeg4_workaround_bugs(AVCodecContext *avctx) +@@ -2686,6 +2689,7 @@ int ff_mpeg4_workaround_bugs(AVCodecContext *avctx) s->workaround_bugs, ctx->lavc_build, ctx->xvid_build, ctx->divx_version, ctx->divx_build, s->divx_packed ? "p" : ""); @@ -44,5 +44,5 @@ index cd39131d55..d8c8227cb4 100644 s->codec_id == AV_CODEC_ID_MPEG4 && avctx->idct_algo == FF_IDCT_AUTO) { -- -2.14.1 +2.20.1 diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1004-added_upstream_mvc_patches.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1004-added_upstream_mvc_patches.patch index 551a27104a..f7dbc5bc39 100644 --- a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1004-added_upstream_mvc_patches.patch +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1004-added_upstream_mvc_patches.patch @@ -1,4 +1,4 @@ -From 20af7af23a9f366476e67669f14957dfaf58f141 Mon Sep 17 00:00:00 2001 +From a853a9c70339c30ea4d5081366fee4bb84bc09c5 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sat, 9 Jan 2016 16:34:09 +0100 Subject: [PATCH 1/4] avcodec: add h264_mvc codec id and profiles @@ -11,19 +11,19 @@ Subject: [PATCH 1/4] avcodec: add h264_mvc codec id and profiles 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h -index d962b9cf0a..4c4581c895 100644 +index 880284d5bd..88e01645cd 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h -@@ -447,6 +447,8 @@ enum AVCodecID { - AV_CODEC_ID_GDV, - AV_CODEC_ID_FITS, +@@ -458,6 +458,8 @@ enum AVCodecID { + AV_CODEC_ID_LSCR, + AV_CODEC_ID_VP4, + AV_CODEC_ID_H264_MVC, + /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs AV_CODEC_ID_PCM_S16LE = 0x10000, -@@ -2895,6 +2897,7 @@ typedef struct AVCodecContext { +@@ -2950,6 +2952,7 @@ typedef struct AVCodecContext { #define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244 #define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA) #define FF_PROFILE_H264_CAVLC_444 44 @@ -32,12 +32,12 @@ index d962b9cf0a..4c4581c895 100644 #define FF_PROFILE_VC1_SIMPLE 0 #define FF_PROFILE_VC1_MAIN 1 diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c -index 79552a910d..b55955476c 100644 +index 4d033c20ff..def006e033 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c -@@ -1647,6 +1647,13 @@ static const AVCodecDescriptor codec_descriptors[] = { - .long_name = NULL_IF_CONFIG_SMALL("FITS (Flexible Image Transport System)"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, +@@ -1726,6 +1726,13 @@ static const AVCodecDescriptor codec_descriptors[] = { + .long_name = NULL_IF_CONFIG_SMALL("On2 VP4"), + .props = AV_CODEC_PROP_LOSSY, }, + { + .id = AV_CODEC_ID_H264_MVC, @@ -50,10 +50,10 @@ index 79552a910d..b55955476c 100644 /* various PCM "codecs" */ { diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c -index d7dc960f36..e4651f12f9 100644 +index eaf0d68d32..fc1e152420 100644 --- a/libavcodec/profiles.c +++ b/libavcodec/profiles.c -@@ -72,6 +72,7 @@ const AVProfile ff_h264_profiles[] = { +@@ -71,6 +71,7 @@ const AVProfile ff_h264_profiles[] = { { FF_PROFILE_H264_CAVLC_444, "CAVLC 4:4:4" }, { FF_PROFILE_H264_MULTIVIEW_HIGH, "Multiview High" }, { FF_PROFILE_H264_STEREO_HIGH, "Stereo High" }, @@ -62,10 +62,10 @@ index d7dc960f36..e4651f12f9 100644 }; diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index 37a6aa8bff..52c5b659c4 100644 +index 0415ceea02..264bf9718b 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c -@@ -701,7 +701,7 @@ static const StreamType ISO_types[] = { +@@ -798,7 +798,7 @@ static const StreamType ISO_types[] = { #endif { 0x1b, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264 }, { 0x1c, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AAC }, @@ -75,36 +75,21 @@ index 37a6aa8bff..52c5b659c4 100644 { 0x24, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_HEVC }, { 0x42, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_CAVS }, -- -2.17.0 +2.20.1 -From 0f3fda4e348e6b12570f5d279713f6da46511846 Mon Sep 17 00:00:00 2001 +From 8d479b1b5395f97a8e5ee0eddab6680941edfb5b Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sat, 9 Jan 2016 16:34:40 +0100 Subject: [PATCH 2/4] h264_parser: add support for parsing h264 mvc NALUs --- - libavcodec/h264.h | 2 ++ libavcodec/h264_parser.c | 34 ++++++++++++++++++++++++++++++---- - libavcodec/parser.c | 1 + - 3 files changed, 33 insertions(+), 4 deletions(-) + libavcodec/parsers.c | 1 + + 2 files changed, 31 insertions(+), 4 deletions(-) -diff --git a/libavcodec/h264.h b/libavcodec/h264.h -index 650580bf3a..c44a0cbedd 100644 ---- a/libavcodec/h264.h -+++ b/libavcodec/h264.h -@@ -41,7 +41,9 @@ enum { - H264_NAL_END_STREAM = 11, - H264_NAL_FILLER_DATA = 12, - H264_NAL_SPS_EXT = 13, -+ H264_NAL_SPS_SUBSET = 15, - H264_NAL_AUXILIARY_SLICE = 19, -+ H264_NAL_SLICE_EXT = 20, - }; - - diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c -index 1a9840a62c..be8b9db9b0 100644 +index 5f9a9c46ef..991e8e82f3 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -62,6 +62,7 @@ typedef struct H264ParseContext { @@ -121,22 +106,22 @@ index 1a9840a62c..be8b9db9b0 100644 if (nalu_type == H264_NAL_SEI || nalu_type == H264_NAL_SPS || - nalu_type == H264_NAL_PPS || nalu_type == H264_NAL_AUD) { + nalu_type == H264_NAL_PPS || nalu_type == H264_NAL_AUD || -+ nalu_type == H264_NAL_SPS_SUBSET) { ++ nalu_type == H264_NAL_SUB_SPS) { if (pc->frame_start_found) { i++; goto found; } } else if (nalu_type == H264_NAL_SLICE || nalu_type == H264_NAL_DPA || - nalu_type == H264_NAL_IDR_SLICE) { -+ nalu_type == H264_NAL_IDR_SLICE || (p->is_mvc && nalu_type == H264_NAL_SLICE_EXT)) { ++ nalu_type == H264_NAL_IDR_SLICE || (p->is_mvc && nalu_type == H264_NAL_EXTEN_SLICE)) { state += 8; + -+ if (nalu_type == H264_NAL_SLICE_EXT) ++ if (nalu_type == H264_NAL_EXTEN_SLICE) + i += 3; // skip mvc extension continue; } state = 7; -@@ -601,7 +606,8 @@ static int h264_parse(AVCodecParserContext *s, +@@ -604,7 +609,8 @@ static int h264_parse(AVCodecParserContext *s, } } @@ -146,16 +131,16 @@ index 1a9840a62c..be8b9db9b0 100644 if (avctx->framerate.num) avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1})); -@@ -658,7 +664,7 @@ static int h264_split(AVCodecContext *avctx, +@@ -661,7 +667,7 @@ static int h264_split(AVCodecContext *avctx, if ((state & 0xFFFFFF00) != 0x100) break; nalu_type = state & 0x1F; - if (nalu_type == H264_NAL_SPS) { -+ if (nalu_type == H264_NAL_SPS || nalu_type == H264_NAL_SPS_SUBSET) { ++ if (nalu_type == H264_NAL_SPS || nalu_type == H264_NAL_SUB_SPS) { has_sps = 1; } else if (nalu_type == H264_NAL_PPS) has_pps = 1; -@@ -710,3 +716,23 @@ AVCodecParser ff_h264_parser = { +@@ -713,3 +719,23 @@ AVCodecParser ff_h264_parser = { .parser_close = h264_close, .split = h264_split, }; @@ -179,11 +164,11 @@ index 1a9840a62c..be8b9db9b0 100644 + .parser_close = h264_close, + .split = h264_split, +}; -diff --git a/libavcodec/parser.c b/libavcodec/parser.c -index f43b197d5e..f96e005ef3 100644 ---- a/libavcodec/parser.c -+++ b/libavcodec/parser.c -@@ -54,6 +54,7 @@ extern AVCodecParser ff_gsm_parser; +diff --git a/libavcodec/parsers.c b/libavcodec/parsers.c +index 33a71de8a0..80b269b324 100644 +--- a/libavcodec/parsers.c ++++ b/libavcodec/parsers.c +@@ -47,6 +47,7 @@ extern AVCodecParser ff_gsm_parser; extern AVCodecParser ff_h261_parser; extern AVCodecParser ff_h263_parser; extern AVCodecParser ff_h264_parser; @@ -192,10 +177,10 @@ index f43b197d5e..f96e005ef3 100644 extern AVCodecParser ff_mjpeg_parser; extern AVCodecParser ff_mlp_parser; -- -2.17.0 +2.20.1 -From cdd668dc436b9c78dcb31df477e329492356e7ec Mon Sep 17 00:00:00 2001 +From e2cad00490c9cd339b9266e8b9fe5d86afe2abe1 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Tue, 28 Nov 2017 16:12:12 +0000 Subject: [PATCH 3/4] h264_parser: force grabing a new timestamp until a frame @@ -206,10 +191,10 @@ Subject: [PATCH 3/4] h264_parser: force grabing a new timestamp until a frame 1 file changed, 3 insertions(+) diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c -index be8b9db9b0..81c9a1bbae 100644 +index 991e8e82f3..f573bd8629 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c -@@ -594,6 +594,9 @@ static int h264_parse(AVCodecParserContext *s, +@@ -597,6 +597,9 @@ static int h264_parse(AVCodecParserContext *s, } else { next = h264_find_frame_end(p, buf, buf_size, avctx); @@ -220,10 +205,10 @@ index be8b9db9b0..81c9a1bbae 100644 *poutbuf = NULL; *poutbuf_size = 0; -- -2.17.0 +2.20.1 -From fb0ec9a132d6eb8fd74348ef87b1176c7ca34a00 Mon Sep 17 00:00:00 2001 +From fc2954e5eba1791443016cdd17fcea280f464db5 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 28 May 2018 13:35:36 +0100 Subject: [PATCH 4/4] fixup @@ -233,46 +218,46 @@ Subject: [PATCH 4/4] fixup 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavcodec/extract_extradata_bsf.c b/libavcodec/extract_extradata_bsf.c -index 082b3e749b..7612749efc 100644 +index 85cf615ffa..b5f1657528 100644 --- a/libavcodec/extract_extradata_bsf.c +++ b/libavcodec/extract_extradata_bsf.c -@@ -59,7 +59,7 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt, +@@ -138,7 +138,7 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt, HEVC_NAL_VPS, HEVC_NAL_SPS, HEVC_NAL_PPS, }; static const int extradata_nal_types_h264[] = { - H264_NAL_SPS, H264_NAL_PPS, -+ H264_NAL_SPS, H264_NAL_SPS_SUBSET, H264_NAL_PPS, ++ H264_NAL_SPS, H264_NAL_SUB_SPS, H264_NAL_PPS, }; ExtractExtradataContext *s = ctx->priv_data; -@@ -90,7 +90,7 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt, +@@ -169,7 +169,7 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt, if (nal->type == HEVC_NAL_SPS) has_sps = 1; if (nal->type == HEVC_NAL_VPS) has_vps = 1; } else { - if (nal->type == H264_NAL_SPS) has_sps = 1; -+ if (nal->type == H264_NAL_SPS || nal->type == H264_NAL_SPS_SUBSET) has_sps = 1; ++ if (nal->type == H264_NAL_SPS || nal->type == H264_NAL_SUB_SPS) has_sps = 1; } } else if (s->remove) { filtered_size += nal->raw_size + 3; -@@ -99,7 +99,7 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt, +@@ -178,7 +178,7 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt, if (extradata_size && ((ctx->par_in->codec_id == AV_CODEC_ID_HEVC && has_sps && has_vps) || - (ctx->par_in->codec_id == AV_CODEC_ID_H264 && has_sps))) { + ((ctx->par_in->codec_id == AV_CODEC_ID_H264 || ctx->par_in->codec_id == AV_CODEC_ID_H264_MVC) && has_sps))) { - AVBufferRef *filtered_buf; + AVBufferRef *filtered_buf = NULL; uint8_t *extradata, *filtered_data; -@@ -253,6 +253,7 @@ static const struct { - } extract_tab[] = { +@@ -334,6 +334,7 @@ static const struct { + { AV_CODEC_ID_AVS2, extract_extradata_mpeg4 }, { AV_CODEC_ID_CAVS, extract_extradata_mpeg4 }, { AV_CODEC_ID_H264, extract_extradata_h2645 }, + { AV_CODEC_ID_H264_MVC, extract_extradata_h2645 }, { AV_CODEC_ID_HEVC, extract_extradata_h2645 }, { AV_CODEC_ID_MPEG1VIDEO, extract_extradata_mpeg12 }, { AV_CODEC_ID_MPEG2VIDEO, extract_extradata_mpeg12 }, -@@ -317,6 +318,7 @@ static void extract_extradata_close(AVBSFContext *ctx) - static const enum AVCodecID codec_ids[] = { +@@ -401,6 +402,7 @@ static const enum AVCodecID codec_ids[] = { + AV_CODEC_ID_AVS2, AV_CODEC_ID_CAVS, AV_CODEC_ID_H264, + AV_CODEC_ID_H264_MVC, @@ -280,5 +265,5 @@ index 082b3e749b..7612749efc 100644 AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG2VIDEO, -- -2.17.0 +2.20.1 diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1008-dav1d-enable-av1.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1008-dav1d-enable-av1.patch deleted file mode 100644 index 213c7c1b3f..0000000000 --- a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1008-dav1d-enable-av1.patch +++ /dev/null @@ -1,407 +0,0 @@ -diff -Nur a/configure b/configure ---- a/configure 2018-11-23 12:03:27.041287929 -0500 -+++ b/configure 2018-11-23 12:08:52.945786916 -0500 -@@ -226,6 +226,7 @@ - --enable-libcelt enable CELT decoding via libcelt [no] - --enable-libcdio enable audio CD grabbing with libcdio [no] - --enable-libcodec2 enable codec2 en/decoding using libcodec2 [no] -+ --enable-libdav1d enable AV1 decoding via libdav1d [no] - --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394 - and libraw1394 [no] - --enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no] -@@ -1700,6 +1701,7 @@ - libcaca - libcelt - libcodec2 -+ libdav1d - libdc1394 - libdrm - libflite -@@ -3062,6 +3064,7 @@ - libcelt_decoder_deps="libcelt" - libcodec2_decoder_deps="libcodec2" - libcodec2_encoder_deps="libcodec2" -+libdav1d_decoder_deps="libdav1d" - libfdk_aac_decoder_deps="libfdk_aac" - libfdk_aac_encoder_deps="libfdk_aac" - libfdk_aac_encoder_select="audio_frame_queue" -@@ -6003,6 +6006,7 @@ - die "ERROR: libcelt must be installed and version must be >= 0.11.0."; } - enabled libcaca && require_pkg_config libcaca caca caca.h caca_create_canvas - enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create -lcodec2 -+enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.0.1" "dav1d/dav1d.h" dav1d_version - enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new - enabled libdrm && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion - enabled libfdk_aac && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen || -diff -Nur a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c ---- a/libavcodec/allcodecs.c 2018-11-23 12:03:27.041287929 -0500 -+++ b/libavcodec/allcodecs.c 2018-11-23 12:11:08.584268221 -0500 -@@ -670,6 +670,7 @@ - extern AVCodec ff_libcelt_decoder; - extern AVCodec ff_libcodec2_encoder; - extern AVCodec ff_libcodec2_decoder; -+extern AVCodec ff_libdav1d_decoder; - extern AVCodec ff_libfdk_aac_encoder; - extern AVCodec ff_libfdk_aac_decoder; - extern AVCodec ff_libgsm_encoder; -diff -Nur a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c ---- a/libavcodec/libdav1d.c 1969-12-31 19:00:00.000000000 -0500 -+++ b/libavcodec/libdav1d.c 2018-11-23 12:33:35.820468086 -0500 -@@ -0,0 +1,346 @@ -+/* -+ * Copyright (c) 2018 Ronald S. Bultje -+ * Copyright (c) 2018 James Almer -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include -+ -+#include "libavutil/avassert.h" -+#include "libavutil/mastering_display_metadata.h" -+#include "libavutil/imgutils.h" -+#include "libavutil/opt.h" -+ -+#include "avcodec.h" -+#include "decode.h" -+#include "internal.h" -+ -+typedef struct Libdav1dContext { -+ AVClass *class; -+ Dav1dContext *c; -+ AVBufferPool *pool; -+ int pool_size; -+ -+ Dav1dData data; -+ int tile_threads; -+ int apply_grain; -+} Libdav1dContext; -+ -+static const enum AVPixelFormat pix_fmt[][3] = { -+ [DAV1D_PIXEL_LAYOUT_I400] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12 }, -+ [DAV1D_PIXEL_LAYOUT_I420] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV420P12 }, -+ [DAV1D_PIXEL_LAYOUT_I422] = { AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV422P12 }, -+ [DAV1D_PIXEL_LAYOUT_I444] = { AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV444P12 }, -+}; -+ -+static void libdav1d_log_callback(void *opaque, const char *fmt, va_list vl) -+{ -+ AVCodecContext *c = opaque; -+ -+ av_vlog(c, AV_LOG_ERROR, fmt, vl); -+} -+ -+static int libdav1d_picture_allocator(Dav1dPicture *p, void *cookie) -+{ -+ Libdav1dContext *dav1d = cookie; -+ enum AVPixelFormat format = pix_fmt[p->p.layout][p->seq_hdr->hbd]; -+ int ret, linesize[4], h = FFALIGN(p->p.h, 128); -+ uint8_t *aligned_ptr, *data[4]; -+ AVBufferRef *buf; -+ -+ ret = av_image_fill_arrays(data, linesize, NULL, format, FFALIGN(p->p.w, 128), -+ h, DAV1D_PICTURE_ALIGNMENT); -+ if (ret < 0) -+ return ret; -+ -+ if (ret != dav1d->pool_size) { -+ av_buffer_pool_uninit(&dav1d->pool); -+ // Use twice the amount of required padding bytes for aligned_ptr below. -+ dav1d->pool = av_buffer_pool_init(ret + DAV1D_PICTURE_ALIGNMENT * 2, NULL); -+ if (!dav1d->pool) { -+ dav1d->pool_size = 0; -+ return AVERROR(ENOMEM); -+ } -+ dav1d->pool_size = ret; -+ } -+ buf = av_buffer_pool_get(dav1d->pool); -+ if (!buf) -+ return AVERROR(ENOMEM); -+ -+ // libdav1d requires DAV1D_PICTURE_ALIGNMENT aligned buffers, which av_malloc() -+ // doesn't guarantee for example when AVX is disabled at configure time. -+ // Use the extra DAV1D_PICTURE_ALIGNMENT padding bytes in the buffer to align it -+ // if required. -+ aligned_ptr = (uint8_t *)FFALIGN((uintptr_t)buf->data, DAV1D_PICTURE_ALIGNMENT); -+ ret = av_image_fill_pointers(data, format, h, aligned_ptr, linesize); -+ if (ret < 0) { -+ av_buffer_unref(&buf); -+ return ret; -+ } -+ -+ p->data[0] = data[0]; -+ p->data[1] = data[1]; -+ p->data[2] = data[2]; -+ p->stride[0] = linesize[0]; -+ p->stride[1] = linesize[1]; -+ p->allocator_data = buf; -+ -+ return 0; -+} -+ -+static void libdav1d_picture_release(Dav1dPicture *p, void *cookie) -+{ -+ AVBufferRef *buf = p->allocator_data; -+ -+ av_buffer_unref(&buf); -+} -+ -+static av_cold int libdav1d_init(AVCodecContext *c) -+{ -+ Libdav1dContext *dav1d = c->priv_data; -+ Dav1dSettings s; -+ int res; -+ -+ av_log(c, AV_LOG_INFO, "libdav1d %s\n", dav1d_version()); -+ -+ dav1d_default_settings(&s); -+ s.logger.cookie = c; -+ s.logger.callback = libdav1d_log_callback; -+ s.allocator.cookie = dav1d; -+ s.allocator.alloc_picture_callback = libdav1d_picture_allocator; -+ s.allocator.release_picture_callback = libdav1d_picture_release; -+ s.n_tile_threads = dav1d->tile_threads; -+ s.apply_grain = dav1d->apply_grain; -+ s.n_frame_threads = FFMIN(c->thread_count ? c->thread_count : av_cpu_count(), DAV1D_MAX_FRAME_THREADS); -+ -+ res = dav1d_open(&dav1d->c, &s); -+ if (res < 0) -+ return AVERROR(ENOMEM); -+ -+ return 0; -+} -+ -+static void libdav1d_flush(AVCodecContext *c) -+{ -+ Libdav1dContext *dav1d = c->priv_data; -+ -+ dav1d_data_unref(&dav1d->data); -+ dav1d_flush(dav1d->c); -+} -+ -+static void libdav1d_data_free(const uint8_t *data, void *opaque) { -+ AVBufferRef *buf = opaque; -+ -+ av_buffer_unref(&buf); -+} -+ -+static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) -+{ -+ Libdav1dContext *dav1d = c->priv_data; -+ Dav1dData *data = &dav1d->data; -+ Dav1dPicture pic = { 0 }, *p = &pic; -+ int res; -+ -+ if (!data->sz) { -+ AVPacket pkt = { 0 }; -+ -+ res = ff_decode_get_packet(c, &pkt); -+ if (res < 0 && res != AVERROR_EOF) -+ return res; -+ -+ if (pkt.size) { -+ res = dav1d_data_wrap(data, pkt.data, pkt.size, libdav1d_data_free, pkt.buf); -+ if (res < 0) { -+ av_packet_unref(&pkt); -+ return res; -+ } -+ -+ data->m.timestamp = pkt.pts; -+ data->m.offset = pkt.pos; -+ data->m.duration = pkt.duration; -+ -+ pkt.buf = NULL; -+ av_packet_unref(&pkt); -+ } -+ } -+ -+ res = dav1d_send_data(dav1d->c, data); -+ if (res < 0) { -+ if (res == AVERROR(EINVAL)) -+ res = AVERROR_INVALIDDATA; -+ if (res != AVERROR(EAGAIN)) -+ return res; -+ } -+ -+ res = dav1d_get_picture(dav1d->c, p); -+ if (res < 0) { -+ if (res == AVERROR(EINVAL)) -+ res = AVERROR_INVALIDDATA; -+ else if (res == AVERROR(EAGAIN) && c->internal->draining) -+ res = AVERROR_EOF; -+ -+ return res; -+ } -+ -+ av_assert0(p->data[0] != NULL); -+ -+ // This requires the custom allocator above -+ frame->buf[0] = av_buffer_ref(p->allocator_data); -+ if (!frame->buf[0]) { -+ dav1d_picture_unref(p); -+ return AVERROR(ENOMEM); -+ } -+ -+ frame->data[0] = p->data[0]; -+ frame->data[1] = p->data[1]; -+ frame->data[2] = p->data[2]; -+ frame->linesize[0] = p->stride[0]; -+ frame->linesize[1] = p->stride[1]; -+ frame->linesize[2] = p->stride[1]; -+ -+ c->profile = p->seq_hdr->profile; -+ frame->format = c->pix_fmt = pix_fmt[p->p.layout][p->seq_hdr->hbd]; -+ frame->width = p->p.w; -+ frame->height = p->p.h; -+ if (c->width != p->p.w || c->height != p->p.h) { -+ res = ff_set_dimensions(c, p->p.w, p->p.h); -+ if (res < 0) -+ goto fail; -+ } -+ -+ switch (p->seq_hdr->chr) { -+ case DAV1D_CHR_VERTICAL: -+ frame->chroma_location = c->chroma_sample_location = AVCHROMA_LOC_LEFT; -+ break; -+ case DAV1D_CHR_COLOCATED: -+ frame->chroma_location = c->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; -+ break; -+ } -+ frame->colorspace = c->colorspace = (enum AVColorSpace) p->seq_hdr->mtrx; -+ frame->color_primaries = c->color_primaries = (enum AVColorPrimaries) p->seq_hdr->pri; -+ frame->color_trc = c->color_trc = (enum AVColorTransferCharacteristic) p->seq_hdr->trc; -+ frame->color_range = c->color_range = p->seq_hdr->color_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; -+ -+ // match timestamps and packet size -+ frame->pts = frame->best_effort_timestamp = p->m.timestamp; -+#if FF_API_PKT_PTS -+FF_DISABLE_DEPRECATION_WARNINGS -+ frame->pkt_pts = p->m.timestamp; -+FF_ENABLE_DEPRECATION_WARNINGS -+#endif -+ frame->pkt_dts = p->m.timestamp; -+ frame->pkt_pos = p->m.offset; -+ frame->pkt_size = p->m.size; -+ frame->pkt_duration = p->m.duration; -+ frame->key_frame = p->frame_hdr->frame_type == DAV1D_FRAME_TYPE_KEY; -+ -+ switch (p->frame_hdr->frame_type) { -+ case DAV1D_FRAME_TYPE_KEY: -+ case DAV1D_FRAME_TYPE_INTRA: -+ frame->pict_type = AV_PICTURE_TYPE_I; -+ break; -+ case DAV1D_FRAME_TYPE_INTER: -+ frame->pict_type = AV_PICTURE_TYPE_P; -+ break; -+ case DAV1D_FRAME_TYPE_SWITCH: -+ frame->pict_type = AV_PICTURE_TYPE_SP; -+ break; -+ default: -+ res = AVERROR_INVALIDDATA; -+ goto fail; -+ } -+ -+ if (p->mastering_display) { -+ AVMasteringDisplayMetadata *mastering = av_mastering_display_metadata_create_side_data(frame); -+ if (!mastering) { -+ res = AVERROR(ENOMEM); -+ goto fail; -+ } -+ -+ for (int i = 0; i < 3; i++) { -+ mastering->display_primaries[i][0] = av_make_q(p->mastering_display->primaries[i][0], 1 << 16); -+ mastering->display_primaries[i][1] = av_make_q(p->mastering_display->primaries[i][1], 1 << 16); -+ } -+ mastering->white_point[0] = av_make_q(p->mastering_display->white_point[0], 1 << 16); -+ mastering->white_point[1] = av_make_q(p->mastering_display->white_point[1], 1 << 16); -+ -+ mastering->max_luminance = av_make_q(p->mastering_display->max_luminance, 1 << 8); -+ mastering->min_luminance = av_make_q(p->mastering_display->min_luminance, 1 << 14); -+ -+ mastering->has_primaries = 1; -+ mastering->has_luminance = 1; -+ } -+ if (p->content_light) { -+ AVContentLightMetadata *light = av_content_light_metadata_create_side_data(frame); -+ if (!light) { -+ res = AVERROR(ENOMEM); -+ goto fail; -+ } -+ light->MaxCLL = p->content_light->max_content_light_level; -+ light->MaxFALL = p->content_light->max_frame_average_light_level; -+ } -+ -+ res = 0; -+fail: -+ dav1d_picture_unref(p); -+ if (res < 0) -+ av_frame_unref(frame); -+ return res; -+} -+ -+static av_cold int libdav1d_close(AVCodecContext *c) -+{ -+ Libdav1dContext *dav1d = c->priv_data; -+ -+ av_buffer_pool_uninit(&dav1d->pool); -+ dav1d_data_unref(&dav1d->data); -+ dav1d_close(&dav1d->c); -+ -+ return 0; -+} -+ -+#define OFFSET(x) offsetof(Libdav1dContext, x) -+#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM -+static const AVOption libdav1d_options[] = { -+ { "tilethreads", "Tile threads", OFFSET(tile_threads), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, DAV1D_MAX_TILE_THREADS, VD }, -+ { "filmgrain", "Apply Film Grain", OFFSET(apply_grain), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VD }, -+ { NULL } -+}; -+ -+static const AVClass libdav1d_class = { -+ .class_name = "libdav1d decoder", -+ .item_name = av_default_item_name, -+ .option = libdav1d_options, -+ .version = LIBAVUTIL_VERSION_INT, -+}; -+ -+AVCodec ff_libdav1d_decoder = { -+ .name = "libdav1d", -+ .long_name = NULL_IF_CONFIG_SMALL("dav1d AV1 decoder by VideoLAN"), -+ .type = AVMEDIA_TYPE_VIDEO, -+ .id = AV_CODEC_ID_AV1, -+ .priv_data_size = sizeof(Libdav1dContext), -+ .init = libdav1d_init, -+ .close = libdav1d_close, -+ .flush = libdav1d_flush, -+ .receive_frame = libdav1d_receive_frame, -+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS, -+ .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_SETS_PKT_DTS, -+ .priv_class = &libdav1d_class, -+ .wrapper_name = "libdav1d", -+}; -diff -Nur a/libavcodec/Makefile b/libavcodec/Makefile ---- a/libavcodec/Makefile 2018-11-23 12:03:27.041287929 -0500 -+++ b/libavcodec/Makefile 2018-11-23 12:10:28.676717867 -0500 -@@ -954,6 +954,7 @@ - OBJS-$(CONFIG_LIBCELT_DECODER) += libcelt_dec.o - OBJS-$(CONFIG_LIBCODEC2_DECODER) += libcodec2.o codec2utils.o - OBJS-$(CONFIG_LIBCODEC2_ENCODER) += libcodec2.o codec2utils.o -+OBJS-$(CONFIG_LIBDAV1D_DECODER) += libdav1d.o - OBJS-$(CONFIG_LIBFDK_AAC_DECODER) += libfdk-aacdec.o - OBJS-$(CONFIG_LIBFDK_AAC_ENCODER) += libfdk-aacenc.o - OBJS-$(CONFIG_LIBGSM_DECODER) += libgsmdec.o diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1009-dav1d-fix-multithreaded-av1-sw-decoding.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1009-dav1d-fix-multithreaded-av1-sw-decoding.patch index 1d087b4ffa..1060f54c50 100644 --- a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1009-dav1d-fix-multithreaded-av1-sw-decoding.patch +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1009-dav1d-fix-multithreaded-av1-sw-decoding.patch @@ -1,36 +1,25 @@ -From 0ae5ba3567a896af2b272e3a52ca574b7f41ec5a Mon Sep 17 00:00:00 2001 -From: Lukas Rusak -Date: Wed, 10 Apr 2019 13:40:07 -0700 -Subject: [PATCH 0/1] *** SUBJECT HERE *** +commit 578b5ee8c0fe7d9ef09ef91ffcafc916f1d7d97b +Author: Lukas Rusak +Date: Wed Apr 10 13:39:21 2019 -0700 -*** BLURB HERE *** - -Lukas Rusak (1): - libavcodec/libdav1d: add libdav1d_get_format method in order to call - ff_get_format - - libavcodec/libdav1d.c | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - --- -2.20.1 - -From 0ae5ba3567a896af2b272e3a52ca574b7f41ec5a Mon Sep 17 00:00:00 2001 -From: Lukas Rusak -Date: Wed, 10 Apr 2019 13:39:21 -0700 -Subject: [PATCH 1/1] libavcodec/libdav1d: add libdav1d_get_format method in - order to call ff_get_format - ---- - libavcodec/libdav1d.c | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) + libavcodec/libdav1d: add libdav1d_get_format method to call ff_get_format + + This will allow applications to properly init the decoder in + cases where a hardware decoder is tried first and and software + decoder is tried after by calling the get_format callback. + + Even though there is no hardware pixel formats available + we still need to return the software pixel format. + + Tested with Kodi by checking if multithreaded software + decoding is properly activated. diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c -index 30c6eccfef..fa71834543 100644 +index 12c63245f8..1bbb83eda3 100644 --- a/libavcodec/libdav1d.c +++ b/libavcodec/libdav1d.c -@@ -48,6 +48,16 @@ static const enum AVPixelFormat pix_fmt[][3] = { - [DAV1D_PIXEL_LAYOUT_I444] = { AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV444P12 }, +@@ -53,6 +53,16 @@ static const enum AVPixelFormat pix_fmt_rgb[3] = { + AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRP12, }; +static enum AVPixelFormat libdav1d_get_format(AVCodecContext *avctx, const Dav1dPicture *p) @@ -46,15 +35,11 @@ index 30c6eccfef..fa71834543 100644 static void libdav1d_log_callback(void *opaque, const char *fmt, va_list vl) { AVCodecContext *c = opaque; -@@ -214,7 +224,7 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) - frame->linesize[2] = p->stride[1]; - +@@ -229,6 +239,7 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) c->profile = p->seq_hdr->profile; -- frame->format = c->pix_fmt = pix_fmt[p->p.layout][p->seq_hdr->hbd]; + c->level = ((p->seq_hdr->operating_points[0].major_level - 2) << 2) + | p->seq_hdr->operating_points[0].minor_level; + frame->format = c->pix_fmt = libdav1d_get_format(c, p); frame->width = p->p.w; frame->height = p->p.h; if (c->width != p->p.w || c->height != p->p.h) { --- -2.20.1 - diff --git a/packages/multimedia/ffmpeg/patches/rpi-hevc/ffmpeg-99.1003-pfcd_hevc_optimisations.patch b/packages/multimedia/ffmpeg/patches/rpi-hevc/ffmpeg-99.1003-pfcd_hevc_optimisations.patch index c64d5e560e..5f23a53b76 100644 --- a/packages/multimedia/ffmpeg/patches/rpi-hevc/ffmpeg-99.1003-pfcd_hevc_optimisations.patch +++ b/packages/multimedia/ffmpeg/patches/rpi-hevc/ffmpeg-99.1003-pfcd_hevc_optimisations.patch @@ -1,5 +1,192 @@ +From 27e3340bc0e488abde669f91dfae5d5bf535ad02 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 31 Jan 2020 11:27:22 +0000 +Subject: [PATCH] pi: hevc acclerated support by pfcd/jc + +--- + .gitignore | 2 + + configure | 7 + + fftools/ffmpeg.c | 291 +- + fftools/ffmpeg_filter.c | 4 +- + fftools/ffmpeg_opt.c | 8 + + libavcodec/Makefile | 37 + + libavcodec/allcodecs.c | 36 + + libavcodec/arm/Makefile | 16 + + libavcodec/arm/cabac.h | 262 +- + libavcodec/arm/rpi_hevc_cabac.h | 605 ++ + libavcodec/arm/rpi_hevc_idct_fn_neon.S | 161 + + libavcodec/arm/rpi_hevc_misc_neon.S | 238 + + libavcodec/arm/rpi_hevc_misc_neon.h | 438 ++ + libavcodec/arm/rpi_hevc_mv_arm.h | 64 + + libavcodec/arm/rpi_hevcdsp_arm.h | 26 + + libavcodec/arm/rpi_hevcdsp_deblock_neon.S | 1633 +++++ + libavcodec/arm/rpi_hevcdsp_idct_neon.S | 183 + + libavcodec/arm/rpi_hevcdsp_init_arm.c | 32 + + libavcodec/arm/rpi_hevcdsp_init_neon.c | 467 ++ + libavcodec/arm/rpi_hevcdsp_res16_neon.S | 591 ++ + libavcodec/arm/rpi_hevcdsp_res8_neon.S | 712 ++ + libavcodec/arm/rpi_hevcdsp_sao_neon.S | 2245 ++++++ + libavcodec/arm/rpi_hevcpred_arm.h | 28 + + libavcodec/arm/rpi_hevcpred_init_arm.c | 35 + + libavcodec/arm/rpi_hevcpred_init_neon.c | 210 + + .../arm/rpi_hevcpred_intra_angular_neon.S | 2975 ++++++++ + libavcodec/arm/rpi_hevcpred_intra_dc_neon.S | 695 ++ + .../arm/rpi_hevcpred_intra_filter_neon.S | 872 +++ + libavcodec/arm/rpi_hevcpred_intra_hv_neon.S | 911 +++ + .../arm/rpi_hevcpred_intra_planar_neon.S | 1034 +++ + libavcodec/avcodec.h | 19 +- + libavcodec/cabac.h | 9 +- + libavcodec/mmaldec.c | 4 + + libavcodec/raw.c | 4 + + libavcodec/rawenc.c | 62 + + libavcodec/rpi_hevc_cabac.c | 2255 ++++++ + libavcodec/rpi_hevc_cabac_fns.h | 191 + + libavcodec/rpi_hevc_data.c | 75 + + libavcodec/rpi_hevc_data.h | 31 + + libavcodec/rpi_hevc_filter.c | 1206 ++++ + libavcodec/rpi_hevc_mv.h | 71 + + libavcodec/rpi_hevc_mvs.c | 486 ++ + libavcodec/rpi_hevc_parse.c | 142 + + libavcodec/rpi_hevc_parse.h | 36 + + libavcodec/rpi_hevc_ps.c | 1936 ++++++ + libavcodec/rpi_hevc_ps.h | 447 ++ + libavcodec/rpi_hevc_refs.c | 485 ++ + libavcodec/rpi_hevc_sei.c | 368 + + libavcodec/rpi_hevc_sei.h | 135 + + libavcodec/rpi_hevc_shader.c | 1537 +++++ + libavcodec/rpi_hevc_shader.h | 63 + + libavcodec/rpi_hevc_shader.qasm | 1821 +++++ + libavcodec/rpi_hevc_shader_cmd.h | 128 + + libavcodec/rpi_hevc_shader_template.c | 61 + + libavcodec/rpi_hevc_shader_template.h | 22 + + libavcodec/rpi_hevc_shader_template_fn.h | 475 ++ + libavcodec/rpi_hevc_transform.s | 444 ++ + libavcodec/rpi_hevc_transform10.h | 94 + + libavcodec/rpi_hevc_transform8.h | 94 + + libavcodec/rpi_hevcdec.c | 6016 +++++++++++++++++ + libavcodec/rpi_hevcdec.h | 1087 +++ + libavcodec/rpi_hevcdsp.c | 450 ++ + libavcodec/rpi_hevcdsp.h | 177 + + libavcodec/rpi_hevcdsp_template.c | 2278 +++++++ + libavcodec/rpi_hevcpred.c | 166 + + libavcodec/rpi_hevcpred.h | 121 + + libavcodec/rpi_hevcpred_template.c | 1522 +++++ + libavcodec/rpi_mailbox.c | 107 + + libavcodec/rpi_mailbox.h | 55 + + libavcodec/rpi_qpu.c | 957 +++ + libavcodec/rpi_qpu.h | 229 + + libavcodec/rpi_zc.c | 741 ++ + libavcodec/rpi_zc.h | 105 + + libavfilter/Makefile | 1 + + libavfilter/allfilters.c | 1 + + libavfilter/avfiltergraph.c | 86 +- + libavfilter/buffersrc.c | 2 +- + libavfilter/vf_unsand.c | 232 + + libavformat/utils.c | 65 +- + libavutil/Makefile | 1 + + libavutil/arm/Makefile | 1 + + libavutil/arm/rpi_sand_neon.S | 40 + + libavutil/buffer.c | 6 + + libavutil/buffer.h | 3 + + libavutil/frame.c | 11 + + libavutil/frame.h | 10 + + libavutil/pixdesc.c | 24 + + libavutil/pixfmt.h | 4 + + libavutil/rpi_sand_fn_pw.h | 182 + + libavutil/rpi_sand_fns.c | 151 + + libavutil/rpi_sand_fns.h | 136 + + pi-util/BUILD.txt | 25 + + pi-util/conf_h265.2016.csv | 195 + + pi-util/conf_h265.2016_HEVC_v1.csv | 147 + + pi-util/conf_h265.csv | 144 + + pi-util/conf_pi1.sh | 30 + + pi-util/conf_pi2.sh | 32 + + pi-util/ffconf.py | 175 + + pi-util/ffperf.py | 125 + + pi-util/make_array.py | 23 + + pi-util/perfcmp.py | 101 + + pi-util/qem.sh | 9 + + pi-util/v3dusage.py | 128 + + 103 files changed, 43525 insertions(+), 95 deletions(-) + create mode 100644 libavcodec/arm/rpi_hevc_cabac.h + create mode 100644 libavcodec/arm/rpi_hevc_idct_fn_neon.S + create mode 100644 libavcodec/arm/rpi_hevc_misc_neon.S + create mode 100644 libavcodec/arm/rpi_hevc_misc_neon.h + create mode 100644 libavcodec/arm/rpi_hevc_mv_arm.h + create mode 100644 libavcodec/arm/rpi_hevcdsp_arm.h + create mode 100644 libavcodec/arm/rpi_hevcdsp_deblock_neon.S + create mode 100644 libavcodec/arm/rpi_hevcdsp_idct_neon.S + create mode 100644 libavcodec/arm/rpi_hevcdsp_init_arm.c + create mode 100644 libavcodec/arm/rpi_hevcdsp_init_neon.c + create mode 100644 libavcodec/arm/rpi_hevcdsp_res16_neon.S + create mode 100644 libavcodec/arm/rpi_hevcdsp_res8_neon.S + create mode 100644 libavcodec/arm/rpi_hevcdsp_sao_neon.S + create mode 100644 libavcodec/arm/rpi_hevcpred_arm.h + create mode 100644 libavcodec/arm/rpi_hevcpred_init_arm.c + create mode 100644 libavcodec/arm/rpi_hevcpred_init_neon.c + create mode 100644 libavcodec/arm/rpi_hevcpred_intra_angular_neon.S + create mode 100644 libavcodec/arm/rpi_hevcpred_intra_dc_neon.S + create mode 100644 libavcodec/arm/rpi_hevcpred_intra_filter_neon.S + create mode 100644 libavcodec/arm/rpi_hevcpred_intra_hv_neon.S + create mode 100644 libavcodec/arm/rpi_hevcpred_intra_planar_neon.S + create mode 100644 libavcodec/rpi_hevc_cabac.c + create mode 100644 libavcodec/rpi_hevc_cabac_fns.h + create mode 100644 libavcodec/rpi_hevc_data.c + create mode 100644 libavcodec/rpi_hevc_data.h + create mode 100644 libavcodec/rpi_hevc_filter.c + create mode 100644 libavcodec/rpi_hevc_mv.h + create mode 100644 libavcodec/rpi_hevc_mvs.c + create mode 100644 libavcodec/rpi_hevc_parse.c + create mode 100644 libavcodec/rpi_hevc_parse.h + create mode 100644 libavcodec/rpi_hevc_ps.c + create mode 100644 libavcodec/rpi_hevc_ps.h + create mode 100644 libavcodec/rpi_hevc_refs.c + create mode 100644 libavcodec/rpi_hevc_sei.c + create mode 100644 libavcodec/rpi_hevc_sei.h + create mode 100644 libavcodec/rpi_hevc_shader.c + create mode 100644 libavcodec/rpi_hevc_shader.h + create mode 100644 libavcodec/rpi_hevc_shader.qasm + create mode 100644 libavcodec/rpi_hevc_shader_cmd.h + create mode 100644 libavcodec/rpi_hevc_shader_template.c + create mode 100644 libavcodec/rpi_hevc_shader_template.h + create mode 100644 libavcodec/rpi_hevc_shader_template_fn.h + create mode 100644 libavcodec/rpi_hevc_transform.s + create mode 100644 libavcodec/rpi_hevc_transform10.h + create mode 100644 libavcodec/rpi_hevc_transform8.h + create mode 100644 libavcodec/rpi_hevcdec.c + create mode 100644 libavcodec/rpi_hevcdec.h + create mode 100644 libavcodec/rpi_hevcdsp.c + create mode 100644 libavcodec/rpi_hevcdsp.h + create mode 100644 libavcodec/rpi_hevcdsp_template.c + create mode 100644 libavcodec/rpi_hevcpred.c + create mode 100644 libavcodec/rpi_hevcpred.h + create mode 100644 libavcodec/rpi_hevcpred_template.c + create mode 100644 libavcodec/rpi_mailbox.c + create mode 100644 libavcodec/rpi_mailbox.h + create mode 100644 libavcodec/rpi_qpu.c + create mode 100644 libavcodec/rpi_qpu.h + create mode 100644 libavcodec/rpi_zc.c + create mode 100644 libavcodec/rpi_zc.h + create mode 100644 libavfilter/vf_unsand.c + create mode 100644 libavutil/arm/rpi_sand_neon.S + create mode 100644 libavutil/rpi_sand_fn_pw.h + create mode 100644 libavutil/rpi_sand_fns.c + create mode 100644 libavutil/rpi_sand_fns.h + create mode 100644 pi-util/BUILD.txt + create mode 100644 pi-util/conf_h265.2016.csv + create mode 100644 pi-util/conf_h265.2016_HEVC_v1.csv + create mode 100644 pi-util/conf_h265.csv + create mode 100755 pi-util/conf_pi1.sh + create mode 100755 pi-util/conf_pi2.sh + create mode 100755 pi-util/ffconf.py + create mode 100755 pi-util/ffperf.py + create mode 100755 pi-util/make_array.py + create mode 100644 pi-util/perfcmp.py + create mode 100755 pi-util/qem.sh + create mode 100755 pi-util/v3dusage.py + diff --git a/.gitignore b/.gitignore -index 0e57cb0b4c..b2e3374fea 100644 +index 2450ee8fc5..4bcc3ae643 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ @@ -19,10 +206,10 @@ index 0e57cb0b4c..b2e3374fea 100644 /ffplay /ffprobe diff --git a/configure b/configure -index 827abfe694..28f630068e 100755 +index 34c2adb4a4..531c7e754f 100755 --- a/configure +++ b/configure -@@ -318,6 +318,7 @@ External library support: +@@ -331,6 +331,7 @@ External library support: --enable-libmfx enable Intel MediaSDK (AKA Quick Sync Video) code via libmfx [no] --enable-libnpp enable Nvidia Performance Primitives-based code [no] --enable-mmal enable Broadcom Multi-Media Abstraction Layer (Raspberry Pi) via MMAL [no] @@ -30,7 +217,7 @@ index 827abfe694..28f630068e 100755 --disable-nvdec disable Nvidia video decoding acceleration (via hwaccel) [autodetect] --disable-nvenc disable Nvidia video encoding code [autodetect] --enable-omx enable OpenMAX IL code [no] -@@ -1776,6 +1777,7 @@ FEATURE_LIST=" +@@ -1866,6 +1867,7 @@ FEATURE_LIST=" gray hardcoded_tables omx_rpi @@ -38,15 +225,15 @@ index 827abfe694..28f630068e 100755 runtime_cpudetect safe_bitstream_reader shared -@@ -2293,6 +2295,7 @@ CONFIG_EXTRA=" +@@ -2390,6 +2392,7 @@ CONFIG_EXTRA=" rtpdec rtpenc_chain rv34dsp + sand + scene_sad sinewin snappy - srtp -@@ -2610,6 +2613,8 @@ hap_decoder_select="snappy texturedsp" +@@ -2715,6 +2718,8 @@ hap_decoder_select="snappy texturedsp" hap_encoder_deps="libsnappy" hap_encoder_select="texturedspenc" hevc_decoder_select="bswapdsp cabac golomb hevcparse videodsp" @@ -54,18 +241,18 @@ index 827abfe694..28f630068e 100755 +hevc_rpi_decoder_select="hevc_decoder sand" huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp" huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp" - iac_decoder_select="imc_decoder" -@@ -3393,6 +3398,8 @@ tinterlace_filter_deps="gpl" - tinterlace_merge_test_deps="tinterlace_filter" - tinterlace_pad_test_deps="tinterlace_filter" - tonemap_filter_deps="const_nan" + hymt_decoder_select="huffyuv_decoder" +@@ -3543,6 +3548,8 @@ tonemap_filter_deps="const_nan" + tonemap_opencl_filter_deps="opencl const_nan" + transpose_opencl_filter_deps="opencl" + transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags" +unsand_filter_deps="rpi" +unsand_filter_select="sand" unsharp_opencl_filter_deps="opencl" uspp_filter_deps="gpl avcodec" vaguedenoiser_filter_deps="gpl" diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c -index c0214c42d8..faaea5772a 100644 +index 01f04103cf..80dc56d0c6 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -24,6 +24,12 @@ @@ -107,7 +294,7 @@ index c0214c42d8..faaea5772a 100644 #if HAVE_SYS_RESOURCE_H #include #include -@@ -162,6 +187,241 @@ static int restore_tty; +@@ -168,6 +193,241 @@ static int restore_tty; static void free_input_threads(void); #endif @@ -349,7 +536,7 @@ index c0214c42d8..faaea5772a 100644 /* sub2video hack: Convert subtitles to video with alpha to insert them in filter graphs. This is a temporary solution until libavfilter gets real subtitles support. -@@ -583,6 +843,11 @@ static void ffmpeg_cleanup(int ret) +@@ -589,6 +849,11 @@ static void ffmpeg_cleanup(int ret) avformat_close_input(&input_files[i]->ctx); av_freep(&input_files[i]); } @@ -361,7 +548,7 @@ index c0214c42d8..faaea5772a 100644 for (i = 0; i < nb_input_streams; i++) { InputStream *ist = input_streams[i]; -@@ -594,7 +859,9 @@ static void ffmpeg_cleanup(int ret) +@@ -600,7 +865,9 @@ static void ffmpeg_cleanup(int ret) av_freep(&ist->filters); av_freep(&ist->hwaccel_device); av_freep(&ist->dts_buffer); @@ -372,7 +559,7 @@ index c0214c42d8..faaea5772a 100644 avcodec_free_context(&ist->dec_ctx); av_freep(&input_streams[i]); -@@ -625,6 +892,7 @@ static void ffmpeg_cleanup(int ret) +@@ -631,6 +898,7 @@ static void ffmpeg_cleanup(int ret) } term_exit(); ffmpeg_exited = 1; @@ -380,7 +567,7 @@ index c0214c42d8..faaea5772a 100644 } void remove_avoptions(AVDictionary **a, AVDictionary *b) -@@ -1060,6 +1328,17 @@ static void do_video_out(OutputFile *of, +@@ -1070,6 +1338,17 @@ static void do_video_out(OutputFile *of, if (ost->source_index >= 0) ist = input_streams[ost->source_index]; @@ -398,7 +585,7 @@ index c0214c42d8..faaea5772a 100644 frame_rate = av_buffersink_get_frame_rate(filter); if (frame_rate.num > 0 && frame_rate.den > 0) duration = 1/(av_q2d(frame_rate) * av_q2d(enc->time_base)); -@@ -2132,8 +2411,8 @@ static int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame) +@@ -2141,8 +2420,8 @@ static int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame) ifilter->channel_layout != frame->channel_layout; break; case AVMEDIA_TYPE_VIDEO: @@ -409,7 +596,7 @@ index c0214c42d8..faaea5772a 100644 break; } -@@ -2891,6 +3170,12 @@ static int init_input_stream(int ist_index, char *error, int error_len) +@@ -2906,6 +3185,12 @@ static int init_input_stream(int ist_index, char *error, int error_len) ist->dec_ctx->opaque = ist; ist->dec_ctx->get_format = get_format; ist->dec_ctx->get_buffer2 = get_buffer; @@ -423,10 +610,10 @@ index c0214c42d8..faaea5772a 100644 av_opt_set_int(ist->dec_ctx, "refcounted_frames", 1, 0); diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c -index 877fd670e6..1efd3a43a8 100644 +index 72838de1e2..6922cedc5d 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c -@@ -1179,8 +1179,8 @@ int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame) +@@ -1188,8 +1188,8 @@ int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame) ifilter->format = frame->format; @@ -438,10 +625,10 @@ index 877fd670e6..1efd3a43a8 100644 ifilter->sample_rate = frame->sample_rate; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c -index d7a7eb0662..3949c9e76b 100644 +index f5ca18aa64..483bb86b54 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c -@@ -684,11 +684,19 @@ static AVCodec *choose_decoder(OptionsContext *o, AVFormatContext *s, AVStream * +@@ -698,11 +698,19 @@ static AVCodec *choose_decoder(OptionsContext *o, AVFormatContext *s, AVStream * MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, st); if (codec_name) { @@ -462,7 +649,7 @@ index d7a7eb0662..3949c9e76b 100644 /* Add all the streams from the given input file to the global diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index 4b8ad121db..f6e6784e5a 100644 +index 3cd73fbcc6..aa15d411cd 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -6,6 +6,7 @@ HEADERS = ac3_parser.h \ @@ -473,7 +660,7 @@ index 4b8ad121db..f6e6784e5a 100644 d3d11va.h \ dirac.h \ dv_profile.h \ -@@ -128,6 +129,7 @@ OBJS-$(CONFIG_QSVDEC) += qsvdec.o +@@ -132,6 +133,7 @@ OBJS-$(CONFIG_QSVDEC) += qsvdec.o OBJS-$(CONFIG_QSVENC) += qsvenc.o OBJS-$(CONFIG_RANGECODER) += rangecoder.o OBJS-$(CONFIG_RDFT) += rdft.o @@ -481,7 +668,7 @@ index 4b8ad121db..f6e6784e5a 100644 OBJS-$(CONFIG_RV34DSP) += rv34dsp.o OBJS-$(CONFIG_SHARED) += log2_tab.o reverse.o OBJS-$(CONFIG_SINEWIN) += sinewin.o sinewin_fixed.o -@@ -360,6 +362,13 @@ OBJS-$(CONFIG_HAP_ENCODER) += hapenc.o hap.o +@@ -368,6 +370,13 @@ OBJS-$(CONFIG_HCOM_DECODER) += hcom.o OBJS-$(CONFIG_HEVC_DECODER) += hevcdec.o hevc_mvs.o \ hevc_cabac.o hevc_refs.o hevcpred.o \ hevcdsp.o hevc_filter.o hevc_data.o @@ -495,7 +682,7 @@ index 4b8ad121db..f6e6784e5a 100644 OBJS-$(CONFIG_HEVC_AMF_ENCODER) += amfenc_hevc.o OBJS-$(CONFIG_HEVC_CUVID_DECODER) += cuviddec.o OBJS-$(CONFIG_HEVC_MEDIACODEC_DECODER) += mediacodecdec.o -@@ -1188,3 +1197,31 @@ $(SUBDIR)qdm2.o: $(SUBDIR)qdm2_tables.h +@@ -1223,3 +1232,31 @@ $(SUBDIR)qdm2.o: $(SUBDIR)qdm2_tables.h $(SUBDIR)sinewin.o: $(SUBDIR)sinewin_tables.h $(SUBDIR)sinewin_fixed.o: $(SUBDIR)sinewin_fixed_tables.h endif @@ -528,10 +715,10 @@ index 4b8ad121db..f6e6784e5a 100644 +$(SUBDIR)rpi_hevcdec.o $(SUBDIR)rpi_shader_template.o $(SUBDIR)rpi_qpu.o: $(SUBDIR)rpi_hevc_shader.h +endif diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c -index 4d4ef530e4..fba8776c9f 100644 +index d2f9a39ce5..cc87600a2a 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c -@@ -142,6 +142,7 @@ extern AVCodec ff_h264_qsv_decoder; +@@ -145,6 +145,7 @@ extern AVCodec ff_h264_qsv_decoder; extern AVCodec ff_h264_rkmpp_decoder; extern AVCodec ff_hap_encoder; extern AVCodec ff_hap_decoder; @@ -539,7 +726,7 @@ index 4d4ef530e4..fba8776c9f 100644 extern AVCodec ff_hevc_decoder; extern AVCodec ff_hevc_qsv_decoder; extern AVCodec ff_hevc_rkmpp_decoder; -@@ -833,6 +834,41 @@ static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id) +@@ -861,6 +862,41 @@ static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id) } } @@ -15183,10 +15370,10 @@ index 0000000000..e35896a102 + +endfunc diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h -index fb0c6fae70..9f2ebb16f3 100644 +index d234271c5b..a36b675fba 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h -@@ -3208,7 +3208,13 @@ typedef struct AVCodecContext { +@@ -3273,7 +3273,13 @@ typedef struct AVCodecContext { #endif /** @@ -15201,7 +15388,7 @@ index fb0c6fae70..9f2ebb16f3 100644 * the end of the audio. I.e. this number of decoded samples must be * discarded by the caller from the end of the stream to get the original * audio without any trailing padding. -@@ -4593,6 +4599,17 @@ void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst); +@@ -4666,6 +4672,17 @@ void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst); */ AVCodec *avcodec_find_decoder(enum AVCodecID id); @@ -15262,10 +15449,10 @@ index 647a22ef7c..4ed35d1126 100644 #include "avcodec.h" diff --git a/libavcodec/raw.c b/libavcodec/raw.c -index 8da2a9735e..9089f9b4ea 100644 +index b6fb91c1c6..e99dacbb1c 100644 --- a/libavcodec/raw.c +++ b/libavcodec/raw.c -@@ -283,6 +283,10 @@ const PixelFormatTag ff_raw_pix_fmt_tags[] = { +@@ -289,6 +289,10 @@ const PixelFormatTag ff_raw_pix_fmt_tags[] = { { AV_PIX_FMT_YUV444P16LE, MKTAG('I', '4', 'F', 'L') }, { AV_PIX_FMT_YUV444P16BE, MKTAG('I', '4', 'F', 'B') }, @@ -19729,7 +19916,7 @@ index 0000000000..221755fb6e + diff --git a/libavcodec/rpi_hevc_parse.c b/libavcodec/rpi_hevc_parse.c new file mode 100644 -index 0000000000..04f9231acc +index 0000000000..36affa9afa --- /dev/null +++ b/libavcodec/rpi_hevc_parse.c @@ -0,0 +1,142 @@ @@ -19764,7 +19951,7 @@ index 0000000000..04f9231acc + int ret = 0; + H2645Packet pkt = { 0 }; + -+ ret = ff_h2645_packet_split(&pkt, buf, buf_size, logctx, is_nalff, nal_length_size, AV_CODEC_ID_HEVC, 1); ++ ret = ff_h2645_packet_split(&pkt, buf, buf_size, logctx, is_nalff, nal_length_size, AV_CODEC_ID_HEVC, 1, 0); + if (ret < 0) { + goto done; + } @@ -28119,7 +28306,7 @@ index 0000000000..1128a2c054 +}; diff --git a/libavcodec/rpi_hevcdec.c b/libavcodec/rpi_hevcdec.c new file mode 100644 -index 0000000000..39a63c77de +index 0000000000..c874222ebb --- /dev/null +++ b/libavcodec/rpi_hevcdec.c @@ -0,0 +1,6016 @@ @@ -33552,7 +33739,7 @@ index 0000000000..39a63c77de + /* split the input packet into NAL units, so we know the upper bound on the + * number of slices in the frame */ + ret = ff_h2645_packet_split(&s->pkt, buf, length, s->avctx, s->is_nalff, -+ s->nal_length_size, s->avctx->codec_id, 0); ++ s->nal_length_size, s->avctx->codec_id, 0, 0); + if (ret < 0) { + av_log(s->avctx, AV_LOG_ERROR, + "Error splitting the input into NAL units.\n"); @@ -42213,11 +42400,11 @@ index 0000000000..26fb3be999 +#endif + diff --git a/libavfilter/Makefile b/libavfilter/Makefile -index bcd5d437ff..ccb49ec8c0 100644 +index 455c809b15..087cab98ee 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile -@@ -346,6 +346,7 @@ OBJS-$(CONFIG_TONEMAP_FILTER) += vf_tonemap.o - OBJS-$(CONFIG_TRANSPOSE_FILTER) += vf_transpose.o +@@ -406,6 +406,7 @@ OBJS-$(CONFIG_TRANSPOSE_OPENCL_FILTER) += vf_transpose_opencl.o opencl.o o + OBJS-$(CONFIG_TRANSPOSE_VAAPI_FILTER) += vf_transpose_vaapi.o vaapi_vpp.o OBJS-$(CONFIG_TRIM_FILTER) += trim.o OBJS-$(CONFIG_UNPREMULTIPLY_FILTER) += vf_premultiply.o framesync.o +OBJS-$(CONFIG_UNSAND_FILTER) += vf_unsand.o @@ -42225,10 +42412,10 @@ index bcd5d437ff..ccb49ec8c0 100644 OBJS-$(CONFIG_UNSHARP_OPENCL_FILTER) += vf_unsharp_opencl.o opencl.o \ opencl/unsharp.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c -index 68b2992027..3b059fce4e 100644 +index 04a3df7d56..8d1470dd34 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c -@@ -338,6 +338,7 @@ extern AVFilter ff_vf_transpose; +@@ -387,6 +387,7 @@ extern AVFilter ff_vf_transpose_vaapi; extern AVFilter ff_vf_trim; extern AVFilter ff_vf_unpremultiply; extern AVFilter ff_vf_unsharp; @@ -42237,7 +42424,7 @@ index 68b2992027..3b059fce4e 100644 extern AVFilter ff_vf_uspp; extern AVFilter ff_vf_vaguedenoiser; diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c -index 4cc6892404..9db92322a4 100644 +index a149f8fb6d..776e3bb9ab 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -32,6 +32,9 @@ @@ -42375,18 +42562,18 @@ index 4cc6892404..9db92322a4 100644 (!ff_merge_samplerates(inlink->in_samplerates, inlink->out_samplerates) || diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c -index cd56f8ca45..813a682aa1 100644 +index e0ff7e4dd8..77bc3d83fe 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c -@@ -207,7 +207,7 @@ static int av_buffersrc_add_frame_internal(AVFilterContext *ctx, +@@ -213,7 +213,7 @@ static int av_buffersrc_add_frame_internal(AVFilterContext *ctx, - switch (ctx->outputs[0]->type) { - case AVMEDIA_TYPE_VIDEO: -- CHECK_VIDEO_PARAM_CHANGE(ctx, s, frame->width, frame->height, -+ CHECK_VIDEO_PARAM_CHANGE(ctx, s, av_frame_cropped_width(frame), av_frame_cropped_height(frame), - frame->format); - break; - case AVMEDIA_TYPE_AUDIO: + switch (ctx->outputs[0]->type) { + case AVMEDIA_TYPE_VIDEO: +- CHECK_VIDEO_PARAM_CHANGE(ctx, s, frame->width, frame->height, ++ CHECK_VIDEO_PARAM_CHANGE(ctx, s, av_frame_cropped_width(frame), av_frame_cropped_height(frame), + frame->format, frame->pts); + break; + case AVMEDIA_TYPE_AUDIO: diff --git a/libavfilter/vf_unsand.c b/libavfilter/vf_unsand.c new file mode 100644 index 0000000000..64578b7ac4 @@ -42626,10 +42813,10 @@ index 0000000000..64578b7ac4 +}; + diff --git a/libavformat/utils.c b/libavformat/utils.c -index c25eab4d49..4db44315c7 100644 +index 6c6f4e1bd1..c6332d3e46 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c -@@ -3005,6 +3005,40 @@ static int has_codec_parameters(AVStream *st, const char **errmsg_ptr) +@@ -3013,6 +3013,40 @@ static int has_codec_parameters(AVStream *st, const char **errmsg_ptr) return 1; } @@ -42670,7 +42857,7 @@ index c25eab4d49..4db44315c7 100644 /* returns 1 or 0 if or if not decoded data was returned, or a negative error */ static int try_decode_frame(AVFormatContext *s, AVStream *st, AVPacket *avpkt, AVDictionary **options) -@@ -3039,7 +3073,11 @@ static int try_decode_frame(AVFormatContext *s, AVStream *st, AVPacket *avpkt, +@@ -3047,7 +3081,11 @@ static int try_decode_frame(AVFormatContext *s, AVStream *st, AVPacket *avpkt, av_dict_set(options ? options : &thread_opt, "threads", "1", 0); if (s->codec_whitelist) av_dict_set(options ? options : &thread_opt, "codec_whitelist", s->codec_whitelist, 0); @@ -42683,7 +42870,7 @@ index c25eab4d49..4db44315c7 100644 if (!options) av_dict_free(&thread_opt); if (ret < 0) { -@@ -3070,6 +3108,14 @@ static int try_decode_frame(AVFormatContext *s, AVStream *st, AVPacket *avpkt, +@@ -3078,6 +3116,14 @@ static int try_decode_frame(AVFormatContext *s, AVStream *st, AVPacket *avpkt, if (avctx->codec_type == AVMEDIA_TYPE_VIDEO || avctx->codec_type == AVMEDIA_TYPE_AUDIO) { ret = avcodec_send_packet(avctx, &pkt); @@ -42698,7 +42885,7 @@ index c25eab4d49..4db44315c7 100644 if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) break; if (ret >= 0) -@@ -3663,9 +3709,20 @@ FF_ENABLE_DEPRECATION_WARNINGS +@@ -3671,9 +3717,20 @@ FF_ENABLE_DEPRECATION_WARNINGS // Try to just open decoders, in case this is enough to get parameters. if (!has_codec_parameters(st, NULL) && st->request_probe <= 0) { if (codec && !avctx->codec) @@ -42723,13 +42910,13 @@ index c25eab4d49..4db44315c7 100644 if (!options) av_dict_free(&thread_opt); diff --git a/libavutil/Makefile b/libavutil/Makefile -index a63ba523c9..4f9a19e800 100644 +index 8a7a44e4b5..6bfc885796 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile -@@ -164,6 +164,7 @@ OBJS-$(CONFIG_QSV) += hwcontext_qsv.o - OBJS-$(CONFIG_LIBDRM) += hwcontext_drm.o - OBJS-$(CONFIG_LZO) += lzo.o +@@ -170,6 +170,7 @@ OBJS-$(CONFIG_LZO) += lzo.o + OBJS-$(CONFIG_MEDIACODEC) += hwcontext_mediacodec.o OBJS-$(CONFIG_OPENCL) += hwcontext_opencl.o + OBJS-$(CONFIG_QSV) += hwcontext_qsv.o +OBJS-$(CONFIG_SAND) += rpi_sand_fns.o OBJS-$(CONFIG_VAAPI) += hwcontext_vaapi.o OBJS-$(CONFIG_VIDEOTOOLBOX) += hwcontext_videotoolbox.o @@ -42818,7 +43005,7 @@ index 73b6bd0b14..d907de3f1c 100644 * @} */ diff --git a/libavutil/frame.c b/libavutil/frame.c -index 00215ac29a..d068f437e7 100644 +index dcf1fc3d17..dd0876f5a9 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -16,6 +16,8 @@ @@ -42840,7 +43027,7 @@ index 00215ac29a..d068f437e7 100644 #if FF_API_FRAME_GET_SET MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp) -@@ -885,6 +890,12 @@ int av_frame_apply_cropping(AVFrame *frame, int flags) +@@ -893,6 +898,12 @@ int av_frame_apply_cropping(AVFrame *frame, int flags) (frame->crop_top + frame->crop_bottom) >= frame->height) return AVERROR(ERANGE); @@ -42854,10 +43041,10 @@ index 00215ac29a..d068f437e7 100644 if (!desc) return AVERROR_BUG; diff --git a/libavutil/frame.h b/libavutil/frame.h -index 9d57d6ce66..1ade7bd707 100644 +index 5d3231e7bb..e250f420a2 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h -@@ -886,6 +886,16 @@ int av_frame_apply_cropping(AVFrame *frame, int flags); +@@ -964,6 +964,16 @@ int av_frame_apply_cropping(AVFrame *frame, int flags); */ const char *av_frame_side_data_name(enum AVFrameSideDataType type); @@ -42875,12 +43062,12 @@ index 9d57d6ce66..1ade7bd707 100644 * @} */ diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c -index 8ed52751c1..71d6dd4250 100644 +index b97b0665b0..e3f21b1137 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c -@@ -2185,6 +2185,30 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { - .name = "opencl", - .flags = AV_PIX_FMT_FLAG_HWACCEL, +@@ -2344,6 +2344,30 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { + }, + .flags = AV_PIX_FMT_FLAG_PLANAR, }, + [AV_PIX_FMT_SAND128] = { + .name = "sand128", @@ -42910,21 +43097,20 @@ index 8ed52751c1..71d6dd4250 100644 #if FF_API_PLUS1_MINUS1 FF_ENABLE_DEPRECATION_WARNINGS diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h -index e184a56672..1078c192a6 100644 +index 8b54c9415b..9f74f7b335 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h -@@ -330,6 +330,11 @@ enum AVPixelFormat { - */ - AV_PIX_FMT_OPENCL, +@@ -347,6 +347,10 @@ enum AVPixelFormat { + AV_PIX_FMT_NV24, ///< planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V) + AV_PIX_FMT_NV42, ///< as above, but U and V bytes are swapped + // RPI - not on ifdef so can be got at by calling progs + AV_PIX_FMT_SAND128, ///< 4:2:0 8-bit 128x*Y stripe, 64x*UV stripe, then next x stripe, mysterious padding + AV_PIX_FMT_SAND64_10, ///< 4:2:0 10-bit 64x*Y stripe, 32x*UV stripe, then next x stripe, mysterious padding + AV_PIX_FMT_SAND64_16, ///< 4:2:0 16-bit 64x*Y stripe, 32x*UV stripe, then next x stripe, mysterious padding -+ + AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions }; - diff --git a/libavutil/rpi_sand_fn_pw.h b/libavutil/rpi_sand_fn_pw.h new file mode 100644 index 0000000000..52d52a2a83 @@ -43445,7 +43631,7 @@ index 0000000000..b1e99a6a89 + diff --git a/pi-util/conf_h265.2016.csv b/pi-util/conf_h265.2016.csv new file mode 100644 -index 0000000000..3e90f6893f +index 0000000000..17fb09be58 --- /dev/null +++ b/pi-util/conf_h265.2016.csv @@ -0,0 +1,195 @@ @@ -43646,7 +43832,7 @@ index 0000000000..3e90f6893f +1,local/intra_pred_21_laps,intra_pred_21_laps.265,intra_pred_21_laps.md5 diff --git a/pi-util/conf_h265.2016_HEVC_v1.csv b/pi-util/conf_h265.2016_HEVC_v1.csv new file mode 100644 -index 0000000000..6082641271 +index 0000000000..b482907fcb --- /dev/null +++ b/pi-util/conf_h265.2016_HEVC_v1.csv @@ -0,0 +1,147 @@ @@ -43799,7 +43985,7 @@ index 0000000000..6082641271 +1,WPP_F_ericsson_MAIN_2,WPP_F_ericsson_MAIN_2.bit,WPP_F_ericsson_MAIN_2_yuv.md5 diff --git a/pi-util/conf_h265.csv b/pi-util/conf_h265.csv new file mode 100644 -index 0000000000..fc14f2a3c2 +index 0000000000..113528cfb0 --- /dev/null +++ b/pi-util/conf_h265.csv @@ -0,0 +1,144 @@ @@ -44618,3 +44804,6 @@ index 0000000000..5935a11ca5 + + do_logparse(args.logfile) + +-- +2.20.1 + diff --git a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0001-avutil-add-av_buffer_pool_flush.patch b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0001-avutil-add-av_buffer_pool_flush.patch index 6db33f9d39..119a6a33c4 100644 --- a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0001-avutil-add-av_buffer_pool_flush.patch +++ b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0001-avutil-add-av_buffer_pool_flush.patch @@ -1,4 +1,4 @@ -From e6cec3f54693e7e2c10b6b7bc8f72daa6e9a77dc Mon Sep 17 00:00:00 2001 +From 3710124dd57ede7588884ecc86cbcaee5d530498 Mon Sep 17 00:00:00 2001 From: Jonas Karlman Date: Mon, 3 Dec 2018 23:48:04 +0100 Subject: [PATCH 01/12] avutil: add av_buffer_pool_flush() @@ -49,6 +49,3 @@ index 73b6bd0b14..0678fa4bea 100644 /** * Mark the pool as being available for freeing. It will actually be freed only * once all the allocated buffers associated with the pool are released. Thus it --- -2.24.0 - diff --git a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0002-Add-common-V4L2-request-API-code.patch b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0002-Add-common-V4L2-request-API-code.patch index 3d87974112..31a8c81d3b 100644 --- a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0002-Add-common-V4L2-request-API-code.patch +++ b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0002-Add-common-V4L2-request-API-code.patch @@ -1,4 +1,4 @@ -From 457a74f059e5467f7f24f15be1b0e87a34e8cabc Mon Sep 17 00:00:00 2001 +From ca0440a82038ebe56c467d89787291f55535d03d Mon Sep 17 00:00:00 2001 From: Jonas Karlman Date: Sat, 15 Dec 2018 22:32:16 +0100 Subject: [PATCH 02/12] Add common V4L2 request API code @@ -15,18 +15,18 @@ Signed-off-by: Jonas Karlman create mode 100644 libavcodec/v4l2_request.h diff --git a/configure b/configure -index 15e6c321b1..7f9e7e7b25 100755 +index 34c2adb4a4..6b41344dfd 100755 --- a/configure +++ b/configure -@@ -264,6 +264,7 @@ External library support: +@@ -271,6 +271,7 @@ External library support: --enable-libtls enable LibreSSL (via libtls), needed for https support - if openssl or gnutls is not used [no] + if openssl, gnutls or mbedtls is not used [no] --enable-libtwolame enable MP2 encoding via libtwolame [no] + --enable-libudev enable libudev [no] --enable-libv4l2 enable libv4l2/v4l-utils [no] --enable-libvidstab enable video stabilization using vid.stab [no] --enable-libvmaf enable vmaf filter via libvmaf [no] -@@ -324,6 +325,7 @@ External library support: +@@ -337,6 +338,7 @@ External library support: --enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no] --enable-rkmpp enable Rockchip Media Process Platform code [no] --disable-v4l2-m2m disable V4L2 mem2mem code [autodetect] @@ -34,7 +34,7 @@ index 15e6c321b1..7f9e7e7b25 100755 --disable-vaapi disable Video Acceleration API (mainly Unix/Intel) code [autodetect] --disable-vdpau disable Nvidia Video Decode and Presentation API for Unix code [autodetect] --disable-videotoolbox disable VideoToolbox code [autodetect] -@@ -1732,6 +1734,7 @@ EXTERNAL_LIBRARY_LIST=" +@@ -1797,6 +1799,7 @@ EXTERNAL_LIBRARY_LIST=" libtesseract libtheora libtwolame @@ -42,7 +42,7 @@ index 15e6c321b1..7f9e7e7b25 100755 libv4l2 libvorbis libvpx -@@ -1782,6 +1785,7 @@ HWACCEL_LIBRARY_LIST=" +@@ -1851,6 +1854,7 @@ HWACCEL_LIBRARY_LIST=" mmal omx opencl @@ -50,23 +50,23 @@ index 15e6c321b1..7f9e7e7b25 100755 " DOCUMENT_LIST=" -@@ -2783,6 +2787,7 @@ d3d11va_deps="dxva_h ID3D11VideoDecoder ID3D11VideoContext" +@@ -2873,6 +2877,7 @@ d3d11va_deps="dxva_h ID3D11VideoDecoder ID3D11VideoContext" dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32" ffnvcodec_deps_any="libdl LoadLibrary" nvdec_deps="ffnvcodec" +v4l2_request_deps="linux_videodev2_h linux_media_h v4l2_timeval_to_ns libdrm libudev" + vaapi_x11_deps="xlib" videotoolbox_hwaccel_deps="videotoolbox pthreads" videotoolbox_hwaccel_extralibs="-framework QuartzCore" - xvmc_deps="X11_extensions_XvMClib_h" -@@ -6063,6 +6068,7 @@ enabled libtls && require_pkg_config libtls libtls tls.h tls_configur +@@ -6270,6 +6275,7 @@ enabled libtls && require_pkg_config libtls libtls tls.h tls_configur enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame && { check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame || die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; } +enabled libudev && require_pkg_config libudev libudev libudev.h udev_new enabled libv4l2 && require_pkg_config libv4l2 libv4l2 libv4l2.h v4l2_ioctl enabled libvidstab && require_pkg_config libvidstab "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit - enabled libvmaf && require_pkg_config libvmaf "libvmaf >= 0.6.2" libvmaf.h compute_vmaf -@@ -6153,6 +6159,10 @@ enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/r + enabled libvmaf && require_pkg_config libvmaf "libvmaf >= 1.3.9" libvmaf.h compute_vmaf +@@ -6365,6 +6371,10 @@ enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/r { enabled libdrm || die "ERROR: rkmpp requires --enable-libdrm"; } } @@ -74,23 +74,23 @@ index 15e6c321b1..7f9e7e7b25 100755 + die "ERROR: v4l2-request requires --enable-libdrm"; } && + { enabled libudev || + die "ERROR: v4l2-request requires --enable-libudev"; } + enabled vapoursynth && require_pkg_config vapoursynth "vapoursynth-script >= 42" VSScript.h vsscript_init - if enabled gcrypt; then - GCRYPT_CONFIG="${cross_prefix}libgcrypt-config" -@@ -6230,6 +6240,8 @@ check_cc h264_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_H264;" + +@@ -6444,6 +6454,8 @@ check_cc h264_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_H264;" check_cc vp8_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;" check_cc vp9_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;" +check_func_headers "linux/media.h linux/videodev2.h" v4l2_timeval_to_ns + - check_header sys/videoio.h + check_headers sys/videoio.h test_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index 4b8ad121db..48f6e06545 100644 +index 3cd73fbcc6..9e847eeadc 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile -@@ -143,6 +143,7 @@ OBJS-$(CONFIG_VP3DSP) += vp3dsp.o +@@ -147,6 +147,7 @@ OBJS-$(CONFIG_VP3DSP) += vp3dsp.o OBJS-$(CONFIG_VP56DSP) += vp56dsp.o OBJS-$(CONFIG_VP8DSP) += vp8dsp.o OBJS-$(CONFIG_V4L2_M2M) += v4l2_m2m.o v4l2_context.o v4l2_buffers.o v4l2_fmt.o @@ -1137,6 +1137,3 @@ index 0000000000..d4146bd4ee +int ff_v4l2_request_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx); + +#endif /* AVCODEC_V4L2_REQUEST_H */ --- -2.24.0 - diff --git a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0003-Add-V4L2-request-API-mpeg2-hwaccel.patch b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0003-Add-V4L2-request-API-mpeg2-hwaccel.patch index 6b8e805364..8af3e620be 100644 --- a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0003-Add-V4L2-request-API-mpeg2-hwaccel.patch +++ b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0003-Add-V4L2-request-API-mpeg2-hwaccel.patch @@ -1,4 +1,4 @@ -From d46c4def125a142419db249051fbaa8e743e3e53 Mon Sep 17 00:00:00 2001 +From 279092b1ef7cb944c513167dd55861ff2f2bb473 Mon Sep 17 00:00:00 2001 From: Jonas Karlman Date: Sat, 15 Dec 2018 22:32:16 +0100 Subject: [PATCH 03/12] Add V4L2 request API mpeg2 hwaccel @@ -14,10 +14,10 @@ Signed-off-by: Jonas Karlman create mode 100644 libavcodec/v4l2_request_mpeg2.c diff --git a/configure b/configure -index 7f9e7e7b25..6088e8d00c 100755 +index 6b41344dfd..e88c201cce 100755 --- a/configure +++ b/configure -@@ -2846,6 +2846,8 @@ mpeg2_dxva2_hwaccel_deps="dxva2" +@@ -2937,6 +2937,8 @@ mpeg2_dxva2_hwaccel_deps="dxva2" mpeg2_dxva2_hwaccel_select="mpeg2video_decoder" mpeg2_nvdec_hwaccel_deps="nvdec" mpeg2_nvdec_hwaccel_select="mpeg2video_decoder" @@ -26,19 +26,19 @@ index 7f9e7e7b25..6088e8d00c 100755 mpeg2_vaapi_hwaccel_deps="vaapi" mpeg2_vaapi_hwaccel_select="mpeg2video_decoder" mpeg2_vdpau_hwaccel_deps="vdpau" -@@ -6241,6 +6243,7 @@ check_cc vp8_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;" +@@ -6455,6 +6457,7 @@ check_cc vp8_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;" check_cc vp9_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;" check_func_headers "linux/media.h linux/videodev2.h" v4l2_timeval_to_ns +check_cc mpeg2_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2_SLICE;" - check_header sys/videoio.h + check_headers sys/videoio.h test_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index 48f6e06545..9b945e3f64 100644 +index 9e847eeadc..864f24a2af 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile -@@ -871,6 +871,7 @@ OBJS-$(CONFIG_MPEG2_D3D11VA_HWACCEL) += dxva2_mpeg2.o +@@ -891,6 +891,7 @@ OBJS-$(CONFIG_MPEG2_D3D11VA_HWACCEL) += dxva2_mpeg2.o OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL) += dxva2_mpeg2.o OBJS-$(CONFIG_MPEG2_NVDEC_HWACCEL) += nvdec_mpeg12.o OBJS-$(CONFIG_MPEG2_QSV_HWACCEL) += qsvdec_other.o @@ -242,6 +242,3 @@ index 0000000000..782b9c2471 + .frame_params = ff_v4l2_request_frame_params, + .caps_internal = HWACCEL_CAP_ASYNC_SAFE, +}; --- -2.24.0 - diff --git a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0004-Add-V4L2-request-API-h264-hwaccel.patch b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0004-Add-V4L2-request-API-h264-hwaccel.patch index 11d6588fe7..0ac85b0a05 100644 --- a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0004-Add-V4L2-request-API-h264-hwaccel.patch +++ b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0004-Add-V4L2-request-API-h264-hwaccel.patch @@ -1,4 +1,4 @@ -From fb59440a268d956bffa40604e4422420453b4605 Mon Sep 17 00:00:00 2001 +From da483a0eb4802714d9ad3a07ea17c2ec0f65c2a5 Mon Sep 17 00:00:00 2001 From: Jernej Skrabec Date: Sat, 15 Dec 2018 22:32:16 +0100 Subject: [PATCH 04/12] Add V4L2 request API h264 hwaccel @@ -16,10 +16,10 @@ Signed-off-by: Jonas Karlman create mode 100644 libavcodec/v4l2_request_h264.c diff --git a/configure b/configure -index 6088e8d00c..a967ae0afb 100755 +index e88c201cce..576a79ff09 100755 --- a/configure +++ b/configure -@@ -2804,6 +2804,8 @@ h264_dxva2_hwaccel_deps="dxva2" +@@ -2895,6 +2895,8 @@ h264_dxva2_hwaccel_deps="dxva2" h264_dxva2_hwaccel_select="h264_decoder" h264_nvdec_hwaccel_deps="nvdec" h264_nvdec_hwaccel_select="h264_decoder" @@ -28,19 +28,19 @@ index 6088e8d00c..a967ae0afb 100755 h264_vaapi_hwaccel_deps="vaapi" h264_vaapi_hwaccel_select="h264_decoder" h264_vdpau_hwaccel_deps="vdpau" -@@ -6243,6 +6245,7 @@ check_cc vp8_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;" +@@ -6457,6 +6459,7 @@ check_cc vp8_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;" check_cc vp9_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;" check_func_headers "linux/media.h linux/videodev2.h" v4l2_timeval_to_ns +check_cc h264_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_H264_SLICE;" check_cc mpeg2_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2_SLICE;" - check_header sys/videoio.h + check_headers sys/videoio.h diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index 9b945e3f64..2bdfaabb5f 100644 +index 864f24a2af..58bd444934 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile -@@ -852,6 +852,7 @@ OBJS-$(CONFIG_H264_D3D11VA_HWACCEL) += dxva2_h264.o +@@ -872,6 +872,7 @@ OBJS-$(CONFIG_H264_D3D11VA_HWACCEL) += dxva2_h264.o OBJS-$(CONFIG_H264_DXVA2_HWACCEL) += dxva2_h264.o OBJS-$(CONFIG_H264_NVDEC_HWACCEL) += nvdec_h264.o OBJS-$(CONFIG_H264_QSV_HWACCEL) += qsvdec_h2645.o @@ -49,10 +49,10 @@ index 9b945e3f64..2bdfaabb5f 100644 OBJS-$(CONFIG_H264_VDPAU_HWACCEL) += vdpau_h264.o OBJS-$(CONFIG_H264_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c -index af9ec9789b..f1e11003af 100644 +index fc4e65bf01..9912ede703 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c -@@ -758,6 +758,7 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback) +@@ -765,6 +765,7 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback) #define HWACCEL_MAX (CONFIG_H264_DXVA2_HWACCEL + \ (CONFIG_H264_D3D11VA_HWACCEL * 2) + \ CONFIG_H264_NVDEC_HWACCEL + \ @@ -60,7 +60,7 @@ index af9ec9789b..f1e11003af 100644 CONFIG_H264_VAAPI_HWACCEL + \ CONFIG_H264_VIDEOTOOLBOX_HWACCEL + \ CONFIG_H264_VDPAU_HWACCEL) -@@ -842,6 +843,9 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback) +@@ -849,6 +850,9 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback) #endif #if CONFIG_H264_VIDEOTOOLBOX_HWACCEL *fmt++ = AV_PIX_FMT_VIDEOTOOLBOX; @@ -71,10 +71,10 @@ index af9ec9789b..f1e11003af 100644 if (h->avctx->codec->pix_fmts) choices = h->avctx->codec->pix_fmts; diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c -index 33e1056d87..3ccfa60621 100644 +index 03c87b59bd..dbcceb915a 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c -@@ -1078,6 +1078,9 @@ AVCodec ff_h264_decoder = { +@@ -1081,6 +1081,9 @@ AVCodec ff_h264_decoder = { #endif #if CONFIG_H264_VIDEOTOOLBOX_HWACCEL HWACCEL_VIDEOTOOLBOX(h264), @@ -545,6 +545,3 @@ index 0000000000..81b3c4b092 + .frame_params = ff_v4l2_request_frame_params, + .caps_internal = HWACCEL_CAP_ASYNC_SAFE, +}; --- -2.24.0 - diff --git a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0005-Add-V4L2-request-API-hevc-hwaccel.patch b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0005-Add-V4L2-request-API-hevc-hwaccel.patch index e9a806e67e..20bba586c0 100644 --- a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0005-Add-V4L2-request-API-hevc-hwaccel.patch +++ b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0005-Add-V4L2-request-API-hevc-hwaccel.patch @@ -1,4 +1,4 @@ -From 2511b50434e37a56af86bd38b76a6b5cf4d3117b Mon Sep 17 00:00:00 2001 +From 521d06aec85d55a28e946a222f591747a1d3f2f5 Mon Sep 17 00:00:00 2001 From: Jernej Skrabec Date: Sat, 15 Dec 2018 22:32:16 +0100 Subject: [PATCH 05/12] Add V4L2 request API hevc hwaccel @@ -15,10 +15,10 @@ Signed-off-by: Jonas Karlman create mode 100644 libavcodec/v4l2_request_hevc.c diff --git a/configure b/configure -index a967ae0afb..d07cd27d88 100755 +index 576a79ff09..d51ee62a70 100755 --- a/configure +++ b/configure -@@ -2820,6 +2820,8 @@ hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC" +@@ -2911,6 +2911,8 @@ hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC" hevc_dxva2_hwaccel_select="hevc_decoder" hevc_nvdec_hwaccel_deps="nvdec" hevc_nvdec_hwaccel_select="hevc_decoder" @@ -27,19 +27,19 @@ index a967ae0afb..d07cd27d88 100755 hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC" hevc_vaapi_hwaccel_select="hevc_decoder" hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC" -@@ -6246,6 +6248,7 @@ check_cc vp9_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;" +@@ -6460,6 +6462,7 @@ check_cc vp9_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;" check_func_headers "linux/media.h linux/videodev2.h" v4l2_timeval_to_ns check_cc h264_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_H264_SLICE;" +check_cc hevc_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_HEVC_SLICE;" check_cc mpeg2_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2_SLICE;" - check_header sys/videoio.h + check_headers sys/videoio.h diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index 2bdfaabb5f..a4c959e0f5 100644 +index 58bd444934..2b53d2b650 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile -@@ -860,6 +860,7 @@ OBJS-$(CONFIG_HEVC_D3D11VA_HWACCEL) += dxva2_hevc.o +@@ -880,6 +880,7 @@ OBJS-$(CONFIG_HEVC_D3D11VA_HWACCEL) += dxva2_hevc.o OBJS-$(CONFIG_HEVC_DXVA2_HWACCEL) += dxva2_hevc.o OBJS-$(CONFIG_HEVC_NVDEC_HWACCEL) += nvdec_hevc.o OBJS-$(CONFIG_HEVC_QSV_HWACCEL) += qsvdec_h2645.o @@ -48,10 +48,10 @@ index 2bdfaabb5f..a4c959e0f5 100644 OBJS-$(CONFIG_HEVC_VDPAU_HWACCEL) += vdpau_hevc.o OBJS-$(CONFIG_MJPEG_NVDEC_HWACCEL) += nvdec_mjpeg.o diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c -index 2c33a1ff57..d717850eeb 100644 +index 8f1c162ace..4c9c92bfc2 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c -@@ -362,6 +362,7 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) +@@ -373,6 +373,7 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) #define HWACCEL_MAX (CONFIG_HEVC_DXVA2_HWACCEL + \ CONFIG_HEVC_D3D11VA_HWACCEL * 2 + \ CONFIG_HEVC_NVDEC_HWACCEL + \ @@ -59,7 +59,7 @@ index 2c33a1ff57..d717850eeb 100644 CONFIG_HEVC_VAAPI_HWACCEL + \ CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL + \ CONFIG_HEVC_VDPAU_HWACCEL) -@@ -388,6 +389,9 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) +@@ -399,6 +400,9 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) #endif #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL *fmt++ = AV_PIX_FMT_VIDEOTOOLBOX; @@ -69,7 +69,7 @@ index 2c33a1ff57..d717850eeb 100644 #endif break; case AV_PIX_FMT_YUV420P10: -@@ -406,6 +410,9 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) +@@ -417,6 +421,9 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) #endif #if CONFIG_HEVC_NVDEC_HWACCEL *fmt++ = AV_PIX_FMT_CUDA; @@ -78,8 +78,8 @@ index 2c33a1ff57..d717850eeb 100644 + *fmt++ = AV_PIX_FMT_DRM_PRIME; #endif break; - case AV_PIX_FMT_YUV420P12: -@@ -3566,6 +3573,9 @@ AVCodec ff_hevc_decoder = { + case AV_PIX_FMT_YUV444P: +@@ -3592,6 +3599,9 @@ AVCodec ff_hevc_decoder = { #endif #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL HWACCEL_VIDEOTOOLBOX(hevc), @@ -634,6 +634,3 @@ index 0000000000..da1fd666d7 + .frame_params = ff_v4l2_request_frame_params, + .caps_internal = HWACCEL_CAP_ASYNC_SAFE, +}; --- -2.24.0 - diff --git a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0006-Add-V4L2-request-API-vp8-hwaccel.patch b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0006-Add-V4L2-request-API-vp8-hwaccel.patch index 574262453f..fc8ceb65cb 100644 --- a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0006-Add-V4L2-request-API-vp8-hwaccel.patch +++ b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0006-Add-V4L2-request-API-vp8-hwaccel.patch @@ -1,4 +1,4 @@ -From 13e487a5da1f64901391b99aa094a697fd2889aa Mon Sep 17 00:00:00 2001 +From 1084cad0a91e33a95150ff82f1d4ce2a0c180e2c Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Wed, 22 May 2019 14:46:58 +0200 Subject: [PATCH 06/12] Add V4L2 request API vp8 hwaccel @@ -17,31 +17,31 @@ Signed-off-by: Ezequiel Garcia create mode 100644 libavcodec/v4l2_request_vp8.c diff --git a/configure b/configure -index d07cd27d88..46bcf32d3d 100755 +index d51ee62a70..6bdfe6fd95 100755 --- a/configure +++ b/configure -@@ -2884,6 +2884,8 @@ vp8_nvdec_hwaccel_deps="nvdec" +@@ -2975,6 +2975,8 @@ vp8_nvdec_hwaccel_deps="nvdec" vp8_nvdec_hwaccel_select="vp8_decoder" - vp8_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferVP8" + vp8_vaapi_hwaccel_deps="vaapi" vp8_vaapi_hwaccel_select="vp8_decoder" +vp8_v4l2request_hwaccel_deps="v4l2_request vp8_v4l2_request" +vp8_v4l2request_hwaccel_select="vp8_decoder" vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9" vp9_d3d11va_hwaccel_select="vp9_decoder" vp9_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_VP9" -@@ -6250,6 +6252,7 @@ check_func_headers "linux/media.h linux/videodev2.h" v4l2_timeval_to_ns +@@ -6464,6 +6466,7 @@ check_func_headers "linux/media.h linux/videodev2.h" v4l2_timeval_to_ns check_cc h264_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_H264_SLICE;" check_cc hevc_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_HEVC_SLICE;" check_cc mpeg2_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2_SLICE;" +check_cc vp8_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_VP8_FRAME;" - check_header sys/videoio.h + check_headers sys/videoio.h test_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index a4c959e0f5..0249defb4f 100644 +index 2b53d2b650..55fa28548b 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile -@@ -890,6 +890,7 @@ OBJS-$(CONFIG_VC1_VAAPI_HWACCEL) += vaapi_vc1.o +@@ -910,6 +910,7 @@ OBJS-$(CONFIG_VC1_VAAPI_HWACCEL) += vaapi_vc1.o OBJS-$(CONFIG_VC1_VDPAU_HWACCEL) += vdpau_vc1.o OBJS-$(CONFIG_VP8_NVDEC_HWACCEL) += nvdec_vp8.o OBJS-$(CONFIG_VP8_VAAPI_HWACCEL) += vaapi_vp8.o @@ -248,7 +248,7 @@ index 0000000000..d24252c5e5 + .caps_internal = HWACCEL_CAP_ASYNC_SAFE, +}; diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c -index 62b9f8bc2d..55966b9d56 100644 +index 3ddc349a4d..d4289320a9 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -175,6 +175,9 @@ static enum AVPixelFormat get_pixel_format(VP8Context *s) @@ -270,7 +270,7 @@ index 62b9f8bc2d..55966b9d56 100644 s->pix_fmt = get_pixel_format(s); if (s->pix_fmt < 0) return AVERROR(EINVAL); -@@ -2969,6 +2972,9 @@ AVCodec ff_vp8_decoder = { +@@ -2981,6 +2984,9 @@ AVCodec ff_vp8_decoder = { #endif #if CONFIG_VP8_NVDEC_HWACCEL HWACCEL_NVDEC(vp8), @@ -280,6 +280,3 @@ index 62b9f8bc2d..55966b9d56 100644 #endif NULL }, --- -2.24.0 - diff --git a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0007-Add-and-use-private-linux-headers-for-V4L2-request-A.patch b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0007-Add-and-use-private-linux-headers-for-V4L2-request-A.patch index c0eb659609..a5710e47ec 100644 --- a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0007-Add-and-use-private-linux-headers-for-V4L2-request-A.patch +++ b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0007-Add-and-use-private-linux-headers-for-V4L2-request-A.patch @@ -1,4 +1,4 @@ -From 23e7417b7ceb66f2ff4a98da5b1785d24994f865 Mon Sep 17 00:00:00 2001 +From e19fbf3c8c161a24e039b93dee2281d5b22e2ca8 Mon Sep 17 00:00:00 2001 From: Jernej Skrabec Date: Thu, 14 Feb 2019 23:20:05 +0100 Subject: [PATCH 07/12] Add and use private linux headers for V4L2 request API @@ -22,10 +22,10 @@ Signed-off-by: Jernej Skrabec create mode 100644 libavcodec/vp8-ctrls.h diff --git a/configure b/configure -index 46bcf32d3d..0c842b920f 100755 +index 6bdfe6fd95..e3a3d82395 100755 --- a/configure +++ b/configure -@@ -2804,7 +2804,7 @@ h264_dxva2_hwaccel_deps="dxva2" +@@ -2895,7 +2895,7 @@ h264_dxva2_hwaccel_deps="dxva2" h264_dxva2_hwaccel_select="h264_decoder" h264_nvdec_hwaccel_deps="nvdec" h264_nvdec_hwaccel_select="h264_decoder" @@ -34,7 +34,7 @@ index 46bcf32d3d..0c842b920f 100755 h264_v4l2request_hwaccel_select="h264_decoder" h264_vaapi_hwaccel_deps="vaapi" h264_vaapi_hwaccel_select="h264_decoder" -@@ -2820,7 +2820,7 @@ hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC" +@@ -2911,7 +2911,7 @@ hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC" hevc_dxva2_hwaccel_select="hevc_decoder" hevc_nvdec_hwaccel_deps="nvdec" hevc_nvdec_hwaccel_select="hevc_decoder" @@ -43,9 +43,9 @@ index 46bcf32d3d..0c842b920f 100755 hevc_v4l2request_hwaccel_select="hevc_decoder" hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC" hevc_vaapi_hwaccel_select="hevc_decoder" -@@ -2884,7 +2884,7 @@ vp8_nvdec_hwaccel_deps="nvdec" +@@ -2975,7 +2975,7 @@ vp8_nvdec_hwaccel_deps="nvdec" vp8_nvdec_hwaccel_select="vp8_decoder" - vp8_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferVP8" + vp8_vaapi_hwaccel_deps="vaapi" vp8_vaapi_hwaccel_select="vp8_decoder" -vp8_v4l2request_hwaccel_deps="v4l2_request vp8_v4l2_request" +vp8_v4l2request_hwaccel_deps="v4l2_request" @@ -757,6 +757,3 @@ index 0000000000..53cba826e4 +}; + +#endif --- -2.24.0 - diff --git a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0008-hwcontext_drm-do-not-require-drm-device.patch b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0008-hwcontext_drm-do-not-require-drm-device.patch index fa81658595..3bc62b6025 100644 --- a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0008-hwcontext_drm-do-not-require-drm-device.patch +++ b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0008-hwcontext_drm-do-not-require-drm-device.patch @@ -1,4 +1,4 @@ -From 6b20e11c96907fb474b1bf33615223bf79eba9c0 Mon Sep 17 00:00:00 2001 +From 60383b61fa64aa0e2806de0b8cf8a3f8d85c41e4 Mon Sep 17 00:00:00 2001 From: Jonas Karlman Date: Mon, 29 Apr 2019 22:08:59 +0000 Subject: [PATCH 08/12] hwcontext_drm: do not require drm device @@ -24,6 +24,3 @@ index 32cbde82eb..aa4794c5e6 100644 hwctx->fd = open(device, O_RDWR); if (hwctx->fd < 0) return AVERROR(errno); --- -2.24.0 - diff --git a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0009-avcodec-h264-parse-idr_pic_id.patch b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0009-avcodec-h264-parse-idr_pic_id.patch index e9c3524970..0f31d2c768 100644 --- a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0009-avcodec-h264-parse-idr_pic_id.patch +++ b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0009-avcodec-h264-parse-idr_pic_id.patch @@ -1,4 +1,4 @@ -From 4c1ce1fde5ca6d3e80bb0d5ab44f2e05f8372db0 Mon Sep 17 00:00:00 2001 +From 4e1a25f7cbbe9978548680171580afdfbf84d603 Mon Sep 17 00:00:00 2001 From: Ezequiel Garcia Date: Wed, 20 Feb 2019 11:18:00 -0300 Subject: [PATCH 09/12] avcodec/h264: parse idr_pic_id @@ -11,10 +11,10 @@ Signed-off-by: Ezequiel Garcia 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c -index f1e11003af..a795fcf66d 100644 +index 9912ede703..18ba196246 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c -@@ -1768,7 +1768,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, +@@ -1824,7 +1824,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, } if (nal->type == H264_NAL_IDR_SLICE) @@ -49,6 +49,3 @@ index ca306b6a3f..f21c8b3508 100644 .pic_order_cnt_lsb = sl->poc_lsb, .delta_pic_order_cnt_bottom = sl->delta_poc_bottom, .delta_pic_order_cnt0 = sl->delta_poc[0], --- -2.24.0 - diff --git a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0010-avcodec-h264-parse-ref_pic_marking_size_in_bits-and-.patch b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0010-avcodec-h264-parse-ref_pic_marking_size_in_bits-and-.patch index 43f72ea2d4..9bd9efacf7 100644 --- a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0010-avcodec-h264-parse-ref_pic_marking_size_in_bits-and-.patch +++ b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0010-avcodec-h264-parse-ref_pic_marking_size_in_bits-and-.patch @@ -1,4 +1,4 @@ -From 0a7b4a2cffae5d37b753b3e4cc8cadd7204ef5f5 Mon Sep 17 00:00:00 2001 +From 8309a49f4049b6ec8d4fd76a5dc18f8d23f8315c Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Wed, 22 May 2019 14:44:22 +0200 Subject: [PATCH 10/12] avcodec/h264: parse ref_pic_marking_size_in_bits and @@ -12,10 +12,10 @@ Signed-off-by: Boris Brezillon 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c -index a795fcf66d..9059e98a16 100644 +index 18ba196246..1bd3388f1e 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c -@@ -1680,7 +1680,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, +@@ -1736,7 +1736,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, unsigned int slice_type, tmp, i; int field_pic_flag, bottom_field_flag; int first_slice = sl == h->slice_ctx && !h->current_slice; @@ -24,7 +24,7 @@ index a795fcf66d..9059e98a16 100644 if (first_slice) av_assert0(!h->setup_finished); -@@ -1770,6 +1770,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, +@@ -1826,6 +1826,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, if (nal->type == H264_NAL_IDR_SLICE) sl->idr_pic_id = get_ue_golomb_long(&sl->gb); @@ -32,7 +32,7 @@ index a795fcf66d..9059e98a16 100644 if (sps->poc_type == 0) { sl->poc_lsb = get_bits(&sl->gb, sps->log2_max_poc_lsb); -@@ -1783,6 +1784,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, +@@ -1839,6 +1840,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, if (pps->pic_order_present == 1 && picture_structure == PICT_FRAME) sl->delta_poc[1] = get_se_golomb(&sl->gb); } @@ -40,7 +40,7 @@ index a795fcf66d..9059e98a16 100644 sl->redundant_pic_count = 0; if (pps->redundant_pic_cnt_present) -@@ -1822,9 +1824,11 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, +@@ -1878,9 +1880,11 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, sl->explicit_ref_marking = 0; if (nal->ref_idc) { @@ -86,6 +86,3 @@ index f21c8b3508..1a7fb873a0 100644 .cabac_init_idc = sl->cabac_init_idc, .slice_qp_delta = sl->qscale - pps->init_qp, --- -2.24.0 - diff --git a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0011-HACK-add-dpb-flags-for-reference-usage-and-field-pic.patch b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0011-HACK-add-dpb-flags-for-reference-usage-and-field-pic.patch index 7c1ae0bc8a..f139080389 100644 --- a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0011-HACK-add-dpb-flags-for-reference-usage-and-field-pic.patch +++ b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0011-HACK-add-dpb-flags-for-reference-usage-and-field-pic.patch @@ -1,4 +1,4 @@ -From 1a2197eea4da8f118726963e0c74647532029306 Mon Sep 17 00:00:00 2001 +From ace9eff28953b97fc1832913d4655c0f4227ea16 Mon Sep 17 00:00:00 2001 From: Jonas Karlman Date: Fri, 24 May 2019 22:58:24 +0000 Subject: [PATCH 11/12] HACK: add dpb flags for reference usage and field @@ -55,6 +55,3 @@ index 1a7fb873a0..13fac3f6f9 100644 } return 0; --- -2.24.0 - diff --git a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0012-WIP-v4l2-request-rolling-timestamps.patch b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0012-WIP-v4l2-request-rolling-timestamps.patch index de901b0665..1374b2fc68 100644 --- a/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0012-WIP-v4l2-request-rolling-timestamps.patch +++ b/packages/multimedia/ffmpeg/patches/v4l2-request-api/ffmpeg-95.0012-WIP-v4l2-request-rolling-timestamps.patch @@ -1,4 +1,4 @@ -From a205c82e430dafd90485b804ce40c1b42cbf9edf Mon Sep 17 00:00:00 2001 +From fa3f88530ec9083ff15d9637a9019a8a9408435b Mon Sep 17 00:00:00 2001 From: Jernej Skrabec Date: Sat, 9 Nov 2019 10:02:43 +0000 Subject: [PATCH 12/12] WIP: v4l2-request: rolling timestamps @@ -67,6 +67,3 @@ index d4146bd4ee..72698f6f3c 100644 } V4L2RequestContext; typedef struct V4L2RequestBuffer { --- -2.24.0 - diff --git a/packages/multimedia/ffmpeg/patches/v4l2/0001-libavcodec-v4l2m2m-fix-indentation-and-add-M2MDEC_CL.patch b/packages/multimedia/ffmpeg/patches/v4l2/0001-libavcodec-v4l2m2m-fix-indentation-and-add-M2MDEC_CL.patch new file mode 100644 index 0000000000..4ef44cdcac --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/v4l2/0001-libavcodec-v4l2m2m-fix-indentation-and-add-M2MDEC_CL.patch @@ -0,0 +1,73 @@ +From 7134be3260ca6b885aa20447a06d35cab380a09e Mon Sep 17 00:00:00 2001 +From: Lukas Rusak +Date: Tue, 24 Apr 2018 22:48:23 -0700 +Subject: [PATCH 01/14] libavcodec: v4l2m2m: fix indentation and add + M2MDEC_CLASS + +This just makes the M2MDEC_CLASS similar to how it is done in rkmpp. It looks +clean and has proper indentation +--- + libavcodec/v4l2_m2m_dec.c | 46 ++++++++++++++++++++------------------- + 1 file changed, 24 insertions(+), 22 deletions(-) + +diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c +index d0601f0e2f..e1b6925771 100644 +--- a/libavcodec/v4l2_m2m_dec.c ++++ b/libavcodec/v4l2_m2m_dec.c +@@ -209,29 +209,31 @@ static const AVOption options[] = { + { NULL}, + }; + ++#define M2MDEC_CLASS(NAME) \ ++ static const AVClass v4l2_m2m_ ## NAME ## _dec_class = { \ ++ .class_name = #NAME "_v4l2_m2m_decoder", \ ++ .item_name = av_default_item_name, \ ++ .option = options, \ ++ .version = LIBAVUTIL_VERSION_INT, \ ++ }; ++ + #define M2MDEC(NAME, LONGNAME, CODEC, bsf_name) \ +-static const AVClass v4l2_m2m_ ## NAME ## _dec_class = {\ +- .class_name = #NAME "_v4l2_m2m_decoder",\ +- .item_name = av_default_item_name,\ +- .option = options,\ +- .version = LIBAVUTIL_VERSION_INT,\ +-};\ +-\ +-AVCodec ff_ ## NAME ## _v4l2m2m_decoder = { \ +- .name = #NAME "_v4l2m2m" ,\ +- .long_name = NULL_IF_CONFIG_SMALL("V4L2 mem2mem " LONGNAME " decoder wrapper"),\ +- .type = AVMEDIA_TYPE_VIDEO,\ +- .id = CODEC ,\ +- .priv_data_size = sizeof(V4L2m2mPriv),\ +- .priv_class = &v4l2_m2m_ ## NAME ## _dec_class,\ +- .init = v4l2_decode_init,\ +- .receive_frame = v4l2_receive_frame,\ +- .close = ff_v4l2_m2m_codec_end,\ +- .bsfs = bsf_name, \ +- .capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY | \ +- AV_CODEC_CAP_AVOID_PROBING, \ +- .wrapper_name = "v4l2m2m", \ +-}; ++ M2MDEC_CLASS(NAME) \ ++ AVCodec ff_ ## NAME ## _v4l2m2m_decoder = { \ ++ .name = #NAME "_v4l2m2m" , \ ++ .long_name = NULL_IF_CONFIG_SMALL("V4L2 mem2mem " LONGNAME " decoder wrapper"), \ ++ .type = AVMEDIA_TYPE_VIDEO, \ ++ .id = CODEC , \ ++ .priv_data_size = sizeof(V4L2m2mPriv), \ ++ .priv_class = &v4l2_m2m_ ## NAME ## _dec_class, \ ++ .init = v4l2_decode_init, \ ++ .receive_frame = v4l2_receive_frame, \ ++ .close = ff_v4l2_m2m_codec_end, \ ++ .bsfs = bsf_name, \ ++ .capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY, \ ++ AV_CODEC_CAP_AVOID_PROBING, \ ++ .wrapper_name = "v4l2m2m", \ ++ }; + + M2MDEC(h264, "H.264", AV_CODEC_ID_H264, "h264_mp4toannexb"); + M2MDEC(hevc, "HEVC", AV_CODEC_ID_HEVC, "hevc_mp4toannexb"); +-- +2.24.1 + diff --git a/packages/multimedia/ffmpeg/patches/v4l2/ffmpeg-999-lrusak-v4l2.patch b/packages/multimedia/ffmpeg/patches/v4l2/0002-libavcodec-v4l2m2m-output-AVDRMFrameDescriptor.patch similarity index 56% rename from packages/multimedia/ffmpeg/patches/v4l2/ffmpeg-999-lrusak-v4l2.patch rename to packages/multimedia/ffmpeg/patches/v4l2/0002-libavcodec-v4l2m2m-output-AVDRMFrameDescriptor.patch index d95eebfc12..01aa1da7e8 100644 --- a/packages/multimedia/ffmpeg/patches/v4l2/ffmpeg-999-lrusak-v4l2.patch +++ b/packages/multimedia/ffmpeg/patches/v4l2/0002-libavcodec-v4l2m2m-output-AVDRMFrameDescriptor.patch @@ -1,74 +1,32 @@ -From 5c80d25f8f3821118fd4050321ac89e23bbedc8e Mon Sep 17 00:00:00 2001 -From: Lukas Rusak -Date: Tue, 24 Apr 2018 22:48:23 -0700 -Subject: [PATCH 1/6] libavcodec: v4l2m2m: fix indentation and add M2MDEC_CLASS - ---- - libavcodec/v4l2_m2m_dec.c | 44 ++++++++++++++++++++------------------- - 1 file changed, 23 insertions(+), 21 deletions(-) - -diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c -index bca45be1484..ed5193ecc17 100644 ---- a/libavcodec/v4l2_m2m_dec.c -+++ b/libavcodec/v4l2_m2m_dec.c -@@ -202,28 +202,30 @@ static const AVOption options[] = { - { NULL}, - }; - -+#define M2MDEC_CLASS(NAME) \ -+ static const AVClass v4l2_m2m_ ## NAME ## _dec_class = { \ -+ .class_name = #NAME "_v4l2_m2m_decoder", \ -+ .item_name = av_default_item_name, \ -+ .option = options, \ -+ .version = LIBAVUTIL_VERSION_INT, \ -+ }; -+ - #define M2MDEC(NAME, LONGNAME, CODEC, bsf_name) \ --static const AVClass v4l2_m2m_ ## NAME ## _dec_class = {\ -- .class_name = #NAME "_v4l2_m2m_decoder",\ -- .item_name = av_default_item_name,\ -- .option = options,\ -- .version = LIBAVUTIL_VERSION_INT,\ --};\ --\ --AVCodec ff_ ## NAME ## _v4l2m2m_decoder = { \ -- .name = #NAME "_v4l2m2m" ,\ -- .long_name = NULL_IF_CONFIG_SMALL("V4L2 mem2mem " LONGNAME " decoder wrapper"),\ -- .type = AVMEDIA_TYPE_VIDEO,\ -- .id = CODEC ,\ -- .priv_data_size = sizeof(V4L2m2mPriv),\ -- .priv_class = &v4l2_m2m_ ## NAME ## _dec_class,\ -- .init = v4l2_decode_init,\ -- .receive_frame = v4l2_receive_frame,\ -- .close = ff_v4l2_m2m_codec_end,\ -- .bsfs = bsf_name, \ -- .capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY, \ -- .wrapper_name = "v4l2m2m", \ --}; -+ M2MDEC_CLASS(NAME) \ -+ AVCodec ff_ ## NAME ## _v4l2m2m_decoder = { \ -+ .name = #NAME "_v4l2m2m" , \ -+ .long_name = NULL_IF_CONFIG_SMALL("V4L2 mem2mem " LONGNAME " decoder wrapper"), \ -+ .type = AVMEDIA_TYPE_VIDEO, \ -+ .id = CODEC , \ -+ .priv_data_size = sizeof(V4L2m2mPriv), \ -+ .priv_class = &v4l2_m2m_ ## NAME ## _dec_class, \ -+ .init = v4l2_decode_init, \ -+ .receive_frame = v4l2_receive_frame, \ -+ .close = ff_v4l2_m2m_codec_end, \ -+ .bsfs = bsf_name, \ -+ .capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY, \ -+ .wrapper_name = "v4l2m2m", \ -+ }; - - M2MDEC(h264, "H.264", AV_CODEC_ID_H264, "h264_mp4toannexb"); - M2MDEC(hevc, "HEVC", AV_CODEC_ID_HEVC, "hevc_mp4toannexb"); - -From ba04ebfb7ec5df1dff44b7cd6c0daac9146dcf3a Mon Sep 17 00:00:00 2001 +From bf9fb2d576488ba08832e7cb7b10fe05a08665a5 Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Tue, 24 Apr 2018 23:00:23 -0700 -Subject: [PATCH 2/6] libavcodec: v4l2m2m: output AVDRMFrameDescriptor +Subject: [PATCH 02/14] libavcodec: v4l2m2m: output AVDRMFrameDescriptor +This allows for a zero-copy output by exporting the v4l2 buffer then wrapping that buffer +in the AVDRMFrameDescriptor like it is done in rkmpp. + +This has been in use for quite some time with great success on many platforms including: + - Amlogic S905 + - Raspberry Pi + - i.MX6 + - Dragonboard 410c + +This was developed in conjunction with Kodi to allow handling the zero-copy buffer rendering. +A simply utility for testing is also available here: https://github.com/BayLibre/ffmpeg-drm + +todo: + - allow selecting pixel format output from decoder + - allow configuring amount of output and capture buffers + +V2: + - allow selecting AV_PIX_FMT_DRM_PRIME + +V3: + - use get_format to select AV_PIX_FMT_DRM_PRIME + - use hw_configs + - add handling of AV_PIX_FMT_YUV420P format (for raspberry pi) + - add handling of AV_PIX_FMT_YUYV422 format (for i.MX6 coda decoder) --- libavcodec/v4l2_buffers.c | 216 ++++++++++++++++++++++++++++++++------ libavcodec/v4l2_buffers.h | 4 + @@ -79,7 +37,7 @@ Subject: [PATCH 2/6] libavcodec: v4l2m2m: output AVDRMFrameDescriptor 6 files changed, 253 insertions(+), 37 deletions(-) diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c -index aef911f3bbc..e5c46ac81e6 100644 +index aef911f3bb..e5c46ac81e 100644 --- a/libavcodec/v4l2_buffers.c +++ b/libavcodec/v4l2_buffers.c @@ -21,6 +21,7 @@ @@ -373,7 +331,7 @@ index aef911f3bbc..e5c46ac81e6 100644 } diff --git a/libavcodec/v4l2_buffers.h b/libavcodec/v4l2_buffers.h -index dc5cc9e2671..a8a50ecc65f 100644 +index 7a57caf949..19324541d0 100644 --- a/libavcodec/v4l2_buffers.h +++ b/libavcodec/v4l2_buffers.h @@ -27,6 +27,7 @@ @@ -395,7 +353,7 @@ index dc5cc9e2671..a8a50ecc65f 100644 * of how many context-refs we are holding. */ AVBufferRef *context_ref; diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c -index efcb0426e49..9457fadb1e9 100644 +index efcb0426e4..9457fadb1e 100644 --- a/libavcodec/v4l2_context.c +++ b/libavcodec/v4l2_context.c @@ -393,22 +393,54 @@ static int v4l2_release_buffers(V4L2Context* ctx) @@ -458,7 +416,7 @@ index efcb0426e49..9457fadb1e9 100644 static inline int v4l2_try_raw_format(V4L2Context* ctx, enum AVPixelFormat pixfmt) diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c -index 427e165f586..7896326e808 100644 +index 427e165f58..7896326e80 100644 --- a/libavcodec/v4l2_m2m.c +++ b/libavcodec/v4l2_m2m.c @@ -159,7 +159,9 @@ static int v4l2_configure_contexts(V4L2m2mContext* s) @@ -473,7 +431,7 @@ index 427e165f586..7896326e808 100644 ret = ff_v4l2_context_init(&s->capture); if (ret) { diff --git a/libavcodec/v4l2_m2m.h b/libavcodec/v4l2_m2m.h -index 452bf0d9bc2..9ac5a2448da 100644 +index 0d4671beb1..043a81a86a 100644 --- a/libavcodec/v4l2_m2m.h +++ b/libavcodec/v4l2_m2m.h @@ -59,6 +59,9 @@ typedef struct V4L2m2mContext { @@ -487,7 +445,7 @@ index 452bf0d9bc2..9ac5a2448da 100644 typedef struct V4L2m2mPriv diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c -index ed5193ecc17..7f41e3b2121 100644 +index e1b6925771..b28f4e236a 100644 --- a/libavcodec/v4l2_m2m_dec.c +++ b/libavcodec/v4l2_m2m_dec.c @@ -23,12 +23,18 @@ @@ -509,7 +467,7 @@ index ed5193ecc17..7f41e3b2121 100644 #include "v4l2_context.h" #include "v4l2_m2m.h" #include "v4l2_fmt.h" -@@ -183,6 +189,15 @@ static av_cold int v4l2_decode_init(AVCodecContext *avctx) +@@ -186,6 +192,15 @@ static av_cold int v4l2_decode_init(AVCodecContext *avctx) capture->av_codec_id = AV_CODEC_ID_RAWVIDEO; capture->av_pix_fmt = avctx->pix_fmt; @@ -524,8 +482,8 @@ index ed5193ecc17..7f41e3b2121 100644 + ret = ff_v4l2_m2m_codec_init(avctx); if (ret) { - av_log(avctx, AV_LOG_ERROR, "can't configure decoder\n"); -@@ -202,6 +217,11 @@ static const AVOption options[] = { + V4L2m2mPriv *priv = avctx->priv_data; +@@ -209,6 +224,11 @@ static const AVOption options[] = { { NULL}, }; @@ -537,7 +495,7 @@ index ed5193ecc17..7f41e3b2121 100644 #define M2MDEC_CLASS(NAME) \ static const AVClass v4l2_m2m_ ## NAME ## _dec_class = { \ .class_name = #NAME "_v4l2_m2m_decoder", \ -@@ -222,7 +242,10 @@ static const AVOption options[] = { +@@ -229,7 +249,10 @@ static const AVOption options[] = { .init = v4l2_decode_init, \ .receive_frame = v4l2_receive_frame, \ .close = ff_v4l2_m2m_codec_end, \ @@ -546,223 +504,8 @@ index ed5193ecc17..7f41e3b2121 100644 .bsfs = bsf_name, \ + .hw_configs = v4l2_m2m_hw_configs, \ .capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY, \ + AV_CODEC_CAP_AVOID_PROBING, \ .wrapper_name = "v4l2m2m", \ - }; +-- +2.24.1 -From 56b801661f935994d971c6b4aaf0d0ed3c4ca83f Mon Sep 17 00:00:00 2001 -From: Lukas Rusak -Date: Tue, 8 May 2018 22:40:23 -0700 -Subject: [PATCH 3/6] libavcodec: v4l2m2m: adjust formatting - ---- - libavcodec/v4l2_buffers.c | 23 +++++++++++++++-------- - libavcodec/v4l2_buffers.h | 1 - - 2 files changed, 15 insertions(+), 9 deletions(-) - -diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c -index e5c46ac81e6..897c3c46369 100644 ---- a/libavcodec/v4l2_buffers.c -+++ b/libavcodec/v4l2_buffers.c -@@ -401,7 +401,8 @@ static int v4l2_bufref_to_buf(V4L2Buffer *out, int plane, const uint8_t* data, i - bytesused = FFMIN(size, out->plane_info[plane].length); - length = out->plane_info[plane].length; - -- memcpy(out->plane_info[plane].mm_addr, data, FFMIN(size, out->plane_info[plane].length)); -+ memcpy(out->plane_info[plane].mm_addr, data, -+ FFMIN(size, out->plane_info[plane].length)); - - if (V4L2_TYPE_IS_MULTIPLANAR(out->buf.type)) { - out->planes[plane].bytesused = bytesused; -@@ -425,7 +426,10 @@ int ff_v4l2_buffer_avframe_to_buf(const AVFrame *frame, V4L2Buffer* out) - int i, ret; - - for(i = 0; i < out->num_planes; i++) { -- ret = v4l2_bufref_to_buf(out, i, frame->buf[i]->data, frame->buf[i]->size, frame->buf[i]); -+ ret = v4l2_bufref_to_buf(out, i, -+ frame->buf[i]->data, -+ frame->buf[i]->size, -+ frame->buf[i]); - if (ret) - return ret; - } -@@ -480,8 +484,8 @@ int ff_v4l2_buffer_buf_to_avframe(AVFrame *frame, V4L2Buffer *avbuf) - /* 2. get frame information */ - frame->key_frame = !!(avbuf->buf.flags & V4L2_BUF_FLAG_KEYFRAME); - frame->color_primaries = v4l2_get_color_primaries(avbuf); -- frame->colorspace = v4l2_get_color_space(avbuf); - frame->color_range = v4l2_get_color_range(avbuf); -+ frame->colorspace = v4l2_get_color_space(avbuf); - frame->color_trc = v4l2_get_color_trc(avbuf); - frame->pts = v4l2_get_pts(avbuf); - -@@ -507,7 +511,8 @@ int ff_v4l2_buffer_buf_to_avpkt(AVPacket *pkt, V4L2Buffer *avbuf) - if (ret) - return ret; - -- pkt->size = V4L2_TYPE_IS_MULTIPLANAR(avbuf->buf.type) ? avbuf->buf.m.planes[0].bytesused : avbuf->buf.bytesused; -+ pkt->size = V4L2_TYPE_IS_MULTIPLANAR(avbuf->buf.type) ? -+ avbuf->buf.m.planes[0].bytesused : avbuf->buf.bytesused; - pkt->data = pkt->buf->data; - - if (avbuf->buf.flags & V4L2_BUF_FLAG_KEYFRAME) -@@ -563,6 +568,7 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index) - /* in MP, the V4L2 API states that buf.length means num_planes */ - if (avbuf->num_planes >= avbuf->buf.length) - break; -+ - if (avbuf->buf.m.planes[avbuf->num_planes].length) - avbuf->num_planes++; - } -@@ -579,12 +585,14 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index) - avbuf->plane_info[i].length = avbuf->buf.m.planes[i].length; - avbuf->plane_info[i].mm_addr = mmap(NULL, avbuf->buf.m.planes[i].length, - PROT_READ | PROT_WRITE, MAP_SHARED, -- buf_to_m2mctx(avbuf)->fd, avbuf->buf.m.planes[i].m.mem_offset); -+ buf_to_m2mctx(avbuf)->fd, -+ avbuf->buf.m.planes[i].m.mem_offset); - } else { - avbuf->plane_info[i].length = avbuf->buf.length; - avbuf->plane_info[i].mm_addr = mmap(NULL, avbuf->buf.length, - PROT_READ | PROT_WRITE, MAP_SHARED, -- buf_to_m2mctx(avbuf)->fd, avbuf->buf.m.offset); -+ buf_to_m2mctx(avbuf)->fd, -+ avbuf->buf.m.offset); - } - - if (avbuf->plane_info[i].mm_addr == MAP_FAILED) -@@ -594,9 +602,8 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index) - avbuf->status = V4L2BUF_AVAILABLE; - - if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) { -- avbuf->buf.m.planes = avbuf->planes; - avbuf->buf.length = avbuf->num_planes; -- -+ avbuf->buf.m.planes = avbuf->planes; - } else { - avbuf->buf.bytesused = avbuf->planes[0].bytesused; - avbuf->buf.length = avbuf->planes[0].length; -diff --git a/libavcodec/v4l2_buffers.h b/libavcodec/v4l2_buffers.h -index a8a50ecc65f..c609a6c6767 100644 ---- a/libavcodec/v4l2_buffers.h -+++ b/libavcodec/v4l2_buffers.h -@@ -131,5 +131,4 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index); - */ - int ff_v4l2_buffer_enqueue(V4L2Buffer* avbuf); - -- - #endif // AVCODEC_V4L2_BUFFERS_H - -From 992ecd533321b876438fe3c4b7630003f260974e Mon Sep 17 00:00:00 2001 -From: Jorge Ramirez-Ortiz -Date: Sun, 6 May 2018 19:56:30 +0200 -Subject: [PATCH 4/6] libavcodec: v4l2m2m: fix error handling during buffer - init - -Signed-off-by: Jorge Ramirez-Ortiz ---- - libavcodec/v4l2_context.c | 19 ++++++++++++++++--- - libavcodec/v4l2_m2m_dec.c | 11 ++++++++--- - 2 files changed, 24 insertions(+), 6 deletions(-) - -diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c -index 9457fadb1e9..fd3161ce2f5 100644 ---- a/libavcodec/v4l2_context.c -+++ b/libavcodec/v4l2_context.c -@@ -263,6 +263,12 @@ static V4L2Buffer* v4l2_dequeue_v4l2buf(V4L2Context *ctx, int timeout) - /* if we are draining and there are no more capture buffers queued in the driver we are done */ - if (!V4L2_TYPE_IS_OUTPUT(ctx->type) && ctx_to_m2mctx(ctx)->draining) { - for (i = 0; i < ctx->num_buffers; i++) { -+ /* catpture buffer initialization happens during decode hence -+ * detection happens at runtime -+ */ -+ if (!ctx->buffers) -+ break; -+ - if (ctx->buffers[i].status == V4L2BUF_IN_DRIVER) - goto start; - } -@@ -724,9 +730,8 @@ int ff_v4l2_context_init(V4L2Context* ctx) - ctx->buffers[i].context = ctx; - ret = ff_v4l2_buffer_initialize(&ctx->buffers[i], i); - if (ret < 0) { -- av_log(logger(ctx), AV_LOG_ERROR, "%s buffer initialization (%s)\n", ctx->name, av_err2str(ret)); -- av_free(ctx->buffers); -- return ret; -+ av_log(logger(ctx), AV_LOG_ERROR, "%s buffer[%d] initialization (%s)\n", ctx->name, i, av_err2str(ret)); -+ goto error; - } - } - -@@ -739,4 +744,12 @@ int ff_v4l2_context_init(V4L2Context* ctx) - V4L2_TYPE_IS_MULTIPLANAR(ctx->type) ? ctx->format.fmt.pix_mp.plane_fmt[0].bytesperline : ctx->format.fmt.pix.bytesperline); - - return 0; -+ -+error: -+ v4l2_release_buffers(ctx); -+ -+ av_free(ctx->buffers); -+ ctx->buffers = NULL; -+ -+ return ret; - } -diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c -index 7f41e3b2121..d524fd29a6a 100644 ---- a/libavcodec/v4l2_m2m_dec.c -+++ b/libavcodec/v4l2_m2m_dec.c -@@ -92,8 +92,8 @@ static int v4l2_try_start(AVCodecContext *avctx) - if (!capture->buffers) { - ret = ff_v4l2_context_init(capture); - if (ret) { -- av_log(avctx, AV_LOG_DEBUG, "can't request output buffers\n"); -- return ret; -+ av_log(avctx, AV_LOG_ERROR, "can't request capture buffers\n"); -+ return AVERROR(ENOMEM); - } - } - -@@ -155,8 +155,13 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) - - if (avpkt.size) { - ret = v4l2_try_start(avctx); -- if (ret) -+ if (ret) { -+ /* cant recover */ -+ if (ret == AVERROR(ENOMEM)) -+ return ret; -+ - return 0; -+ } - } - - dequeue: - -From 98f828fcb15f2bcec11a6b8f56ae808c4c1220c2 Mon Sep 17 00:00:00 2001 -From: Lukas Rusak -Date: Sun, 17 Jun 2018 22:56:37 -0700 -Subject: [PATCH 6/6] libavcodec: v4l2m2m: make sure to unref avpkt - ---- - libavcodec/v4l2_m2m_dec.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c -index 6dd0de7ffcf..6fdbf8f16e4 100644 ---- a/libavcodec/v4l2_m2m_dec.c -+++ b/libavcodec/v4l2_m2m_dec.c -@@ -156,6 +156,7 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) - if (avpkt.size) { - ret = v4l2_try_start(avctx); - if (ret) { -+ av_packet_unref(&avpkt); - /* cant recover */ - if (ret == AVERROR(ENOMEM)) - return ret; -@@ -165,6 +166,7 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) - } - - dequeue: -+ av_packet_unref(&avpkt); - return ff_v4l2_context_dequeue_frame(capture, frame); - } - diff --git a/packages/multimedia/ffmpeg/patches/v4l2/0003-libavcodec-v4l2m2m-adjust-formatting.patch b/packages/multimedia/ffmpeg/patches/v4l2/0003-libavcodec-v4l2m2m-adjust-formatting.patch new file mode 100644 index 0000000000..a40bb79848 --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/v4l2/0003-libavcodec-v4l2m2m-adjust-formatting.patch @@ -0,0 +1,106 @@ +From ebcfd47d8411fcc91d8058643b151068b5a7fedc Mon Sep 17 00:00:00 2001 +From: Lukas Rusak +Date: Tue, 8 May 2018 22:40:23 -0700 +Subject: [PATCH 03/14] libavcodec: v4l2m2m: adjust formatting + +just some simple formatting fixes that unify the code quality +--- + libavcodec/v4l2_buffers.c | 23 +++++++++++++++-------- + libavcodec/v4l2_buffers.h | 1 - + 2 files changed, 15 insertions(+), 9 deletions(-) + +diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c +index e5c46ac81e..897c3c4636 100644 +--- a/libavcodec/v4l2_buffers.c ++++ b/libavcodec/v4l2_buffers.c +@@ -401,7 +401,8 @@ static int v4l2_bufref_to_buf(V4L2Buffer *out, int plane, const uint8_t* data, i + bytesused = FFMIN(size, out->plane_info[plane].length); + length = out->plane_info[plane].length; + +- memcpy(out->plane_info[plane].mm_addr, data, FFMIN(size, out->plane_info[plane].length)); ++ memcpy(out->plane_info[plane].mm_addr, data, ++ FFMIN(size, out->plane_info[plane].length)); + + if (V4L2_TYPE_IS_MULTIPLANAR(out->buf.type)) { + out->planes[plane].bytesused = bytesused; +@@ -425,7 +426,10 @@ int ff_v4l2_buffer_avframe_to_buf(const AVFrame *frame, V4L2Buffer* out) + int i, ret; + + for(i = 0; i < out->num_planes; i++) { +- ret = v4l2_bufref_to_buf(out, i, frame->buf[i]->data, frame->buf[i]->size, frame->buf[i]); ++ ret = v4l2_bufref_to_buf(out, i, ++ frame->buf[i]->data, ++ frame->buf[i]->size, ++ frame->buf[i]); + if (ret) + return ret; + } +@@ -480,8 +484,8 @@ int ff_v4l2_buffer_buf_to_avframe(AVFrame *frame, V4L2Buffer *avbuf) + /* 2. get frame information */ + frame->key_frame = !!(avbuf->buf.flags & V4L2_BUF_FLAG_KEYFRAME); + frame->color_primaries = v4l2_get_color_primaries(avbuf); +- frame->colorspace = v4l2_get_color_space(avbuf); + frame->color_range = v4l2_get_color_range(avbuf); ++ frame->colorspace = v4l2_get_color_space(avbuf); + frame->color_trc = v4l2_get_color_trc(avbuf); + frame->pts = v4l2_get_pts(avbuf); + +@@ -507,7 +511,8 @@ int ff_v4l2_buffer_buf_to_avpkt(AVPacket *pkt, V4L2Buffer *avbuf) + if (ret) + return ret; + +- pkt->size = V4L2_TYPE_IS_MULTIPLANAR(avbuf->buf.type) ? avbuf->buf.m.planes[0].bytesused : avbuf->buf.bytesused; ++ pkt->size = V4L2_TYPE_IS_MULTIPLANAR(avbuf->buf.type) ? ++ avbuf->buf.m.planes[0].bytesused : avbuf->buf.bytesused; + pkt->data = pkt->buf->data; + + if (avbuf->buf.flags & V4L2_BUF_FLAG_KEYFRAME) +@@ -563,6 +568,7 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index) + /* in MP, the V4L2 API states that buf.length means num_planes */ + if (avbuf->num_planes >= avbuf->buf.length) + break; ++ + if (avbuf->buf.m.planes[avbuf->num_planes].length) + avbuf->num_planes++; + } +@@ -579,12 +585,14 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index) + avbuf->plane_info[i].length = avbuf->buf.m.planes[i].length; + avbuf->plane_info[i].mm_addr = mmap(NULL, avbuf->buf.m.planes[i].length, + PROT_READ | PROT_WRITE, MAP_SHARED, +- buf_to_m2mctx(avbuf)->fd, avbuf->buf.m.planes[i].m.mem_offset); ++ buf_to_m2mctx(avbuf)->fd, ++ avbuf->buf.m.planes[i].m.mem_offset); + } else { + avbuf->plane_info[i].length = avbuf->buf.length; + avbuf->plane_info[i].mm_addr = mmap(NULL, avbuf->buf.length, + PROT_READ | PROT_WRITE, MAP_SHARED, +- buf_to_m2mctx(avbuf)->fd, avbuf->buf.m.offset); ++ buf_to_m2mctx(avbuf)->fd, ++ avbuf->buf.m.offset); + } + + if (avbuf->plane_info[i].mm_addr == MAP_FAILED) +@@ -594,9 +602,8 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index) + avbuf->status = V4L2BUF_AVAILABLE; + + if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) { +- avbuf->buf.m.planes = avbuf->planes; + avbuf->buf.length = avbuf->num_planes; +- ++ avbuf->buf.m.planes = avbuf->planes; + } else { + avbuf->buf.bytesused = avbuf->planes[0].bytesused; + avbuf->buf.length = avbuf->planes[0].length; +diff --git a/libavcodec/v4l2_buffers.h b/libavcodec/v4l2_buffers.h +index 19324541d0..b6072baec8 100644 +--- a/libavcodec/v4l2_buffers.h ++++ b/libavcodec/v4l2_buffers.h +@@ -131,5 +131,4 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index); + */ + int ff_v4l2_buffer_enqueue(V4L2Buffer* avbuf); + +- + #endif // AVCODEC_V4L2_BUFFERS_H +-- +2.24.1 + diff --git a/packages/multimedia/ffmpeg/patches/v4l2/0004-libavcodec-v4l2m2m-fix-error-handling-during-buffer-.patch b/packages/multimedia/ffmpeg/patches/v4l2/0004-libavcodec-v4l2m2m-fix-error-handling-during-buffer-.patch new file mode 100644 index 0000000000..3ed7a62fad --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/v4l2/0004-libavcodec-v4l2m2m-fix-error-handling-during-buffer-.patch @@ -0,0 +1,84 @@ +From db39d4579d36266a3f3b87312303d5097543633d Mon Sep 17 00:00:00 2001 +From: Jorge Ramirez-Ortiz +Date: Sun, 6 May 2018 19:56:30 +0200 +Subject: [PATCH 04/14] libavcodec: v4l2m2m: fix error handling during buffer + init + +Signed-off-by: Jorge Ramirez-Ortiz +--- + libavcodec/v4l2_context.c | 19 ++++++++++++++++--- + libavcodec/v4l2_m2m_dec.c | 9 +++++++-- + 2 files changed, 23 insertions(+), 5 deletions(-) + +diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c +index 9457fadb1e..12d40d597e 100644 +--- a/libavcodec/v4l2_context.c ++++ b/libavcodec/v4l2_context.c +@@ -263,6 +263,12 @@ static V4L2Buffer* v4l2_dequeue_v4l2buf(V4L2Context *ctx, int timeout) + /* if we are draining and there are no more capture buffers queued in the driver we are done */ + if (!V4L2_TYPE_IS_OUTPUT(ctx->type) && ctx_to_m2mctx(ctx)->draining) { + for (i = 0; i < ctx->num_buffers; i++) { ++ /* capture buffer initialization happens during decode hence ++ * detection happens at runtime ++ */ ++ if (!ctx->buffers) ++ break; ++ + if (ctx->buffers[i].status == V4L2BUF_IN_DRIVER) + goto start; + } +@@ -724,9 +730,8 @@ int ff_v4l2_context_init(V4L2Context* ctx) + ctx->buffers[i].context = ctx; + ret = ff_v4l2_buffer_initialize(&ctx->buffers[i], i); + if (ret < 0) { +- av_log(logger(ctx), AV_LOG_ERROR, "%s buffer initialization (%s)\n", ctx->name, av_err2str(ret)); +- av_free(ctx->buffers); +- return ret; ++ av_log(logger(ctx), AV_LOG_ERROR, "%s buffer[%d] initialization (%s)\n", ctx->name, i, av_err2str(ret)); ++ goto error; + } + } + +@@ -739,4 +744,12 @@ int ff_v4l2_context_init(V4L2Context* ctx) + V4L2_TYPE_IS_MULTIPLANAR(ctx->type) ? ctx->format.fmt.pix_mp.plane_fmt[0].bytesperline : ctx->format.fmt.pix.bytesperline); + + return 0; ++ ++error: ++ v4l2_release_buffers(ctx); ++ ++ av_free(ctx->buffers); ++ ctx->buffers = NULL; ++ ++ return ret; + } +diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c +index b28f4e236a..fb5406a74e 100644 +--- a/libavcodec/v4l2_m2m_dec.c ++++ b/libavcodec/v4l2_m2m_dec.c +@@ -92,8 +92,8 @@ static int v4l2_try_start(AVCodecContext *avctx) + if (!capture->buffers) { + ret = ff_v4l2_context_init(capture); + if (ret) { +- av_log(avctx, AV_LOG_DEBUG, "can't request output buffers\n"); +- return ret; ++ av_log(avctx, AV_LOG_ERROR, "can't request capture buffers\n"); ++ return AVERROR(ENOMEM); + } + } + +@@ -157,6 +157,11 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) + ret = v4l2_try_start(avctx); + if (ret) { + av_packet_unref(&avpkt); ++ ++ /* cant recover */ ++ if (ret == AVERROR(ENOMEM)) ++ return ret; ++ + return 0; + } + } +-- +2.24.1 + diff --git a/packages/multimedia/ffmpeg/patches/v4l2/0005-libavcodec-v4l2m2m-depends-on-libdrm.patch b/packages/multimedia/ffmpeg/patches/v4l2/0005-libavcodec-v4l2m2m-depends-on-libdrm.patch new file mode 100644 index 0000000000..365d1f51e4 --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/v4l2/0005-libavcodec-v4l2m2m-depends-on-libdrm.patch @@ -0,0 +1,38 @@ +From 86a709f752d430166b9c1e26fa639886710b79ad Mon Sep 17 00:00:00 2001 +From: Lukas Rusak +Date: Thu, 16 Aug 2018 21:09:40 -0700 +Subject: [PATCH 05/14] libavcodec: v4l2m2m: depends on libdrm + +--- + configure | 1 + + libavcodec/v4l2_buffers.c | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/configure b/configure +index 34c2adb4a4..b72f1d6270 100755 +--- a/configure ++++ b/configure +@@ -3343,6 +3343,7 @@ sndio_indev_deps="sndio" + sndio_outdev_deps="sndio" + v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h" + v4l2_indev_suggest="libv4l2" ++v4l2_outdev_deps="libdrm" + v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h" + v4l2_outdev_suggest="libv4l2" + vfwcap_indev_deps="vfw32 vfwcap_defines" +diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c +index 897c3c4636..d6838866b7 100644 +--- a/libavcodec/v4l2_buffers.c ++++ b/libavcodec/v4l2_buffers.c +@@ -21,7 +21,7 @@ + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +-#include ++#include + #include + #include + #include +-- +2.24.1 + diff --git a/packages/multimedia/ffmpeg/patches/v4l2/0006-libavcodec-v4l2m2m-set-format_modifier-to-DRM_FORMAT.patch b/packages/multimedia/ffmpeg/patches/v4l2/0006-libavcodec-v4l2m2m-set-format_modifier-to-DRM_FORMAT.patch new file mode 100644 index 0000000000..ddbd61d602 --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/v4l2/0006-libavcodec-v4l2m2m-set-format_modifier-to-DRM_FORMAT.patch @@ -0,0 +1,30 @@ +From e657b496a21056d51f17f187dfdf0c62d1da13f2 Mon Sep 17 00:00:00 2001 +From: Lukas Rusak +Date: Thu, 16 Aug 2018 21:10:13 -0700 +Subject: [PATCH 06/14] libavcodec: v4l2m2m: set format_modifier to + DRM_FORMAT_MOD_LINEAR + +--- + libavcodec/v4l2_buffers.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c +index d6838866b7..d879aab7b1 100644 +--- a/libavcodec/v4l2_buffers.c ++++ b/libavcodec/v4l2_buffers.c +@@ -321,10 +321,12 @@ static int v4l2_buffer_export_drm(V4L2Buffer* avbuf) + /* drm frame */ + avbuf->drm_frame.objects[i].size = avbuf->buf.m.planes[i].length; + avbuf->drm_frame.objects[i].fd = expbuf.fd; ++ avbuf->drm_frame.objects[i].format_modifier = DRM_FORMAT_MOD_LINEAR; + } else { + /* drm frame */ + avbuf->drm_frame.objects[0].size = avbuf->buf.length; + avbuf->drm_frame.objects[0].fd = expbuf.fd; ++ avbuf->drm_frame.objects[0].format_modifier = DRM_FORMAT_MOD_LINEAR; + } + } + +-- +2.24.1 + diff --git a/packages/multimedia/ffmpeg/patches/v4l2/0007-libavcodec-v4l2m2m-only-mmap-the-buffer-when-it-is-o.patch b/packages/multimedia/ffmpeg/patches/v4l2/0007-libavcodec-v4l2m2m-only-mmap-the-buffer-when-it-is-o.patch new file mode 100644 index 0000000000..30a7484304 --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/v4l2/0007-libavcodec-v4l2m2m-only-mmap-the-buffer-when-it-is-o.patch @@ -0,0 +1,50 @@ +From 013503bba6eefa10caffe2451fe375b31ed1584a Mon Sep 17 00:00:00 2001 +From: Lukas Rusak +Date: Thu, 16 Aug 2018 21:10:53 -0700 +Subject: [PATCH 07/14] libavcodec: v4l2m2m: only mmap the buffer when it is + output type and drm prime is used + +--- + libavcodec/v4l2_buffers.c | 24 ++++++++++++++++-------- + 1 file changed, 16 insertions(+), 8 deletions(-) + +diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c +index d879aab7b1..ee19bb5b6f 100644 +--- a/libavcodec/v4l2_buffers.c ++++ b/libavcodec/v4l2_buffers.c +@@ -585,16 +585,24 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index) + + if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) { + avbuf->plane_info[i].length = avbuf->buf.m.planes[i].length; +- avbuf->plane_info[i].mm_addr = mmap(NULL, avbuf->buf.m.planes[i].length, +- PROT_READ | PROT_WRITE, MAP_SHARED, +- buf_to_m2mctx(avbuf)->fd, +- avbuf->buf.m.planes[i].m.mem_offset); ++ ++ if ((V4L2_TYPE_IS_OUTPUT(ctx->type) && buf_to_m2mctx(avbuf)->output_drm) || ++ !buf_to_m2mctx(avbuf)->output_drm) { ++ avbuf->plane_info[i].mm_addr = mmap(NULL, avbuf->buf.m.planes[i].length, ++ PROT_READ | PROT_WRITE, MAP_SHARED, ++ buf_to_m2mctx(avbuf)->fd, ++ avbuf->buf.m.planes[i].m.mem_offset); ++ } + } else { + avbuf->plane_info[i].length = avbuf->buf.length; +- avbuf->plane_info[i].mm_addr = mmap(NULL, avbuf->buf.length, +- PROT_READ | PROT_WRITE, MAP_SHARED, +- buf_to_m2mctx(avbuf)->fd, +- avbuf->buf.m.offset); ++ ++ if ((V4L2_TYPE_IS_OUTPUT(ctx->type) && buf_to_m2mctx(avbuf)->output_drm) || ++ !buf_to_m2mctx(avbuf)->output_drm) { ++ avbuf->plane_info[i].mm_addr = mmap(NULL, avbuf->buf.length, ++ PROT_READ | PROT_WRITE, MAP_SHARED, ++ buf_to_m2mctx(avbuf)->fd, ++ avbuf->buf.m.offset); ++ } + } + + if (avbuf->plane_info[i].mm_addr == MAP_FAILED) +-- +2.24.1 + diff --git a/packages/multimedia/ffmpeg/patches/v4l2/0008-libavcodec-v4l2m2m-allow-using-software-pixel-format.patch b/packages/multimedia/ffmpeg/patches/v4l2/0008-libavcodec-v4l2m2m-allow-using-software-pixel-format.patch new file mode 100644 index 0000000000..9f6149077f --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/v4l2/0008-libavcodec-v4l2m2m-allow-using-software-pixel-format.patch @@ -0,0 +1,42 @@ +From f3df44dbdf5e7ca66064c0ac9ae0f84bbcc245e9 Mon Sep 17 00:00:00 2001 +From: Lukas Rusak +Date: Thu, 16 Aug 2018 21:11:38 -0700 +Subject: [PATCH 08/14] libavcodec: v4l2m2m: allow using software pixel formats + +--- + libavcodec/v4l2_m2m_dec.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c +index fb5406a74e..8834b3d6fc 100644 +--- a/libavcodec/v4l2_m2m_dec.c ++++ b/libavcodec/v4l2_m2m_dec.c +@@ -203,8 +203,16 @@ static av_cold int v4l2_decode_init(AVCodecContext *avctx) + * - the DRM frame format is passed in the DRM frame descriptor layer. + * check the v4l2_get_drm_frame function. + */ +- if (ff_get_format(avctx, avctx->codec->pix_fmts) == AV_PIX_FMT_DRM_PRIME) ++ switch (ff_get_format(avctx, avctx->codec->pix_fmts)) { ++ case AV_PIX_FMT_DRM_PRIME: + s->output_drm = 1; ++ break; ++ case AV_PIX_FMT_NONE: ++ return 0; ++ break; ++ default: ++ break; ++ } + + ret = ff_v4l2_m2m_codec_init(avctx); + if (ret) { +@@ -255,6 +263,7 @@ static const AVCodecHWConfigInternal *v4l2_m2m_hw_configs[] = { + .receive_frame = v4l2_receive_frame, \ + .close = ff_v4l2_m2m_codec_end, \ + .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_DRM_PRIME, \ ++ AV_PIX_FMT_NV12, \ + AV_PIX_FMT_NONE}, \ + .bsfs = bsf_name, \ + .hw_configs = v4l2_m2m_hw_configs, \ +-- +2.24.1 + diff --git a/packages/multimedia/ffmpeg/patches/v4l2/0009-libavcodec-v4l2m2m-fix-decoder-capabilities.patch b/packages/multimedia/ffmpeg/patches/v4l2/0009-libavcodec-v4l2m2m-fix-decoder-capabilities.patch new file mode 100644 index 0000000000..f359d9c87a --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/v4l2/0009-libavcodec-v4l2m2m-fix-decoder-capabilities.patch @@ -0,0 +1,26 @@ +From 3af2830856f4356acb9bf1655adf632759782aac Mon Sep 17 00:00:00 2001 +From: Lukas Rusak +Date: Mon, 24 Sep 2018 13:38:46 -0700 +Subject: [PATCH 09/14] libavcodec: v4l2m2m: fix decoder capabilities + +--- + libavcodec/v4l2_m2m_dec.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c +index 8834b3d6fc..0087de35d0 100644 +--- a/libavcodec/v4l2_m2m_dec.c ++++ b/libavcodec/v4l2_m2m_dec.c +@@ -267,8 +267,7 @@ static const AVCodecHWConfigInternal *v4l2_m2m_hw_configs[] = { + AV_PIX_FMT_NONE}, \ + .bsfs = bsf_name, \ + .hw_configs = v4l2_m2m_hw_configs, \ +- .capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY, \ +- AV_CODEC_CAP_AVOID_PROBING, \ ++ .capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING, \ + .wrapper_name = "v4l2m2m", \ + }; + +-- +2.24.1 + diff --git a/packages/multimedia/ffmpeg/patches/v4l2/0010-libavcodec-v4l2m2m-implement-hwcontext.patch b/packages/multimedia/ffmpeg/patches/v4l2/0010-libavcodec-v4l2m2m-implement-hwcontext.patch new file mode 100644 index 0000000000..40ef615117 --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/v4l2/0010-libavcodec-v4l2m2m-implement-hwcontext.patch @@ -0,0 +1,101 @@ +From 8b7ec4eae175835a806619b0bba98eb6d7252a13 Mon Sep 17 00:00:00 2001 +From: Lukas Rusak +Date: Mon, 24 Sep 2018 13:39:31 -0700 +Subject: [PATCH 10/14] libavcodec: v4l2m2m: implement hwcontext + +--- + libavcodec/v4l2_buffers.c | 22 ++++++++++++++++++++++ + libavcodec/v4l2_context.h | 2 ++ + libavcodec/v4l2_m2m.h | 2 ++ + libavcodec/v4l2_m2m_dec.c | 9 +++++++++ + 4 files changed, 35 insertions(+) + +diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c +index ee19bb5b6f..27820905b2 100644 +--- a/libavcodec/v4l2_buffers.c ++++ b/libavcodec/v4l2_buffers.c +@@ -456,6 +456,7 @@ int ff_v4l2_buffer_buf_to_avframe(AVFrame *frame, V4L2Buffer *avbuf) + + frame->data[0] = (uint8_t *) v4l2_get_drm_frame(avbuf); + frame->format = AV_PIX_FMT_DRM_PRIME; ++ frame->hw_frames_ctx = av_buffer_ref(avbuf->context->frames_ref); + } else { + /* 1. get references to the actual data */ + for (i = 0; i < avbuf->num_planes; i++) { +@@ -555,6 +556,27 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index) + avbuf->buf.type = ctx->type; + avbuf->buf.index = index; + ++ if (buf_to_m2mctx(avbuf)->output_drm) { ++ AVHWFramesContext *hwframes; ++ ++ av_buffer_unref(&ctx->frames_ref); ++ ++ ctx->frames_ref = av_hwframe_ctx_alloc(buf_to_m2mctx(avbuf)->device_ref); ++ if (!ctx->frames_ref) { ++ ret = AVERROR(ENOMEM); ++ return ret; ++ } ++ ++ hwframes = (AVHWFramesContext*)ctx->frames_ref->data; ++ hwframes->format = AV_PIX_FMT_DRM_PRIME; ++ hwframes->sw_format = ctx->av_pix_fmt; ++ hwframes->width = ctx->width; ++ hwframes->height = ctx->height; ++ ret = av_hwframe_ctx_init(ctx->frames_ref); ++ if (ret < 0) ++ return ret; ++ } ++ + if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) { + avbuf->buf.length = VIDEO_MAX_PLANES; + avbuf->buf.m.planes = avbuf->planes; +diff --git a/libavcodec/v4l2_context.h b/libavcodec/v4l2_context.h +index 632f1d0aac..9a1dbbea60 100644 +--- a/libavcodec/v4l2_context.h ++++ b/libavcodec/v4l2_context.h +@@ -91,6 +91,8 @@ typedef struct V4L2Context { + */ + int done; + ++ AVBufferRef *frames_ref; ++ + } V4L2Context; + + /** +diff --git a/libavcodec/v4l2_m2m.h b/libavcodec/v4l2_m2m.h +index 043a81a86a..4475618392 100644 +--- a/libavcodec/v4l2_m2m.h ++++ b/libavcodec/v4l2_m2m.h +@@ -60,6 +60,8 @@ typedef struct V4L2m2mContext { + /* Reference to self; only valid while codec is active. */ + AVBufferRef *self_ref; + ++ AVBufferRef *device_ref; ++ + /* generate DRM frames */ + int output_drm; + } V4L2m2mContext; +diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c +index 0087de35d0..fffeb49092 100644 +--- a/libavcodec/v4l2_m2m_dec.c ++++ b/libavcodec/v4l2_m2m_dec.c +@@ -214,6 +214,15 @@ static av_cold int v4l2_decode_init(AVCodecContext *avctx) + break; + } + ++ s->device_ref = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_DRM); ++ if (!s->device_ref) { ++ ret = AVERROR(ENOMEM); ++ return ret; ++ } ++ ret = av_hwdevice_ctx_init(s->device_ref); ++ if (ret < 0) ++ return ret; ++ + ret = ff_v4l2_m2m_codec_init(avctx); + if (ret) { + V4L2m2mPriv *priv = avctx->priv_data; +-- +2.24.1 + diff --git a/packages/multimedia/ffmpeg/patches/v4l2/0011-libavcodec-v4l2m2m-implement-flush.patch b/packages/multimedia/ffmpeg/patches/v4l2/0011-libavcodec-v4l2m2m-implement-flush.patch new file mode 100644 index 0000000000..1b29060cfd --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/v4l2/0011-libavcodec-v4l2m2m-implement-flush.patch @@ -0,0 +1,50 @@ +From 799aa17fbaa5a5dda7fd8a04c71df905e363f6f3 Mon Sep 17 00:00:00 2001 +From: Lukas Rusak +Date: Mon, 24 Sep 2018 13:39:56 -0700 +Subject: [PATCH 11/14] libavcodec: v4l2m2m: implement flush + +--- + libavcodec/v4l2_m2m_dec.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c +index fffeb49092..47ac53df00 100644 +--- a/libavcodec/v4l2_m2m_dec.c ++++ b/libavcodec/v4l2_m2m_dec.c +@@ -236,6 +236,25 @@ static av_cold int v4l2_decode_init(AVCodecContext *avctx) + return v4l2_prepare_decoder(s); + } + ++static void v4l2_flush(AVCodecContext *avctx) ++{ ++ V4L2m2mPriv *priv = avctx->priv_data; ++ V4L2m2mContext* s = priv->context; ++ int ret; ++ ++ /* wait for pending buffer references */ ++ if (atomic_load(&s->refcount)) ++ while(sem_wait(&s->refsync) == -1 && errno == EINTR); ++ ++ ret = ff_v4l2_context_set_status(&s->output, VIDIOC_STREAMOFF); ++ if (ret) ++ av_log(avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->output.name); ++ ++ ret = ff_v4l2_context_set_status(&s->capture, VIDIOC_STREAMOFF); ++ if (ret) ++ av_log(avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->capture.name); ++} ++ + #define OFFSET(x) offsetof(V4L2m2mPriv, x) + #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM + +@@ -271,6 +290,7 @@ static const AVCodecHWConfigInternal *v4l2_m2m_hw_configs[] = { + .init = v4l2_decode_init, \ + .receive_frame = v4l2_receive_frame, \ + .close = ff_v4l2_m2m_codec_end, \ ++ .flush = v4l2_flush, \ + .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_DRM_PRIME, \ + AV_PIX_FMT_NV12, \ + AV_PIX_FMT_NONE}, \ +-- +2.24.1 + diff --git a/packages/multimedia/ffmpeg/patches/v4l2/ffmpeg-999-aspect-ratio.patch b/packages/multimedia/ffmpeg/patches/v4l2/0012-libavcodec-v4l2m2m-aspect-ratio.patch similarity index 75% rename from packages/multimedia/ffmpeg/patches/v4l2/ffmpeg-999-aspect-ratio.patch rename to packages/multimedia/ffmpeg/patches/v4l2/0012-libavcodec-v4l2m2m-aspect-ratio.patch index c7c2fbbb66..ba62a0397c 100644 --- a/packages/multimedia/ffmpeg/patches/v4l2/ffmpeg-999-aspect-ratio.patch +++ b/packages/multimedia/ffmpeg/patches/v4l2/0012-libavcodec-v4l2m2m-aspect-ratio.patch @@ -1,17 +1,17 @@ -From e5d21ff782977b0fe79a60796dc9d973d98e692c Mon Sep 17 00:00:00 2001 -From: Maxime Jourdan -Date: Sun, 9 Sep 2018 17:22:35 +0200 -Subject: [PATCH] avcodec: v4l2_context: set frame SAR using VIDIOC_CROPCAP +From f91c0f01a4c563129acd388272e0ac4795b83435 Mon Sep 17 00:00:00 2001 +From: Lukas Rusak +Date: Fri, 31 Jan 2020 08:33:02 -0800 +Subject: [PATCH 12/14] libavcodec: v4l2m2m: aspect ratio --- libavcodec/v4l2_context.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c -index efcb0426e4..8bff58ca5d 100644 +index 12d40d597e..5c51399a4c 100644 --- a/libavcodec/v4l2_context.c +++ b/libavcodec/v4l2_context.c -@@ -501,6 +501,24 @@ static int v4l2_get_coded_format(V4L2Context* ctx, uint32_t *p) +@@ -539,6 +539,24 @@ static int v4l2_get_coded_format(V4L2Context* ctx, uint32_t *p) return 0; } @@ -36,7 +36,7 @@ index efcb0426e4..8bff58ca5d 100644 /***************************************************************************** * * V4L2 Context Interface -@@ -574,6 +592,7 @@ int ff_v4l2_context_enqueue_packet(V4L2Context* ctx, const AVPacket* pkt) +@@ -612,6 +630,7 @@ int ff_v4l2_context_enqueue_packet(V4L2Context* ctx, const AVPacket* pkt) int ff_v4l2_context_dequeue_frame(V4L2Context* ctx, AVFrame* frame) { V4L2Buffer* avbuf = NULL; @@ -44,7 +44,7 @@ index efcb0426e4..8bff58ca5d 100644 /* * blocks until: -@@ -588,7 +607,12 @@ int ff_v4l2_context_dequeue_frame(V4L2Context* ctx, AVFrame* frame) +@@ -626,7 +645,12 @@ int ff_v4l2_context_dequeue_frame(V4L2Context* ctx, AVFrame* frame) return AVERROR(EAGAIN); } @@ -59,4 +59,5 @@ index efcb0426e4..8bff58ca5d 100644 int ff_v4l2_context_dequeue_packet(V4L2Context* ctx, AVPacket* pkt) -- -2.18.0 +2.24.1 + diff --git a/packages/multimedia/ffmpeg/patches/v4l2/ffmpeg-999-z-fixes.patch b/packages/multimedia/ffmpeg/patches/v4l2/0013-libavcodec-v4l2m2m-save-pkt.patch similarity index 66% rename from packages/multimedia/ffmpeg/patches/v4l2/ffmpeg-999-z-fixes.patch rename to packages/multimedia/ffmpeg/patches/v4l2/0013-libavcodec-v4l2m2m-save-pkt.patch index 7e2f74d22f..95e0c03633 100644 --- a/packages/multimedia/ffmpeg/patches/v4l2/ffmpeg-999-z-fixes.patch +++ b/packages/multimedia/ffmpeg/patches/v4l2/0013-libavcodec-v4l2m2m-save-pkt.patch @@ -1,8 +1,17 @@ +From da24c4a08dd820804d9bd0709815d954836277d8 Mon Sep 17 00:00:00 2001 +From: Lukas Rusak +Date: Fri, 31 Jan 2020 08:35:37 -0800 +Subject: [PATCH 13/14] libavcodec: v4l2m2m: save pkt + +--- + libavcodec/v4l2_m2m_dec.c | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c -index 80a09f7a43..af65927ac3 100644 +index 47ac53df00..cf48ff4b22 100644 --- a/libavcodec/v4l2_m2m_dec.c +++ b/libavcodec/v4l2_m2m_dec.c -@@ -125,6 +125,8 @@ static int v4l2_prepare_decoder(V4L2m2mContext *s) +@@ -131,6 +131,8 @@ static int v4l2_prepare_decoder(V4L2m2mContext *s) return 0; } @@ -11,7 +20,7 @@ index 80a09f7a43..af65927ac3 100644 static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) { V4L2m2mContext *s = ((V4L2m2mPriv*)avctx->priv_data)->context; -@@ -133,9 +135,14 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) +@@ -139,9 +141,14 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) AVPacket avpkt = {0}; int ret; @@ -29,7 +38,7 @@ index 80a09f7a43..af65927ac3 100644 if (s->draining) goto dequeue; -@@ -144,6 +151,8 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) +@@ -150,6 +157,8 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) if (ret < 0) { if (ret != AVERROR(ENOMEM)) return ret; @@ -38,7 +47,7 @@ index 80a09f7a43..af65927ac3 100644 /* no input buffers available, continue dequeing */ } -@@ -156,7 +165,8 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) +@@ -167,7 +176,8 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) } dequeue: @@ -47,5 +56,7 @@ index 80a09f7a43..af65927ac3 100644 + av_packet_unref(&avpkt); return ff_v4l2_context_dequeue_frame(capture, frame); } - + +-- +2.24.1 diff --git a/packages/multimedia/ffmpeg/patches/v4l2/0014-libavcodec-v4l2m2m-only-use-a-few-output-buffers.patch b/packages/multimedia/ffmpeg/patches/v4l2/0014-libavcodec-v4l2m2m-only-use-a-few-output-buffers.patch new file mode 100644 index 0000000000..24cfd7469c --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/v4l2/0014-libavcodec-v4l2m2m-only-use-a-few-output-buffers.patch @@ -0,0 +1,25 @@ +From d317cac9ec2470bcdb44f92a82b64e4d132aeb51 Mon Sep 17 00:00:00 2001 +From: Lukas Rusak +Date: Fri, 31 Jan 2020 09:00:51 -0800 +Subject: [PATCH 14/14] libavcodec: v4l2m2m: only use a few output buffers + +--- + libavcodec/v4l2_m2m.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavcodec/v4l2_m2m.h b/libavcodec/v4l2_m2m.h +index 4475618392..7e075e7e80 100644 +--- a/libavcodec/v4l2_m2m.h ++++ b/libavcodec/v4l2_m2m.h +@@ -38,7 +38,7 @@ + + #define V4L_M2M_DEFAULT_OPTS \ + { "num_output_buffers", "Number of buffers in the output context",\ +- OFFSET(num_output_buffers), AV_OPT_TYPE_INT, { .i64 = 16 }, 6, INT_MAX, FLAGS } ++ OFFSET(num_output_buffers), AV_OPT_TYPE_INT, { .i64 = 2 }, 1, INT_MAX, FLAGS } + + typedef struct V4L2m2mContext { + char devname[PATH_MAX]; +-- +2.24.1 + diff --git a/packages/multimedia/ffmpeg/patches/v4l2/ffmpeg-999-min-buffers.patch b/packages/multimedia/ffmpeg/patches/v4l2/ffmpeg-999-min-buffers.patch deleted file mode 100644 index c156cf69ff..0000000000 --- a/packages/multimedia/ffmpeg/patches/v4l2/ffmpeg-999-min-buffers.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/libavcodec/v4l2_m2m.h 2018-07-22 11:04:44.223961230 +0100 -+++ b/libavcodec/v4l2_m2m.h 2018-07-30 18:19:54.780753049 +0100 -@@ -38,7 +38,7 @@ - - #define V4L_M2M_DEFAULT_OPTS \ - { "num_output_buffers", "Number of buffers in the output context",\ -- OFFSET(num_output_buffers), AV_OPT_TYPE_INT, { .i64 = 16 }, 6, INT_MAX, FLAGS } -+ OFFSET(num_output_buffers), AV_OPT_TYPE_INT, { .i64 = 2 }, 1, INT_MAX, FLAGS } - - typedef struct V4L2m2mContext { - char devname[PATH_MAX];