summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <jb@kdenlive.org>2016-11-19 22:58:05 (GMT)
committerJean-Baptiste Mardelle <jb@kdenlive.org>2016-11-20 14:45:00 (GMT)
commit64027bb069ceab0bfc0d80f8cdf52e5b24783e0c (patch)
treeea1302374625c89b94bf053fef50482a7962bdf5
parentf49178380d1eee8e807b55deb6eb58f9983fd468 (diff)
Do not cache supported codecs / formats
Fix slideshow image count message when no image found
-rw-r--r--src/dialogs/renderwidget.cpp42
-rw-r--r--src/dialogs/renderwidget.h1
-rw-r--r--src/dialogs/wizard.cpp18
-rw-r--r--src/kdenlivesettings.kcfg15
-rw-r--r--src/project/dialogs/slideshowclip.cpp6
5 files changed, 42 insertions, 40 deletions
diff --git a/src/dialogs/renderwidget.cpp b/src/dialogs/renderwidget.cpp
index 9546f7c..a2f028b 100644
--- a/src/dialogs/renderwidget.cpp
+++ b/src/dialogs/renderwidget.cpp
@@ -92,6 +92,9 @@ enum JOBSTATUS {
ABORTEDJOB
};
+static QStringList acodecsList;
+static QStringList vcodecsList;
+static QStringList supportedFormats;
RenderJobItem::RenderJobItem(QTreeWidget * parent, const QStringList & strings, int type)
: QTreeWidgetItem(parent, strings, type),
@@ -312,6 +315,7 @@ RenderWidget::RenderWidget(const QString &projectfolder, bool enableProxy, const
QDBusConnectionInterface* interface = QDBusConnection::sessionBus().interface();
if (!interface || (!interface->isServiceRegistered(QStringLiteral("org.kde.ksmserver")) && !interface->isServiceRegistered(QStringLiteral("org.gnome.SessionManager"))))
m_view.shutdown->setEnabled(false);
+ checkCodecs();
refreshView();
focusFirstVisibleItem();
adjustSize();
@@ -1429,14 +1433,6 @@ void RenderWidget::refreshView()
QIcon brokenIcon = KoIconUtils::themedIcon(QStringLiteral("dialog-close"));
QIcon warningIcon = KoIconUtils::themedIcon(QStringLiteral("dialog-warning"));
- QStringList formatsList;
- QStringList vcodecsList;
- QStringList acodecsList;
- if (!KdenliveSettings::bypasscodeccheck()) {
- formatsList= KdenliveSettings::supportedformats();
- vcodecsList = KdenliveSettings::videocodecs();
- acodecsList = KdenliveSettings::audiocodecs();
- }
KColorScheme scheme(palette().currentColorGroup(), KColorScheme::Window);
const QColor disabled = scheme.foreground(KColorScheme::InactiveText).color();
const QColor disabledbg = scheme.background(KColorScheme::NegativeBackground).color();
@@ -1474,13 +1470,13 @@ void RenderWidget::refreshView()
}
// Make sure the selected profile uses an installed avformat codec / format
- if (!formatsList.isEmpty()) {
+ if (!supportedFormats.isEmpty()) {
QString format;
if (std.startsWith(QLatin1String("f="))) format = std.section(QStringLiteral("f="), 1, 1);
else if (std.contains(QStringLiteral(" f="))) format = std.section(QStringLiteral(" f="), 1, 1);
if (!format.isEmpty()) {
format = format.section(' ', 0, 0).toLower();
- if (!formatsList.contains(format)) {
+ if (!supportedFormats.contains(format)) {
item->setData(0, ErrorRole, i18n("Unsupported video format: %1", format));
item->setIcon(0, brokenIcon);
item->setForeground(0, disabled);
@@ -1817,7 +1813,6 @@ void RenderWidget::parseFile(const QString &exportFile, bool editable)
QString extension;
QDomNodeList groups = doc.elementsByTagName(QStringLiteral("group"));
QTreeWidgetItem *item = NULL;
- const QStringList acodecsList = KdenliveSettings::audiocodecs();
bool replaceVorbisCodec = false;
if (acodecsList.contains(QStringLiteral("libvorbis"))) replaceVorbisCodec = true;
bool replaceLibfaacCodec = false;
@@ -2547,3 +2542,28 @@ void RenderWidget::adjustSpeed(int speedIndex)
}
}
}
+
+void RenderWidget::checkCodecs()
+{
+ Mlt::Profile p;
+ Mlt::Consumer *consumer = new Mlt::Consumer(p, "avformat");;
+ if (consumer) {
+ consumer->set("vcodec", "list");
+ consumer->set("acodec", "list");
+ consumer->set("f", "list");
+ consumer->start();
+ vcodecsList.clear();
+ Mlt::Properties vcodecs((mlt_properties) consumer->get_data("vcodec"));
+ for (int i = 0; i < vcodecs.count(); ++i)
+ vcodecsList << QString(vcodecs.get(i));
+ acodecsList.clear();
+ Mlt::Properties acodecs((mlt_properties) consumer->get_data("acodec"));
+ for (int i = 0; i < acodecs.count(); ++i)
+ acodecsList << QString(acodecs.get(i));
+ supportedFormats.clear();
+ Mlt::Properties formats((mlt_properties) consumer->get_data("f"));
+ for (int i = 0; i < formats.count(); ++i)
+ supportedFormats << QString(formats.get(i));
+ delete consumer;
+ }
+}
diff --git a/src/dialogs/renderwidget.h b/src/dialogs/renderwidget.h
index ab8c4ff..ced88c0 100644
--- a/src/dialogs/renderwidget.h
+++ b/src/dialogs/renderwidget.h
@@ -211,6 +211,7 @@ private:
bool saveProfile(QDomElement newprofile);
/** @brief Create a rendering profile from MLT preset. */
QTreeWidgetItem *loadFromMltPreset(const QString groupName, const QString path, const QString profileName);
+ void checkCodecs();
signals:
void abortProcess(const QString &url);
diff --git a/src/dialogs/wizard.cpp b/src/dialogs/wizard.cpp
index 3c1819d..204d1de 100644
--- a/src/dialogs/wizard.cpp
+++ b/src/dialogs/wizard.cpp
@@ -54,6 +54,9 @@ const int mltVersionRevision = MLT_MIN_PATCH_VERSION;
static const char kdenlive_version[] = KDENLIVE_VERSION;
+static QStringList acodecsList;
+static QStringList vcodecsList;
+
MyWizardPage::MyWizardPage(QWidget *parent) : QWizardPage(parent)
, m_isComplete(false)
@@ -363,21 +366,12 @@ void Wizard::checkMltComponents()
consumer->set("acodec", "list");
consumer->set("f", "list");
consumer->start();
- QStringList result;
Mlt::Properties vcodecs((mlt_properties) consumer->get_data("vcodec"));
for (int i = 0; i < vcodecs.count(); ++i)
- result << QString(vcodecs.get(i));
- KdenliveSettings::setVideocodecs(result);
- result.clear();
+ vcodecsList << QString(vcodecs.get(i));
Mlt::Properties acodecs((mlt_properties) consumer->get_data("acodec"));
for (int i = 0; i < acodecs.count(); ++i)
- result << QString(acodecs.get(i));
- KdenliveSettings::setAudiocodecs(result);
- result.clear();
- Mlt::Properties formats((mlt_properties) consumer->get_data("f"));
- for (int i = 0; i < formats.count(); ++i)
- result << QString(formats.get(i));
- KdenliveSettings::setSupportedformats(result);
+ acodecsList << QString(acodecs.get(i));
checkMissingCodecs();
delete consumer;
}
@@ -413,8 +407,6 @@ void Wizard::checkMltComponents()
void Wizard::checkMissingCodecs()
{
- const QStringList acodecsList = KdenliveSettings::audiocodecs();
- const QStringList vcodecsList = KdenliveSettings::videocodecs();
bool replaceVorbisCodec = false;
if (acodecsList.contains(QStringLiteral("libvorbis"))) replaceVorbisCodec = true;
bool replaceLibfaacCodec = false;
diff --git a/src/kdenlivesettings.kcfg b/src/kdenlivesettings.kcfg
index 1082805..034d3f2 100644
--- a/src/kdenlivesettings.kcfg
+++ b/src/kdenlivesettings.kcfg
@@ -762,21 +762,6 @@
<default></default>
</entry>
- <entry name="audiocodecs" type="StringList">
- <label>Available avformat audio codecs.</label>
- <default></default>
- </entry>
-
- <entry name="videocodecs" type="StringList">
- <label>Available avformat video codecs.</label>
- <default></default>
- </entry>
-
- <entry name="supportedformats" type="StringList">
- <label>Available avformat formats.</label>
- <default></default>
- </entry>
-
<entry name="hastitleproducer" type="Bool">
<label>Is MLT compiled with Qt4 Kdenlive title support.</label>
<default>true</default>
diff --git a/src/project/dialogs/slideshowclip.cpp b/src/project/dialogs/slideshowclip.cpp
index 8f63d15..11798ab 100644
--- a/src/project/dialogs/slideshowclip.cpp
+++ b/src/project/dialogs/slideshowclip.cpp
@@ -273,7 +273,11 @@ void SlideshowClip::parseFolder()
}
m_count = m_view.icon_list->count();
m_view.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(m_count > 0);
- m_view.label_info->setText(i18np("1 image found", "%1 images found", m_count));
+ if (m_count == 0) {
+ m_view.label_info->setText(i18n("No image found"));
+ } else {
+ m_view.label_info->setText(i18np("1 image found", "%1 images found", m_count));
+ }
if (m_view.show_thumbs->isChecked()) slotGenerateThumbs();
m_view.icon_list->setCurrentRow(0);
}