From: Jean-Baptiste Mardelle Date: Sat, 19 Feb 2011 11:13:31 +0000 (+0000) Subject: Image clips can be proxied too now X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=ade7290445e275aca81bb280012a0b3c90b7f959;p=kdenlive Image clips can be proxied too now svn path=/trunk/kdenlive/; revision=5426 --- diff --git a/src/clipproperties.cpp b/src/clipproperties.cpp index 866349a6..875f85e9 100644 --- a/src/clipproperties.cpp +++ b/src/clipproperties.cpp @@ -223,7 +223,11 @@ ClipProperties::ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidg l->addWidget(pb); connect(pb, SIGNAL(clicked()), this, SLOT(slotDeleteProxy())); m_proxyContainer->setLayout(l); - if (t == AUDIO) { + if (t == IMAGE) { + m_view.tab_image->layout()->addWidget(line); + m_view.tab_image->layout()->addWidget(m_proxyContainer); + } + else if (t == AUDIO) { m_view.tab_audio->layout()->addWidget(line); m_view.tab_audio->layout()->addWidget(m_proxyContainer); } diff --git a/src/geometrywidget.cpp b/src/geometrywidget.cpp index 7eae9fd8..0de02ec0 100644 --- a/src/geometrywidget.cpp +++ b/src/geometrywidget.cpp @@ -92,24 +92,24 @@ GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos, connect(m_ui.buttonSync, SIGNAL(toggled(bool)), this, SLOT(slotSetSynchronize(bool))); m_spinX = new DragValue(i18n("X"), 0, 0, -1, QString(), false, this); - m_spinX->setRange(-10000, 10000); + m_spinX->setRange(-99000, 99000); m_ui.horizontalLayout->addWidget(m_spinX); m_spinY = new DragValue(i18n("Y"), 0, 0, -1, QString(), false, this); - m_spinY->setRange(-10000, 10000); + m_spinY->setRange(-99000, 99000); m_ui.horizontalLayout->addWidget(m_spinY); m_spinWidth = new DragValue(i18n("W"), m_monitor->render->frameRenderWidth(), 0, -1, QString(), false, this); - m_spinWidth->setRange(1, 10000); + m_spinWidth->setRange(1, 99000); m_ui.horizontalLayout->addWidget(m_spinWidth); m_spinHeight = new DragValue(i18n("H"), m_monitor->render->renderHeight(), 0, -1, QString(), false, this); - m_spinHeight->setRange(1, 10000); + m_spinHeight->setRange(1, 99000); m_ui.horizontalLayout->addWidget(m_spinHeight); m_ui.horizontalLayout->addStretch(10); m_spinSize = new DragValue(i18n("Size"), 100, 2, -1, i18n("%"), false, this); - m_spinSize->setRange(1, 10000); + m_spinSize->setRange(1, 99000); m_ui.horizontalLayout2->addWidget(m_spinSize); m_opacity = new DragValue(i18n("Opacity"), 100, 0, -1, i18n("%"), true, this); diff --git a/src/kdenlivedoc.cpp b/src/kdenlivedoc.cpp index 60a96c76..d6e2cb43 100644 --- a/src/kdenlivedoc.cpp +++ b/src/kdenlivedoc.cpp @@ -76,8 +76,11 @@ KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup m_documentProperties["zoneout"] = "100"; m_documentProperties["enableproxy"] = QString::number((int) KdenliveSettings::enableproxy()); m_documentProperties["proxyparams"] = KdenliveSettings::proxyparams(); + m_documentProperties["proxyextension"] = KdenliveSettings::proxyextension(); m_documentProperties["generateproxy"] = QString::number((int) KdenliveSettings::generateproxy()); m_documentProperties["proxyminsize"] = QString::number(KdenliveSettings::proxyminsize()); + m_documentProperties["generateimageproxy"] = QString::number((int) KdenliveSettings::generateimageproxy()); + m_documentProperties["proxyimageminsize"] = QString::number(KdenliveSettings::proxyimageminsize()); // Load properties QMapIterator i(properties); diff --git a/src/kdenlivesettings.kcfg b/src/kdenlivesettings.kcfg index dff10c95..8e0dc584 100644 --- a/src/kdenlivesettings.kcfg +++ b/src/kdenlivesettings.kcfg @@ -97,11 +97,26 @@ false + + + false + + 1000 + + + 2000 + + + + + avi + + -f avi -acodec libmp3lame -ac 2 -ab 92k -ar 48000 -vcodec mpeg2video -g 5 -deinterlace -s 480x270 -b 150k diff --git a/src/kdenlivesettingsdialog.cpp b/src/kdenlivesettingsdialog.cpp index 7e2e9169..bd9da80f 100644 --- a/src/kdenlivesettingsdialog.cpp +++ b/src/kdenlivesettingsdialog.cpp @@ -64,8 +64,9 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap& map QWidget *p8 = new QWidget; m_configProject.setupUi(p8); m_page8 = addPage(p8, i18n("Project Defaults"), "document-new"); - connect(m_configProject.kcfg_enableproxy, SIGNAL(toggled(bool)), m_configProject.proxy_frame, SLOT(setEnabled(bool))); - m_configProject.proxy_frame->setEnabled(KdenliveSettings::enableproxy()); + connect(m_configProject.kcfg_generateproxy, SIGNAL(toggled(bool)), m_configProject.kcfg_proxyminsize, SLOT(setEnabled(bool))); + m_configProject.kcfg_proxyminsize->setEnabled(KdenliveSettings::generateproxy()); + m_configProject.kcfg_proxyparams->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 5); QWidget *p3 = new QWidget; m_configTimeline.setupUi(p3); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 52e53d56..d9e824d4 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1802,8 +1802,11 @@ void MainWindow::newFile(bool showProjectSettings, bool force) // set up default properties documentProperties.insert("enableproxy", QString::number((int) KdenliveSettings::enableproxy())); documentProperties.insert("generateproxy", QString::number((int) KdenliveSettings::generateproxy())); - documentProperties.insert("proxyparams", KdenliveSettings::proxyparams()); documentProperties.insert("proxyminsize", QString::number(KdenliveSettings::proxyminsize())); + documentProperties.insert("proxyparams", KdenliveSettings::proxyparams()); + documentProperties.insert("proxyextension", KdenliveSettings::proxyextension()); + documentProperties.insert("generateimageproxy", QString::number((int) KdenliveSettings::generateimageproxy())); + documentProperties.insert("proxyimageminsize", QString::number(KdenliveSettings::proxyimageminsize())); if (!KdenliveSettings::activatetabs()) if (!closeCurrentDocument()) return; @@ -1823,8 +1826,11 @@ void MainWindow::newFile(bool showProjectSettings, bool force) projectTracks = w->tracks(); documentProperties.insert("enableproxy", QString::number((int) w->useProxy())); documentProperties.insert("generateproxy", QString::number((int) w->generateProxy())); - documentProperties.insert("proxyparams", w->proxyParams()); documentProperties.insert("proxyminsize", QString::number(w->proxyMinSize())); + documentProperties.insert("proxyparams", w->proxyParams()); + documentProperties.insert("proxyextension", w->proxyExtension()); + documentProperties.insert("generateimageproxy", QString::number((int) w->generateImageProxy())); + documentProperties.insert("proxyimageminsize", QString::number(w->proxyImageMinSize())); delete w; } m_timelineArea->setEnabled(true); @@ -2232,6 +2238,10 @@ void MainWindow::slotEditProjectSettings() //m_activeDocument->rebuildAllProxies(); } } + if (m_activeDocument->getDocumentProperty("proxyextension") != w->proxyExtension()) { + m_activeDocument->setModified(); + m_activeDocument->setDocumentProperty("proxyextension", w->proxyExtension()); + } if (m_activeDocument->getDocumentProperty("generateproxy") != QString::number((int) w->generateProxy())) { m_activeDocument->setModified(); m_activeDocument->setDocumentProperty("generateproxy", QString::number((int) w->generateProxy())); @@ -2240,6 +2250,14 @@ void MainWindow::slotEditProjectSettings() m_activeDocument->setModified(); m_activeDocument->setDocumentProperty("proxyminsize", QString::number(w->proxyMinSize())); } + if (m_activeDocument->getDocumentProperty("generateimageproxy") != QString::number((int) w->generateImageProxy())) { + m_activeDocument->setModified(); + m_activeDocument->setDocumentProperty("generateimageproxy", QString::number((int) w->generateImageProxy())); + } + if (m_activeDocument->getDocumentProperty("proxyimageminsize") != QString::number(w->proxyImageMinSize())) { + m_activeDocument->setModified(); + m_activeDocument->setDocumentProperty("proxyimageminsize", QString::number(w->proxyImageMinSize())); + } if (QString::number((int) w->useProxy()) != m_activeDocument->getDocumentProperty("enableproxy")) { m_activeDocument->setDocumentProperty("enableproxy", QString::number((int) w->useProxy())); m_activeDocument->setModified(); diff --git a/src/projectlist.cpp b/src/projectlist.cpp index e6eda4e7..286121b3 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -1004,7 +1004,7 @@ void ProjectList::slotAddClip(DocClipBase *clip, bool getProperties) m_infoQueue.insert(clip->getId(), e); } else if (item->hasProxy() && !item->isProxyRunning()) { - slotCreateProxy(clip->getId()); + slotCreateProxy(clip->getId(), false); } clip->askForAudioThumbs(); @@ -1059,6 +1059,15 @@ void ProjectList::slotGotProxy(const QString &id) // Proxy clip successfully created QDomElement e = item->referencedClip()->toXML().cloneNode().toElement(); //e.removeAttribute("file_hash"); + + // Make sure we get the correct producer length if it was adjusted in timeline + CLIPTYPE t = item->clipType(); + if (t == COLOR || t == IMAGE || t == SLIDESHOW || t == TEXT) { + int length = QString(item->referencedClip()->producerProperty("length")).toInt(); + if (length > 0 && !e.hasAttribute("length")) { + e.setAttribute("length", length); + } + } e.setAttribute("replace", 1); m_infoQueue.insert(id, e); if (!m_queueRunner.isRunning() && m_processingClips.isEmpty()) m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue); @@ -1149,8 +1158,9 @@ void ProjectList::updateAllClips() } else { if (item->data(0, Qt::DecorationRole).isNull()) requestClipThumbnail(clip->getId()); - if (item->data(0, DurationRole).toString().isEmpty()) + if (item->data(0, DurationRole).toString().isEmpty()) { item->changeDuration(item->referencedClip()->producer()->get_playtime()); + } } item->setData(0, UsageRole, QString::number(item->numReferences())); } @@ -1600,11 +1610,11 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce 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() > proxyMinSize()) { + 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 newProps; - newProps.insert("proxy", proxydir + item->referencedClip()->getClipHash() + ".avi"); + newProps.insert("proxy", proxydir + item->referencedClip()->getClipHash() + "." + m_doc->getDocumentProperty("proxyextension")); QMap oldProps = clip->properties(); oldProps.insert("proxy", QString()); EditClipCommand *command = new EditClipCommand(this, clipId, oldProps, newProps, true); @@ -1719,6 +1729,11 @@ bool ProjectList::adjustProjectProfileToItem(ProjectItem *item) return profileUpdated; } +QString ProjectList::getDocumentProperty(const QString &key) const +{ + return m_doc->getDocumentProperty(key); +} + bool ProjectList::useProxy() const { return m_doc->getDocumentProperty("enableproxy").toInt(); @@ -1729,14 +1744,9 @@ bool ProjectList::generateProxy() const return m_doc->getDocumentProperty("generateproxy").toInt(); } -int ProjectList::proxyMinSize() const -{ - return m_doc->getDocumentProperty("proxyminsize").toInt(); -} - -QString ProjectList::proxyParams() const +bool ProjectList::generateImageProxy() const { - return m_doc->getDocumentProperty("proxyparams").simplified(); + return m_doc->getDocumentProperty("generateimageproxy").toInt(); } void ProjectList::slotReplyGetImage(const QString &clipId, const QPixmap &pix) @@ -2073,10 +2083,16 @@ QMap ProjectList::getProxies() return list; } -void ProjectList::slotCreateProxy(const QString id) +void ProjectList::slotCreateProxy(const QString id, bool createProducer) { ProjectItem *item = getItemById(id); if (!item || item->isProxyRunning()) return; + + // If proxy producer already exists, skip creation + if (!createProducer) { + setProxyStatus(id, PROXYDONE); + return; + } setProxyStatus(id, PROXYWAITING); if (m_abortProxyId.contains(id)) m_abortProxyId.removeAll(id); emit projectModified(); @@ -2123,10 +2139,62 @@ void ProjectList::slotGenerateProxy(const QString id) file.close(); QFile::remove(path); } + if (item->clipType() == IMAGE) { + // Image proxy + QImage i(url); + if (i.isNull()) { + // Cannot load image + setProxyStatus(id, PROXYCRASHED); + return; + } + QImage proxy; + // Images are scaled to profile size. + //TODO: Make it be configurable? + if (i.width() > i.height()) proxy = i.scaledToWidth(m_render->frameRenderWidth()); + else proxy = i.scaledToHeight(m_render->renderHeight()); + int exif_orientation = QString(item->referencedClip()->producerProperty("_exif_orientation")).toInt(); + if (exif_orientation > 1) { + // Rotate image according to exif data + QImage processed; + QMatrix matrix; + + switch ( exif_orientation ) { + case 2: + matrix.scale( -1, 1 ); + break; + case 3: + matrix.rotate( 180 ); + break; + case 4: + matrix.scale( 1, -1 ); + break; + case 5: + matrix.rotate( 270 ); + matrix.scale( -1, 1 ); + break; + case 6: + matrix.rotate( 90 ); + break; + case 7: + matrix.rotate( 90 ); + matrix.scale( -1, 1 ); + break; + case 8: + matrix.rotate( 270 ); + break; + } + processed = proxy.transformed( matrix ); + processed.save(path); + } + else proxy.save(path); + setProxyStatus(id, PROXYDONE); + slotGotProxy(id); + return; + } QStringList parameters; parameters << "-i" << url; - QString params = proxyParams(); + QString params = m_doc->getDocumentProperty("proxyparams").simplified(); foreach(QString s, params.split(' ')) parameters << s; @@ -2185,13 +2253,36 @@ void ProjectList::updateProxyConfig() if ((t == VIDEO || t == AV || t == UNKNOWN) && item->referencedClip() != NULL) { if (generateProxy() && useProxy() && !item->isProxyRunning()) { DocClipBase *clip = item->referencedClip(); - if (clip->getProperty("frame_size").section('x', 0, 0).toInt() > proxyMinSize()) { + if (clip->getProperty("frame_size").section('x', 0, 0).toInt() > m_doc->getDocumentProperty("proxyminsize").toInt()) { + if (clip->getProperty("proxy").isEmpty()) { + // We need to insert empty proxy in old properties so that undo will work + QMap oldProps = clip->properties(); + oldProps.insert("proxy", QString()); + QMap newProps; + newProps.insert("proxy", proxydir + item->referencedClip()->getClipHash() + "." + m_doc->getDocumentProperty("proxyextension")); + new EditClipCommand(this, clip->getId(), oldProps, newProps, true, command); + } + } + } + else if (item->hasProxy()) { + // remove proxy + QMap newProps; + newProps.insert("proxy", QString()); + newProps.insert("replace", "1"); + new EditClipCommand(this, item->clipId(), item->referencedClip()->properties(), newProps, true, command); + } + } + else if (t == IMAGE && item->referencedClip() != NULL) { + if (generateImageProxy() && useProxy()) { + DocClipBase *clip = item->referencedClip(); + int maxImageSize = m_doc->getDocumentProperty("proxyimageminsize").toInt(); + if (clip->getProperty("frame_size").section('x', 0, 0).toInt() > maxImageSize || clip->getProperty("frame_size").section('x', 1, 1).toInt() > maxImageSize) { if (clip->getProperty("proxy").isEmpty()) { // We need to insert empty proxy in old properties so that undo will work QMap oldProps = clip->properties(); oldProps.insert("proxy", QString()); QMap newProps; - newProps.insert("proxy", proxydir + item->referencedClip()->getClipHash() + ".avi"); + newProps.insert("proxy", proxydir + item->referencedClip()->getClipHash() + ".png"); new EditClipCommand(this, clip->getId(), oldProps, newProps, true, command); } } @@ -2202,11 +2293,6 @@ void ProjectList::updateProxyConfig() newProps.insert("proxy", QString()); newProps.insert("replace", "1"); new EditClipCommand(this, item->clipId(), item->referencedClip()->properties(), newProps, true, command); - /*item->referencedClip()->clearProperty("proxy"); - QDomElement e = item->toXml().cloneNode().toElement(); - e.removeAttribute("file_hash"); - e.setAttribute("replace", 1); - m_infoQueue.insert(item->clipId(), e);*/ } } ++it; @@ -2242,11 +2328,11 @@ void ProjectList::slotProxyCurrentItem(bool doProxy) if (listItem->type() == PROJECTCLIPTYPE) { ProjectItem *item = static_cast (listItem); CLIPTYPE t = item->clipType(); - if ((t == VIDEO || t == AV || t == UNKNOWN) && item->referencedClip()) { + if ((t == VIDEO || t == AV || t == UNKNOWN || t == IMAGE) && item->referencedClip()) { oldProps = item->referencedClip()->properties(); if (doProxy) { newProps.clear(); - QString path = proxydir + item->referencedClip()->getClipHash() + ".avi"; + QString path = proxydir + item->referencedClip()->getClipHash() + "." + (t == IMAGE ? "png" : m_doc->getDocumentProperty("proxyextension")); newProps.insert("proxy", path); // We need to insert empty proxy so that undo will work oldProps.insert("proxy", QString()); diff --git a/src/projectlist.h b/src/projectlist.h index 266775f7..a39e84e9 100644 --- a/src/projectlist.h +++ b/src/projectlist.h @@ -195,14 +195,15 @@ public: QMap getProxies(); /** @brief Enable / disable proxies. */ void updateProxyConfig(); - /** @brief Does this project automatically use proxies. */ + /** @brief Get a property from the document. */ + QString getDocumentProperty(const QString &key) const; + + /** @brief Does this project allow proxies. */ bool useProxy() const; - /** @brief proxy parameters for this project. */ - QString proxyParams() const; /** @brief Should we automatically create proxy clips for newly added clips. */ bool generateProxy() const; - /** @brief Minimum clip width to create proxy. */ - int proxyMinSize() const; + /** @brief Should we automatically create proxy clips for newly added clips. */ + bool generateImageProxy() const; public slots: void setDocument(KdenliveDoc *doc); @@ -329,7 +330,7 @@ private slots: /** @brief Enable / disable proxy for current clip. */ void slotProxyCurrentItem(bool doProxy); /** @brief Put clip in the proxy waiting list. */ - void slotCreateProxy(const QString id); + void slotCreateProxy(const QString id, bool createProducer = true); /** @brief Stop creation of this clip's proxy. */ void slotAbortProxy(const QString id); /** @brief Start creation of proxy clip. */ diff --git a/src/projectsettings.cpp b/src/projectsettings.cpp index c4e8e4d1..a12eeab4 100644 --- a/src/projectsettings.cpp +++ b/src/projectsettings.cpp @@ -65,22 +65,28 @@ ProjectSettings::ProjectSettings(ProjectList *projectlist, QStringList lumas, in video_thumbs->setChecked(KdenliveSettings::videothumbnails()); audio_tracks->setValue(audiotracks); video_tracks->setValue(videotracks); - connect(enable_proxy, SIGNAL(toggled(bool)), proxy_box, SLOT(setEnabled(bool))); + proxy_params->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 5); connect(generate_proxy, SIGNAL(toggled(bool)), proxy_minsize, SLOT(setEnabled(bool))); + connect(generate_imageproxy, SIGNAL(toggled(bool)), proxy_imageminsize, SLOT(setEnabled(bool))); if (projectlist) { - enable_proxy->setChecked(projectlist->useProxy()); - generate_proxy->setChecked(projectlist->generateProxy()); - proxy_minsize->setValue(projectlist->proxyMinSize()); - proxy_params->setText(projectlist->proxyParams()); - proxy_box->setEnabled(projectlist->useProxy()); + enable_proxy->setChecked(projectlist->getDocumentProperty("enableproxy").toInt()); + generate_proxy->setChecked(projectlist->getDocumentProperty("generateproxy").toInt()); + proxy_minsize->setValue(projectlist->getDocumentProperty("proxyminsize").toInt()); + proxy_params->setPlainText(projectlist->getDocumentProperty("proxyparams")); + generate_imageproxy->setChecked(projectlist->getDocumentProperty("generateimageproxy").toInt()); + proxy_imageminsize->setValue(projectlist->getDocumentProperty("proxyimageminsize").toInt()); + proxy_extension->setText(projectlist->getDocumentProperty("proxyextension")); } else { enable_proxy->setChecked(KdenliveSettings::enableproxy()); generate_proxy->setChecked(KdenliveSettings::generateproxy()); proxy_minsize->setValue(KdenliveSettings::proxyminsize()); - proxy_params->setText(KdenliveSettings::proxyparams()); - proxy_box->setEnabled(KdenliveSettings::enableproxy()); + proxy_params->setPlainText(KdenliveSettings::proxyparams()); + generate_imageproxy->setChecked(KdenliveSettings::generateimageproxy()); + proxy_imageminsize->setValue(KdenliveSettings::proxyimageminsize()); + proxy_extension->setText(KdenliveSettings::proxyextension()); + } if (readOnlyTracks) { @@ -92,6 +98,7 @@ ProjectSettings::ProjectSettings(ProjectList *projectlist, QStringList lumas, in slotUpdateFiles(); connect(clear_cache, SIGNAL(clicked()), this, SLOT(slotClearCache())); connect(delete_unused, SIGNAL(clicked()), this, SLOT(slotDeleteUnused())); + connect(delete_proxies, SIGNAL(clicked()), this, SLOT(slotDeleteProxies())); } else tabWidget->widget(1)->setEnabled(false); connect(profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay())); connect(project_folder, SIGNAL(textChanged(const QString &)), this, SLOT(slotUpdateButton(const QString &))); @@ -140,12 +147,26 @@ void ProjectSettings::slotClearCache() slotUpdateFiles(true); } +void ProjectSettings::slotDeleteProxies() +{ + buttonBox->setEnabled(false); + + KIO::NetAccess::del(KUrl(project_folder->url().path(KUrl::AddTrailingSlash) + "proxy/"), this); + KStandardDirs::makeDir(project_folder->url().path(KUrl::AddTrailingSlash) + "proxy/"); + buttonBox->setEnabled(true); + slotUpdateFiles(true); +} + void ProjectSettings::slotUpdateFiles(bool cacheOnly) { - KIO::DirectorySizeJob * job = KIO::directorySize(project_folder->url().path(KUrl::AddTrailingSlash) + "thumbs/"); + KIO::DirectorySizeJob *job = KIO::directorySize(project_folder->url().path(KUrl::AddTrailingSlash) + "thumbs/"); job->exec(); thumbs_count->setText(QString::number(job->totalFiles())); thumbs_size->setText(KIO::convertSize(job->totalSize())); + job = KIO::directorySize(project_folder->url().path(KUrl::AddTrailingSlash) + "proxy/"); + job->exec(); + proxy_count->setText(QString::number(job->totalFiles())); + proxy_size->setText(KIO::convertSize(job->totalSize())); delete job; if (cacheOnly) return; int unused = 0; @@ -331,16 +352,31 @@ bool ProjectSettings::generateProxy() const return generate_proxy->isChecked(); } +bool ProjectSettings::generateImageProxy() const +{ + return generate_imageproxy->isChecked(); +} + int ProjectSettings::proxyMinSize() const { return proxy_minsize->value(); } +int ProjectSettings::proxyImageMinSize() const +{ + return proxy_imageminsize->value(); +} + QString ProjectSettings::proxyParams() const { return proxy_params->toPlainText(); } +QString ProjectSettings::proxyExtension() const +{ + return proxy_extension->text(); +} + //static QStringList ProjectSettings::extractPlaylistUrls(QString path) { diff --git a/src/projectsettings.h b/src/projectsettings.h index 9654d7fa..1209fb9c 100644 --- a/src/projectsettings.h +++ b/src/projectsettings.h @@ -41,7 +41,10 @@ public: bool useProxy() const; bool generateProxy() const; int proxyMinSize() const; + bool generateImageProxy() const; + int proxyImageMinSize() const; QString proxyParams() const; + QString proxyExtension() const; static QStringList extractPlaylistUrls(QString path); static QStringList extractSlideshowUrls(KUrl url); @@ -53,6 +56,7 @@ private slots: void slotUpdateButton(const QString &path); void slotUpdateFiles(bool cacheOnly = false); void slotClearCache(); + void slotDeleteProxies(); void slotDeleteUnused(); /** @brief Export project data to text file. */ void slotExportToText(); diff --git a/src/renderer.cpp b/src/renderer.cpp index 55ad1a0f..ca03e622 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -540,6 +540,8 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int QString path; if (xml.hasAttribute("proxy") && xml.attribute("proxy") != "-") path = xml.attribute("proxy"); else path = xml.attribute("resource"); + + KUrl url = KUrl(path); Mlt::Producer *producer = NULL; CLIPTYPE type = (CLIPTYPE)xml.attribute("type").toInt(); @@ -627,17 +629,22 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int int full_luma = xml.attribute("full_luma").toInt(); if (full_luma != 0) producer->set("set.force_full_luma", full_luma); } - + + int clipOut = 0; + if (xml.hasAttribute("out")) clipOut = xml.attribute("out").toInt(); + // setup length here as otherwise default length (currently 15000 frames in MLT) will be taken even if outpoint is larger if (type == COLOR || type == TEXT || type == IMAGE || type == SLIDESHOW) { int length; - if (xml.hasAttribute("length")) length = xml.attribute("length").toInt(); + if (xml.hasAttribute("length")) { + length = xml.attribute("length").toInt(); + clipOut = length - 1; + } else length = xml.attribute("out").toInt() - xml.attribute("in").toInt(); producer->set("length", length); } - if (xml.hasAttribute("out")) - producer->set_in_and_out(xml.attribute("in").toInt(), xml.attribute("out").toInt()); + if (clipOut > 0) producer->set_in_and_out(xml.attribute("in").toInt(), clipOut); producer->set("id", clipId.toUtf8().constData()); diff --git a/src/widgets/clipproperties_ui.ui b/src/widgets/clipproperties_ui.ui index a156b798..62bf4492 100644 --- a/src/widgets/clipproperties_ui.ui +++ b/src/widgets/clipproperties_ui.ui @@ -7,7 +7,7 @@ 0 0 280 - 520 + 503 @@ -227,7 +227,7 @@ - + Slideshow @@ -386,33 +386,37 @@ - + Image - - - - - Image size - - - - - - - true - - + + + + + + + Image size + + + + + + + true + + + + - + Transparent background - + Qt::Vertical diff --git a/src/widgets/configproject_ui.ui b/src/widgets/configproject_ui.ui index 51b0eae1..1b0d0b5b 100644 --- a/src/widgets/configproject_ui.ui +++ b/src/widgets/configproject_ui.ui @@ -6,8 +6,8 @@ 0 0 - 312 - 294 + 333 + 353 @@ -140,28 +140,21 @@ - - - Enable proxy clips + + + Proxy clips - - - - - - QFrame::NoFrame + + true - - QFrame::Raised + + false - - 0 - - Generate proxy if clip larger than + Generate for videos larger than @@ -179,19 +172,63 @@ - + - Transcoding parameters + Generate for images larger than + + + + + + + pixels + + + 500 + + + 100000 + + + 2000 - + + + FFmpeg video transcoding parameters + + + + + + + + 0 + 0 + + + + + + + + File extension + + + + + + + avi + + - + Qt::Vertical @@ -199,7 +236,7 @@ 20 - 21 + 40 @@ -212,6 +249,11 @@ QSpinBox
knuminput.h
+ + KLineEdit + QLineEdit +
klineedit.h
+
KComboBox QComboBox diff --git a/src/widgets/projectsettings_ui.ui b/src/widgets/projectsettings_ui.ui index 1d297ff3..73d200a8 100644 --- a/src/widgets/projectsettings_ui.ui +++ b/src/widgets/projectsettings_ui.ui @@ -6,8 +6,8 @@ 0 0 - 321 - 462 + 337 + 527
@@ -236,28 +236,21 @@ - - - Enable proxy clips + + + Proxy clips - - - - - - QFrame::NoFrame + + true - - QFrame::Raised + + false - - 0 - - Generate proxy if clip larger than + Generate for videos larger than @@ -274,25 +267,56 @@ - - + + + + Generate for images larger than + + + + + + + pixels + + + 500 + + + 100000 + + + 2000 + + + + + + + FFmpeg video transcoding parameters + + + + + + + + + + File extension + + + + + + + avi + + - - - - Qt::Vertical - - - - 105 - 17 - - - - @@ -300,14 +324,14 @@ Project Files - + Clips used in project: - + @@ -328,7 +352,7 @@ - + @@ -356,7 +380,7 @@ - + @@ -378,34 +402,44 @@ - + - Project files + Proxy clips - - + + - - + + - Fonts + - - - - true + + + + Delete proxies + + + + + + + Project files - + + + + true @@ -429,16 +463,34 @@ - - + + + + Fonts + + - + + + + true + + + + Plain text export + + + + + + +