]> git.sesse.net Git - kdenlive/blobdiff - src/projectlist.cpp
Fix encoding problem in renderer:
[kdenlive] / src / projectlist.cpp
index 3ca48c99b7d2b5af156a5b6dd3e3d6b9860af396..375a1c2c488f5261a0325fe2089f70946920eb52 100644 (file)
@@ -1299,8 +1299,10 @@ void ProjectList::slotRemoveInvalidProxy(const QString &id, bool durationError)
 {
     ProjectItem *item = getItemById(id);
     if (item) {
-        //TODO: use durationError to display correct message to user after 0.8 release
-        if (durationError) kDebug() << "Proxy duration is wrong, try changing transcoding parameters.";
+        if (durationError) {
+            kDebug() << "Proxy duration is wrong, try changing transcoding parameters.";
+            emit displayMessage(i18n("Proxy clip unusable (duration is different from original)."), -2);
+        }
         item->setProxyStatus(PROXYCRASHED);
         QString path = item->referencedClip()->getProperty("proxy");
         KUrl proxyFolder(m_doc->projectFolder().path( KUrl::AddTrailingSlash) + "proxy/");
@@ -1604,29 +1606,37 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce
     if (item && producer) {
         //m_listView->blockSignals(true);
         monitorItemEditing(false);
+        DocClipBase *clip = item->referencedClip();
         item->setProperties(properties, metadata);
-        if (item->referencedClip()->isPlaceHolder() && producer->is_valid()) {
-            item->referencedClip()->setValid();
+        if (clip->isPlaceHolder() && producer->is_valid()) {
+            clip->setValid();
             item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsDropEnabled);
             toReload = clipId;
         }
-        
+
         // Proxy stuff
         QString size = properties.value("frame_size");
-        DocClipBase *clip = item->referencedClip();
-        if (!useProxy() && item->referencedClip()->getProperty("proxy").isEmpty()) setProxyStatus(item, NOPROXY);
-        if (useProxy() && generateProxy() && item->referencedClip()->getProperty("proxy") == "-") setProxyStatus(item, NOPROXY);
-        else if (useProxy() && !item->isProxyRunning() && (item->clipType() == AV || item->clipType() == VIDEO) && generateProxy() && size.section('x', 0, 0).toInt() > m_doc->getDocumentProperty("proxyminsize").toInt()) {
-            if (clip->getProperty("proxy").isEmpty()) {
-                QString proxydir = m_doc->projectFolder().path( KUrl::AddTrailingSlash) + "proxy/";
-                QMap <QString, QString> newProps;
-                newProps.insert("proxy", proxydir + item->referencedClip()->getClipHash() + "." + m_doc->getDocumentProperty("proxyextension"));
-                // insert required duration for proxy
-                newProps.insert("proxy_out", item->referencedClip()->producerProperty("out"));
-                QMap <QString, QString> oldProps = clip->properties();
-                oldProps.insert("proxy", QString());
-                EditClipCommand *command = new EditClipCommand(this, clipId, oldProps, newProps, true);
-                m_doc->commandStack()->push(command);
+        if (!useProxy() && clip->getProperty("proxy").isEmpty()) setProxyStatus(item, NOPROXY);
+        if (useProxy() && generateProxy() && clip->getProperty("proxy") == "-") setProxyStatus(item, NOPROXY);
+        else if (useProxy() && !item->isProxyRunning()) {
+            // proxy video and image clips
+            int maxSize;
+            CLIPTYPE t = item->clipType();
+            if (t == IMAGE) maxSize = m_doc->getDocumentProperty("proxyimageminsize").toInt();
+            else maxSize = m_doc->getDocumentProperty("proxyminsize").toInt();
+            if (((t == AV || t == VIDEO) && generateProxy() && size.section('x', 0, 0).toInt() > maxSize) || (t == IMAGE && generateImageProxy() && (size.section('x', 0, 0).toInt() > maxSize || size.section('x', 1, 1).toInt() > maxSize))) {
+                if (clip->getProperty("proxy").isEmpty()) {
+                    QString proxydir = m_doc->projectFolder().path( KUrl::AddTrailingSlash) + "proxy/";
+                    QMap <QString, QString> newProps;
+                    QString path = proxydir + clip->getClipHash() + "." + (t == IMAGE ? "png" : m_doc->getDocumentProperty("proxyextension"));
+                    newProps.insert("proxy", path);
+                    // insert required duration for proxy
+                    if (t != IMAGE) newProps.insert("proxy_out", clip->producerProperty("out"));
+                    QMap <QString, QString> oldProps = clip->properties();
+                    oldProps.insert("proxy", QString());
+                    EditClipCommand *command = new EditClipCommand(this, clipId, oldProps, newProps, true);
+                    m_doc->commandStack()->push(command);
+                }
             }
         }