Update ffmpeg to 3.4.1

This commit is contained in:
Martchus 2017-12-20 19:57:24 +01:00
parent 2319ff9606
commit ec0ae088b9
10 changed files with 280 additions and 299 deletions

View File

@ -17,12 +17,12 @@
pkgname=ffmpeg-full-nvenc
_pkgbasename=ffmpeg
pkgver=3.3.4
pkgver=3.4.1
pkgrel=1
epoch=1
pkgdesc="Record, convert, and stream audio and video (all codecs including Nvidia NVENC)"
arch=('i686' 'x86_64')
url="http://ffmpeg.org/"
url='http://ffmpeg.org/'
license=('GPL' 'custom:UNREDISTRIBUTABLE')
depends=('alsa-lib' 'bzip2' 'celt' 'chromaprint-fftw' 'fontconfig' 'frei0r-plugins'
'fribidi' 'glibc' 'gnutls' 'gsm' 'jack' 'kvazaar' 'ladspa' 'lame' 'libass.so'
@ -47,17 +47,19 @@ provides=('libavcodec.so' 'libavdevice.so' 'libavfilter.so' 'libavformat.so'
'libswscale.so' 'ffmpeg' 'qt-faststart')
source=(https://ffmpeg.org/releases/$_pkgbasename-$pkgver.tar.xz{,.asc}
'UNREDISTRIBUTABLE.txt'
'ffmpeg-openjpeg2.2.patch')
'fs56089.patch')
validpgpkeys=('FCF986EA15E6E293A5644F10B4322F04D67658D8')
sha256sums=('98b97e1b908dfeb6aeb6d407e5a5eacdfc253a40c2d195f5867ed2d1d46ea957'
'SKIP'
'e0c1b126862072a71e18b9580a6b01afc76a54aa6e642d2c413ba0ac9d3010c4'
'490598f78d7879af8ef5b8d7f92ada83d0ee64f9609f6c7b989eb331c2539f68')
'0bfcd12d1992903f21c146ae56d9ad89b52818cfb2303197ee905347c25a5427')
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() {

View File

@ -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);

View File

@ -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

View File

@ -20,8 +20,18 @@ provides=("ffmpeg=$pkgver"
'libavresample.so' 'libavutil.so' 'libpostproc.so' 'libswresample.so'
'libswscale.so')
conflicts=("$_name")
source=("$pkgname"::'git://source.ffmpeg.org/ffmpeg.git')
sha256sums=('SKIP')
source=("$pkgname"::'git://source.ffmpeg.org/ffmpeg.git'
'fs56089.patch')
sha256sums=('SKIP'
'0bfcd12d1992903f21c146ae56d9ad89b52818cfb2303197ee905347c25a5427')
prepare() {
cd ffmpeg-${pkgver}
# https://bugs.archlinux.org/task/56089
# Backport of http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=a606f27f4c610708fa96e35eed7b7537d3d8f712
patch -Np1 -i ../fs56089.patch
}
pkgver() {
cd "$srcdir/$pkgname"

View File

@ -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);

View File

@ -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

View File

@ -9,8 +9,8 @@
_name=ffmpeg
pkgname=ffmpeg-libfdk_aac
pkgver=3.4
pkgrel=2
pkgver=3.4.1
pkgrel=1
epoch=1
pkgdesc='Complete solution to record, convert and stream audio and video (with libfdk-aac support)'
arch=('i686' 'x86_64')
@ -35,7 +35,7 @@ conflicts=("$_name")
source=(https://ffmpeg.org/releases/$_name-$pkgver.tar.xz{,.asc}
'fs56089.patch')
validpgpkeys=('FCF986EA15E6E293A5644F10B4322F04D67658D8') # ffmpeg-devel
sha256sums=('aeee06e4d8b18d852c61ebbfe5e1bb7014b1e118e8728c1c2115f91e51bffbef'
sha256sums=('5a77278a63741efa74e26bf197b9bb09ac6381b9757391b922407210f0f991c0'
'SKIP'
'0bfcd12d1992903f21c146ae56d9ad89b52818cfb2303197ee905347c25a5427')

View File

@ -6,7 +6,7 @@
_name=ffmpeg
pkgname=mingw-w64-ffmpeg
pkgver=3.3.4
pkgver=3.4.1
pkgrel=1
epoch=1
pkgdesc='Complete solution to record, convert and stream audio and video (mingw-w64)'
@ -22,17 +22,19 @@ depends=('mingw-w64-crt' 'mingw-w64-bzip2' 'mingw-w64-fontconfig' 'mingw-w64-fri
options=(!strip !buildflags staticlibs)
makedepends=('mingw-w64-gcc' 'mingw-w64-pkg-config' 'yasm')
source=(https://ffmpeg.org/releases/ffmpeg-${pkgver}.tar.xz{,.asc}
'ffmpeg-openjpeg2.2.patch')
'fs56089.patch')
validpgpkeys=('FCF986EA15E6E293A5644F10B4322F04D67658D8') # ffmpeg-devel
sha256sums=('98b97e1b908dfeb6aeb6d407e5a5eacdfc253a40c2d195f5867ed2d1d46ea957'
'SKIP'
'490598f78d7879af8ef5b8d7f92ada83d0ee64f9609f6c7b989eb331c2539f68')
'0bfcd12d1992903f21c146ae56d9ad89b52818cfb2303197ee905347c25a5427')
_architectures='i686-w64-mingw32 x86_64-w64-mingw32'
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() {

View File

@ -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);

View File

@ -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