Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fix up the ffmpeg-compat-57 aur package
From 42bdc704f057c287eb7cfcb1bbf5fd55db663d03 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klemens=20Sch=C3=B6lhorn?= <klemens@schoelhorn.eu>
Date: Wed, 23 May 2018 02:44:06 +0200
Subject: [PATCH] Update to ffmpeg 3.4.2
---
PKGBUILD | 82 ++++++++++++++++++----------------
ffmpeg-openjpeg2.2.patch | 95 ----------------------------------------
fs56089.patch | 84 +++++++++++++++++++++++++++++++++++
3 files changed, 129 insertions(+), 132 deletions(-)
delete mode 100644 ffmpeg-openjpeg2.2.patch
create mode 100644 fs56089.patch
diff --git a/PKGBUILD b/PKGBUILD
index 52322a3..89fd229 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,50 +1,62 @@
# Maintainer: Muflone http://www.muflone.com/contacts/english/
pkgname=ffmpeg-compat-57
-pkgver=3.3.4
-pkgrel=2
+pkgver=3.4.2
+pkgrel=1
pkgdesc="Compatibility package for ffmpeg to provide versions 57 of libavcodec, libavdevice and libavformat, not anymore provided by the ffmpeg package"
arch=('i686' 'x86_64')
url="http://ffmpeg.org/"
license=('GPL')
-depends=('bzip2' 'fribidi' 'glibc' 'gmp' 'gnutls' 'gsm'
- 'lame' 'libmodplug'
- 'libtheora' 'libva'
- 'libwebp' 'opencore-amr' 'openjpeg2' 'opus'
- 'schroedinger' 'speex' 'v4l-utils' 'xz' 'zlib'
- 'libbluray.so>=2-64'
- 'libvorbisenc.so>=2-64' 'libvorbis.so>=0-64' 'libvpx.so>=5-64'
- 'libx264.so>=152-64' 'libx265.so>=146-64' 'libxvidcore.so>=4-64'
- 'rtmpdump')
-makedepends=('yasm')
-provides=('libavcodec.so=57' 'libavdevice.so=57' 'libavformat.so=57' 'libavutils.so=55')
+depends=('alsa-lib' 'bzip2' 'fontconfig' 'fribidi' 'glibc' 'gmp' 'gnutls' 'gsm'
+ 'jack' 'lame' 'libavc1394' 'libiec61883' 'libmodplug' 'libpulse'
+ 'libraw1394' 'libsoxr' 'libssh' 'libtheora' 'libvdpau' 'libwebp'
+ 'libx11' 'libxcb' 'libxml2' 'opencore-amr' 'openjpeg2' 'opus' 'sdl2'
+ 'speex' 'v4l-utils' 'xz' 'zlib'
+ 'libomxil-bellagio'
+ 'libass.so' 'libbluray.so' 'libfreetype.so' 'libva-drm.so' 'libva.so'
+ 'libva-x11.so' 'libvidstab.so' 'libvorbisenc.so' 'libvorbis.so'
+ 'libvpx.so' 'libx264.so' 'libx265.so' 'libxvidcore.so')
+makedepends=('yasm' 'libvdpau')
+provides=('libavcodec.so=57' 'libavdevice.so=57' 'libavfilter.so=6'
+ 'libavformat.so=57' 'libavresample.so=3' 'libavutil.so=55'
+ 'libpostproc.so=54' 'libswresample.so=2' 'libswscale.so=4')
source=("http://ffmpeg.org/releases/ffmpeg-${pkgver}.tar.xz"{,.asc}
- "ffmpeg-openjpeg2.2.patch")
-sha256sums=('98b97e1b908dfeb6aeb6d407e5a5eacdfc253a40c2d195f5867ed2d1d46ea957'
+ "fs56089.patch")
+sha256sums=('2b92e9578ef8b3e49eeab229e69305f5f4cbc1fdaa22e927fc7fca18acccd740'
'SKIP'
- '490598f78d7879af8ef5b8d7f92ada83d0ee64f9609f6c7b989eb331c2539f68')
+ '0bfcd12d1992903f21c146ae56d9ad89b52818cfb2303197ee905347c25a5427')
validpgpkeys=('FCF986EA15E6E293A5644F10B4322F04D67658D8')
prepare() {
cd "ffmpeg-${pkgver}"
- patch -Np1 -i ../ffmpeg-openjpeg2.2.patch
+
+ # https://bugs.archlinux.org/task/56089
+ # Backport of http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=a606f27f4c610708fa96e35eed7b7537d3d8f712
+ patch -Np1 -i ../fs56089.patch
}
build() {
- cd "ffmpeg-${pkgver}"
+ cd ffmpeg-${pkgver}
+
./configure \
- --prefix=/usr \
- --incdir="/usr/include" \
- --shlibdir="/usr/lib" \
- --libdir="/usr/lib" \
+ --prefix='/usr' \
--disable-debug \
+ --disable-doc \
+ --disable-programs \
--disable-static \
- --disable-fontconfig \
+ --disable-stripping \
+ --enable-avisynth \
+ --enable-avresample \
+ --enable-fontconfig \
+ --enable-gmp \
+ --enable-gnutls \
--enable-gpl \
--enable-libass \
--enable-libbluray \
--enable-libfreetype \
+ --enable-libfribidi \
--enable-libgsm \
+ --enable-libiec61883 \
--enable-libmodplug \
--enable-libmp3lame \
--enable-libopencore_amrnb \
@@ -52,34 +64,30 @@ build() {
--enable-libopenjpeg \
--enable-libopus \
--enable-libpulse \
- --enable-librtmp \
- --enable-libschroedinger \
+ --enable-libsoxr \
--enable-libspeex \
+ --enable-libssh \
--enable-libtheora \
--enable-libv4l2 \
+ --enable-libvidstab \
--enable-libvorbis \
--enable-libvpx \
+ --enable-libwebp \
--enable-libx264 \
--enable-libx265 \
+ --enable-libxcb \
+ --enable-libxml2 \
--enable-libxvid \
- --enable-runtime-cpudetect \
--enable-shared \
- --enable-vdpau \
- --enable-version3 \
- --disable-doc \
- --disable-programs \
- --disable-avresample \
- --disable-avfilter \
- --disable-postproc \
- --disable-swresample \
- --disable-swscale
+ --enable-version3
+
make
}
package() {
- cd "ffmpeg-${pkgver}"
+ cd ffmpeg-${pkgver}
+
make DESTDIR="${pkgdir}" install-libs
cd "${pkgdir}/usr/lib"
rm -f *.so
}
-
diff --git a/ffmpeg-openjpeg2.2.patch b/ffmpeg-openjpeg2.2.patch
deleted file mode 100644
index d23c914..0000000
--- a/ffmpeg-openjpeg2.2.patch
+++ /dev/null
@@ -1,95 +0,0 @@
-diff -rupN ffmpeg-3.3.3.orig/configure ffmpeg-3.3.3/configure
---- ffmpeg-3.3.3.orig/configure 2017-07-29 19:49:29.000000000 +0200
-+++ ffmpeg-3.3.3/configure 2017-08-15 13:21:28.782566614 +0200
-@@ -1875,6 +1875,7 @@ HEADERS_LIST="
- machine_ioctl_meteor_h
- malloc_h
- opencv2_core_core_c_h
-+ openjpeg_2_2_openjpeg_h
- openjpeg_2_1_openjpeg_h
- openjpeg_2_0_openjpeg_h
- openjpeg_1_5_openjpeg_h
-@@ -5805,7 +5806,9 @@ enabled libopencv && { check_hea
- require opencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
- require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader; }
- enabled libopenh264 && require_pkg_config openh264 wels/codec_api.h WelsGetCodecVersion
--enabled libopenjpeg && { { check_lib openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
-+enabled libopenjpeg && { { check_lib openjpeg-2.2/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
-+ check_lib openjpeg-2.2/openjpeg.h opj_version -lopenjp2 ||
-+ { check_lib openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
- check_lib openjpeg-2.1/openjpeg.h opj_version -lopenjp2 ||
- { check_lib openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
- { check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
-diff -rupN ffmpeg-3.3.3.orig/libavcodec/libopenjpegdec.c ffmpeg-3.3.3/libavcodec/libopenjpegdec.c
---- ffmpeg-3.3.3.orig/libavcodec/libopenjpegdec.c 2017-07-29 19:49:30.000000000 +0200
-+++ ffmpeg-3.3.3/libavcodec/libopenjpegdec.c 2017-08-15 13:21:28.869233484 +0200
-@@ -34,7 +34,9 @@
- #include "internal.h"
- #include "thread.h"
-
--#if HAVE_OPENJPEG_2_1_OPENJPEG_H
-+#if HAVE_OPENJPEG_2_2_OPENJPEG_H
-+# include <openjpeg-2.2/openjpeg.h>
-+#elif HAVE_OPENJPEG_2_1_OPENJPEG_H
- # include <openjpeg-2.1/openjpeg.h>
- #elif HAVE_OPENJPEG_2_0_OPENJPEG_H
- # include <openjpeg-2.0/openjpeg.h>
-@@ -44,7 +46,7 @@
- # include <openjpeg.h>
- #endif
-
--#if HAVE_OPENJPEG_2_1_OPENJPEG_H || HAVE_OPENJPEG_2_0_OPENJPEG_H
-+#if HAVE_OPENJPEG_2_2_OPENJPEG_H || HAVE_OPENJPEG_2_1_OPENJPEG_H || HAVE_OPENJPEG_2_0_OPENJPEG_H
- # define OPENJPEG_MAJOR_VERSION 2
- # define OPJ(x) OPJ_##x
- #else
-@@ -429,7 +431,7 @@ static int libopenjpeg_decode_frame(AVCo
- opj_stream_set_read_function(stream, stream_read);
- opj_stream_set_skip_function(stream, stream_skip);
- opj_stream_set_seek_function(stream, stream_seek);
--#if HAVE_OPENJPEG_2_1_OPENJPEG_H
-+#if HAVE_OPENJPEG_2_2_OPENJPEG_H || HAVE_OPENJPEG_2_1_OPENJPEG_H
- opj_stream_set_user_data(stream, &reader, NULL);
- #elif HAVE_OPENJPEG_2_0_OPENJPEG_H
- opj_stream_set_user_data(stream, &reader);
-diff -rupN ffmpeg-3.3.3.orig/libavcodec/libopenjpegenc.c ffmpeg-3.3.3/libavcodec/libopenjpegenc.c
---- ffmpeg-3.3.3.orig/libavcodec/libopenjpegenc.c 2017-07-29 19:49:30.000000000 +0200
-+++ ffmpeg-3.3.3/libavcodec/libopenjpegenc.c 2017-08-15 13:21:28.869233484 +0200
-@@ -32,7 +32,9 @@
- #include "avcodec.h"
- #include "internal.h"
-
--#if HAVE_OPENJPEG_2_1_OPENJPEG_H
-+#if HAVE_OPENJPEG_2_2_OPENJPEG_H
-+# include <openjpeg-2.2/openjpeg.h>
-+#elif HAVE_OPENJPEG_2_1_OPENJPEG_H
- # include <openjpeg-2.1/openjpeg.h>
- #elif HAVE_OPENJPEG_2_0_OPENJPEG_H
- # include <openjpeg-2.0/openjpeg.h>
-@@ -42,7 +44,7 @@
- # include <openjpeg.h>
- #endif
-
--#if HAVE_OPENJPEG_2_1_OPENJPEG_H || HAVE_OPENJPEG_2_0_OPENJPEG_H
-+#if HAVE_OPENJPEG_2_2_OPENJPEG_H || HAVE_OPENJPEG_2_1_OPENJPEG_H || HAVE_OPENJPEG_2_0_OPENJPEG_H
- # define OPENJPEG_MAJOR_VERSION 2
- # define OPJ(x) OPJ_##x
- #else
-@@ -305,7 +307,7 @@ static av_cold int libopenjpeg_encode_in
-
- opj_set_default_encoder_parameters(&ctx->enc_params);
-
--#if HAVE_OPENJPEG_2_1_OPENJPEG_H
-+#if HAVE_OPENJPEG_2_2_OPENJPEG_H || HAVE_OPENJPEG_2_1_OPENJPEG_H
- switch (ctx->cinema_mode) {
- case OPJ_CINEMA2K_24:
- ctx->enc_params.rsiz = OPJ_PROFILE_CINEMA_2K;
-@@ -769,7 +771,7 @@ static int libopenjpeg_encode_frame(AVCo
- opj_stream_set_write_function(stream, stream_write);
- opj_stream_set_skip_function(stream, stream_skip);
- opj_stream_set_seek_function(stream, stream_seek);
--#if HAVE_OPENJPEG_2_1_OPENJPEG_H
-+#if HAVE_OPENJPEG_2_2_OPENJPEG_H || HAVE_OPENJPEG_2_1_OPENJPEG_H
- opj_stream_set_user_data(stream, &writer, NULL);
- #elif HAVE_OPENJPEG_2_0_OPENJPEG_H
- opj_stream_set_user_data(stream, &writer);
diff --git a/fs56089.patch b/fs56089.patch
new file mode 100644
index 0000000..6aca38f
--- /dev/null
+++ b/fs56089.patch
@@ -0,0 +1,84 @@
+diff -rupN ffmpeg-3.4.orig/libavformat/aviobuf.c ffmpeg-3.4/libavformat/aviobuf.c
+--- ffmpeg-3.4.orig/libavformat/aviobuf.c 2017-11-02 14:57:16.078834563 +0100
++++ ffmpeg-3.4/libavformat/aviobuf.c 2017-11-02 15:02:52.549816990 +0100
+@@ -531,6 +531,24 @@ void avio_write_marker(AVIOContext *s, i
+ s->last_time = time;
+ }
+
++static int read_packet_wrapper(AVIOContext *s, uint8_t *buf, int size)
++{
++ int ret;
++
++ if (!s->read_packet)
++ return AVERROR_EOF;
++ ret = s->read_packet(s->opaque, buf, size);
++#if FF_API_OLD_AVIO_EOF_0
++ if (!ret && !s->max_packet_size) {
++ av_log(NULL, AV_LOG_WARNING, "Invalid return value 0 for stream protocol\n");
++ ret = AVERROR_EOF;
++ }
++#else
++ av_assert2(ret || s->max_packet_size);
++#endif
++ return ret;
++}
++
+ /* Input stream */
+
+ static void fill_buffer(AVIOContext *s)
+@@ -569,10 +587,7 @@ static void fill_buffer(AVIOContext *s)
+ len = s->orig_buffer_size;
+ }
+
+- if (s->read_packet)
+- len = s->read_packet(s->opaque, dst, len);
+- else
+- len = 0;
++ len = read_packet_wrapper(s, dst, len);
+ if (len <= 0) {
+ /* do not modify buffer if EOF reached so that a seek back can
+ be done without rereading data */
+@@ -644,8 +659,7 @@ int avio_read(AVIOContext *s, unsigned c
+ if (len == 0 || s->write_flag) {
+ if((s->direct || size > s->buffer_size) && !s->update_checksum) {
+ // bypass the buffer and read data directly into buf
+- if(s->read_packet)
+- len = s->read_packet(s->opaque, buf, size);
++ len = read_packet_wrapper(s, buf, size);
+
+ if (len <= 0) {
+ /* do not modify buffer if EOF reached so that a seek back can
+@@ -711,7 +725,7 @@ int avio_read_partial(AVIOContext *s, un
+ return -1;
+
+ if (s->read_packet && s->write_flag) {
+- len = s->read_packet(s->opaque, buf, size);
++ len = read_packet_wrapper(s, buf, size);
+ if (len > 0)
+ s->pos += len;
+ return len;
+diff -rupN ffmpeg-3.4.orig/libavformat/avio.h ffmpeg-3.4/libavformat/avio.h
+--- ffmpeg-3.4.orig/libavformat/avio.h 2017-11-02 14:57:16.078834563 +0100
++++ ffmpeg-3.4/libavformat/avio.h 2017-11-02 14:59:15.602300896 +0100
+@@ -452,6 +452,8 @@ void avio_free_directory_entry(AVIODirEn
+ * @param write_flag Set to 1 if the buffer should be writable, 0 otherwise.
+ * @param opaque An opaque pointer to user-specific data.
+ * @param read_packet A function for refilling the buffer, may be NULL.
++ * For stream protocols, must never return 0 but rather
++ * a proper AVERROR code.
+ * @param write_packet A function for writing the buffer contents, may be NULL.
+ * The function may not change the input buffers content.
+ * @param seek A function for seeking to specified byte position, may be NULL.
+diff -rupN ffmpeg-3.4.orig/libavformat/version.h ffmpeg-3.4/libavformat/version.h
+--- ffmpeg-3.4.orig/libavformat/version.h 2017-11-02 14:57:16.082167807 +0100
++++ ffmpeg-3.4/libavformat/version.h 2017-11-02 15:04:01.704627612 +0100
+@@ -97,6 +97,9 @@
+ #ifndef FF_API_OLD_ROTATE_API
+ #define FF_API_OLD_ROTATE_API (LIBAVFORMAT_VERSION_MAJOR < 58)
+ #endif
++#ifndef FF_API_OLD_AVIO_EOF_0
++#define FF_API_OLD_AVIO_EOF_0 (LIBAVFORMAT_VERSION_MAJOR < 58)
++#endif
+
+
+ #ifndef FF_API_R_FRAME_RATE
--
2.17.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.