Set an update option to supress a warning with ffmpeg-5.1
This commit is contained in:
parent
52fb09cf39
commit
54f9913222
|
@ -0,0 +1,44 @@
|
||||||
|
From a2a88fe837fd6770ac94f08b2eb841f0dc9d2430 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= <flameeyes@flameeyes.com>
|
||||||
|
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ř <ppisar@redhat.com>
|
||||||
|
---
|
||||||
|
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 <libavcodec/avcodec.h>
|
||||||
|
#include <libavformat/avformat.h>
|
||||||
|
#include <libavutil/avutil.h>
|
||||||
|
+#include <libavutil/opt.h>
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
From d29fd2cf84ea386c67ecb0302adebc0700088d94 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= <flameeyes@flameeyes.com>
|
||||||
|
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ř <ppisar@redhat.com>
|
||||||
|
---
|
||||||
|
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
|
||||||
|
|
13
unpaper.spec
13
unpaper.spec
|
@ -1,6 +1,6 @@
|
||||||
Name: unpaper
|
Name: unpaper
|
||||||
Version: 7.0.0
|
Version: 7.0.0
|
||||||
Release: 3%{?dist}
|
Release: 4%{?dist}
|
||||||
Summary: Post-processing of scanned and photocopied book pages
|
Summary: Post-processing of scanned and photocopied book pages
|
||||||
# AUTHORS: GPLv2
|
# AUTHORS: GPLv2
|
||||||
# constants.h: 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
|
#Source1: https://www.flameeyes.eu/files/%%{name}-%%{version}.tar.xz.sig
|
||||||
## A key exported from keyserver <hkp://pgp.surfnet.nl> on 2022-02-25.
|
## A key exported from keyserver <hkp://pgp.surfnet.nl> on 2022-02-25.
|
||||||
#Source2: gpgkey-BDAEF3008A1CC62079C2A16847664B94E36B629F.gpg
|
#Source2: gpgkey-BDAEF3008A1CC62079C2A16847664B94E36B629F.gpg
|
||||||
|
# 1/2Set an update option to supress a warning with ffmpeg-5.1,
|
||||||
|
# in upstream after 7.0.0,
|
||||||
|
# <https://github.com/unpaper/unpaper/issues/113>
|
||||||
|
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,
|
||||||
|
# <https://github.com/unpaper/unpaper/issues/113>
|
||||||
|
Patch1: unpaper-7.0.0-Set-the-update-option-to-suppress-the-ffmpeg-5.1-war.patch
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
#BuildRequires: gnupg2
|
#BuildRequires: gnupg2
|
||||||
BuildRequires: meson >= 0.57
|
BuildRequires: meson >= 0.57
|
||||||
|
@ -122,6 +130,9 @@ chmod +x %{buildroot}%{_libexecdir}/%{name}/test
|
||||||
%{_libexecdir}/%{name}
|
%{_libexecdir}/%{name}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Oct 10 2022 Petr Pisar <ppisar@redhat.com> - 7.0.0-4
|
||||||
|
- Set an update option to supress a warning with ffmpeg-5.1 (upstream #113)
|
||||||
|
|
||||||
* Mon Aug 29 2022 Neal Gompa <ngompa@fedoraproject.org> - 7.0.0-3
|
* Mon Aug 29 2022 Neal Gompa <ngompa@fedoraproject.org> - 7.0.0-3
|
||||||
- Rebuild for ffmpeg 5.1 (#2121070)
|
- Rebuild for ffmpeg 5.1 (#2121070)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue