void Initialise() { Thumbnailer::Ptr thumbnailer(new DefaultThumbnailer("default")); std::list<std::string> mime_types; mime_types.push_back("*"); ThumbnailGenerator::RegisterThumbnailer(mime_types, thumbnailer); }
void AVThumbnailer::createThumbnail(AVThumbnailer *that, QString flavor, QString inPath, QString outPath, int width, bool crop) { try { ffmpegthumbnailer::VideoThumbnailer thumbnailer(width, false, !crop, 8, false); thumbnailer.setSeekPercentage(10); thumbnailer.generateThumbnail(inPath.toStdString(), Jpeg, outPath.toStdString()); that->m_mutex.lock(); that->m_taskInProgress = false; that->m_mutex.unlock(); QMetaObject::invokeMethod(that, "thumbnailGenerated", Qt::QueuedConnection, Q_ARG(QString, inPath), Q_ARG(QString, flavor)); } catch (std::exception& e) { qDebug() << e.what(); that->m_mutex.lock(); that->m_taskInProgress = false; that->m_mutex.unlock(); QMetaObject::invokeMethod(that, "thumbnailError", Qt::QueuedConnection, Q_ARG(QString, inPath), Q_ARG(uint, 0), Q_ARG(QString, QString())); } catch (...) { that->m_mutex.lock(); that->m_taskInProgress = false; that->m_mutex.unlock(); QMetaObject::invokeMethod(that, "thumbnailError", Qt::QueuedConnection, Q_ARG(QString, inPath), Q_ARG(uint, 0), Q_ARG(QString, QString())); } }