Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Do not cache supported codecs / formats

Fix slideshow image count message when no image found
parent e16c303b
......@@ -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;
}
}
......@@ -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);
......
......@@ -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;
......
......@@ -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>
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment