1 |
commit: c55e93a8acc7eb98dbbc618b2f81f112d260cdf1 |
2 |
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Nov 29 21:14:31 2018 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Nov 29 21:19:53 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c55e93a8 |
7 |
|
8 |
media-libs/qtav: Fix build with ffmpeg-4 |
9 |
|
10 |
Thanks-to: Marco Genasci <fedeliallalinea <AT> gmail.com> |
11 |
Closes: https://bugs.gentoo.org/670765 |
12 |
Package-Manager: Portage-2.3.52, Repoman-2.3.12 |
13 |
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> |
14 |
|
15 |
...-ffmpeg-4.patch => qtav-1.12.0-ffmpeg4-1.patch} | 0 |
16 |
media-libs/qtav/files/qtav-1.12.0-ffmpeg4-2.patch | 119 +++++++++++++++++++++ |
17 |
media-libs/qtav/qtav-1.12.0.ebuild | 6 +- |
18 |
3 files changed, 122 insertions(+), 3 deletions(-) |
19 |
|
20 |
diff --git a/media-libs/qtav/files/qtav-1.12.0-ffmpeg-4.patch b/media-libs/qtav/files/qtav-1.12.0-ffmpeg4-1.patch |
21 |
similarity index 100% |
22 |
rename from media-libs/qtav/files/qtav-1.12.0-ffmpeg-4.patch |
23 |
rename to media-libs/qtav/files/qtav-1.12.0-ffmpeg4-1.patch |
24 |
|
25 |
diff --git a/media-libs/qtav/files/qtav-1.12.0-ffmpeg4-2.patch b/media-libs/qtav/files/qtav-1.12.0-ffmpeg4-2.patch |
26 |
new file mode 100644 |
27 |
index 00000000000..1f78acfde49 |
28 |
--- /dev/null |
29 |
+++ b/media-libs/qtav/files/qtav-1.12.0-ffmpeg4-2.patch |
30 |
@@ -0,0 +1,119 @@ |
31 |
+From 7f6929b49c25ca475a08f87e8b52aa1642d109dd Mon Sep 17 00:00:00 2001 |
32 |
+From: Felix Matouschek <felix@××××××××××.org> |
33 |
+Date: Sat, 11 Nov 2017 10:13:06 +0100 |
34 |
+Subject: [PATCH] Make QtAV build with newer versions of FFmpeg |
35 |
+ |
36 |
+Some defines changed their name in newer versions of FFmpeg, this |
37 |
+patch uses preprocessor instructions in AVCompat.h to use the |
38 |
+correct define names. Also filter names retrieved by |
39 |
+'avfilter_get_by_name' should be used as const variables in |
40 |
+libavfilter versions starting at 7.0.0. |
41 |
+--- |
42 |
+ src/AVMuxer.cpp | 2 +- |
43 |
+ src/QtAV/private/AVCompat.h | 12 ++++++++++++ |
44 |
+ src/codec/audio/AudioEncoderFFmpeg.cpp | 4 ++-- |
45 |
+ src/codec/video/VideoEncoderFFmpeg.cpp | 2 +- |
46 |
+ src/filter/LibAVFilter.cpp | 8 +++++++- |
47 |
+ src/subtitle/SubtitleProcessorFFmpeg.cpp | 2 +- |
48 |
+ 6 files changed, 24 insertions(+), 6 deletions(-) |
49 |
+ |
50 |
+diff --git a/src/AVMuxer.cpp b/src/AVMuxer.cpp |
51 |
+index 2f0b40d05..d2eb3dde8 100644 |
52 |
+--- a/src/AVMuxer.cpp |
53 |
++++ b/src/AVMuxer.cpp |
54 |
+@@ -124,7 +124,7 @@ AVStream *AVMuxer::Private::addStream(AVFormatContext* ctx, const QString &codec |
55 |
+ c->time_base = s->time_base; |
56 |
+ /* Some formats want stream headers to be separate. */ |
57 |
+ if (ctx->oformat->flags & AVFMT_GLOBALHEADER) |
58 |
+- c->flags |= CODEC_FLAG_GLOBAL_HEADER; |
59 |
++ c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; |
60 |
+ // expose avctx to encoder and set properties in encoder? |
61 |
+ // list codecs for a given format in ui |
62 |
+ return s; |
63 |
+diff --git a/src/QtAV/private/AVCompat.h b/src/QtAV/private/AVCompat.h |
64 |
+index e387868a8..6c38596d1 100644 |
65 |
+--- a/src/QtAV/private/AVCompat.h |
66 |
++++ b/src/QtAV/private/AVCompat.h |
67 |
+@@ -456,3 +456,15 @@ const char *get_codec_long_name(AVCodecID id); |
68 |
+ } } while(0) |
69 |
+ |
70 |
+ #endif //QTAV_COMPAT_H |
71 |
++ |
72 |
++#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(56,33,0) |
73 |
++#define AV_CODEC_FLAG_GLOBAL_HEADER CODEC_FLAG_GLOBAL_HEADER |
74 |
++#endif |
75 |
++ |
76 |
++#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(56,56,100) |
77 |
++#define AV_INPUT_BUFFER_MIN_SIZE FF_MIN_BUFFER_SIZE |
78 |
++#endif |
79 |
++ |
80 |
++#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(56,56,100) |
81 |
++#define AV_INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE |
82 |
++#endif |
83 |
+diff --git a/src/codec/audio/AudioEncoderFFmpeg.cpp b/src/codec/audio/AudioEncoderFFmpeg.cpp |
84 |
+index a74f4f31d..3811e11a6 100644 |
85 |
+--- a/src/codec/audio/AudioEncoderFFmpeg.cpp |
86 |
++++ b/src/codec/audio/AudioEncoderFFmpeg.cpp |
87 |
+@@ -151,8 +151,8 @@ bool AudioEncoderFFmpegPrivate::open() |
88 |
+ } else { |
89 |
+ buffer_size = frame_size*format_used.bytesPerSample()*format_used.channels()*2+200; |
90 |
+ } |
91 |
+- if (buffer_size < FF_MIN_BUFFER_SIZE) |
92 |
+- buffer_size = FF_MIN_BUFFER_SIZE; |
93 |
++ if (buffer_size < AV_INPUT_BUFFER_MIN_SIZE) |
94 |
++ buffer_size = AV_INPUT_BUFFER_MIN_SIZE; |
95 |
+ buffer.resize(buffer_size); |
96 |
+ return true; |
97 |
+ } |
98 |
+diff --git a/src/codec/video/VideoEncoderFFmpeg.cpp b/src/codec/video/VideoEncoderFFmpeg.cpp |
99 |
+index 7c5ed42d0..671efa7d3 100644 |
100 |
+--- a/src/codec/video/VideoEncoderFFmpeg.cpp |
101 |
++++ b/src/codec/video/VideoEncoderFFmpeg.cpp |
102 |
+@@ -245,7 +245,7 @@ bool VideoEncoderFFmpegPrivate::open() |
103 |
+ applyOptionsForContext(); |
104 |
+ AV_ENSURE_OK(avcodec_open2(avctx, codec, &dict), false); |
105 |
+ // from mpv ao_lavc |
106 |
+- const int buffer_size = qMax<int>(qMax<int>(width*height*6+200, FF_MIN_BUFFER_SIZE), sizeof(AVPicture));//?? |
107 |
++ const int buffer_size = qMax<int>(qMax<int>(width*height*6+200, AV_INPUT_BUFFER_MIN_SIZE), sizeof(AVPicture));//?? |
108 |
+ buffer.resize(buffer_size); |
109 |
+ return true; |
110 |
+ } |
111 |
+diff --git a/src/filter/LibAVFilter.cpp b/src/filter/LibAVFilter.cpp |
112 |
+index 191512040..8993a91f7 100644 |
113 |
+--- a/src/filter/LibAVFilter.cpp |
114 |
++++ b/src/filter/LibAVFilter.cpp |
115 |
+@@ -120,7 +120,10 @@ class LibAVFilter::Private |
116 |
+ // pixel_aspect==sar, pixel_aspect is more compatible |
117 |
+ QString buffersrc_args = args; |
118 |
+ qDebug("buffersrc_args=%s", buffersrc_args.toUtf8().constData()); |
119 |
+- AVFilter *buffersrc = avfilter_get_by_name(video ? "buffer" : "abuffer"); |
120 |
++#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(7,0,0) |
121 |
++ const |
122 |
++#endif |
123 |
++ AVFilter *buffersrc = avfilter_get_by_name(video ? "buffer" : "abuffer"); |
124 |
+ Q_ASSERT(buffersrc); |
125 |
+ AV_ENSURE_OK(avfilter_graph_create_filter(&in_filter_ctx, |
126 |
+ buffersrc, |
127 |
+@@ -128,6 +131,9 @@ class LibAVFilter::Private |
128 |
+ filter_graph) |
129 |
+ , false); |
130 |
+ /* buffer video sink: to terminate the filter chain. */ |
131 |
++#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(7,0,0) |
132 |
++ const |
133 |
++#endif |
134 |
+ AVFilter *buffersink = avfilter_get_by_name(video ? "buffersink" : "abuffersink"); |
135 |
+ Q_ASSERT(buffersink); |
136 |
+ AV_ENSURE_OK(avfilter_graph_create_filter(&out_filter_ctx, buffersink, "out", |
137 |
+diff --git a/src/subtitle/SubtitleProcessorFFmpeg.cpp b/src/subtitle/SubtitleProcessorFFmpeg.cpp |
138 |
+index 30ee9367c..1755c3816 100644 |
139 |
+--- a/src/subtitle/SubtitleProcessorFFmpeg.cpp |
140 |
++++ b/src/subtitle/SubtitleProcessorFFmpeg.cpp |
141 |
+@@ -249,7 +249,7 @@ bool SubtitleProcessorFFmpeg::processHeader(const QByteArray &codec, const QByte |
142 |
+ codec_ctx->time_base.den = 1000; |
143 |
+ if (!data.isEmpty()) { |
144 |
+ av_free(codec_ctx->extradata); |
145 |
+- codec_ctx->extradata = (uint8_t*)av_mallocz(data.size() + FF_INPUT_BUFFER_PADDING_SIZE); |
146 |
++ codec_ctx->extradata = (uint8_t*)av_mallocz(data.size() + AV_INPUT_BUFFER_PADDING_SIZE); |
147 |
+ if (!codec_ctx->extradata) |
148 |
+ return false; |
149 |
+ codec_ctx->extradata_size = data.size(); |
150 |
\ No newline at end of file |
151 |
|
152 |
diff --git a/media-libs/qtav/qtav-1.12.0.ebuild b/media-libs/qtav/qtav-1.12.0.ebuild |
153 |
index f3e1ff02cc1..9f203d800ef 100644 |
154 |
--- a/media-libs/qtav/qtav-1.12.0.ebuild |
155 |
+++ b/media-libs/qtav/qtav-1.12.0.ebuild |
156 |
@@ -1,4 +1,4 @@ |
157 |
-# Copyright 1999-2018 Gentoo Foundation |
158 |
+# Copyright 1999-2018 Gentoo Authors |
159 |
# Distributed under the terms of the GNU General Public License v2 |
160 |
|
161 |
EAPI=6 |
162 |
@@ -38,8 +38,8 @@ RDEPEND="${DEPEND}" |
163 |
S="${WORKDIR}/${MY_PN}-${PV}" |
164 |
|
165 |
PATCHES=( |
166 |
- "${FILESDIR}/${P}-multilib.patch" |
167 |
- "${FILESDIR}/${P}-ffmpeg-4.patch" |
168 |
+ "${FILESDIR}"/${P}-multilib.patch |
169 |
+ "${FILESDIR}"/${P}-ffmpeg4-{1,2}.patch # bugs 660852, 670765 |
170 |
) |
171 |
|
172 |
src_prepare() { |