$ git diff --patch-with-stat --summary 2ba23e8ca278828a03c8847de446ab6da128957d..ef72639faa117fe7c5bc0e6d6668792da4907cee
.abf.yml | 2 +-
1354c39c78e5ca1e8bfaf9b65ed021f672f0729f.patch | 24 +
3a84081cbd982ce1bd9456eca5b1b03cd495e0fe.patch | 39 ++
846e26b8c93a313d9f0c1f7d4a2965b357482abf.patch | 23 +
c11b3253a4e6142ce7341dd4a1aaef075ad81c97.patch | 22 +
d8bf24459b694338de4ceb2a2e6d4d2949d6658d.patch | 753 +++++++++++++++++++++++++
e47a95463116b17a6e96ef87e1341b5544747982.patch | 55 ++
ffmpeg.spec | 87 ++-
8 files changed, 988 insertions(+), 17 deletions(-)
create mode 100644 1354c39c78e5ca1e8bfaf9b65ed021f672f0729f.patch
create mode 100644 3a84081cbd982ce1bd9456eca5b1b03cd495e0fe.patch
create mode 100644 846e26b8c93a313d9f0c1f7d4a2965b357482abf.patch
create mode 100644 c11b3253a4e6142ce7341dd4a1aaef075ad81c97.patch
create mode 100644 d8bf24459b694338de4ceb2a2e6d4d2949d6658d.patch
create mode 100644 e47a95463116b17a6e96ef87e1341b5544747982.patch
diff --git a/.abf.yml b/.abf.yml
index 4855177..056119d 100644
--- a/.abf.yml
+++ b/.abf.yml
@@ -1,3 +1,3 @@
sources:
+ ffmpeg-4.2.2.tar.xz: 2557ec7d1dee31169980a8a10404129f94bd5809
restricted-multimedia-headers.tar.xz: c192c6516486a6c2399d36c435d6214cd3d4a0e9
- ffmpeg-4.2.1.tar.xz: c386b7330259d9eec0bdefb39e05bf9145e3d850
diff --git a/1354c39c78e5ca1e8bfaf9b65ed021f672f0729f.patch b/1354c39c78e5ca1e8bfaf9b65ed021f672f0729f.patch
new file mode 100644
index 0000000..c3992e5
--- /dev/null
+++ b/1354c39c78e5ca1e8bfaf9b65ed021f672f0729f.patch
@@ -0,0 +1,24 @@
+From 1354c39c78e5ca1e8bfaf9b65ed021f672f0729f Mon Sep 17 00:00:00 2001
+From: Derek Buitenhuis <derek.buitenhuis@gmail.com>
+Date: Mon, 11 Nov 2019 14:15:41 +0000
+Subject: [PATCH] librav1e: Don't make users explicitly set -qp -1 to use bit
+ rate mode
+
+Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
+---
+ libavcodec/librav1e.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c
+index 5052cac8960..a5aedd512cd 100644
+--- a/libavcodec/librav1e.c
++++ b/libavcodec/librav1e.c
+@@ -533,7 +533,7 @@ static int librav1e_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
+ #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
+
+ static const AVOption options[] = {
+- { "qp", "use constant quantizer mode", OFFSET(quantizer), AV_OPT_TYPE_INT, { .i64 = 100 }, -1, 255, VE },
++ { "qp", "use constant quantizer mode", OFFSET(quantizer), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 255, VE },
+ { "speed", "what speed preset to use", OFFSET(speed), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 10, VE },
+ { "tiles", "number of tiles encode with", OFFSET(tiles), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE },
+ { "tile-rows", "number of tiles rows to encode with", OFFSET(tile_rows), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE },
diff --git a/3a84081cbd982ce1bd9456eca5b1b03cd495e0fe.patch b/3a84081cbd982ce1bd9456eca5b1b03cd495e0fe.patch
new file mode 100644
index 0000000..68efcd1
--- /dev/null
+++ b/3a84081cbd982ce1bd9456eca5b1b03cd495e0fe.patch
@@ -0,0 +1,39 @@
+From 3a84081cbd982ce1bd9456eca5b1b03cd495e0fe Mon Sep 17 00:00:00 2001
+From: James Almer <jamrial@gmail.com>
+Date: Sun, 10 Nov 2019 22:15:44 -0300
+Subject: [PATCH] avcodec/librav1e: free the RaPacket after using it
+
+Fixes leaks.
+
+Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
+Signed-off-by: James Almer <jamrial@gmail.com>
+---
+ libavcodec/librav1e.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c
+index f65d7841274..5052cac8960 100644
+--- a/libavcodec/librav1e.c
++++ b/libavcodec/librav1e.c
+@@ -508,12 +508,12 @@ static int librav1e_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
+ pkt->flags |= AV_PKT_FLAG_KEY;
+
+ pkt->pts = pkt->dts = rpkt->input_frameno * avctx->ticks_per_frame;
++ rav1e_packet_unref(rpkt);
+
+ if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
+ int ret = av_bsf_send_packet(ctx->bsf, pkt);
+ if (ret < 0) {
+ av_log(avctx, AV_LOG_ERROR, "extradata extraction send failed.\n");
+- rav1e_packet_unref(rpkt);
+ av_packet_unref(pkt);
+ return ret;
+ }
+@@ -521,7 +521,6 @@ static int librav1e_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
+ ret = av_bsf_receive_packet(ctx->bsf, pkt);
+ if (ret < 0) {
+ av_log(avctx, AV_LOG_ERROR, "extradata extraction receive failed.\n");
+- rav1e_packet_unref(rpkt);
+ av_packet_unref(pkt);
+ return ret;
+ }
diff --git a/846e26b8c93a313d9f0c1f7d4a2965b357482abf.patch b/846e26b8c93a313d9f0c1f7d4a2965b357482abf.patch
new file mode 100644
index 0000000..c5e1a3f
--- /dev/null
+++ b/846e26b8c93a313d9f0c1f7d4a2965b357482abf.patch
@@ -0,0 +1,23 @@
+From 846e26b8c93a313d9f0c1f7d4a2965b357482abf Mon Sep 17 00:00:00 2001
+From: Zhong Li <zhongli_dev@126.com>
+Date: Tue, 12 Nov 2019 09:09:20 +0000
+Subject: [PATCH] lavc/rav1e: log and doc updated for const quantizer mode
+
+Signed-off-by: Zhong Li <zhongli_dev@126.com>
+---
+ doc/encoders.texi | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/doc/encoders.texi b/doc/encoders.texi
+index 6cf3a740936..6b02c7798dc 100644
+--- a/doc/encoders.texi
++++ b/doc/encoders.texi
+@@ -1395,7 +1395,7 @@ Sets the maximum quantizer to use when using bitrate mode.
+ Sets the minimum quantizer to use when using bitrate mode.
+
+ @item qp
+-Uses quantizer mode to encode at the given quantizer.
++Uses quantizer mode to encode at the given quantizer (0-255).
+
+ @item speed
+ Selects the speed preset (0-10) to encode with.
diff --git a/c11b3253a4e6142ce7341dd4a1aaef075ad81c97.patch b/c11b3253a4e6142ce7341dd4a1aaef075ad81c97.patch
new file mode 100644
index 0000000..87381db
--- /dev/null
+++ b/c11b3253a4e6142ce7341dd4a1aaef075ad81c97.patch
@@ -0,0 +1,22 @@
+From c11b3253a4e6142ce7341dd4a1aaef075ad81c97 Mon Sep 17 00:00:00 2001
+From: Gyan Doshi <ffmpeg@gyani.pro>
+Date: Sat, 11 Jan 2020 11:01:17 +0530
+Subject: [PATCH] doc/general: update table AV1 entry for librav1e
+
+---
+ doc/general.texi | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/doc/general.texi b/doc/general.texi
+index e66859992bb..4bd4b4f6b9a 100644
+--- a/doc/general.texi
++++ b/doc/general.texi
+@@ -814,7 +814,7 @@ following image formats are supported:
+ @item Autodesk RLE @tab @tab X
+ @tab fourcc: AASC
+ @item AV1 @tab E @tab E
+- @tab Supported through external libraries libaom and libdav1d
++ @tab Supported through external libraries libaom, libdav1d and librav1e
+ @item Avid 1:1 10-bit RGB Packer @tab X @tab X
+ @tab fourcc: AVrp
+ @item AVS (Audio Video Standard) video @tab @tab X
diff --git a/d8bf24459b694338de4ceb2a2e6d4d2949d6658d.patch b/d8bf24459b694338de4ceb2a2e6d4d2949d6658d.patch
new file mode 100644
index 0000000..b525ca4
--- /dev/null
+++ b/d8bf24459b694338de4ceb2a2e6d4d2949d6658d.patch
@@ -0,0 +1,753 @@
+From d8bf24459b694338de4ceb2a2e6d4d2949d6658d Mon Sep 17 00:00:00 2001
+From: Derek Buitenhuis <derek.buitenhuis@gmail.com>
+Date: Wed, 29 May 2019 19:28:24 +0100
+Subject: [PATCH] avcodec: Add librav1e encoder
+
+Port to the new send/receive API by: James Almer <jamrial@gmail.com>.
+
+Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
+---
+ Changelog | 1 +
+ configure | 5 +
+ doc/encoders.texi | 43 +++
+ doc/general.texi | 7 +
+ libavcodec/Makefile | 1 +
+ libavcodec/allcodecs.c | 1 +
+ libavcodec/librav1e.c | 594 +++++++++++++++++++++++++++++++++++++++++
+ libavcodec/version.h | 2 +-
+ 8 files changed, 653 insertions(+), 1 deletion(-)
+ create mode 100644 libavcodec/librav1e.c
+
+diff --git a/configure b/configure
+index 48e14260131..1de90e93fdc 100755
+--- a/configure
++++ b/configure
+@@ -254,6 +254,7 @@ External library support:
+ --enable-libopenmpt enable decoding tracked files via libopenmpt [no]
+ --enable-libopus enable Opus de/encoding via libopus [no]
+ --enable-libpulse enable Pulseaudio input via libpulse [no]
++ --enable-librav1e enable AV1 encoding via rav1e [no]
+ --enable-librsvg enable SVG rasterization via librsvg [no]
+ --enable-librubberband enable rubberband needed for rubberband filter [no]
+ --enable-librtmp enable RTMP[E] support via librtmp [no]
+@@ -1784,6 +1785,7 @@ EXTERNAL_LIBRARY_LIST="
+ libopenmpt
+ libopus
+ libpulse
++ librav1e
+ librsvg
+ librtmp
+ libshine
+@@ -3203,6 +3205,8 @@ libopenmpt_demuxer_deps="libopenmpt"
+ libopus_decoder_deps="libopus"
+ libopus_encoder_deps="libopus"
+ libopus_encoder_select="audio_frame_queue"
++librav1e_encoder_deps="librav1e"
++librav1e_encoder_select="extract_extradata_bsf"
+ librsvg_decoder_deps="librsvg"
+ libshine_encoder_deps="libshine"
+ libshine_encoder_select="audio_frame_queue"
+@@ -6287,6 +6291,7 @@ enabled libopus && {
+ }
+ }
+ enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new
++enabled librav1e && require_pkg_config librav1e "rav1e >= 0.1.0" rav1e.h rav1e_context_new
+ enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
+ enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
+ enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++"
+diff --git a/doc/encoders.texi b/doc/encoders.texi
+index eefd124751f..6cf3a740936 100644
+--- a/doc/encoders.texi
++++ b/doc/encoders.texi
+@@ -1378,6 +1378,49 @@ makes it possible to store non-rgb pix_fmts.
+
+ @end table
+
++@section librav1e
++
++rav1e AV1 encoder wrapper.
++
++Requires the presence of the rav1e headers and library during configuration.
++You need to explicitly configure the build with @code{--enable-librav1e}.
++
++@subsection Options
++
++@table @option
++@item qmax
++Sets the maximum quantizer to use when using bitrate mode.
++
++@item qmin
++Sets the minimum quantizer to use when using bitrate mode.
++
++@item qp
++Uses quantizer mode to encode at the given quantizer.
++
++@item speed
++Selects the speed preset (0-10) to encode with.
++
++@item tiles
++Selects how many tiles to encode with.
++
++@item tile-rows
++Selects how many rows of tiles to encode with.
++
++@item tile-columns
++Selects how many columns of tiles to encode with.
++
++@item rav1e-params
++Set rav1e options using a list of @var{key}=@var{value} pairs separated
++by ":". See @command{rav1e --help} for a list of options.
++
++For example to specify librav1e encoding options with @option{-rav1e-params}:
++
++@example
++ffmpeg -i input -c:v librav1e -b:v 500K -rav1e-params speed=5:low_latency=true output.mp4
++@end example
++
++@end table
++
+ @section libaom-av1
+
+ libaom AV1 encoder wrapper.
+diff --git a/doc/general.texi b/doc/general.texi
+index 79a23e17181..a5b77e0de13 100644
+--- a/doc/general.texi
++++ b/doc/general.texi
+@@ -253,6 +253,13 @@ FFmpeg can use the OpenJPEG libraries for decoding/encoding J2K videos. Go to
+ instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjpeg} to
+ @file{./configure}.
+
++@section rav1e
++
++FFmpeg can make use of rav1e (Rust AV1 Encoder) via its C bindings to encode videos.
++Go to @url{https://github.com/xiph/rav1e/} and follow the instructions to build
++the C library. To enable using rav1e in FFmpeg, pass @code{--enable-librav1e}
++to @file{./configure}.
++
+ @section TwoLAME
+
+ FFmpeg can make use of the TwoLAME library for MP2 encoding.
+diff --git a/libavcodec/Makefile b/libavcodec/Makefile
+index eee1e505f96..b990c6ba874 100644
+--- a/libavcodec/Makefile
++++ b/libavcodec/Makefile
+@@ -993,6 +993,7 @@ OBJS-$(CONFIG_LIBOPUS_DECODER) += libopusdec.o libopus.o \
+ vorbis_data.o
+ OBJS-$(CONFIG_LIBOPUS_ENCODER) += libopusenc.o libopus.o \
+ vorbis_data.o
++OBJS-$(CONFIG_LIBRAV1E_ENCODER) += librav1e.o
+ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o
+ OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o
+ OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o
+diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
+index 23a778e041c..0c0741936cd 100644
+--- a/libavcodec/allcodecs.c
++++ b/libavcodec/allcodecs.c
+@@ -704,6 +704,7 @@ extern AVCodec ff_libopenjpeg_encoder;
+ extern AVCodec ff_libopenjpeg_decoder;
+ extern AVCodec ff_libopus_encoder;
+ extern AVCodec ff_libopus_decoder;
++extern AVCodec ff_librav1e_encoder;
+ extern AVCodec ff_librsvg_decoder;
+ extern AVCodec ff_libshine_encoder;
+ extern AVCodec ff_libspeex_encoder;
+diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c
+new file mode 100644
+index 00000000000..f65d7841274
+--- /dev/null
++++ b/libavcodec/librav1e.c
+@@ -0,0 +1,594 @@
++/*
++ * librav1e encoder
++ *
++ * Copyright (c) 2019 Derek Buitenhuis
++ *
++ * 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 <rav1e.h>
++
++#include "libavutil/internal.h"
++#include "libavutil/avassert.h"
++#include "libavutil/base64.h"
++#include "libavutil/common.h"
++#include "libavutil/mathematics.h"
++#include "libavutil/opt.h"
++#include "libavutil/pixdesc.h"
++#include "avcodec.h"
++#include "internal.h"
++
++typedef struct librav1eContext {
++ const AVClass *class;
++
++ RaContext *ctx;
++ AVBSFContext *bsf;
++
++ uint8_t *pass_data;
++ size_t pass_pos;
++ int pass_size;
++
++ char *rav1e_opts;
++ int quantizer;
++ int speed;
++ int tiles;
++ int tile_rows;
++ int tile_cols;
++} librav1eContext;
++
++static inline RaPixelRange range_map(enum AVPixelFormat pix_fmt, enum AVColorRange range)
++{
++ switch (pix_fmt) {
++ case AV_PIX_FMT_YUVJ420P:
++ case AV_PIX_FMT_YUVJ422P:
++ case AV_PIX_FMT_YUVJ444P:
++ return RA_PIXEL_RANGE_FULL;
++ }
++
++ switch (range) {
++ case AVCOL_RANGE_JPEG:
++ return RA_PIXEL_RANGE_FULL;
++ case AVCOL_RANGE_MPEG:
++ default:
++ return RA_PIXEL_RANGE_LIMITED;
++ }
++}
++
++static inline RaChromaSampling pix_fmt_map(enum AVPixelFormat pix_fmt)
++{
++ switch (pix_fmt) {
++ case AV_PIX_FMT_YUV420P:
++ case AV_PIX_FMT_YUVJ420P:
++ case AV_PIX_FMT_YUV420P10:
++ case AV_PIX_FMT_YUV420P12:
++ return RA_CHROMA_SAMPLING_CS420;
++ case AV_PIX_FMT_YUV422P:
++ case AV_PIX_FMT_YUVJ422P:
++ case AV_PIX_FMT_YUV422P10:
++ case AV_PIX_FMT_YUV422P12:
++ return RA_CHROMA_SAMPLING_CS422;
++ case AV_PIX_FMT_YUV444P:
++ case AV_PIX_FMT_YUVJ444P:
++ case AV_PIX_FMT_YUV444P10:
++ case AV_PIX_FMT_YUV444P12:
++ return RA_CHROMA_SAMPLING_CS444;
++ default:
++ av_assert0(0);
++ }
++}
++
++static inline RaChromaSamplePosition chroma_loc_map(enum AVChromaLocation chroma_loc)
++{
++ switch (chroma_loc) {
++ case AVCHROMA_LOC_LEFT:
++ return RA_CHROMA_SAMPLE_POSITION_VERTICAL;
++ case AVCHROMA_LOC_TOPLEFT:
++ return RA_CHROMA_SAMPLE_POSITION_COLOCATED;
++ default:
++ return RA_CHROMA_SAMPLE_POSITION_UNKNOWN;
++ }
++}
++
++static int get_stats(AVCodecContext *avctx, int eos)
++{
++ librav1eContext *ctx = avctx->priv_data;
++ RaData* buf = rav1e_twopass_out(ctx->ctx);
++ if (!buf)
++ return 0;
++
++ if (!eos) {
++ uint8_t *tmp = av_fast_realloc(ctx->pass_data, &ctx->pass_size,
++ ctx->pass_pos + buf->len);
++ if (!tmp) {
++ rav1e_data_unref(buf);
++ return AVERROR(ENOMEM);
++ }
++
++ ctx->pass_data = tmp;
++ memcpy(ctx->pass_data + ctx->pass_pos, buf->data, buf->len);
++ ctx->pass_pos += buf->len;
++ } else {
++ size_t b64_size = AV_BASE64_SIZE(ctx->pass_pos);
++
++ memcpy(ctx->pass_data, buf->data, buf->len);
++
++ avctx->stats_out = av_malloc(b64_size);
++ if (!avctx->stats_out) {
++ rav1e_data_unref(buf);
++ return AVERROR(ENOMEM);
++ }
++
++ av_base64_encode(avctx->stats_out, b64_size, ctx->pass_data, ctx->pass_pos);
++
++ av_freep(&ctx->pass_data);
++ }
++
++ rav1e_data_unref(buf);
++
++ return 0;
++}
++
++static int set_stats(AVCodecContext *avctx)
++{
++ librav1eContext *ctx = avctx->priv_data;
++ int ret = 1;
++
++ while (ret > 0 && ctx->pass_size - ctx->pass_pos > 0) {
++ ret = rav1e_twopass_in(ctx->ctx, ctx->pass_data + ctx->pass_pos, ctx->pass_size);
++ if (ret < 0)
++ return AVERROR_EXTERNAL;
++ ctx->pass_pos += ret;
++ }
++
++ return 0;
++}
++
++static av_cold int librav1e_encode_close(AVCodecContext *avctx)
++{
++ librav1eContext *ctx = avctx->priv_data;
++
++ if (ctx->ctx) {
++ rav1e_context_unref(ctx->ctx);
++ ctx->ctx = NULL;
++ }
++
++ av_bsf_free(&ctx->bsf);
++ av_freep(&ctx->pass_data);
++
++ return 0;
++}
++
++static av_cold int librav1e_encode_init(AVCodecContext *avctx)
++{
++ librav1eContext *ctx = avctx->priv_data;
++ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
++ RaConfig *cfg = NULL;
++ int rret;
++ int ret = 0;
++
++ cfg = rav1e_config_default();
++ if (!cfg) {
++ av_log(avctx, AV_LOG_ERROR, "Could not allocate rav1e config.\n");
++ return AVERROR_EXTERNAL;
++ }
++
++ rav1e_config_set_time_base(cfg, (RaRational) {
++ avctx->time_base.num * avctx->ticks_per_frame,
++ avctx->time_base.den
++ });
++
++ if (avctx->flags & AV_CODEC_FLAG_PASS2) {
++ if (!avctx->stats_in) {
++ av_log(avctx, AV_LOG_ERROR, "No stats file provided for second pass.\n");
++ ret = AVERROR(EINVAL);
++ goto end;
++ }
++
++ ctx->pass_size = (strlen(avctx->stats_in) * 3) / 4;
++ ctx->pass_data = av_malloc(ctx->pass_size);
++ if (!ctx->pass_data) {
++ av_log(avctx, AV_LOG_ERROR, "Could not allocate stats buffer.\n");
++ ret = AVERROR(ENOMEM);
++ goto end;
++ }
++
++ ctx->pass_size = av_base64_decode(ctx->pass_data, avctx->stats_in, ctx->pass_size);
++ if (ctx->pass_size < 0) {
++ av_log(avctx, AV_LOG_ERROR, "Invalid pass file.\n");
++ ret = AVERROR(EINVAL);
++ goto end;
++ }
++ }
++
++ if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
++ const AVBitStreamFilter *filter = av_bsf_get_by_name("extract_extradata");
++ int bret;
++
++ if (!filter) {
++ av_log(avctx, AV_LOG_ERROR, "extract_extradata bitstream filter "
++ "not found. This is a bug, please report it.\n");
++ ret = AVERROR_BUG;
++ goto end;
++ }
++
++ bret = av_bsf_alloc(filter, &ctx->bsf);
++ if (bret < 0) {
++ ret = bret;
++ goto end;
++ }
++
++ bret = avcodec_parameters_from_context(ctx->bsf->par_in, avctx);
++ if (bret < 0) {
++ ret = bret;
++ goto end;
++ }
++
++ bret = av_bsf_init(ctx->bsf);
++ if (bret < 0) {
++ ret = bret;
++ goto end;
++ }
++ }
++
++ if (ctx->rav1e_opts) {
++ AVDictionary *dict = NULL;
++ AVDictionaryEntry *en = NULL;
++
++ if (!av_dict_parse_string(&dict, ctx->rav1e_opts, "=", ":", 0)) {
++ while (en = av_dict_get(dict, "", en, AV_DICT_IGNORE_SUFFIX)) {
++ int parse_ret = rav1e_config_parse(cfg, en->key, en->value);
++ if (parse_ret < 0)
++ av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s.\n", en->key, en->value);
++ }
++ av_dict_free(&dict);
++ }
++ }
++
++ rret = rav1e_config_parse_int(cfg, "width", avctx->width);
++ if (rret < 0) {
++ av_log(avctx, AV_LOG_ERROR, "Invalid width passed to rav1e.\n");
++ ret = AVERROR_INVALIDDATA;
++ goto end;
++ }
++
++ rret = rav1e_config_parse_int(cfg, "height", avctx->height);
++ if (rret < 0) {
++ av_log(avctx, AV_LOG_ERROR, "Invalid height passed to rav1e.\n");
++ ret = AVERROR_INVALIDDATA;
++ goto end;
++ }
++
++ rret = rav1e_config_parse_int(cfg, "threads", avctx->thread_count);
++ if (rret < 0)
++ av_log(avctx, AV_LOG_WARNING, "Invalid number of threads, defaulting to auto.\n");
++
++ if (ctx->speed >= 0) {
++ rret = rav1e_config_parse_int(cfg, "speed", ctx->speed);
++ if (rret < 0) {
++ av_log(avctx, AV_LOG_ERROR, "Could not set speed preset.\n");
++ ret = AVERROR_EXTERNAL;
++ goto end;
++ }
++ }
++
++ /* rav1e handles precedence between 'tiles' and cols/rows for us. */
++ if (ctx->tiles > 0) {
++ rret = rav1e_config_parse_int(cfg, "tiles", ctx->tiles);
++ if (rret < 0) {
++ av_log(avctx, AV_LOG_ERROR, "Could not set number of tiles to encode with.\n");
++ ret = AVERROR_EXTERNAL;
++ goto end;
++ }
++ }
++ if (ctx->tile_rows > 0) {
++ rret = rav1e_config_parse_int(cfg, "tile_rows", ctx->tile_rows);
++ if (rret < 0) {
++ av_log(avctx, AV_LOG_ERROR, "Could not set number of tile rows to encode with.\n");
++ ret = AVERROR_EXTERNAL;
++ goto end;
++ }
++ }
++ if (ctx->tile_cols > 0) {
++ rret = rav1e_config_parse_int(cfg, "tile_cols", ctx->tile_cols);
++ if (rret < 0) {
++ av_log(avctx, AV_LOG_ERROR, "Could not set number of tile cols to encode with.\n");
++ ret = AVERROR_EXTERNAL;
++ goto end;
++ }
++ }
++
++ if (avctx->gop_size > 0) {
++ rret = rav1e_config_parse_int(cfg, "key_frame_interval", avctx->gop_size);
++ if (rret < 0) {
++ av_log(avctx, AV_LOG_ERROR, "Could not set max keyint.\n");
++ ret = AVERROR_EXTERNAL;
++ goto end;
++ }
++ }
++
++ if (avctx->keyint_min > 0) {
++ rret = rav1e_config_parse_int(cfg, "min_key_frame_interval", avctx->keyint_min);
++ if (rret < 0) {
++ av_log(avctx, AV_LOG_ERROR, "Could not set min keyint.\n");
++ ret = AVERROR_EXTERNAL;
++ goto end;
++ }
++ }
++
++ if (avctx->bit_rate && ctx->quantizer < 0) {
++ int max_quantizer = avctx->qmax >= 0 ? avctx->qmax : 255;
++
++ rret = rav1e_config_parse_int(cfg, "quantizer", max_quantizer);
++ if (rret < 0) {
++ av_log(avctx, AV_LOG_ERROR, "Could not set max quantizer.\n");
++ ret = AVERROR_EXTERNAL;
++ goto end;
++ }
++
++ if (avctx->qmin >= 0) {
++ rret = rav1e_config_parse_int(cfg, "min_quantizer", avctx->qmin);
++ if (rret < 0) {
++ av_log(avctx, AV_LOG_ERROR, "Could not set min quantizer.\n");
++ ret = AVERROR_EXTERNAL;
++ goto end;
++ }
++ }
++
++ rret = rav1e_config_parse_int(cfg, "bitrate", avctx->bit_rate);
++ if (rret < 0) {
++ av_log(avctx, AV_LOG_ERROR, "Could not set bitrate.\n");
++ ret = AVERROR_INVALIDDATA;
++ goto end;
++ }
++ } else if (ctx->quantizer >= 0) {
++ if (avctx->bit_rate)
++ av_log(avctx, AV_LOG_WARNING, "Both bitrate and quantizer specified. Using quantizer mode.");
++
++ rret = rav1e_config_parse_int(cfg, "quantizer", ctx->quantizer);
++ if (rret < 0) {
++ av_log(avctx, AV_LOG_ERROR, "Could not set quantizer.\n");
++ ret = AVERROR_EXTERNAL;
++ goto end;
++ }
++ }
++
++ rret = rav1e_config_set_pixel_format(cfg, desc->comp[0].depth,
++ pix_fmt_map(avctx->pix_fmt),
++ chroma_loc_map(avctx->chroma_sample_location),
++ range_map(avctx->pix_fmt, avctx->color_range));
++ if (rret < 0) {
++ av_log(avctx, AV_LOG_ERROR, "Failed to set pixel format properties.\n");
++ ret = AVERROR_INVALIDDATA;
++ goto end;
++ }
++
++ /* rav1e's colorspace enums match standard values. */
++ rret = rav1e_config_set_color_description(cfg, (RaMatrixCoefficients) avctx->colorspace,
++ (RaColorPrimaries) avctx->color_primaries,
++ (RaTransferCharacteristics) avctx->color_trc);
++ if (rret < 0) {
++ av_log(avctx, AV_LOG_WARNING, "Failed to set color properties.\n");
++ if (avctx->err_recognition & AV_EF_EXPLODE) {
++ ret = AVERROR_INVALIDDATA;
++ goto end;
++ }
++ }
++
++ ctx->ctx = rav1e_context_new(cfg);
++ if (!ctx->ctx) {
++ av_log(avctx, AV_LOG_ERROR, "Failed to create rav1e encode context.\n");
++ ret = AVERROR_EXTERNAL;
++ goto end;
++ }
++
++ ret = 0;
++
++end:
++
++ rav1e_config_unref(cfg);
++
++ return ret;
++}
++
++static int librav1e_send_frame(AVCodecContext *avctx, const AVFrame *frame)
++{
++ librav1eContext *ctx = avctx->priv_data;
++ RaFrame *rframe = NULL;
++ int ret;
++
++ if (frame) {
++ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
++
++ rframe = rav1e_frame_new(ctx->ctx);
++ if (!rframe) {
++ av_log(avctx, AV_LOG_ERROR, "Could not allocate new rav1e frame.\n");
++ return AVERROR(ENOMEM);
++ }
++
++ for (int i = 0; i < desc->nb_components; i++) {
++ int shift = i ? desc->log2_chroma_h : 0;
++ int bytes = desc->comp[0].depth == 8 ? 1 : 2;
++ rav1e_frame_fill_plane(rframe, i, frame->data[i],
++ (frame->height >> shift) * frame->linesize[i],
++ frame->linesize[i], bytes);
++ }
++ }
++
++ ret = rav1e_send_frame(ctx->ctx, rframe);
++ if (rframe)
++ rav1e_frame_unref(rframe); /* No need to unref if flushing. */
++
++ switch (ret) {
++ case RA_ENCODER_STATUS_SUCCESS:
++ break;
++ case RA_ENCODER_STATUS_ENOUGH_DATA:
++ return AVERROR(EAGAIN);
++ case RA_ENCODER_STATUS_FAILURE:
++ av_log(avctx, AV_LOG_ERROR, "Could not send frame: %s\n", rav1e_status_to_str(ret));
++ return AVERROR_EXTERNAL;
++ default:
++ av_log(avctx, AV_LOG_ERROR, "Unknown return code %d from rav1e_send_frame: %s\n", ret, rav1e_status_to_str(ret));
++ return AVERROR_UNKNOWN;
++ }
++
++ return 0;
++}
++
++static int librav1e_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
++{
++ librav1eContext *ctx = avctx->priv_data;
++ RaPacket *rpkt = NULL;
++ int ret;
++
++retry:
++
++ if (avctx->flags & AV_CODEC_FLAG_PASS1) {
++ int sret = get_stats(avctx, 0);
++ if (sret < 0)
++ return sret;
++ } else if (avctx->flags & AV_CODEC_FLAG_PASS2) {
++ int sret = set_stats(avctx);
++ if (sret < 0)
++ return sret;
++ }
++
++ ret = rav1e_receive_packet(ctx->ctx, &rpkt);
++ switch (ret) {
++ case RA_ENCODER_STATUS_SUCCESS:
++ break;
++ case RA_ENCODER_STATUS_LIMIT_REACHED:
++ if (avctx->flags & AV_CODEC_FLAG_PASS1) {
++ int sret = get_stats(avctx, 1);
++ if (sret < 0)
++ return sret;
++ }
++ return AVERROR_EOF;
++ case RA_ENCODER_STATUS_ENCODED:
++ if (avctx->internal->draining)
++ goto retry;
++ return AVERROR(EAGAIN);
++ case RA_ENCODER_STATUS_NEED_MORE_DATA:
++ if (avctx->internal->draining) {
++ av_log(avctx, AV_LOG_ERROR, "Unexpected error when receiving packet after EOF.\n");
++ return AVERROR_EXTERNAL;
++ }
++ return AVERROR(EAGAIN);
++ case RA_ENCODER_STATUS_FAILURE:
++ av_log(avctx, AV_LOG_ERROR, "Could not encode frame: %s\n", rav1e_status_to_str(ret));
++ return AVERROR_EXTERNAL;
++ default:
++ av_log(avctx, AV_LOG_ERROR, "Unknown return code %d from rav1e_receive_packet: %s\n", ret, rav1e_status_to_str(ret));
++ return AVERROR_UNKNOWN;
++ }
++
++ ret = av_new_packet(pkt, rpkt->len);
++ if (ret < 0) {
++ av_log(avctx, AV_LOG_ERROR, "Could not allocate packet.\n");
++ rav1e_packet_unref(rpkt);
++ return ret;
++ }
++
++ memcpy(pkt->data, rpkt->data, rpkt->len);
++
++ if (rpkt->frame_type == RA_FRAME_TYPE_KEY)
++ pkt->flags |= AV_PKT_FLAG_KEY;
++
++ pkt->pts = pkt->dts = rpkt->input_frameno * avctx->ticks_per_frame;
++
++ if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
++ int ret = av_bsf_send_packet(ctx->bsf, pkt);
++ if (ret < 0) {
++ av_log(avctx, AV_LOG_ERROR, "extradata extraction send failed.\n");
++ rav1e_packet_unref(rpkt);
++ av_packet_unref(pkt);
++ return ret;
++ }
++
++ ret = av_bsf_receive_packet(ctx->bsf, pkt);
++ if (ret < 0) {
++ av_log(avctx, AV_LOG_ERROR, "extradata extraction receive failed.\n");
++ rav1e_packet_unref(rpkt);
++ av_packet_unref(pkt);
++ return ret;
++ }
++ }
++
++ return 0;
++}
++
++#define OFFSET(x) offsetof(librav1eContext, x)
++#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
++
++static const AVOption options[] = {
++ { "qp", "use constant quantizer mode", OFFSET(quantizer), AV_OPT_TYPE_INT, { .i64 = 100 }, -1, 255, VE },
++ { "speed", "what speed preset to use", OFFSET(speed), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 10, VE },
++ { "tiles", "number of tiles encode with", OFFSET(tiles), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE },
++ { "tile-rows", "number of tiles rows to encode with", OFFSET(tile_rows), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE },
++ { "tile-columns", "number of tiles columns to encode with", OFFSET(tile_cols), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE },
++ { "rav1e-params", "set the rav1e configuration using a :-separated list of key=value parameters", OFFSET(rav1e_opts), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
++ { NULL }
++};
++
++static const AVCodecDefault librav1e_defaults[] = {
++ { "b", "0" },
++ { "g", "0" },
++ { "keyint_min", "0" },
++ { "qmax", "-1" },
++ { "qmin", "-1" },
++ { NULL }
++};
++
++const enum AVPixelFormat librav1e_pix_fmts[] = {
++ AV_PIX_FMT_YUV420P,
++ AV_PIX_FMT_YUVJ420P,
++ AV_PIX_FMT_YUV420P10,
++ AV_PIX_FMT_YUV420P12,
++ AV_PIX_FMT_YUV422P,
++ AV_PIX_FMT_YUVJ422P,
++ AV_PIX_FMT_YUV422P10,
++ AV_PIX_FMT_YUV422P12,
++ AV_PIX_FMT_YUV444P,
++ AV_PIX_FMT_YUVJ444P,
++ AV_PIX_FMT_YUV444P10,
++ AV_PIX_FMT_YUV444P12,
++ AV_PIX_FMT_NONE
++};
++
++static const AVClass class = {
++ .class_name = "librav1e",
++ .item_name = av_default_item_name,
++ .option = options,
++ .version = LIBAVUTIL_VERSION_INT,
++};
++
++AVCodec ff_librav1e_encoder = {
++ .name = "librav1e",
++ .long_name = NULL_IF_CONFIG_SMALL("librav1e AV1"),
++ .type = AVMEDIA_TYPE_VIDEO,
++ .id = AV_CODEC_ID_AV1,
++ .init = librav1e_encode_init,
++ .send_frame = librav1e_send_frame,
++ .receive_packet = librav1e_receive_packet,
++ .close = librav1e_encode_close,
++ .priv_data_size = sizeof(librav1eContext),
++ .priv_class = &class,
++ .defaults = librav1e_defaults,
++ .pix_fmts = librav1e_pix_fmts,
++ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
++ .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
++ .wrapper_name = "librav1e",
++};
diff --git a/e47a95463116b17a6e96ef87e1341b5544747982.patch b/e47a95463116b17a6e96ef87e1341b5544747982.patch
new file mode 100644
index 0000000..2f301f2
--- /dev/null
+++ b/e47a95463116b17a6e96ef87e1341b5544747982.patch
@@ -0,0 +1,55 @@
+From e47a95463116b17a6e96ef87e1341b5544747982 Mon Sep 17 00:00:00 2001
+From: Marton Balint <cus@passwd.hu>
+Date: Wed, 25 Dec 2019 01:55:25 +0100
+Subject: [PATCH] avcodec/librav1e: use AV_OPT_TYPE_DICT for rav1e-params
+
+Signed-off-by: Marton Balint <cus@passwd.hu>
+---
+ libavcodec/librav1e.c | 19 +++++++------------
+ 1 file changed, 7 insertions(+), 12 deletions(-)
+
+diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c
+index a5aedd512cd..b8b1b4f8f12 100644
+--- a/libavcodec/librav1e.c
++++ b/libavcodec/librav1e.c
+@@ -42,7 +42,7 @@ typedef struct librav1eContext {
+ size_t pass_pos;
+ int pass_size;
+
+- char *rav1e_opts;
++ AVDictionary *rav1e_opts;
+ int quantizer;
+ int speed;
+ int tiles;
+@@ -244,17 +244,12 @@ static av_cold int librav1e_encode_init(AVCodecContext *avctx)
+ }
+ }
+
+- if (ctx->rav1e_opts) {
+- AVDictionary *dict = NULL;
++ {
+ AVDictionaryEntry *en = NULL;
+-
+- if (!av_dict_parse_string(&dict, ctx->rav1e_opts, "=", ":", 0)) {
+- while (en = av_dict_get(dict, "", en, AV_DICT_IGNORE_SUFFIX)) {
+- int parse_ret = rav1e_config_parse(cfg, en->key, en->value);
+- if (parse_ret < 0)
+- av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s.\n", en->key, en->value);
+- }
+- av_dict_free(&dict);
++ while ((en = av_dict_get(ctx->rav1e_opts, "", en, AV_DICT_IGNORE_SUFFIX))) {
++ int parse_ret = rav1e_config_parse(cfg, en->key, en->value);
++ if (parse_ret < 0)
++ av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s.\n", en->key, en->value);
+ }
+ }
+
+@@ -538,7 +533,7 @@ static const AVOption options[] = {
+ { "tiles", "number of tiles encode with", OFFSET(tiles), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE },
+ { "tile-rows", "number of tiles rows to encode with", OFFSET(tile_rows), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE },
+ { "tile-columns", "number of tiles columns to encode with", OFFSET(tile_cols), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE },
+- { "rav1e-params", "set the rav1e configuration using a :-separated list of key=value parameters", OFFSET(rav1e_opts), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
++ { "rav1e-params", "set the rav1e configuration using a :-separated list of key=value parameters", OFFSET(rav1e_opts), AV_OPT_TYPE_DICT, { 0 }, 0, 0, VE },
+ { NULL }
+ };
+
diff --git a/ffmpeg.spec b/ffmpeg.spec
index 3429688..37b879a 100644
--- a/ffmpeg.spec
+++ b/ffmpeg.spec
@@ -35,31 +35,38 @@
%bcond_without dlopen
%endif
-# OpenCL can speed up things and offload work to the GPU, but as of 2014/12/21
-# (Mesa 10.4.0, Xorg 1.6.3, Intel driver 2.99.917), it causes crashes on startup
+%ifarch %{riscv}
+%bcond_with opencl
+%else
%bcond_without opencl
+%endif
%bcond_without swscaler
%bcond_with faac
-# bootstrap
-# rebuild ffmpeg after MESA api upgrade
-# 1. rebuild ffmpeg with disabled opencv
-# 2. rebuild opencv with new ffmpeg
-# 3. rebuild ffmpeg again
-# 4. PROFIT
+
+%bcond_without bootstrap
+
+# OpenCV, Soxr and PulseAudio use ffmpeg - can't link to them
+# while bootstrapping...
+%if %{with bootstrap}
+%bcond_with opencv
+%bcond_with soxr
+%bcond_with pulse
+%else
%bcond_without opencv
+%bcond_without soxr
+%bcond_without pulse
+%endif
%bcond_without swscaler
# (tpg) use OpenMP
-# Also avoid lld for now
-# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219089
-%global optflags %{optflags} -Ofast -fopenmp -fuse-ld=gold
-%global ldflags %{ldflags} -Ofast -fopenmp -fuse-ld=gold
+%global optflags %{optflags} -Ofast -fopenmp
+%global ldflags %{ldflags} -Ofast -fopenmp
Summary: Hyper fast MPEG1/MPEG4/H263/H264/H265/RV and AC3/MPEG audio encoder
Name: ffmpeg
-Version: 4.2.1
-Release: 2
+Version: 4.2.2
+Release: 5
%if %{build_plf}
License: GPLv3+
%else
@@ -75,6 +82,13 @@ Patch1: ffmpeg-4.2-dlopen-faac-mp3lame-opencore-x264-x265-xvid.patch
Patch2: ffmpeg-1.0.1-time.h.patch
Patch3: ffmpeg-2.5-fix-build-with-flto-and-inline-assembly.patch
Patch5: ffmpeg-3.5.0-force_dl.patch
+# Add RAV1e support
+Patch6: https://github.com/FFmpeg/FFmpeg/commit/d8bf24459b694338de4ceb2a2e6d4d2949d6658d.patch
+Patch7: https://github.com/FFmpeg/FFmpeg/commit/3a84081cbd982ce1bd9456eca5b1b03cd495e0fe.patch
+Patch8: https://github.com/FFmpeg/FFmpeg/commit/1354c39c78e5ca1e8bfaf9b65ed021f672f0729f.patch
+Patch9: https://github.com/FFmpeg/FFmpeg/commit/846e26b8c93a313d9f0c1f7d4a2965b357482abf.patch
+Patch10: https://github.com/FFmpeg/FFmpeg/commit/e47a95463116b17a6e96ef87e1341b5544747982.patch
+Patch11: https://github.com/FFmpeg/FFmpeg/commit/c11b3253a4e6142ce7341dd4a1aaef075ad81c97.patch
BuildRequires: texi2html
BuildRequires: yasm
BuildRequires: pkgconfig(bzip2)
@@ -84,13 +98,17 @@ BuildRequires: pkgconfig(libjpeg)
BuildRequires: ladspa-devel
BuildRequires: pkgconfig(libgme)
BuildRequires: gomp-devel
+%ifnarch %{riscv}
BuildRequires: pkgconfig(caca)
+%endif
BuildRequires: pkgconfig(celt)
BuildRequires: pkgconfig(fontconfig)
%if !%{with dlopen} || "%{disttag}" == "mdk"
BuildRequires: pkgconfig(fdk-aac)
%endif
BuildRequires: pkgconfig(dav1d)
+BuildRequires: pkgconfig(rav1e)
+BuildRequires: pkgconfig(aom)
BuildRequires: pkgconfig(ffnvcodec)
BuildRequires: pkgconfig(freetype2)
BuildRequires: pkgconfig(gnutls)
@@ -98,7 +116,9 @@ BuildRequires: pkgconfig(gl)
BuildRequires: pkgconfig(jack)
BuildRequires: pkgconfig(libass)
BuildRequires: pkgconfig(libavc1394)
+%ifnarch %{riscv}
BuildRequires: pkgconfig(libbluray)
+%endif
BuildRequires: pkgconfig(libbs2b)
BuildRequires: pkgconfig(libcdio_paranoia)
BuildRequires: pkgconfig(libdc1394-2)
@@ -107,14 +127,18 @@ BuildRequires: pkgconfig(libilbc)
BuildRequires: pkgconfig(libmodplug)
BuildRequires: pkgconfig(libopenjp2)
BuildRequires: pkgconfig(libpng)
+%if %{with pulse}
BuildRequires: pkgconfig(libpulse)
+%endif
BuildRequires: pkgconfig(librtmp)
BuildRequires: pkgconfig(libssh)
BuildRequires: pkgconfig(libva)
BuildRequires: pkgconfig(libv4l2)
BuildRequires: pkgconfig(libwebp)
BuildRequires: pkgconfig(libzmq)
+%ifnarch %{riscv}
BuildRequires: pkgconfig(openal)
+%endif
%if %{with opencv}
BuildRequires: pkgconfig(opencv)
BuildRequires: pkgconfig(frei0r)
@@ -125,16 +149,22 @@ BuildRequires: pkgconfig(sdl2)
%if 0
BuildRequires: pkgconfig(shine)
%endif
+%if %{with soxr}
BuildRequires: pkgconfig(soxr)
+%endif
BuildRequires: pkgconfig(theora)
BuildRequires: pkgconfig(twolame)
BuildRequires: pkgconfig(vdpau)
+%ifnarch %{riscv}
BuildRequires: pkgconfig(vidstab)
-BuildRequires: pkgconfig(vorbis)
BuildRequires: pkgconfig(vpx)
+%endif
+BuildRequires: pkgconfig(vorbis)
BuildRequires: pkgconfig(wavpack)
BuildRequires: pkgconfig(xavs)
+%ifnarch %{riscv}
BuildRequires: pkgconfig(zvbi-0.2)
+%endif
BuildRequires: lame-devel
%if %{build_plf} || "%{disttag}" == "mdk"
BuildRequires: x264-devel >= 0.148
@@ -303,12 +333,21 @@ This package contains the static libraries for %{name}.
%endif
%patch3 -p1 -b .flto_inline_asm~
%patch5 -p1 -b .force_dl
+%patch6 -p1 -b .p6~
+%patch7 -p1 -b .p7~
+%patch8 -p1 -b .p8~
+%patch9 -p1 -b .p9~
+%patch10 -p1 -b .p10~
+%patch11 -p1 -b .p11~
# The debuginfo generator doesn't like non-world readable files
find . -name "*.c" -o -name "*.h" -o -name "*.asm" |xargs chmod 0644
# use headers from current packages in restricted repo
%build
+%ifarch %{ix86}
+%global ldflags %{ldflags} -Wl,-z,notext
+%endif
export CFLAGS="%{optflags} -fPIC -I/usr/include/openjpeg-2.2"
export LDFLAGS="%{ldflags}"
@@ -335,9 +374,13 @@ if ! ./configure \
--enable-gpl \
--enable-version3 \
--enable-nonfree \
+%ifnarch %{armx} %{arm} %{riscv}
--enable-nvenc \
+%endif
--enable-ffplay \
--enable-libdav1d \
+ --enable-librav1e \
+ --enable-libaom \
%ifarch %{ix86} %{x86_64}
--disable-lto \
%else
@@ -347,7 +390,9 @@ if ! ./configure \
--enable-libtheora \
--enable-libvorbis \
--disable-encoder=vorbis \
+%ifnarch %{riscv}
--enable-libvpx \
+%endif
--enable-runtime-cpudetect \
--enable-libdc1394 \
--enable-librtmp \
@@ -365,22 +410,33 @@ if ! ./configure \
--enable-libass \
--enable-gnutls \
--enable-libcdio \
+%if %{with pulse}
--enable-libpulse \
+%endif
--enable-libv4l2 \
+%ifnarch %{riscv}
--enable-openal \
+%endif
--enable-opengl \
--enable-libzmq \
+%ifnarch %{riscv}
--enable-libzvbi \
+%endif
--enable-libwavpack \
--enable-libssh \
+%if %{with soxr}
--enable-libsoxr \
+%endif
--enable-libtwolame \
--enable-libopus \
--enable-libilbc \
--enable-libiec61883 \
--enable-libgme \
+%ifnarch %{riscv}
--enable-libcaca \
--enable-libbluray \
+ --enable-libvidstab \
+%endif
--enable-ladspa \
--enable-libwebp \
--enable-avisynth \
@@ -388,7 +444,6 @@ if ! ./configure \
%if 0
--enable-libshine \
%endif
- --enable-libvidstab \
--enable-libflite \
--enable-libxcb \
--enable-libxcb-shm \