Merge ~panfaust/kubuntu-packaging/+git/ffmpegthumbs:work into ~kubuntu-packagers/kubuntu-packaging/+git/ffmpegthumbs:kubuntu_yakkety_archive

Proposed by Jose Manuel Santamaria Lema
Status: Merged
Merged at revision: 490801dfd449b25c4051ad3abd6e7193aec4e9f5
Proposed branch: ~panfaust/kubuntu-packaging/+git/ffmpegthumbs:work
Merge into: ~kubuntu-packagers/kubuntu-packaging/+git/ffmpegthumbs:kubuntu_yakkety_archive
Diff against target: 416 lines (+351/-4)
6 files modified
debian/changelog (+20/-2)
debian/control (+1/-1)
debian/patches/series (+1/-0)
debian/patches/upstream_port_to_libavfilter.patch (+321/-0)
debian/rules (+1/-1)
debian/upstream/metadata (+7/-0)
Reviewer Review Type Date Requested Status
Kubuntu Packagers Pending
Review via email: mp+300788@code.launchpad.net

Description of the change

Right now ffmpegthumbs 16.04.3 is failing to build in staging, there is an upstream patch for this included in debian which solves the issue.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index 390a1ee..080d3e2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,8 +15,18 @@ ffmpegthumbs (4:16.04.3-0ubuntu1) UNRELEASED; urgency=medium
15 * Removing patch ffmpeg_2.9.patch15 * Removing patch ffmpeg_2.9.patch
16 * New upstream release (16.04.3)16 * New upstream release (16.04.3)
1717
18 [ José Manuel Santamaría Lema ]
19 * Merge with debian, fixing a FTBFS.
20
18 -- Clive Johnston <clivejo@kubuntu.org> Fri, 08 Jul 2016 00:44:44 +010021 -- Clive Johnston <clivejo@kubuntu.org> Fri, 08 Jul 2016 00:44:44 +0100
1922
23ffmpegthumbs (4:16.04.2-1) unstable; urgency=medium
24
25 [ Automatic packaging ]
26 * Refresh patches
27
28 -- Maximiliano Curia <maxy@debian.org> Wed, 22 Jun 2016 16:18:03 +0200
29
20ffmpegthumbs (4:15.12.3-0ubuntu1) xenial; urgency=medium30ffmpegthumbs (4:15.12.3-0ubuntu1) xenial; urgency=medium
2131
22 * New upstream bugfix release32 * New upstream bugfix release
@@ -36,12 +46,20 @@ ffmpegthumbs (4:15.12.1-0ubuntu1) xenial; urgency=medium
3646
37 -- Clive Johnston <clivejo@aol.com> Wed, 09 Mar 2016 10:23:59 +010047 -- Clive Johnston <clivejo@aol.com> Wed, 09 Mar 2016 10:23:59 +0100
3848
39ffmpegthumbs (4:15.12.0-2~) UNRELEASED; urgency=medium49ffmpegthumbs (4:15.12.0-2) unstable; urgency=medium
4050
51 [ Maximiliano Curia ]
41 * Add new patch: ffmpeg2.9_support.patch (Closes: #803813) Thanks to52 * Add new patch: ffmpeg2.9_support.patch (Closes: #803813) Thanks to
42 Andreas Cadhalpun53 Andreas Cadhalpun
54 * debian/control: Update Vcs-Browser and Vcs-Git fields
55 * Add upstream metadata (DEP-12)
56 * Use the newer debian-qt-kde.mk
57 * Use upstream ffmpeg 2.9 patch
58
59 [ Automatic packaging ]
60 * Bump Standards-Version to 3.9.8
4361
44 -- Maximiliano Curia <maxy@debian.org> Fri, 05 Feb 2016 10:42:11 +010062 -- Maximiliano Curia <maxy@debian.org> Sun, 29 May 2016 15:40:55 +0200
4563
46ffmpegthumbs (4:15.12.0-1) experimental; urgency=medium64ffmpegthumbs (4:15.12.0-1) experimental; urgency=medium
4765
diff --git a/debian/control b/debian/control
index 4cc4a18..0e0a3d2 100644
--- a/debian/control
+++ b/debian/control
@@ -17,7 +17,7 @@ Build-Depends: cmake (>= 2.8.12~),
17 pkg-config,17 pkg-config,
18 pkg-kde-tools (>= 0.12),18 pkg-kde-tools (>= 0.12),
19 qtbase5-dev (>= 5.2.0~)19 qtbase5-dev (>= 5.2.0~)
20Standards-Version: 3.9.620Standards-Version: 3.9.8
21Homepage: http://www.kde.org/21Homepage: http://www.kde.org/
22Vcs-Browser: https://code.launchpad.net/~kubuntu-packagers/kubuntu-packaging/+git/ffmpegthumbs22Vcs-Browser: https://code.launchpad.net/~kubuntu-packagers/kubuntu-packaging/+git/ffmpegthumbs
23Vcs-Git: git://git.launchpad.net/~kubuntu-packagers/kubuntu-packaging/+git/ffmpegthumbs23Vcs-Git: git://git.launchpad.net/~kubuntu-packagers/kubuntu-packaging/+git/ffmpegthumbs
diff --git a/debian/patches/series b/debian/patches/series
24new file mode 10064424new file mode 100644
index 0000000..b9788e9
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
1upstream_port_to_libavfilter.patch
diff --git a/debian/patches/upstream_port_to_libavfilter.patch b/debian/patches/upstream_port_to_libavfilter.patch
0new file mode 1006442new file mode 100644
index 0000000..0bdc4c4
--- /dev/null
+++ b/debian/patches/upstream_port_to_libavfilter.patch
@@ -0,0 +1,321 @@
1From: Debian/Kubuntu Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
2Date: Wed, 15 Jun 2016 01:53:13 +0200
3Subject: upstream_port_to_libavfilter
4
5commit 3978c762072b7bc16b2096819b7cfa2052deaf5e
6Author: Martin T. H. Sandsmark <martin.sandsmark@kde.org>
7Date: Fri May 27 22:29:11 2016 +0200
8
9 Port to libavfilter for deinterlacing.
10
11 Based on a patch from Andreas Cadhalpun
12 <andreas.cadhalpun@googlemail.com>.
13---
14 CMakeLists.txt | 2 +-
15 cmake/FindFFmpeg.cmake | 1 +
16 ffmpegthumbnailer/moviedecoder.cpp | 117 +++++++++++++++++++++++++++++++++----
17 ffmpegthumbnailer/moviedecoder.h | 18 +++++-
18 tests/CMakeLists.txt | 2 +-
19 5 files changed, 124 insertions(+), 16 deletions(-)
20
21diff --git a/CMakeLists.txt b/CMakeLists.txt
22index 7a025d4..1fab769 100644
23--- a/CMakeLists.txt
24+++ b/CMakeLists.txt
25@@ -36,7 +36,7 @@ set( ffmpegthumbs_PART_SRCS
26
27 add_library(ffmpegthumbs MODULE ${ffmpegthumbs_PART_SRCS})
28
29-target_link_libraries(ffmpegthumbs Qt5::Gui KF5::KIOWidgets ${AVUTIL_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVCODEC_LIBRARIES} ${SWSCALE_LIBRARIES} )
30+target_link_libraries(ffmpegthumbs Qt5::Gui KF5::KIOWidgets ${AVUTIL_LIBRARIES} ${AVFILTER_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVCODEC_LIBRARIES} ${SWSCALE_LIBRARIES} )
31
32 install(TARGETS ffmpegthumbs DESTINATION ${PLUGIN_INSTALL_DIR})
33
34diff --git a/cmake/FindFFmpeg.cmake b/cmake/FindFFmpeg.cmake
35index 27c6b16..915ab5f 100644
36--- a/cmake/FindFFmpeg.cmake
37+++ b/cmake/FindFFmpeg.cmake
38@@ -99,6 +99,7 @@ if (NOT FFMPEG_LIBRARIES)
39
40 # Check for all possible component.
41 find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h)
42+ find_component(AVFILTER libavfilter avfilter libavfilter/avfilter.h)
43 find_component(AVFORMAT libavformat avformat libavformat/avformat.h)
44 find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h)
45 find_component(AVUTIL libavutil avutil libavutil/avutil.h)
46diff --git a/ffmpegthumbnailer/moviedecoder.cpp b/ffmpegthumbnailer/moviedecoder.cpp
47index c8ae6d1..b2e7551 100644
48--- a/ffmpegthumbnailer/moviedecoder.cpp
49+++ b/ffmpegthumbnailer/moviedecoder.cpp
50@@ -40,6 +40,10 @@ MovieDecoder::MovieDecoder(const QString& filename, AVFormatContext* pavContext)
51 , m_FormatContextWasGiven(pavContext != NULL)
52 , m_AllowSeek(true)
53 , m_initialized(false)
54+ , m_bufferSinkContext(nullptr)
55+ , m_bufferSourceContext(nullptr)
56+ , m_filterGraph(nullptr)
57+ , m_filterFrame(nullptr)
58 {
59 initialize(filename);
60 }
61@@ -51,6 +55,9 @@ MovieDecoder::~MovieDecoder()
62
63 void MovieDecoder::initialize(const QString& filename)
64 {
65+ m_lastWidth = -1;
66+ m_lastHeight = -1;
67+ m_lastPixfmt = AV_PIX_FMT_NONE;
68 av_register_all();
69 avcodec_register_all();
70
71@@ -67,7 +74,7 @@ void MovieDecoder::initialize(const QString& filename)
72 }
73
74 initializeVideo();
75- m_pFrame = avcodec_alloc_frame();
76+ m_pFrame = av_frame_alloc();
77
78 if (m_pFrame) {
79 m_initialized=true;
80@@ -82,6 +89,7 @@ bool MovieDecoder::getInitialized()
81
82 void MovieDecoder::destroy()
83 {
84+ deleteFilterGraph();
85 if (m_pVideoCodecContext) {
86 avcodec_close(m_pVideoCodecContext);
87 m_pVideoCodecContext = NULL;
88@@ -93,13 +101,13 @@ void MovieDecoder::destroy()
89 }
90
91 if (m_pPacket) {
92- av_free_packet(m_pPacket);
93+ av_packet_unref(m_pPacket);
94 delete m_pPacket;
95 m_pPacket = NULL;
96 }
97
98 if (m_pFrame) {
99- av_free(m_pFrame);
100+ av_frame_free(&m_pFrame);
101 m_pFrame = NULL;
102 }
103
104@@ -239,7 +247,7 @@ bool MovieDecoder::decodeVideoPacket()
105 return false;
106 }
107
108- avcodec_get_frame_defaults(m_pFrame);
109+ av_frame_unref(m_pFrame);
110
111 int frameFinished = 0;
112
113@@ -264,7 +272,7 @@ bool MovieDecoder::getVideoPacket()
114 int attempts = 0;
115
116 if (m_pPacket) {
117- av_free_packet(m_pPacket);
118+ av_packet_unref(m_pPacket);
119 delete m_pPacket;
120 }
121
122@@ -275,7 +283,7 @@ bool MovieDecoder::getVideoPacket()
123 if (framesAvailable) {
124 frameDecoded = m_pPacket->stream_index == m_VideoStream;
125 if (!frameDecoded) {
126- av_free_packet(m_pPacket);
127+ av_packet_unref(m_pPacket);
128 }
129 }
130 }
131@@ -283,15 +291,100 @@ bool MovieDecoder::getVideoPacket()
132 return frameDecoded;
133 }
134
135+void MovieDecoder::deleteFilterGraph()
136+{
137+ if (m_filterGraph) {
138+ av_frame_free(&m_filterFrame);
139+ avfilter_graph_free(&m_filterGraph);
140+ m_filterGraph = nullptr;
141+ }
142+}
143+
144+bool MovieDecoder::initFilterGraph(enum AVPixelFormat pixfmt, int width, int height)
145+{
146+ AVFilterInOut *inputs = nullptr, *outputs = nullptr;
147+
148+ deleteFilterGraph();
149+ m_filterGraph = avfilter_graph_alloc();
150+
151+ QByteArray arguments("buffer=");
152+ arguments += "video_size=" + QByteArray::number(width) + "x" + QByteArray::number(height) + ":";
153+ arguments += "pix_fmt=" + QByteArray::number(pixfmt) + ":";
154+ arguments += "time_base=1/1:pixel_aspect=0/1[in];";
155+ arguments += "[in]yadif[out];";
156+ arguments += "[out]buffersink";
157+
158+ int ret = avfilter_graph_parse2(m_filterGraph, arguments.constData(), &inputs, &outputs);
159+ if (ret < 0) {
160+ qWarning() << "Unable to parse filter graph";
161+ return false;
162+ }
163+
164+ if(inputs || outputs)
165+ return -1;
166+
167+ ret = avfilter_graph_config(m_filterGraph, nullptr);
168+ if (ret < 0) {
169+ qWarning() << "Unable to validate filter graph";
170+ return false;
171+ }
172+
173+ m_bufferSourceContext = avfilter_graph_get_filter(m_filterGraph, "Parsed_buffer_0");
174+ m_bufferSinkContext = avfilter_graph_get_filter(m_filterGraph, "Parsed_buffersink_2");
175+ if (!m_bufferSourceContext || !m_bufferSinkContext) {
176+ qWarning() << "Unable to get source or sink";
177+ return false;
178+ }
179+ m_filterFrame = av_frame_alloc();
180+ m_lastWidth = width;
181+ m_lastHeight = height;
182+ m_lastPixfmt = pixfmt;
183+
184+ return true;
185+}
186+
187+bool MovieDecoder::processFilterGraph(AVPicture *dst, const AVPicture *src,
188+ enum AVPixelFormat pixfmt, int width, int height)
189+{
190+ if (!m_filterGraph || width != m_lastWidth ||
191+ height != m_lastHeight || pixfmt != m_lastPixfmt) {
192+
193+ if (!initFilterGraph(pixfmt, width, height)) {
194+ return false;
195+ }
196+ }
197+
198+ memcpy(m_filterFrame->data, src->data, sizeof(src->data));
199+ memcpy(m_filterFrame->linesize, src->linesize, sizeof(src->linesize));
200+ m_filterFrame->width = width;
201+ m_filterFrame->height = height;
202+ m_filterFrame->format = pixfmt;
203+
204+ int ret = av_buffersrc_add_frame(m_bufferSourceContext, m_filterFrame);
205+ if (ret < 0) {
206+ return false;
207+ }
208+
209+ ret = av_buffersink_get_frame(m_bufferSinkContext, m_filterFrame);
210+ if (ret < 0) {
211+ return false;
212+ }
213+
214+ av_picture_copy(dst, (const AVPicture *) m_filterFrame, pixfmt, width, height);
215+ av_frame_unref(m_filterFrame);
216+
217+ return true;
218+}
219+
220 void MovieDecoder::getScaledVideoFrame(int scaledSize, bool maintainAspectRatio, VideoFrame& videoFrame)
221 {
222 if (m_pFrame->interlaced_frame) {
223- avpicture_deinterlace((AVPicture*) m_pFrame, (AVPicture*) m_pFrame, m_pVideoCodecContext->pix_fmt,
224+ processFilterGraph((AVPicture*) m_pFrame, (AVPicture*) m_pFrame, m_pVideoCodecContext->pix_fmt,
225 m_pVideoCodecContext->width, m_pVideoCodecContext->height);
226 }
227
228 int scaledWidth, scaledHeight;
229- convertAndScaleFrame(PIX_FMT_RGB24, scaledSize, maintainAspectRatio, scaledWidth, scaledHeight);
230+ convertAndScaleFrame(AV_PIX_FMT_RGB24, scaledSize, maintainAspectRatio, scaledWidth, scaledHeight);
231
232 videoFrame.width = scaledWidth;
233 videoFrame.height = scaledHeight;
234@@ -302,7 +395,7 @@ void MovieDecoder::getScaledVideoFrame(int scaledSize, bool maintainAspectRatio,
235 memcpy((&(videoFrame.frameData.front())), m_pFrame->data[0], videoFrame.lineSize * videoFrame.height);
236 }
237
238-void MovieDecoder::convertAndScaleFrame(PixelFormat format, int scaledSize, bool maintainAspectRatio, int& scaledWidth, int& scaledHeight)
239+void MovieDecoder::convertAndScaleFrame(AVPixelFormat format, int scaledSize, bool maintainAspectRatio, int& scaledWidth, int& scaledHeight)
240 {
241 calculateDimensions(scaledSize, maintainAspectRatio, scaledWidth, scaledHeight);
242 SwsContext* scaleContext = sws_getContext(m_pVideoCodecContext->width, m_pVideoCodecContext->height,
243@@ -323,7 +416,7 @@ void MovieDecoder::convertAndScaleFrame(PixelFormat format, int scaledSize, bool
244 convertedFrame->data, convertedFrame->linesize);
245 sws_freeContext(scaleContext);
246
247- av_free(m_pFrame);
248+ av_frame_free(&m_pFrame);
249 av_free(m_pFrameBuffer);
250
251 m_pFrame = convertedFrame;
252@@ -355,9 +448,9 @@ void MovieDecoder::calculateDimensions(int squareSize, bool maintainAspectRatio,
253 }
254 }
255
256-void MovieDecoder::createAVFrame(AVFrame** avFrame, quint8** frameBuffer, int width, int height, PixelFormat format)
257+void MovieDecoder::createAVFrame(AVFrame** avFrame, quint8** frameBuffer, int width, int height, AVPixelFormat format)
258 {
259- *avFrame = avcodec_alloc_frame();
260+ *avFrame = av_frame_alloc();
261
262 int numBytes = avpicture_get_size(format, width, height);
263 *frameBuffer = reinterpret_cast<quint8*>(av_malloc(numBytes));
264diff --git a/ffmpegthumbnailer/moviedecoder.h b/ffmpegthumbnailer/moviedecoder.h
265index 2888926..788ce43 100644
266--- a/ffmpegthumbnailer/moviedecoder.h
267+++ b/ffmpegthumbnailer/moviedecoder.h
268@@ -23,6 +23,9 @@
269 extern "C" {
270 #include <libavcodec/avcodec.h>
271 #include <libavformat/avformat.h>
272+#include <libavfilter/avfilter.h>
273+#include <libavfilter/buffersrc.h>
274+#include <libavfilter/buffersink.h>
275 }
276
277 namespace ffmpegthumbnailer
278@@ -52,10 +55,14 @@ private:
279
280 bool decodeVideoPacket();
281 bool getVideoPacket();
282- void convertAndScaleFrame(PixelFormat format, int scaledSize, bool maintainAspectRatio, int& scaledWidth, int& scaledHeight);
283- void createAVFrame(AVFrame** avFrame, quint8** frameBuffer, int width, int height, PixelFormat format);
284+ void convertAndScaleFrame(AVPixelFormat format, int scaledSize, bool maintainAspectRatio, int& scaledWidth, int& scaledHeight);
285+ void createAVFrame(AVFrame** avFrame, quint8** frameBuffer, int width, int height, AVPixelFormat format);
286 void calculateDimensions(int squareSize, bool maintainAspectRatio, int& destWidth, int& destHeight);
287
288+ void deleteFilterGraph();
289+ bool initFilterGraph(enum AVPixelFormat pixfmt, int width, int height);
290+ bool processFilterGraph(AVPicture *dst, const AVPicture *src, enum AVPixelFormat pixfmt, int width, int height);
291+
292 private:
293 int m_VideoStream;
294 AVFormatContext* m_pFormatContext;
295@@ -68,6 +75,13 @@ private:
296 bool m_FormatContextWasGiven;
297 bool m_AllowSeek;
298 bool m_initialized;
299+ AVFilterContext* m_bufferSinkContext;
300+ AVFilterContext* m_bufferSourceContext;
301+ AVFilterGraph* m_filterGraph;
302+ AVFrame* m_filterFrame;
303+ int m_lastWidth;
304+ int m_lastHeight;
305+ enum AVPixelFormat m_lastPixfmt;
306 };
307
308 }
309diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
310index 1728fcd..b46169a 100644
311--- a/tests/CMakeLists.txt
312+++ b/tests/CMakeLists.txt
313@@ -19,7 +19,7 @@ set(ffmpegthumbtest_SRCS ffmpegthumbtest.cpp
314
315 add_executable(ffmpegthumbtest ${ffmpegthumbtest_SRCS} )
316
317-target_link_libraries(ffmpegthumbtest Qt5::Gui KF5::KIOWidgets ${AVUTIL_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVCODEC_LIBRARIES} ${SWSCALE_LIBRARIES})
318+target_link_libraries(ffmpegthumbtest Qt5::Gui KF5::KIOWidgets ${AVUTIL_LIBRARIES} ${AVFILTER_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVCODEC_LIBRARIES} ${SWSCALE_LIBRARIES})
319
320
321
diff --git a/debian/rules b/debian/rules
index 169ddd7..4c9ce6a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,4 +1,4 @@
1#!/usr/bin/make -f1#!/usr/bin/make -f
22
3include /usr/share/pkg-kde-tools/qt-kde-team/2/debian-qt-kde.mk3include /usr/share/pkg-kde-tools/qt-kde-team/3/debian-qt-kde.mk
44
diff --git a/debian/upstream/metadata b/debian/upstream/metadata
5new file mode 1006445new file mode 100644
index 0000000..a03b122
--- /dev/null
+++ b/debian/upstream/metadata
@@ -0,0 +1,7 @@
1Name: ffmpegthumbs
2Changelog: https://quickgit.kde.org/?p=ffmpegthumbs.git&a=log
3Contact: kde-devel@kde.org
4Donation: https://www.kde.org/community/donations/index.php
5Repository: https://anongit.kde.org/ffmpegthumbs.git
6Repository-Browse: https://quickgit.kde.org/?p=ffmpegthumbs.git
7Security-Contact: security@kde.org

Subscribers

People subscribed via source and target branches