From 54f9913222a510f756b844f382165b5ca267e43e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Mon, 10 Oct 2022 14:31:14 +0200 Subject: [PATCH] Set an update option to supress a warning with ffmpeg-5.1 --- ...ption-to-suppress-the-ffmpeg-5.1-war.patch | 44 +++++++++++++++ ...oc_output_context2-to-create-the-out.patch | 55 +++++++++++++++++++ unpaper.spec | 13 ++++- 3 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 unpaper-7.0.0-Set-the-update-option-to-suppress-the-ffmpeg-5.1-war.patch create mode 100644 unpaper-7.0.0-Use-avformat_alloc_output_context2-to-create-the-out.patch diff --git a/unpaper-7.0.0-Set-the-update-option-to-suppress-the-ffmpeg-5.1-war.patch b/unpaper-7.0.0-Set-the-update-option-to-suppress-the-ffmpeg-5.1-war.patch new file mode 100644 index 0000000..f8eb9be --- /dev/null +++ b/unpaper-7.0.0-Set-the-update-option-to-suppress-the-ffmpeg-5.1-war.patch @@ -0,0 +1,44 @@ +From a2a88fe837fd6770ac94f08b2eb841f0dc9d2430 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= +Date: Sat, 8 Oct 2022 10:14:46 +0100 +Subject: [PATCH] Set the `update` option to suppress the ffmpeg 5.1 warning. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This addresses Issue #113, the spurious warning coming from ffmpeg 5.1+ +about the filename not being an image sequence (we do our own sequencing +so we do not want it to be seen by ffmpeg at all!) + +Signed-off-by: Petr Písař +--- + file.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/file.c b/file.c +index fc24a4c..53ef727 100644 +--- a/file.c ++++ b/file.c +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + + #include "tools.h" + #include "unpaper.h" +@@ -142,6 +143,11 @@ void saveImage(char *filename, AVFrame *input, int outputPixFmt) { + errOutput("unable to allocate output context."); + } + ++ if ((ret = av_opt_set(out_ctx->priv_data, "update", "true", 0)) < 0) { ++ av_strerror(ret, errbuff, sizeof(errbuff)); ++ errOutput("unable to configure update option: %s", errbuff); ++ } ++ + switch (outputPixFmt) { + case AV_PIX_FMT_RGB24: + output_codec = AV_CODEC_ID_PPM; +-- +2.37.3 + diff --git a/unpaper-7.0.0-Use-avformat_alloc_output_context2-to-create-the-out.patch b/unpaper-7.0.0-Use-avformat_alloc_output_context2-to-create-the-out.patch new file mode 100644 index 0000000..b388b1f --- /dev/null +++ b/unpaper-7.0.0-Use-avformat_alloc_output_context2-to-create-the-out.patch @@ -0,0 +1,55 @@ +From d29fd2cf84ea386c67ecb0302adebc0700088d94 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= +Date: Sat, 8 Oct 2022 00:16:20 +0100 +Subject: [PATCH] Use avformat_alloc_output_context2() to create the out + context. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This simplifies the API usage quite a bit, while maintaining the same +logic as previously. + +Signed-off-by: Petr Písař +--- + file.c | 14 ++------------ + 1 file changed, 2 insertions(+), 12 deletions(-) + +diff --git a/file.c b/file.c +index d9c239e..fc24a4c 100644 +--- a/file.c ++++ b/file.c +@@ -127,7 +127,6 @@ void loadImage(const char *filename, AVFrame **image) { + * @return true on success, false on failure + */ + void saveImage(char *filename, AVFrame *input, int outputPixFmt) { +- const AVOutputFormat *fmt = NULL; + enum AVCodecID output_codec = -1; + const AVCodec *codec; + AVFormatContext *out_ctx; +@@ -138,20 +137,11 @@ void saveImage(char *filename, AVFrame *input, int outputPixFmt) { + int ret; + char errbuff[1024]; + +- fmt = av_guess_format("image2", NULL, NULL); +- +- if (!fmt) { +- errOutput("could not find suitable output fmt."); +- } +- +- out_ctx = avformat_alloc_context(); +- if (!out_ctx) { ++ if (avformat_alloc_output_context2(&out_ctx, NULL, "image2", filename) < 0 || ++ out_ctx == NULL) { + errOutput("unable to allocate output context."); + } + +- out_ctx->oformat = fmt; +- out_ctx->url = av_strdup(filename); +- + switch (outputPixFmt) { + case AV_PIX_FMT_RGB24: + output_codec = AV_CODEC_ID_PPM; +-- +2.37.3 + diff --git a/unpaper.spec b/unpaper.spec index 73aeec7..e032a8e 100644 --- a/unpaper.spec +++ b/unpaper.spec @@ -1,6 +1,6 @@ Name: unpaper Version: 7.0.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Post-processing of scanned and photocopied book pages # AUTHORS: GPLv2 # constants.h: GPLv2 @@ -42,6 +42,14 @@ Source0: https://www.flameeyes.eu/files/%{name}-%{version}.tar.xz #Source1: https://www.flameeyes.eu/files/%%{name}-%%{version}.tar.xz.sig ## A key exported from keyserver on 2022-02-25. #Source2: gpgkey-BDAEF3008A1CC62079C2A16847664B94E36B629F.gpg +# 1/2Set an update option to supress a warning with ffmpeg-5.1, +# in upstream after 7.0.0, +# +Patch0: unpaper-7.0.0-Use-avformat_alloc_output_context2-to-create-the-out.patch +# 2/2 Set an update option to supress a warning with ffmpeg-5.1, +# in upstream after 7.0.0, +# +Patch1: unpaper-7.0.0-Set-the-update-option-to-suppress-the-ffmpeg-5.1-war.patch BuildRequires: gcc #BuildRequires: gnupg2 BuildRequires: meson >= 0.57 @@ -122,6 +130,9 @@ chmod +x %{buildroot}%{_libexecdir}/%{name}/test %{_libexecdir}/%{name} %changelog +* Mon Oct 10 2022 Petr Pisar - 7.0.0-4 +- Set an update option to supress a warning with ffmpeg-5.1 (upstream #113) + * Mon Aug 29 2022 Neal Gompa - 7.0.0-3 - Rebuild for ffmpeg 5.1 (#2121070)