void MainWindow::slotUpdateClip(const QString &id)
{
if (!m_activeDocument) return;
+ kDebug()<<"//\n\n RECIEVED UPDATED PRODUCER FOR: "<<id<<"\n\n--------------------";
DocClipBase *clip = m_activeDocument->clipManager()->getClipById(id);
if (clip->numReferences() > 0) m_activeTimeline->projectView()->slotUpdateClip(id);
if (m_clipMonitor->activeClip() && m_clipMonitor->activeClip()->getId() == id) {
connect(m_projectList, SIGNAL(showClipProperties(QList <DocClipBase *>, QMap<QString, QString>)), this, SLOT(slotShowClipProperties(QList <DocClipBase *>, QMap<QString, QString>)));
connect(m_projectMonitor->render, SIGNAL(replyGetImage(const QString &, const QString &, int, int)), m_projectList, SLOT(slotReplyGetImage(const QString &, const QString &, int, int)));
connect(m_projectMonitor->render, SIGNAL(replyGetImage(const QString &, const QImage &)), m_projectList, SLOT(slotReplyGetImage(const QString &, const QImage &)));
- connect(m_projectMonitor->render, SIGNAL(replyGetFileProperties(const QString &, Mlt::Producer*, const stringMap &, const stringMap &, bool, bool)), this, SLOT(slotReplyGetFileProperties(const QString &, Mlt::Producer*, const stringMap &, const stringMap &, bool, bool)));
+ connect(m_projectMonitor->render, SIGNAL(replyGetFileProperties(const QString &, Mlt::Producer*, const stringMap &, const stringMap &, bool)), m_projectList, SLOT(slotReplyGetFileProperties(const QString &, Mlt::Producer*, const stringMap &, const stringMap &, bool)));
connect(m_projectMonitor->render, SIGNAL(removeInvalidClip(const QString &, bool)), m_projectList, SLOT(slotRemoveInvalidClip(const QString &, bool)));
delete dia;
}
-void MainWindow::slotReplyGetFileProperties(const QString &clipId, Mlt::Producer *producer, const stringMap &properties, const stringMap &metadata, bool replace, bool refreshThumbnail)
-{
- m_projectList->slotReplyGetFileProperties(clipId, producer, properties, metadata, replace, refreshThumbnail);
-}
-
-
void MainWindow::slotElapsedTime()
{
kDebug()<<"-----------------------------------------\n"<<"Time elapsed: "<<m_timer.elapsed()<<"\n-------------------------";
void slotInsertNotesTimecode();
/** @brief Open the project's backupdialog. */
void slotOpenBackupDialog(const KUrl url = KUrl());
- /** @brief Make sure to update clip monitor before deleting a clip's producer. */
- void slotReplyGetFileProperties(const QString &clipId, Mlt::Producer *producer, const stringMap &properties, const stringMap &metadata, bool replace, bool refreshThumbnail);
/** @brief Disable proxies for this project. */
void slotDisableProxies();
QHBoxLayout *box = new QHBoxLayout;
KTreeWidgetSearchLine *searchView = new KTreeWidgetSearchLine;
- m_refreshMonitorTimer.setSingleShot(true);
- m_refreshMonitorTimer.setInterval(100);
- connect(&m_refreshMonitorTimer, SIGNAL(timeout()), this, SLOT(slotRefreshMonitor()));
-
box->addWidget(searchView);
//int s = style()->pixelMetric(QStyle::PM_SmallIconSize);
//m_toolbar->setIconSize(QSize(s, s));
void ProjectList::slotClipSelected()
{
- m_refreshMonitorTimer.stop();
QTreeWidgetItem *item = m_listView->currentItem();
ProjectItem *clip = NULL;
if (item) {
{
if (item == NULL || !m_refreshed) return;
DocClipBase *clip = item->referencedClip();
+ if (!clip || !clip->isClean() || m_render->isProcessing(item->clipId())) {
+ // Clip is being reprocessed, abort
+ kDebug()<<"//// TRYING TO PROXY: "<<item->clipId()<<", but it is busy";
+ return;
+ }
+
// Proxy clip successfully created
QDomElement e = clip->toXML().cloneNode().toElement();
}
}
-void ProjectList::slotRefreshMonitor()
-{
- if (m_listView->selectedItems().count() == 1 && m_render && m_render->processingItems() == 0) {
- if (m_listView->currentItem() && m_listView->currentItem()->type() != PROJECTFOLDERTYPE) {
- ProjectItem *item = static_cast <ProjectItem*>(m_listView->currentItem());
- DocClipBase *clip = item->referencedClip();
- if (clip && clip->isClean() && !m_render->isProcessing(item->clipId())) emit clipSelected(clip);
- }
- }
-}
-void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Producer *producer, const stringMap &properties, const stringMap &metadata, bool replace, bool refreshThumbnail)
+void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Producer *producer, const stringMap &properties, const stringMap &metadata, bool replace)
{
QString toReload;
ProjectItem *item = getItemById(clipId);
item->setProperties(properties, metadata);
clip->setProducer(producer, replace);
clip->askForAudioThumbs();
- if (refreshThumbnail) getCachedThumbnail(item);
+
// Proxy stuff
QString size = properties.value("frame_size");
if (!useProxy() && clip->getProperty("proxy").isEmpty()) setProxyStatus(item, NOPROXY);
}
}
- if (!replace && item->data(0, Qt::DecorationRole).isNull() && !refreshThumbnail) {
+ if (!replace && item->data(0, Qt::DecorationRole).isNull()) {
requestClipThumbnail(clipId);
}
if (!toReload.isEmpty())
}
if (replace && item) {
toReload = clipId;
- // update clip in clip monitor
- /*if (queue == 0 && item->isSelected() && m_listView->selectedItems().count() == 1)
- m_refreshMonitorTimer.start();*/
}
if (!item) {
// no item for producer, delete it
if ((t == VIDEO || t == AV || t == UNKNOWN || t == IMAGE || t == PLAYLIST) && item->referencedClip()) {
if ((doProxy && item->hasProxy()) || (!doProxy && !item->hasProxy())) continue;
DocClipBase *clip = item->referencedClip();
- if (!clip->isClean() || m_render->isProcessing(item->clipId())) continue;
+ if (!clip || !clip->isClean() || m_render->isProcessing(item->clipId())) {
+ kDebug()<<"//// TRYING TO PROXY: "<<item->clipId()<<", but it is busy";
+ continue;
+ }
+
resetThumbsProducer(clip);
oldProps = clip->properties();
if (doProxy) {
void updateAllClips(bool displayRatioChanged, bool fpsChanged);
void slotReplyGetImage(const QString &clipId, const QImage &img);
void slotReplyGetImage(const QString &clipId, const QString &name, int width, int height);
- void slotReplyGetFileProperties(const QString &clipId, Mlt::Producer *producer, const stringMap &properties, const stringMap &metadata, bool replace, bool refreshThumbnail);
+ void slotReplyGetFileProperties(const QString &clipId, Mlt::Producer *producer, const stringMap &properties, const stringMap &metadata, bool replace);
void slotAddClip(DocClipBase *clip, bool getProperties);
void slotDeleteClip(const QString &clipId);
void slotUpdateClip(const QString &id);
QList <PROXYINFO> m_proxyList;
QFutureSynchronizer<void> m_proxyThreads;
InvalidDialog *m_invalidClipDialog;
- QTimer m_refreshMonitorTimer;
void requestClipThumbnail(const QString id);
/** @brief Stop creation of this clip's proxy. */
void slotAbortProxy(const QString id, const QString path);
/** @brief Start creation of proxy clip. */
- void slotGenerateProxy();//const QString destPath, const QString sourcePath, int clipType, int exif);
- /** @brief Timer triggering a refresh of the clip monitor. */
- void slotRefreshMonitor();
+ void slotGenerateProxy();
signals:
void clipSelected(DocClipBase *, QPoint zone = QPoint());
if (info.xml.hasAttribute("templatetext"))
producer->set("templatetext", info.xml.attribute("templatetext").toUtf8().constData());
+
+ int imageWidth = (int)((double) info.imageHeight * m_mltProfile->width() / m_mltProfile->height() + 0.5);
+ int fullWidth = (int)((double) info.imageHeight * m_mltProfile->dar() + 0.5);
+ int frameNumber = info.xml.attribute("thumbnail", "-1").toInt();
if ((!info.replaceProducer && info.xml.hasAttribute("file_hash")) || proxyProducer) {
// Clip already has all properties
- emit replyGetFileProperties(info.clipId, producer, stringMap(), stringMap(), info.replaceProducer, true);
+ if (proxyProducer) {
+ // Recreate clip thumb
+ if (frameNumber > 0) producer->seek(frameNumber);
+ Mlt::Frame *frame = producer->get_frame();
+ if (frame && frame->is_valid()) {
+ QImage img = KThumb::getFrame(frame, imageWidth, fullWidth, info.imageHeight);
+ delete frame;
+ emit replyGetImage(info.clipId, img);
+ }
+ }
+ emit replyGetFileProperties(info.clipId, producer, stringMap(), stringMap(), info.replaceProducer);
m_processingClipId.clear();
continue;
}
- int imageWidth = (int)((double) info.imageHeight * m_mltProfile->width() / m_mltProfile->height() + 0.5);
- int fullWidth = (int)((double) info.imageHeight * m_mltProfile->dar() + 0.5);
stringMap filePropertyMap;
stringMap metadataPropertyMap;
-
- int frameNumber = info.xml.attribute("thumbnail", "-1").toInt();
if (frameNumber > 0) producer->seek(frameNumber);
duration = duration > 0 ? duration : producer->get_playtime();
signals:
/** @brief The renderer received a reply to a getFileProperties request. */
- void replyGetFileProperties(const QString &clipId, Mlt::Producer*, const stringMap &, const stringMap &, bool replaceProducer, bool refreshThumbnail = false);
+ void replyGetFileProperties(const QString &clipId, Mlt::Producer*, const stringMap &, const stringMap &, bool replaceProducer);
/** @brief The renderer received a reply to a getImage request. */
void replyGetImage(const QString &, const QString &, int, int);