207 lines
5.9 KiB
Diff
207 lines
5.9 KiB
Diff
|
From: Hrvoje Senjan <hrvoje.senjan@gmail.com>
|
||
|
Date: Mon, 15 Sep 2014 11:41:21 +0000
|
||
|
Subject: Port to Frameworks
|
||
|
X-Git-Url: http://quickgit.kde.org/?p=ffmpegthumbs.git&a=commitdiff&h=c06602ff79ac5e3eb94cef2c680135caa1a3c53c
|
||
|
---
|
||
|
Port to Frameworks
|
||
|
|
||
|
For thumbnailer to work, commit ae87a7d in KIO is needed,
|
||
|
as desktop file uses mimetype groups
|
||
|
|
||
|
REVIEW: 118545
|
||
|
---
|
||
|
|
||
|
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -1,13 +1,22 @@
|
||
|
-find_package(KDE4 REQUIRED)
|
||
|
-include(KDE4Defaults)
|
||
|
-include(MacroLibrary)
|
||
|
+project(ffmpegthumbs)
|
||
|
|
||
|
-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||
|
+cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
|
||
|
+set(QT_MIN_VERSION "5.2.0")
|
||
|
|
||
|
+find_package(ECM 1.0.0 REQUIRED NO_MODULE)
|
||
|
+set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||
|
+
|
||
|
+include(FeatureSummary)
|
||
|
+include(WriteBasicConfigVersionFile)
|
||
|
+include(KDEInstallDirs)
|
||
|
+include(KDECMakeSettings)
|
||
|
+include(KDECompilerSettings)
|
||
|
+
|
||
|
+find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Gui)
|
||
|
+find_package(KF5 REQUIRED COMPONENTS KIO)
|
||
|
find_package(FFmpeg COMPONENTS AVCODEC AVFORMAT SWSCALE)
|
||
|
|
||
|
include_directories(
|
||
|
- ${KDE4_INCLUDES}
|
||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||
|
${PC_AVCODEC_INCLUDEDIR}
|
||
|
${PC_AVFORMAT_INCLUDEDIR}
|
||
|
@@ -25,9 +34,9 @@ set( ffmpegthumbs_PART_SRCS
|
||
|
ffmpegthumbnailer/videothumbnailer.cpp
|
||
|
)
|
||
|
|
||
|
-kde4_add_plugin(ffmpegthumbs ${ffmpegthumbs_PART_SRCS})
|
||
|
+add_library(ffmpegthumbs MODULE ${ffmpegthumbs_PART_SRCS})
|
||
|
|
||
|
-target_link_libraries(ffmpegthumbs ${KDE4_KIO_LIBS} ${AVUTIL_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVCODEC_LIBRARIES} ${SWSCALE_LIBRARIES} )
|
||
|
+target_link_libraries(ffmpegthumbs Qt5::Gui KF5::KIOWidgets ${AVUTIL_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVCODEC_LIBRARIES} ${SWSCALE_LIBRARIES} )
|
||
|
|
||
|
install(TARGETS ffmpegthumbs DESTINATION ${PLUGIN_INSTALL_DIR})
|
||
|
|
||
|
@@ -35,6 +44,6 @@ install(TARGETS ffmpegthumbs DESTINATION ${PLUGIN_INSTALL_DIR})
|
||
|
|
||
|
install(FILES ffmpegthumbs.desktop DESTINATION ${SERVICES_INSTALL_DIR})
|
||
|
|
||
|
-if (KDE4_BUILD_TESTS)
|
||
|
- add_subdirectory(tests)
|
||
|
-endif (KDE4_BUILD_TESTS)
|
||
|
+if(BUILD_TESTING)
|
||
|
+ add_subdirectory(tests)
|
||
|
+endif()
|
||
|
--- a/ffmpegthumbnailer.cpp
|
||
|
+++ b/ffmpegthumbnailer.cpp
|
||
|
@@ -15,12 +15,11 @@
|
||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||
|
|
||
|
#include "ffmpegthumbnailer.h"
|
||
|
-#include <kdebug.h>
|
||
|
#include <QImage>
|
||
|
|
||
|
extern "C"
|
||
|
{
|
||
|
- KDE_EXPORT ThumbCreator* new_creator()
|
||
|
+ Q_DECL_EXPORT ThumbCreator *new_creator()
|
||
|
{
|
||
|
return new FFMpegThumbnailer();
|
||
|
}
|
||
|
|
||
|
--- a/ffmpegthumbnailer/imagewriter.cpp
|
||
|
+++ b/ffmpegthumbnailer/imagewriter.cpp
|
||
|
@@ -15,7 +15,6 @@
|
||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||
|
|
||
|
#include "imagewriter.h"
|
||
|
-#include <kdebug.h>
|
||
|
#include <iostream>
|
||
|
|
||
|
|
||
|
|
||
|
--- a/ffmpegthumbnailer/moviedecoder.cpp
|
||
|
+++ b/ffmpegthumbnailer/moviedecoder.cpp
|
||
|
@@ -16,7 +16,7 @@
|
||
|
|
||
|
#include "moviedecoder.h"
|
||
|
|
||
|
-#include <kdebug.h>
|
||
|
+#include <QDebug>
|
||
|
#include <QFileInfo>
|
||
|
|
||
|
extern "C" {
|
||
|
@@ -57,12 +57,12 @@
|
||
|
QFileInfo fileInfo(filename);
|
||
|
|
||
|
if ((!m_FormatContextWasGiven) && avformat_open_input(&m_pFormatContext, fileInfo.absoluteFilePath().toLocal8Bit().data(), NULL, NULL) != 0) {
|
||
|
- kDebug() << "Could not open input file: " << fileInfo.absoluteFilePath();
|
||
|
+ qDebug() << "Could not open input file: " << fileInfo.absoluteFilePath();
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (avformat_find_stream_info(m_pFormatContext, 0) < 0) {
|
||
|
- kDebug() << "Could not find stream information";
|
||
|
+ qDebug() << "Could not find stream information";
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
@@ -129,7 +129,7 @@
|
||
|
}
|
||
|
|
||
|
if (m_VideoStream == -1) {
|
||
|
- kDebug() << "Could not find video stream";
|
||
|
+ qDebug() << "Could not find video stream";
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
@@ -139,14 +139,14 @@
|
||
|
if (m_pVideoCodec == NULL) {
|
||
|
// set to NULL, otherwise avcodec_close(m_pVideoCodecContext) crashes
|
||
|
m_pVideoCodecContext = NULL;
|
||
|
- kDebug() << "Video Codec not found";
|
||
|
+ qDebug() << "Video Codec not found";
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
m_pVideoCodecContext->workaround_bugs = 1;
|
||
|
|
||
|
if (avcodec_open2(m_pVideoCodecContext, m_pVideoCodec, 0) < 0) {
|
||
|
- kDebug() << "Could not open video codec";
|
||
|
+ qDebug() << "Could not open video codec";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@@ -193,7 +193,7 @@
|
||
|
if (ret >= 0) {
|
||
|
avcodec_flush_buffers(m_pFormatContext->streams[m_VideoStream]->codec);
|
||
|
} else {
|
||
|
- kDebug() << "Seeking in video failed";
|
||
|
+ qDebug() << "Seeking in video failed";
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
@@ -214,7 +214,7 @@
|
||
|
} while ((!gotFrame || !m_pFrame->key_frame) && keyFrameAttempts < 200);
|
||
|
|
||
|
if (gotFrame == 0) {
|
||
|
- kDebug() << "Seeking in video failed";
|
||
|
+ qDebug() << "Seeking in video failed";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@@ -228,7 +228,7 @@
|
||
|
}
|
||
|
|
||
|
if (!frameFinished) {
|
||
|
- kDebug() << "decodeVideoFrame() failed: frame not finished";
|
||
|
+ qDebug() << "decodeVideoFrame() failed: frame not finished";
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
@@ -250,7 +250,7 @@
|
||
|
#endif
|
||
|
|
||
|
if (bytesDecoded < 0) {
|
||
|
- kDebug() << "Failed to decode video frame: bytesDecoded < 0";
|
||
|
+ qDebug() << "Failed to decode video frame: bytesDecoded < 0";
|
||
|
}
|
||
|
|
||
|
return (frameFinished > 0);
|
||
|
@@ -310,7 +310,7 @@
|
||
|
format, SWS_BICUBIC, NULL, NULL, NULL);
|
||
|
|
||
|
if (NULL == scaleContext) {
|
||
|
- kDebug() << "Failed to create resize context";
|
||
|
+ qDebug() << "Failed to create resize context";
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
|
||
|
--- a/tests/CMakeLists.txt
|
||
|
+++ b/tests/CMakeLists.txt
|
||
|
@@ -17,9 +17,9 @@
|
||
|
)
|
||
|
|
||
|
|
||
|
-kde4_add_executable(ffmpegthumbtest ${ffmpegthumbtest_SRCS} )
|
||
|
+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 Qt5::Gui KF5::KIOWidgets ${AVUTIL_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVCODEC_LIBRARIES} ${SWSCALE_LIBRARIES})
|
||
|
|
||
|
|
||
|
|