[SCM] ffmpegthumbs packaging branch, master, updated. debian/15.07.90-1-7-gbe070e7

Maximiliano Curia maxy at moszumanska.debian.org
Fri Feb 5 10:13:27 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ffmpegthumbs.git;a=commitdiff;h=be070e7

The following commit has been merged in the master branch:
commit be070e7e187224dfa5c8e8bd4eab357797d8c5ab
Author: Maximiliano Curia <maxy at gnuservers.com.ar>
Date:   Fri Feb 5 10:46:24 2016 +0100

    Add new patch: ffmpeg2.9_support.patch (Closes: #803813)
---
 debian/changelog                |   3 +-
 debian/control                  |   1 +
 debian/patches/ffmpeg_2.9.patch | 252 ++++++++++++++++++++++++++++++++++++++++
 debian/patches/series           |   1 +
 4 files changed, 256 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 900a8fb..67741f4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
 ffmpegthumbs (4:15.12.0-2~) UNRELEASED; urgency=medium
 
-  * 
+  * Add new patch: ffmpeg2.9_support.patch (Closes: #803813) Thanks to
+    Andreas Cadhalpun
 
  -- Maximiliano Curia <maxy at debian.org>  Fri, 05 Feb 2016 10:42:11 +0100
 
diff --git a/debian/control b/debian/control
index aa8510b..14d806b 100644
--- a/debian/control
+++ b/debian/control
@@ -10,6 +10,7 @@ Build-Depends: cmake (>= 2.8.12~),
                extra-cmake-modules (>= 1.0.0~),
                kio-dev,
                libavcodec-dev,
+               libavfilter-dev,
                libavformat-dev,
                libavutil-dev,
                libswscale-dev,
diff --git a/debian/patches/ffmpeg_2.9.patch b/debian/patches/ffmpeg_2.9.patch
new file mode 100644
index 0000000..efd22e8
--- /dev/null
+++ b/debian/patches/ffmpeg_2.9.patch
@@ -0,0 +1,252 @@
+Description: Replace deprecated FFmpeg API
+Author: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
+Last-Update: <2015-11-02>
+
+Index: ffmpegthumbs/CMakeLists.txt
+===================================================================
+--- ffmpegthumbs.orig/CMakeLists.txt	2016-02-05 10:36:04.441640346 +0100
++++ ffmpegthumbs/CMakeLists.txt	2016-02-05 10:39:00.494448489 +0100
+@@ -36,7 +36,7 @@
+ 
+ add_library(ffmpegthumbs MODULE ${ffmpegthumbs_PART_SRCS})
+ 
+-target_link_libraries(ffmpegthumbs Qt5::Gui KF5::KIOWidgets ${AVUTIL_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVCODEC_LIBRARIES} ${SWSCALE_LIBRARIES} )
++target_link_libraries(ffmpegthumbs Qt5::Gui KF5::KIOWidgets ${AVUTIL_LIBRARIES} ${AVFILTER_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVCODEC_LIBRARIES} ${SWSCALE_LIBRARIES} )
+ 
+ install(TARGETS ffmpegthumbs DESTINATION ${PLUGIN_INSTALL_DIR})
+ 
+Index: ffmpegthumbs/cmake/FindFFmpeg.cmake
+===================================================================
+--- ffmpegthumbs.orig/cmake/FindFFmpeg.cmake	2016-02-05 10:36:04.441640346 +0100
++++ ffmpegthumbs/cmake/FindFFmpeg.cmake	2016-02-05 10:36:04.413641490 +0100
+@@ -99,6 +99,7 @@
+ 
+   # Check for all possible component.
+   find_component(AVCODEC  libavcodec  avcodec  libavcodec/avcodec.h)
++  find_component(AVFILTER libavfilter avfilter libavfilter/avfilter.h)
+   find_component(AVFORMAT libavformat avformat libavformat/avformat.h)
+   find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h)
+   find_component(AVUTIL   libavutil   avutil   libavutil/avutil.h)
+Index: ffmpegthumbs/ffmpegthumbnailer/moviedecoder.cpp
+===================================================================
+--- ffmpegthumbs.orig/ffmpegthumbnailer/moviedecoder.cpp	2016-02-05 10:36:04.441640346 +0100
++++ ffmpegthumbs/ffmpegthumbnailer/moviedecoder.cpp	2016-02-05 10:36:04.413641490 +0100
+@@ -51,6 +51,9 @@
+ 
+ void MovieDecoder::initialize(const QString& filename)
+ {
++    m_last_width = -1;
++    m_last_height = -1;
++    m_last_pixfmt = AV_PIX_FMT_NONE;
+     av_register_all();
+     avcodec_register_all();
+ 
+@@ -67,7 +70,7 @@
+     }
+ 
+     initializeVideo();
+-    m_pFrame = avcodec_alloc_frame();
++    m_pFrame = av_frame_alloc();
+ 
+     if (m_pFrame) {
+         m_initialized=true;
+@@ -82,6 +85,7 @@
+ 
+ void MovieDecoder::destroy()
+ {
++    delete_filter_graph();
+     if (m_pVideoCodecContext) {
+         avcodec_close(m_pVideoCodecContext);
+         m_pVideoCodecContext = NULL;
+@@ -99,7 +103,7 @@
+     }
+ 
+     if (m_pFrame) {
+-        av_free(m_pFrame);
++        av_frame_free(&m_pFrame);
+         m_pFrame = NULL;
+     }
+ 
+@@ -239,7 +243,7 @@
+         return false;
+     }
+ 
+-    avcodec_get_frame_defaults(m_pFrame);
++    av_frame_unref(m_pFrame);
+ 
+     int frameFinished = 0;
+ 
+@@ -283,15 +287,83 @@
+     return frameDecoded;
+ }
+ 
++void MovieDecoder::delete_filter_graph() {
++    if (m_filter_graph) {
++        av_frame_free(&m_filter_frame);
++        avfilter_graph_free(&m_filter_graph);
++    }
++}
++
++int MovieDecoder::init_filter_graph(enum AVPixelFormat pixfmt, int width, int height) {
++    AVFilterInOut *inputs = NULL, *outputs = NULL;
++    char args[512];
++    int res;
++
++    delete_filter_graph();
++    m_filter_graph = avfilter_graph_alloc();
++    snprintf(args, sizeof(args),
++             "buffer=video_size=%dx%d:pix_fmt=%d:time_base=1/1:pixel_aspect=0/1[in];"
++             "[in]yadif[out];"
++             "[out]buffersink",
++             width, height, pixfmt);
++    res = avfilter_graph_parse2(m_filter_graph, args, &inputs, &outputs);
++    if (res < 0)
++        return res;
++    if(inputs || outputs)
++        return -1;
++    res = avfilter_graph_config(m_filter_graph, NULL);
++    if (res < 0)
++        return res;
++
++    m_buffersrc_ctx = avfilter_graph_get_filter(m_filter_graph, "Parsed_buffer_0");
++    m_buffersink_ctx = avfilter_graph_get_filter(m_filter_graph, "Parsed_buffersink_2");
++    if (!m_buffersrc_ctx || !m_buffersink_ctx)
++        return -1;
++    m_filter_frame = av_frame_alloc();
++    m_last_width = width;
++    m_last_height = height;
++    m_last_pixfmt = pixfmt;
++
++    return 0;
++}
++
++int MovieDecoder::process_filter_graph(AVPicture *dst, const AVPicture *src,
++                                enum AVPixelFormat pixfmt, int width, int height) {
++    int res;
++
++    if (!m_filter_graph || width != m_last_width ||
++        height != m_last_height || pixfmt != m_last_pixfmt) {
++        res = init_filter_graph(pixfmt, width, height);
++        if (res < 0)
++            return res;
++    }
++
++    memcpy(m_filter_frame->data, src->data, sizeof(src->data));
++    memcpy(m_filter_frame->linesize, src->linesize, sizeof(src->linesize));
++    m_filter_frame->width = width;
++    m_filter_frame->height = height;
++    m_filter_frame->format = pixfmt;
++    res = av_buffersrc_add_frame(m_buffersrc_ctx, m_filter_frame);
++    if (res < 0)
++        return res;
++    res = av_buffersink_get_frame(m_buffersink_ctx, m_filter_frame);
++    if (res < 0)
++        return res;
++    av_picture_copy(dst, (const AVPicture *) m_filter_frame, pixfmt, width, height);
++    av_frame_unref(m_filter_frame);
++
++    return 0;
++}
++
+ void MovieDecoder::getScaledVideoFrame(int scaledSize, bool maintainAspectRatio, VideoFrame& videoFrame)
+ {
+     if (m_pFrame->interlaced_frame) {
+-        avpicture_deinterlace((AVPicture*) m_pFrame, (AVPicture*) m_pFrame, m_pVideoCodecContext->pix_fmt,
++        process_filter_graph((AVPicture*) m_pFrame, (AVPicture*) m_pFrame, m_pVideoCodecContext->pix_fmt,
+                               m_pVideoCodecContext->width, m_pVideoCodecContext->height);
+     }
+ 
+     int scaledWidth, scaledHeight;
+-    convertAndScaleFrame(PIX_FMT_RGB24, scaledSize, maintainAspectRatio, scaledWidth, scaledHeight);
++    convertAndScaleFrame(AV_PIX_FMT_RGB24, scaledSize, maintainAspectRatio, scaledWidth, scaledHeight);
+ 
+     videoFrame.width = scaledWidth;
+     videoFrame.height = scaledHeight;
+@@ -302,7 +374,7 @@
+     memcpy((&(videoFrame.frameData.front())), m_pFrame->data[0], videoFrame.lineSize * videoFrame.height);
+ }
+ 
+-void MovieDecoder::convertAndScaleFrame(PixelFormat format, int scaledSize, bool maintainAspectRatio, int& scaledWidth, int& scaledHeight)
++void MovieDecoder::convertAndScaleFrame(AVPixelFormat format, int scaledSize, bool maintainAspectRatio, int& scaledWidth, int& scaledHeight)
+ {
+     calculateDimensions(scaledSize, maintainAspectRatio, scaledWidth, scaledHeight);
+     SwsContext* scaleContext = sws_getContext(m_pVideoCodecContext->width, m_pVideoCodecContext->height,
+@@ -323,7 +395,7 @@
+               convertedFrame->data, convertedFrame->linesize);
+     sws_freeContext(scaleContext);
+ 
+-    av_free(m_pFrame);
++    av_frame_free(&m_pFrame);
+     av_free(m_pFrameBuffer);
+ 
+     m_pFrame        = convertedFrame;
+@@ -355,9 +427,9 @@
+     }
+ }
+ 
+-void MovieDecoder::createAVFrame(AVFrame** avFrame, quint8** frameBuffer, int width, int height, PixelFormat format)
++void MovieDecoder::createAVFrame(AVFrame** avFrame, quint8** frameBuffer, int width, int height, AVPixelFormat format)
+ {
+-    *avFrame = avcodec_alloc_frame();
++    *avFrame = av_frame_alloc();
+ 
+     int numBytes = avpicture_get_size(format, width, height);
+     *frameBuffer = reinterpret_cast<quint8*>(av_malloc(numBytes));
+Index: ffmpegthumbs/ffmpegthumbnailer/moviedecoder.h
+===================================================================
+--- ffmpegthumbs.orig/ffmpegthumbnailer/moviedecoder.h	2016-02-05 10:36:04.441640346 +0100
++++ ffmpegthumbs/ffmpegthumbnailer/moviedecoder.h	2016-02-05 10:36:04.413641490 +0100
+@@ -23,6 +23,9 @@
+ extern "C" {
+ #include <libavcodec/avcodec.h>
+ #include <libavformat/avformat.h>
++#include <libavfilter/avfilter.h>
++#include <libavfilter/buffersrc.h>
++#include <libavfilter/buffersink.h>
+ }
+ 
+ namespace ffmpegthumbnailer
+@@ -52,10 +55,14 @@
+ 
+     bool decodeVideoPacket();
+     bool getVideoPacket();
+-    void convertAndScaleFrame(PixelFormat format, int scaledSize, bool maintainAspectRatio, int& scaledWidth, int& scaledHeight);
+-    void createAVFrame(AVFrame** avFrame, quint8** frameBuffer, int width, int height, PixelFormat format);
++    void convertAndScaleFrame(AVPixelFormat format, int scaledSize, bool maintainAspectRatio, int& scaledWidth, int& scaledHeight);
++    void createAVFrame(AVFrame** avFrame, quint8** frameBuffer, int width, int height, AVPixelFormat format);
+     void calculateDimensions(int squareSize, bool maintainAspectRatio, int& destWidth, int& destHeight);
+ 
++    void delete_filter_graph();
++    int init_filter_graph(enum AVPixelFormat pixfmt, int width, int height);
++    int process_filter_graph(AVPicture *dst, const AVPicture *src, enum AVPixelFormat pixfmt, int width, int height);
++
+ private:
+     int                     m_VideoStream;
+     AVFormatContext*        m_pFormatContext;
+@@ -68,6 +75,13 @@
+     bool                    m_FormatContextWasGiven;
+     bool                    m_AllowSeek;
+     bool                    m_initialized;
++    AVFilterContext*        m_buffersink_ctx;
++    AVFilterContext*        m_buffersrc_ctx;
++    AVFilterGraph*          m_filter_graph;
++    AVFrame*                m_filter_frame;
++    int                     m_last_width;
++    int                     m_last_height;
++    enum AVPixelFormat      m_last_pixfmt;
+ };
+ 
+ }
+Index: ffmpegthumbs/tests/CMakeLists.txt
+===================================================================
+--- ffmpegthumbs.orig/tests/CMakeLists.txt	2016-02-05 10:36:04.441640346 +0100
++++ ffmpegthumbs/tests/CMakeLists.txt	2016-02-05 10:40:53.101848212 +0100
+@@ -19,7 +19,7 @@
+ 
+ add_executable(ffmpegthumbtest ${ffmpegthumbtest_SRCS} )
+ 
+-target_link_libraries(ffmpegthumbtest Qt5::Gui KF5::KIOWidgets ${AVUTIL_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVCODEC_LIBRARIES} ${SWSCALE_LIBRARIES})
++target_link_libraries(ffmpegthumbtest Qt5::Gui KF5::KIOWidgets ${AVUTIL_LIBRARIES} ${AVFILTER_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVCODEC_LIBRARIES} ${SWSCALE_LIBRARIES})
+ 
+ 
+ 
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..a827249
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+ffmpeg_2.9.patch

-- 
ffmpegthumbs packaging



More information about the pkg-kde-commits mailing list