Don't hardcode encoding profiles, use an external config file

svn path=/trunk/kdenlive/; revision=5998
parent c50bb624
install(FILES banner.png timeline_nothumbs.png timeline_athumbs.png timeline_vthumbs.png timeline_avthumbs.png metadata.properties blacklisted_effects.txt blacklisted_transitions.txt DESTINATION ${DATA_INSTALL_DIR}/kdenlive )
install(FILES banner.png timeline_nothumbs.png timeline_athumbs.png timeline_vthumbs.png timeline_avthumbs.png metadata.properties blacklisted_effects.txt blacklisted_transitions.txt encodingprofiles.rc DESTINATION ${DATA_INSTALL_DIR}/kdenlive )
install( FILES kdenliveeffectscategory.rc DESTINATION ${CONFIG_INSTALL_DIR} )
install (FILES kdenlive.xpm DESTINATION share/pixmaps)
install (FILES kdenlive.menu DESTINATION share/menu RENAME kdenlive)
[decklink]
DNxHD=vcodec=dnxhd vb=145000k acodec=pcm_s16le threads=%threads;mov
Normal MPEG=vcodec=mpeg2video qscale=10 acodec=mp2 ac=2 ab=128k ar=48000 threads=%threads;mpg
[proxy]
Normal MPEG=-f mpegts -acodec libmp3lame -ac 2 -ab 128k -ar 48000 -vcodec mpeg2video -g 5 -deinterlace -s 480x270 -vb 400k;ts
[video4linux]
Normal MPEG=f=mpeg acodec=mp2 ab=128k ar=48000 vcodec=mpeg2video minrate=0 vb=4000k;mpg
......@@ -46,12 +46,7 @@ EncodingProfilesDialog::EncodingProfilesDialog(int profileType, QWidget * parent
button_delete->setIcon(KIcon("list-remove"));
button_download->setIcon(KIcon("download"));
QString profileFile = KStandardDirs::locateLocal("appdata", "encodingprofiles.rc");
if (!QFile::exists(profileFile)) {
// todo: copy global config file to local
//KIO::NetAccess::copy()
}
m_configFile = new KConfig(profileFile, KConfig::SimpleConfig);
m_configFile = new KConfig("encodingprofiles.rc", KConfig::FullConfig, "appdata");
profile_type->setCurrentIndex(profileType);
connect(profile_type, SIGNAL(currentIndexChanged(int)), this, SLOT(slotLoadProfiles()));
connect(profile_list, SIGNAL(currentRowChanged(int)), this, SLOT(slotShowParams()));
......
......@@ -114,17 +114,17 @@
<entry name="proxyextension" type="String">
<label>File extension for proxy clips.</label>
<default>ts</default>
<default></default>
</entry>
<entry name="proxy_profile" type="UInt">
<label>default v4l encoding profile.</label>
<label>default proxy encoding profile.</label>
<default>0</default>
</entry>
<entry name="proxyparams" type="String">
<label>Proxy clips transcoding parameters.</label>
<default>-f mpegts -acodec libmp3lame -ac 2 -ab 128k -ar 48000 -vcodec mpeg2video -g 5 -deinterlace -s 480x270 -vb 400k</default>
<default></default>
</entry>
</group>
......@@ -334,12 +334,12 @@
<entry name="v4l_parameters" type="String">
<label>Default video4linux format.</label>
<default>f=mpeg acodec=mp2 ab=128k ar=48000 vcodec=mpeg2video minrate=0 b=4000k</default>
<default></default>
</entry>
<entry name="v4l_extension" type="String">
<label>Default video4linux file extension.</label>
<default>mpg</default>
<default></default>
</entry>
<entry name="v4l_format" type="UInt">
......@@ -504,12 +504,12 @@
<entry name="decklink_parameters" type="String">
<label>Default Decklink encoding parameters.</label>
<default>vcodec=mpeg2video qscale=10 acodec=mp2 ac=2 ab=128k ar=48000 threads=%threads</default>
<default></default>
</entry>
<entry name="decklink_extension" type="String">
<label>Default Decklink capture file extension.</label>
<default>mpg</default>
<default></default>
</entry>
</group>
......
......@@ -934,16 +934,7 @@ void KdenliveSettingsDialog::slotManageEncodingProfile()
void KdenliveSettingsDialog::loadEncodingProfiles()
{
QString profileFile = KStandardDirs::locateLocal("appdata", "encodingprofiles.rc");
KConfig conf(profileFile, KConfig::SimpleConfig);
if (!QFile::exists(profileFile)) {
KConfigGroup g1(&conf, "video4linux");
g1.writeEntry("Normal MPEG", KdenliveSettings::v4l_parameters() + ";" + KdenliveSettings::v4l_extension());
KConfigGroup g2(&conf, "decklink");
g2.writeEntry("Normal MPEG", KdenliveSettings::decklink_parameters() + ";" + KdenliveSettings::decklink_extension());
KConfigGroup g3(&conf, "proxy");
g3.writeEntry("Normal MPEG", KdenliveSettings::proxyparams() + ";" + KdenliveSettings::proxyextension());
}
KConfig conf("encodingprofiles.rc", KConfig::FullConfig, "appdata");
// Load v4l profiles
m_configCapture.kcfg_v4l_profile->blockSignals(true);
......
......@@ -64,6 +64,7 @@
#include "archivewidget.h"
#include "databackup/backupwidget.h"
#include <KApplication>
#include <KAction>
#include <KLocale>
......@@ -612,6 +613,45 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
actionCollection()->addAssociatedWidget(m_clipMonitor->container());
actionCollection()->addAssociatedWidget(m_projectMonitor->container());
// Populate encoding profiles
KConfig conf("encodingprofiles.rc", KConfig::FullConfig, "appdata");
if (KdenliveSettings::proxyparams().isEmpty()) {
KConfigGroup group(&conf, "proxy");
QMap< QString, QString > values = group.entryMap();
QMapIterator<QString, QString> i(values);
if (i.hasNext()) {
i.next();
KdenliveSettings::setProxy_profile(i.key());
QString data = i.value();
KdenliveSettings::setProxyparams(data.section(';', 0, 0));
KdenliveSettings::setProxyextension(data.section(';', 1, 1));
}
}
if (KdenliveSettings::v4l_parameters().isEmpty()) {
KConfigGroup group(&conf, "video4linux");
QMap< QString, QString > values = group.entryMap();
QMapIterator<QString, QString> i(values);
if (i.hasNext()) {
i.next();
KdenliveSettings::setV4l_profile(i.key());
QString data = i.value();
KdenliveSettings::setV4l_parameters(data.section(';', 0, 0));
KdenliveSettings::setV4l_extension(data.section(';', 1, 1));
}
}
if (KdenliveSettings::decklink_parameters().isEmpty()) {
KConfigGroup group(&conf, "decklink");
QMap< QString, QString > values = group.entryMap();
QMapIterator<QString, QString> i(values);
if (i.hasNext()) {
i.next();
KdenliveSettings::setDecklink_profile(i.key());
QString data = i.value();
KdenliveSettings::setDecklink_parameters(data.section(';', 0, 0));
KdenliveSettings::setDecklink_extension(data.section(';', 1, 1));
}
}
}
MainWindow::~MainWindow()
......@@ -1778,14 +1818,6 @@ void MainWindow::newFile(bool showProjectSettings, bool force)
QMap <QString, QString> documentProperties;
QPoint projectTracks(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks());
if (!showProjectSettings) {
// set up default properties
documentProperties.insert("enableproxy", QString::number((int) KdenliveSettings::enableproxy()));
documentProperties.insert("generateproxy", QString::number((int) KdenliveSettings::generateproxy()));
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;
......
......@@ -94,8 +94,7 @@ ProjectSettings::ProjectSettings(ProjectList *projectlist, QStringList lumas, in
// load proxy profiles
QString profileFile = KStandardDirs::locateLocal("appdata", "encodingprofiles.rc");
KConfig conf(profileFile, KConfig::SimpleConfig);
KConfig conf("encodingprofiles.rc", KConfig::FullConfig, "appdata");
KConfigGroup group(&conf, "proxy");
QMap <QString, QString> values = group.entryMap();
QMapIterator<QString, QString> k(values);
......
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