Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Re-enable thumbnailer (install directory might need a fix)

parent 65a9eb51
......@@ -100,7 +100,7 @@ add_subdirectory(data)
#macro_optional_add_subdirectory(po)
add_subdirectory(renderer)
add_subdirectory(src)
#add_subdirectory(thumbnailer)
add_subdirectory(thumbnailer)
#add_subdirectory(testingArea)
......
......@@ -199,11 +199,9 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --std=c99")
# KDE definitions and include directories *must* always come first, Qt follows
# (to avoid breaking builds when KDE and/or Qt are installed to different
# prefixes).
add_definitions(${KDE4_DEFINITIONS})
include_directories(
${CMAKE_BINARY_DIR}
${KDE4_INCLUDES} # Adds Qt include directories too.
${MLT_INCLUDE_DIR}
${MLTPP_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/lib/external
......
set(westleypreview_SRCS westleypreview.cpp)
set(mltpreview_SRCS mltpreview.cpp)
include_directories(
${KDE4_INCLUDES}
${MLT_INCLUDE_DIR}
${MLTPP_INCLUDE_DIR}
)
kde4_add_plugin(westleypreview ${westleypreview_SRCS})
add_library(mltpreview MODULE ${mltpreview_SRCS})
#include(${QT_USE_FILE})
target_link_libraries(westleypreview
${KDE4_KIO_LIBS}
${QT_LIBRARIES}
target_link_libraries(mltpreview
Qt5::Core
Qt5::Gui
KF5::KIOCore
KF5::KIOWidgets
${MLT_LIBRARIES}
${MLTPP_LIBRARIES}
)
install(TARGETS westleypreview DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES westleypreview.desktop DESTINATION ${SERVICES_INSTALL_DIR})
#FIXME: For some reason the plugin only seems to work if installed in $lib/qt5/plugins and not in $lib/plugins like KF5 recommands
install(TARGETS mltpreview DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES mltpreview.desktop DESTINATION ${SERVICES_INSTALL_DIR})
......@@ -18,7 +18,7 @@
Boston, MA 02110-1301, USA.
***************************************************************************/
#include "westleypreview.h"
#include "mltpreview.h"
#include <QFile>
#include <QImage>
......@@ -27,22 +27,18 @@
#include <krandomsequence.h>
#include <QDebug>
#include <ktempdir.h>
#include <unistd.h>
#define DBG_AREA
//#include "config.h"
extern "C" {
KDE_EXPORT ThumbCreator *new_creator() {
Q_DECL_EXPORT ThumbCreator *new_creator() {
return new MltPreview;
}
}
MltPreview::MltPreview() :
QObject(),
ThumbCreator()
MltPreview::MltPreview()
{
Mlt::Factory::init();
}
......@@ -77,7 +73,6 @@ bool MltPreview::create(const QString &path, int width, int height, QImage &img)
}
//img = getFrame(producer, frame, width, height);
while (variance <= 40 && ct < 4) {
img = getFrame(producer, frame, wanted_width , wanted_height);
variance = imageVariance(img);
......@@ -92,27 +87,27 @@ bool MltPreview::create(const QString &path, int width, int height, QImage &img)
QImage MltPreview::getFrame(Mlt::Producer *producer, int framepos, int width, int height)
{
QImage result;
QImage mltImage(width, height, QImage::Format_ARGB32_Premultiplied);
if (producer == NULL) {
return result;
return mltImage;
}
producer->seek(framepos);
Mlt::Frame *frame = producer->get_frame();
if (frame == NULL) {
return result;
return mltImage;
}
mlt_image_format format = mlt_image_rgb24a;
uint8_t *data = frame->get_image(format, width, height, 0);
QImage image((uchar *)data, width, height, QImage::Format_ARGB32);
if (!image.isNull()) {
result = image.rgbSwapped().convertToFormat(QImage::Format_RGB32);
const uchar* imagedata = frame->get_image(format, width, height);
if (imagedata != NULL) {
memcpy(mltImage.bits(), imagedata, width * height * 4);
mltImage = mltImage.rgbSwapped();
}
delete frame;
return result;
return mltImage;
}
......@@ -121,11 +116,11 @@ uint MltPreview::imageVariance(const QImage &image)
if (image.isNull()) return 0;
uint delta = 0;
uint avg = 0;
uint bytes = image.numBytes();
uint bytes = image.byteCount();
uint STEPS = bytes / 2;
if (STEPS < 1) return 0;
QVarLengthArray<uchar> pivot(STEPS);
kDebug(DBG_AREA) << "Using " << STEPS << " steps\n";
qDebug() << "Using " << STEPS << " steps\n";
const uchar *bits=image.bits();
// First pass: get pivots and taking average
for( uint i=0; i<STEPS ; i++ ){
......
......@@ -37,7 +37,11 @@ Name[x-test]=xxMLT Playlistxx
Name[zh_CN]=MLT 播放列表
Name[zh_TW]=MLT 播放清單
X-KDE-ServiceTypes=ThumbCreator
CacheThumbnail=true
IgnoreMaximumSize=true
MimeType=video/mlt-playlist;application/x-kdenlive;application/x-kdenlivetitle;
X-KDE-Library=westleypreview
X-KDE-Library=mltpreview
CacheThumbnail=true
......@@ -20,8 +20,8 @@
***************************************************************************/
#ifndef WESTLEYPREVIEW_H
#define WESTLEYPREVIEW_H
#ifndef MLTPREVIEW_H
#define MLTPREVIEW_H
#include <kio/thumbcreator.h>
......@@ -29,9 +29,8 @@
#include <QObject>
class MltPreview : public QObject, public ThumbCreator
class MltPreview : public ThumbCreator
{
Q_OBJECT
public:
MltPreview();
virtual ~MltPreview();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment