Only display available codecs in rendering dialog

svn path=/branches/KDE4/; revision=2875
parent e30c1d60
......@@ -440,6 +440,9 @@ void RenderWidget::refreshView() {
QString group = item->text();
QListWidgetItem *sizeItem;
bool firstSelected = false;
const QStringList formatsList = KdenliveSettings::supportedformats();
const QStringList vcodecsList = KdenliveSettings::videocodecs();
const QStringList acodecsList = KdenliveSettings::audiocodecs();
for (int i = 0; i < m_view.size_list->count(); i++) {
sizeItem = m_view.size_list->item(i);
if (sizeItem->data(GroupRole) == group) {
......@@ -464,6 +467,47 @@ void RenderWidget::refreshView() {
}
}
}
if (!sizeItem->isHidden()) {
// Make sure the selected profile uses an installed avformat codec / format
std = sizeItem->data(ParamsRole).toString();
if (!formatsList.isEmpty()) {
QString format;
if (std.startsWith("f=")) format = std.section("f=", 1, 1);
else if (std.contains(" f=")) format = std.section(" f=", 1, 1);
if (!format.isEmpty()) {
format = format.section(' ', 0, 0).toLower();
if (!formatsList.contains(format)) {
kDebug() << "***** UNSUPPORTED F: " << format;
sizeItem->setHidden(true);
}
}
}
if (!acodecsList.isEmpty() && !sizeItem->isHidden()) {
QString format;
if (std.startsWith("acodec=")) format = std.section("acodec=", 1, 1);
else if (std.contains(" acodec=")) format = std.section(" acodec=", 1, 1);
if (!format.isEmpty()) {
format = format.section(' ', 0, 0).toLower();
if (!acodecsList.contains(format)) {
kDebug() << "***** UNSUPPORTED ACODEC: " << format;
sizeItem->setHidden(true);
}
}
}
if (!vcodecsList.isEmpty() && !sizeItem->isHidden()) {
QString format;
if (std.startsWith("vcodec=")) format = std.section("vcodec=", 1, 1);
else if (std.contains(" vcodec=")) format = std.section(" vcodec=", 1, 1);
if (!format.isEmpty()) {
format = format.section(' ', 0, 0).toLower();
if (!vcodecsList.contains(format)) {
kDebug() << "***** UNSUPPORTED VCODEC: " << format;
sizeItem->setHidden(true);
}
}
}
}
} else sizeItem->setHidden(true);
}
focusFirstVisibleItem();
......
......@@ -56,13 +56,29 @@
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Formats</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QListWidget" name="acodecs_list" />
</item>
<item row="1" column="1" >
<widget class="QListWidget" name="vcodecs_list" />
</item>
<item row="1" column="2" >
<widget class="QListWidget" name="formats_list" />
</item>
</layout>
<zorder>acodecs_list</zorder>
<zorder>vcodecs_list</zorder>
<zorder>formats_list</zorder>
<zorder>label_3</zorder>
<zorder>label_2</zorder>
<zorder>label</zorder>
</widget>
</widget>
</item>
......
......@@ -141,9 +141,9 @@ void Wizard::checkMltComponents() {
m_mltCheck.tabWidget->setTabEnabled(1, false);
} else {
avformatItem->setIcon(0, okIcon);
// Check installed codecs
// Check installed audio codecs
QProcess checkProcess2;
checkProcess2.start(KdenliveSettings::rendererpath(), QStringList() << "-producer" << "avformat:acodec-list");
checkProcess2.start(KdenliveSettings::rendererpath(), QStringList() << "noise:" << "-consumer" << "avformat" << "acodec=list");
if (!checkProcess2.waitForStarted()) {
m_mltCheck.tabWidget->setTabEnabled(1, false);
kDebug() << "// Error parsing MLT's avformat codecs";
......@@ -151,27 +151,54 @@ void Wizard::checkMltComponents() {
checkProcess2.waitForFinished();
QByteArray codecList = checkProcess2.readAllStandardError();
QString acodecList(codecList);
acodecList = acodecList.section("...", 0, 0);
QStringList result;
QStringList alist = acodecList.split("\n", QString::SkipEmptyParts);
for (int i = 0; i < alist.count(); i++) {
if (alist.at(i).contains("- ")) m_audioCodecs.append(alist.at(i).section("- ", 1).simplified());
if (alist.at(i).contains("- ")) result.append(alist.at(i).section("- ", 1).simplified().toLower());
}
m_mltCheck.acodecs_list->addItems(m_audioCodecs);
m_mltCheck.acodecs_list->addItems(result);
KdenliveSettings::setAudiocodecs(result);
//kDebug()<<"// FOUND LIST:\n\n"<<m_audioCodecs<<"\n\n++++++++++++++++++++";
}
checkProcess2.start(KdenliveSettings::rendererpath(), QStringList() << "-producer" << "avformat:vcodec-list");
// Check video codecs
checkProcess2.start(KdenliveSettings::rendererpath(), QStringList() << "noise:" << "-consumer" << "avformat" << "vcodec=list");
if (!checkProcess2.waitForStarted()) {
kDebug() << "// Error parsing MLT's avformat codecs";
} else {
checkProcess2.waitForFinished();
QByteArray codecList = checkProcess2.readAllStandardError();
QString vcodecList(codecList);
vcodecList = vcodecList.section("...", 0, 0);
QStringList result;
QStringList vlist = vcodecList.split("\n", QString::SkipEmptyParts);
for (int i = 0; i < vlist.count(); i++) {
if (vlist.at(i).contains("- ")) m_videoCodecs.append(vlist.at(i).section("- ", 1).simplified());
if (vlist.at(i).contains("- ")) result.append(vlist.at(i).section("- ", 1).simplified().toLower());
}
m_mltCheck.vcodecs_list->addItems(m_videoCodecs);
m_mltCheck.vcodecs_list->addItems(result);
KdenliveSettings::setVideocodecs(result);
//kDebug()<<"// FOUND LIST:\n\n"<<m_videoCodecs<<"\n\n++++++++++++++++++++";
}
// Check formats
checkProcess2.start(KdenliveSettings::rendererpath(), QStringList() << "noise:" << "-consumer" << "avformat" << "f=list");
if (!checkProcess2.waitForStarted()) {
kDebug() << "// Error parsing MLT's avformat codecs";
} else {
checkProcess2.waitForFinished();
QByteArray codecList = checkProcess2.readAllStandardError();
QString vcodecList(codecList);
QStringList result;
QStringList vlist = vcodecList.split("\n", QString::SkipEmptyParts);
for (int i = 0; i < vlist.count(); i++) {
if (vlist.at(i).contains("- ")) {
QString format = vlist.at(i).section("- ", 1).simplified().toLower();
if (format.contains(',')) {
QStringList sub = format.split(',', QString::SkipEmptyParts);
for (int j = 0; j < sub.count(); j++)
result.append(sub.at(j));
} else result.append(format);
}
}
m_mltCheck.formats_list->addItems(result);
KdenliveSettings::setSupportedformats(result);
//kDebug()<<"// FOUND LIST:\n\n"<<m_videoCodecs<<"\n\n++++++++++++++++++++";
}
......
......@@ -91,8 +91,6 @@ private:
QMap <QString, QString> m_profilesInfo;
void slotCheckPrograms();
void checkMltComponents();
QStringList m_audioCodecs;
QStringList m_videoCodecs;
private slots:
void slotCheckThumbs();
......
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