[arch-commits] Commit in unpaper/trunk (PKGBUILD ffmpeg5.patch)
Antonio Rojas
arojas at gemini.archlinux.org
Mon Mar 14 08:23:08 UTC 2022
Date: Monday, March 14, 2022 @ 08:23:07
Author: arojas
Revision: 1152158
Use upstream ffmpeg5 patch (FS#73972)
Modified:
unpaper/trunk/PKGBUILD
Deleted:
unpaper/trunk/ffmpeg5.patch
---------------+
PKGBUILD | 6 -
ffmpeg5.patch | 225 --------------------------------------------------------
2 files changed, 3 insertions(+), 228 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2022-03-14 07:45:32 UTC (rev 1152157)
+++ PKGBUILD 2022-03-14 08:23:07 UTC (rev 1152158)
@@ -3,17 +3,17 @@
pkgname=unpaper
pkgver=6.1
-pkgrel=8
+pkgrel=9
pkgdesc="post-processing tool for scanned sheets of paper"
arch=('x86_64')
url="https://github.com/Flameeyes/unpaper"
license=("GPL")
depends=('ffmpeg')
-makedepends=('libxslt')
+makedepends=('libxslt' 'docbook-xsl')
source=("$pkgname-${pkgver}.tar.gz::https://github.com/Flameeyes/unpaper/archive/unpaper-$pkgver.tar.gz"
ffmpeg5.patch)
sha256sums=('213f8143b3361dde3286537eb66aaf7cdd7e4f5e7bde42ac6e91020997a81f1d'
- '4bc67a04e5305c983dc973ef99628259a0f93e7b153ff4996bd73ece3c7698b1')
+ 'f0d2d96ce399acb41ab8392855f857fcd0e3b1e5d869bb5753a90633c4dfb977')
prepare() {
cd "$srcdir"/unpaper-unpaper-$pkgver
Deleted: ffmpeg5.patch
===================================================================
--- ffmpeg5.patch 2022-03-14 07:45:32 UTC (rev 1152157)
+++ ffmpeg5.patch 2022-03-14 08:23:07 UTC (rev 1152158)
@@ -1,225 +0,0 @@
-diff --git a/file.c b/file.c
-index c92994d..f75dc82 100644
---- a/file.c
-+++ b/file.c
-@@ -19,11 +19,9 @@
-
- /* --- tool functions for file handling ------------------------------------ */
-
--#include <stdlib.h>
- #include <stdint.h>
- #include <stdio.h>
- #include <string.h>
--#include <assert.h>
-
- #include <libavcodec/avcodec.h>
- #include <libavformat/avformat.h>
-@@ -40,17 +38,14 @@
- * @param type returns the type of the loaded image
- */
- void loadImage(const char *filename, AVFrame **image) {
-- int ret, got_frame = 0;
- AVFormatContext *s = NULL;
-- AVCodecContext *avctx = avcodec_alloc_context3(NULL);
-- AVCodec *codec;
-+ AVCodecContext *ctx = NULL;
-+ const AVCodec *codec = NULL;
- AVPacket pkt;
- AVFrame *frame = av_frame_alloc();
-+ int ret;
- char errbuff[1024];
-
-- if (!avctx)
-- errOutput("cannot allocate a new context");
--
- ret = avformat_open_input(&s, filename, NULL, NULL);
- if (ret < 0) {
- av_strerror(ret, errbuff, sizeof(errbuff));
-@@ -65,20 +60,23 @@ void loadImage(const char *filename, AVFrame **image) {
- if (s->nb_streams < 1)
- errOutput("unable to open file %s: missing streams", filename);
-
-- if (s->streams[0]->codec->codec_type != AVMEDIA_TYPE_VIDEO)
-- errOutput("unable to open file %s: wrong stream", filename);
-+ codec = avcodec_find_decoder(s->streams[0]->codecpar->codec_id);
-+ if (!codec) {
-+ errOutput("unable to open file %s: unsupported format", filename);
-+ }
-
-- ret = avcodec_copy_context(avctx, s->streams[0]->codec);
-- if (ret < 0) {
-- av_strerror(ret, errbuff, sizeof(errbuff));
-- errOutput("cannot set the new context for %s: %s", filename, errbuff);
-+ ctx = avcodec_alloc_context3(codec);
-+ if (!ctx) {
-+ errOutput("cannot allocate decoder context for %s", filename);
- }
-
-- codec = avcodec_find_decoder(avctx->codec_id);
-- if (!codec)
-- errOutput("unable to open file %s: unsupported format", filename);
-+ ret = avcodec_parameters_to_context(ctx, s->streams[0]->codecpar);
-+ if (ret < 0) {
-+ av_strerror(ret, errbuff, sizeof errbuff);
-+ errOutput("unable to copy parameters to context: %s", errbuff);
-+ }
-
-- ret = avcodec_open2(avctx, codec, NULL);
-+ ret = avcodec_open2(ctx, codec, NULL);
- if (ret < 0) {
- av_strerror(ret, errbuff, sizeof(errbuff));
- errOutput("unable to open file %s: %s", filename, errbuff);
-@@ -93,10 +91,16 @@ void loadImage(const char *filename, AVFrame **image) {
- if (pkt.stream_index != 0)
- errOutput("unable to open file %s: invalid stream.", filename);
-
-- ret = avcodec_decode_video2(avctx, frame, &got_frame, &pkt);
-+ ret = avcodec_send_packet(ctx, &pkt);
- if (ret < 0) {
-- av_strerror(ret, errbuff, sizeof(errbuff));
-- errOutput("unable to open file %s: %s", filename, errbuff);
-+ av_strerror(ret, errbuff, sizeof errbuff);
-+ errOutput("cannot send packet to decoder: %s", errbuff);
-+ }
-+
-+ ret = avcodec_receive_frame(ctx, frame);
-+ if (ret < 0) {
-+ av_strerror(ret, errbuff, sizeof errbuff);
-+ errOutput("error while receiving frame from decoder: %s", errbuff);
- }
-
- switch(frame->format) {
-@@ -123,6 +127,7 @@ void loadImage(const char *filename, AVFrame **image) {
- default:
- errOutput("unable to open file %s: unsupported pixel format", filename);
- }
-+ avcodec_free_context(&ctx);
- }
-
-
-@@ -135,12 +140,13 @@ void loadImage(const char *filename, AVFrame **image) {
- * @return true on success, false on failure
- */
- void saveImage(char *filename, AVFrame *image, int outputPixFmt) {
-- AVOutputFormat *fmt = NULL;
-- enum AVCodecID output_codec = -1;
-- AVCodec *codec;
-- AVFormatContext *out_ctx;
-- AVCodecContext *codec_ctx;
-- AVStream *video_st;
-+ const AVOutputFormat *fmt = NULL;
-+ enum AVCodecID output_codec;
-+ const AVCodec *codec = NULL;
-+ AVFormatContext *out_ctx = NULL;
-+ AVCodecContext *codec_ctx = NULL;
-+ AVStream *video_st = NULL;
-+ AVPacket *pkt = NULL;
- int ret;
- char errbuff[1024];
-
-@@ -156,7 +162,7 @@ void saveImage(char *filename, AVFrame *image, int outputPixFmt) {
- }
-
- out_ctx->oformat = fmt;
-- snprintf(out_ctx->filename, sizeof(out_ctx->filename), "%s", filename);
-+ out_ctx->url = av_strdup(filename);
-
- switch (outputPixFmt) {
- case AV_PIX_FMT_RGB24:
-@@ -193,10 +199,17 @@ void saveImage(char *filename, AVFrame *image, int outputPixFmt) {
- errOutput("could not alloc output stream");
- }
-
-- codec_ctx = video_st->codec;
-+ codec_ctx = avcodec_alloc_context3(codec);
-+ if (!codec_ctx) {
-+ errOutput("could not alloc codec context");
-+ }
-+
- codec_ctx->width = image->width;
- codec_ctx->height = image->height;
- codec_ctx->pix_fmt = image->format;
-+ video_st->codecpar->width = image->width;
-+ video_st->codecpar->height = image->height;
-+ video_st->codecpar->format = image->format;
- video_st->time_base.den = codec_ctx->time_base.den = 1;
- video_st->time_base.num = codec_ctx->time_base.num = 1;
-
-@@ -210,33 +223,38 @@ void saveImage(char *filename, AVFrame *image, int outputPixFmt) {
- if (verbose >= VERBOSE_MORE)
- av_dump_format(out_ctx, 0, filename, 1);
-
-- if (avio_open(&out_ctx->pb, filename, AVIO_FLAG_WRITE) < 0) {
-- errOutput("could not open '%s'", filename);
-+ if ((ret = avio_open(&out_ctx->pb, filename, AVIO_FLAG_WRITE)) < 0) {
-+ av_strerror(ret, errbuff, sizeof errbuff);
-+ errOutput("cannot alloc I/O context for %s: %s", filename, errbuff);
- }
-
-- avformat_write_header(out_ctx, NULL);
-+ if ((ret = avformat_write_header(out_ctx, NULL)) < 0) {
-+ av_strerror(ret, errbuff, sizeof errbuff);
-+ errOutput("error writing header to '%s': %s", filename, errbuff);
-
-- AVPacket pkt = { 0 };
-- int got_packet;
-- av_init_packet(&pkt);
-+ pkt = av_packet_alloc();
-+ if (!pkt) {
-+ errOutput("unable to allocate output packet");
-+ }
-
-- /* encode the image */
-- ret = avcodec_encode_video2(video_st->codec, &pkt, image, &got_packet);
-+ ret = avcodec_send_frame(codec_ctx, image);
-+ if (ret < 0) {
-+ av_strerror(ret, errbuff, sizeof errbuff);
-+ errOutput("unable to send frame to encoder: %s", errbuff);
-+ }
-
-+ ret = avcodec_receive_packet(codec_ctx, pkt);
- if (ret < 0) {
- av_strerror(ret, errbuff, sizeof(errbuff));
- errOutput("unable to write file %s: %s", filename, errbuff);
- }
-- av_write_frame(out_ctx, &pkt);
-+ av_write_frame(out_ctx, pkt);
-
- av_write_trailer(out_ctx);
-- avcodec_close(codec_ctx);
--
-- av_free(codec_ctx);
-- av_free(video_st);
--
-- avio_close(out_ctx->pb);
-- av_free(out_ctx);
-+ av_packet_free(&pkt);
-+ avcodec_free_context(&codec_ctx);
-+ avformat_free_context(out_ctx);
-+ }
- }
-
- /**
-diff --git a/unpaper.c b/unpaper.c
-index d3d91ad..0220f70 100644
---- a/unpaper.c
-+++ b/unpaper.c
-@@ -28,8 +28,6 @@
-
- #include <sys/stat.h>
-
--#include <libavcodec/avcodec.h>
--#include <libavformat/avformat.h>
- #include <libavutil/avutil.h>
-
- #include "unpaper.h"
-@@ -944,9 +942,6 @@ int main(int argc, char* argv[]) {
- deskewScanStepRad = degreesToRadians(deskewScanStep);
- deskewScanDeviationRad = degreesToRadians(deskewScanDeviation);
-
-- avcodec_register_all();
-- av_register_all();
--
- for (int nr = startSheet; (endSheet == -1) || (nr <= endSheet); nr++) {
- char inputFilesBuffer[2][255];
- char outputFilesBuffer[2][255];
More information about the arch-commits
mailing list