FreeBSD Bugzilla – Attachment 176963 Details for
Bug 214194
multimedia/kdemultimedia4-ffmpegthumbs: fails to build with ffmpeg 3.x
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch kdemultimedia4-ffmpegthumbs for FFmpeg 3.x
multinedia_kdemultimedia4-ffmpegthumbs.patch (text/plain), 12.67 KB, created by
Matthew Rezny
on 2016-11-13 19:13:33 UTC
(
hide
)
Description:
patch kdemultimedia4-ffmpegthumbs for FFmpeg 3.x
Filename:
MIME Type:
Creator:
Matthew Rezny
Created:
2016-11-13 19:13:33 UTC
Size:
12.67 KB
patch
obsolete
>Index: multimedia/kdemultimedia4-ffmpegthumbs/Makefile >=================================================================== >--- multimedia/kdemultimedia4-ffmpegthumbs/Makefile (revision 426060) >+++ multimedia/kdemultimedia4-ffmpegthumbs/Makefile (working copy) >@@ -15,6 +15,7 @@ > > USES= cmake:outsource kde:4 pkgconfig tar:xz > USE_KDE= automoc4 kdelibs >-USE_QT4= moc_build qmake_build rcc_build uic_build >+USE_QT4= moc_build qmake_build rcc_build uic_build \ >+ corelib dbus gui network svg xml > > .include <bsd.port.mk> >Index: multimedia/kdemultimedia4-ffmpegthumbs/files/patch-ffmpegthumbnailer_videothumbnailer.h >=================================================================== >--- multimedia/kdemultimedia4-ffmpegthumbs/files/patch-ffmpegthumbnailer_videothumbnailer.h (nonexistent) >+++ multimedia/kdemultimedia4-ffmpegthumbs/files/patch-ffmpegthumbnailer_videothumbnailer.h (working copy) >@@ -0,0 +1,13 @@ >+# Fix a type mismatch >+# >+--- ffmpegthumbnailer/videothumbnailer.h.orig 2016-11-04 13:04:13 UTC >++++ ffmpegthumbnailer/videothumbnailer.h >+@@ -31,7 +31,7 @@ >+ namespace ffmpegthumbnailer >+ { >+ >+-class VideoFrame; >++struct VideoFrame; >+ class ImageWriter; >+ class MovieDecoder; >+ > >Property changes on: multimedia/kdemultimedia4-ffmpegthumbs/files/patch-ffmpegthumbnailer_videothumbnailer.h >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: multimedia/kdemultimedia4-ffmpegthumbs/files/patch-git_3978c76 >=================================================================== >--- multimedia/kdemultimedia4-ffmpegthumbs/files/patch-git_3978c76 (nonexistent) >+++ multimedia/kdemultimedia4-ffmpegthumbs/files/patch-git_3978c76 (working copy) >@@ -0,0 +1,310 @@ >+From: Martin T. H. Sandsmark <martin.sandsmark@kde.org> >+Date: Fri, 27 May 2016 20:29:11 +0000 >+Subject: Port to libavfilter for deinterlacing. >+X-Git-Tag: v16.07.80 >+X-Git-Url: http://quickgit.kde.org/?p=ffmpegthumbs.git&a=commitdiff&h=3978c762072b7bc16b2096819b7cfa2052deaf5e >+--- >+Port to libavfilter for deinterlacing. >+ >+Based on a patch from Andreas Cadhalpun >+<andreas.cadhalpun@googlemail.com>. >+--- >+ >+ >+--- CMakeLists.txt >++++ CMakeLists.txt >+@@ -36,7 +36,7 @@ >+ >+ kde4_add_plugin(ffmpegthumbs ${ffmpegthumbs_PART_SRCS}) >+ >+-target_link_libraries(ffmpegthumbs ${KDE4_KIO_LIBS} ${AVUTIL_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVCODEC_LIBRARIES} ${SWSCALE_LIBRARIES} ) >++target_link_libraries(ffmpegthumbs ${KDE4_KIO_LIBS} ${AVUTIL_LIBRARIES} ${AVFILTER_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVCODEC_LIBRARIES} ${SWSCALE_LIBRARIES} ) >+ >+ install(TARGETS ffmpegthumbs DESTINATION ${PLUGIN_INSTALL_DIR}) >+ >+ >+--- cmake/FindFFmpeg.cmake >++++ cmake/FindFFmpeg.cmake >+@@ -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) >+ >+--- ffmpegthumbnailer/moviedecoder.cpp >++++ ffmpegthumbnailer/moviedecoder.cpp >+@@ -40,6 +40,10 @@ >+ , m_FormatContextWasGiven(pavContext != NULL) >+ , m_AllowSeek(true) >+ , m_initialized(false) >++ , m_bufferSinkContext(nullptr) >++ , m_bufferSourceContext(nullptr) >++ , m_filterGraph(nullptr) >++ , m_filterFrame(nullptr) >+ { >+ initialize(filename); >+ } >+@@ -51,6 +55,9 @@ >+ >+ void MovieDecoder::initialize(const QString& filename) >+ { >++ m_lastWidth = -1; >++ m_lastHeight = -1; >++ m_lastPixfmt = AV_PIX_FMT_NONE; >+ av_register_all(); >+ avcodec_register_all(); >+ >+@@ -67,7 +74,7 @@ >+ } >+ >+ initializeVideo(); >+- m_pFrame = avcodec_alloc_frame(); >++ m_pFrame = av_frame_alloc(); >+ >+ if (m_pFrame) { >+ m_initialized=true; >+@@ -82,6 +89,7 @@ >+ >+ void MovieDecoder::destroy() >+ { >++ deleteFilterGraph(); >+ if (m_pVideoCodecContext) { >+ avcodec_close(m_pVideoCodecContext); >+ m_pVideoCodecContext = NULL; >+@@ -93,13 +101,13 @@ >+ } >+ >+ if (m_pPacket) { >+- av_free_packet(m_pPacket); >++ av_packet_unref(m_pPacket); >+ delete m_pPacket; >+ m_pPacket = NULL; >+ } >+ >+ if (m_pFrame) { >+- av_free(m_pFrame); >++ av_frame_free(&m_pFrame); >+ m_pFrame = NULL; >+ } >+ >+@@ -239,7 +247,7 @@ >+ return false; >+ } >+ >+- avcodec_get_frame_defaults(m_pFrame); >++ av_frame_unref(m_pFrame); >+ >+ int frameFinished = 0; >+ >+@@ -264,7 +272,7 @@ >+ int attempts = 0; >+ >+ if (m_pPacket) { >+- av_free_packet(m_pPacket); >++ av_packet_unref(m_pPacket); >+ delete m_pPacket; >+ } >+ >+@@ -275,7 +283,7 @@ >+ if (framesAvailable) { >+ frameDecoded = m_pPacket->stream_index == m_VideoStream; >+ if (!frameDecoded) { >+- av_free_packet(m_pPacket); >++ av_packet_unref(m_pPacket); >+ } >+ } >+ } >+@@ -283,15 +291,100 @@ >+ return frameDecoded; >+ } >+ >++void MovieDecoder::deleteFilterGraph() >++{ >++ if (m_filterGraph) { >++ av_frame_free(&m_filterFrame); >++ avfilter_graph_free(&m_filterGraph); >++ m_filterGraph = nullptr; >++ } >++} >++ >++bool MovieDecoder::initFilterGraph(enum AVPixelFormat pixfmt, int width, int height) >++{ >++ AVFilterInOut *inputs = nullptr, *outputs = nullptr; >++ >++ deleteFilterGraph(); >++ m_filterGraph = avfilter_graph_alloc(); >++ >++ QByteArray arguments("buffer="); >++ arguments += "video_size=" + QByteArray::number(width) + "x" + QByteArray::number(height) + ":"; >++ arguments += "pix_fmt=" + QByteArray::number(pixfmt) + ":"; >++ arguments += "time_base=1/1:pixel_aspect=0/1[in];"; >++ arguments += "[in]yadif[out];"; >++ arguments += "[out]buffersink"; >++ >++ int ret = avfilter_graph_parse2(m_filterGraph, arguments.constData(), &inputs, &outputs); >++ if (ret < 0) { >++ qWarning() << "Unable to parse filter graph"; >++ return false; >++ } >++ >++ if(inputs || outputs) >++ return -1; >++ >++ ret = avfilter_graph_config(m_filterGraph, nullptr); >++ if (ret < 0) { >++ qWarning() << "Unable to validate filter graph"; >++ return false; >++ } >++ >++ m_bufferSourceContext = avfilter_graph_get_filter(m_filterGraph, "Parsed_buffer_0"); >++ m_bufferSinkContext = avfilter_graph_get_filter(m_filterGraph, "Parsed_buffersink_2"); >++ if (!m_bufferSourceContext || !m_bufferSinkContext) { >++ qWarning() << "Unable to get source or sink"; >++ return false; >++ } >++ m_filterFrame = av_frame_alloc(); >++ m_lastWidth = width; >++ m_lastHeight = height; >++ m_lastPixfmt = pixfmt; >++ >++ return true; >++} >++ >++bool MovieDecoder::processFilterGraph(AVPicture *dst, const AVPicture *src, >++ enum AVPixelFormat pixfmt, int width, int height) >++{ >++ if (!m_filterGraph || width != m_lastWidth || >++ height != m_lastHeight || pixfmt != m_lastPixfmt) { >++ >++ if (!initFilterGraph(pixfmt, width, height)) { >++ return false; >++ } >++ } >++ >++ memcpy(m_filterFrame->data, src->data, sizeof(src->data)); >++ memcpy(m_filterFrame->linesize, src->linesize, sizeof(src->linesize)); >++ m_filterFrame->width = width; >++ m_filterFrame->height = height; >++ m_filterFrame->format = pixfmt; >++ >++ int ret = av_buffersrc_add_frame(m_bufferSourceContext, m_filterFrame); >++ if (ret < 0) { >++ return false; >++ } >++ >++ ret = av_buffersink_get_frame(m_bufferSinkContext, m_filterFrame); >++ if (ret < 0) { >++ return false; >++ } >++ >++ av_picture_copy(dst, (const AVPicture *) m_filterFrame, pixfmt, width, height); >++ av_frame_unref(m_filterFrame); >++ >++ return true; >++} >++ >+ 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, >++ processFilterGraph((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 +395,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 +416,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 +448,9 @@ >+ } >+ } >+ >+-void MovieDecoder::createAVFrame(AVFrame** avFrame, quint8** frameBuffer, int width, int height, PixelFormat format) >+-{ >+- *avFrame = avcodec_alloc_frame(); >++void MovieDecoder::createAVFrame(AVFrame** avFrame, quint8** frameBuffer, int width, int height, AVPixelFormat format) >++{ >++ *avFrame = av_frame_alloc(); >+ >+ int numBytes = avpicture_get_size(format, width, height); >+ *frameBuffer = reinterpret_cast<quint8*>(av_malloc(numBytes)); >+ >+--- ffmpegthumbnailer/moviedecoder.h >++++ ffmpegthumbnailer/moviedecoder.h >+@@ -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,9 +55,13 @@ >+ >+ 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 deleteFilterGraph(); >++ bool initFilterGraph(enum AVPixelFormat pixfmt, int width, int height); >++ bool processFilterGraph(AVPicture *dst, const AVPicture *src, enum AVPixelFormat pixfmt, int width, int height); >+ >+ private: >+ int m_VideoStream; >+@@ -68,6 +75,13 @@ >+ bool m_FormatContextWasGiven; >+ bool m_AllowSeek; >+ bool m_initialized; >++ AVFilterContext* m_bufferSinkContext; >++ AVFilterContext* m_bufferSourceContext; >++ AVFilterGraph* m_filterGraph; >++ AVFrame* m_filterFrame; >++ int m_lastWidth; >++ int m_lastHeight; >++ enum AVPixelFormat m_lastPixfmt; >+ }; >+ >+ } >+ >+--- tests/CMakeLists.txt >++++ tests/CMakeLists.txt >+@@ -19,7 +19,7 @@ >+ >+ kde4_add_executable(ffmpegthumbtest ${ffmpegthumbtest_SRCS} ) >+ >+-target_link_libraries(ffmpegthumbtest ${KDE4_KDECORE_LIBS} ${KDE4_KIO_LIBS} ${AVUTIL_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVCODEC_LIBRARIES} ${SWSCALE_LIBRARIES}) >++target_link_libraries(ffmpegthumbtest ${KDE4_KDECORE_LIBS} ${KDE4_KIO_LIBS} ${AVUTIL_LIBRARIES} ${AVFILTER_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVCODEC_LIBRARIES} ${SWSCALE_LIBRARIES}) >+ >+ >+ > >Property changes on: multimedia/kdemultimedia4-ffmpegthumbs/files/patch-git_3978c76 >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 214194
:
176620
| 176963 |
177494