}
}
}
-
+
// Something went wrong, or a new file was requested: create a new project
if (!success) {
m_url.clear();
m_document = createEmptyDocument(tracks.x(), tracks.y());
}
- // Set the video profile (empty == default)
- KdenliveSettings::setCurrent_profile(profilePath());
-
// Ask to create the project directory if it does not exist
if (!QFile::exists(m_projectFolder.path())) {
int create = KMessageBox::questionYesNo(parent, i18n("Project directory %1 does not exist. Create it?", m_projectFolder.path()));
int KdenliveDoc::setSceneList()
{
- m_render->resetProfile(KdenliveSettings::current_profile());
+ m_render->resetProfile(KdenliveSettings::current_profile(), true);
if (m_render->setSceneList(m_document.toString(), m_documentProperties.value("position").toInt()) == -1) {
// INVALID MLT Consumer, something is wrong
return -1;
QDomDocument doc;
QDomElement mlt = doc.createElement("mlt");
doc.appendChild(mlt);
-
-
+
// Create black producer
// For some unknown reason, we have to build the black producer here and not in renderer.cpp, otherwise
// the composite transitions with the black track are corrupted.
m_height = m_profile.height;
kDebug() << "Kdenlive document, init timecode from path: " << path << ", " << m_fps;
m_timecode.setFormat(m_fps);
+ KdenliveSettings::setCurrent_profile(m_profile.path);
return (current_fps != m_fps);
}
}
if (baseClip && !baseClip->fileURL().isEmpty()) {
// create zone from clip url, so that we don't have problems with proxy clips
- QProcess::startDetached(KdenliveSettings::rendererpath(), QStringList() << baseClip->fileURL().path() << "in=" + QString::number(zone.x()) << "out=" + QString::number(zone.y()) << "-consumer" << "xml:" + url->url().path());
+ QProcess p;
+#if QT_VERSION >= 0x040600
+ QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
+ env.remove("MLT_PROFILE");
+ p.setProcessEnvironment(env);
+#else
+ QStringList env = QProcess::systemEnvironment();
+ env << "MLT_PROFILE='\0'";
+ p.setEnvironment(env);
+#endif
+ p.start(KdenliveSettings::rendererpath(), QStringList() << baseClip->fileURL().path() << "in=" + QString::number(zone.x()) << "out=" + QString::number(zone.y()) << "-consumer" << "xml:" + url->url().path());
+ if (!p.waitForStarted(3000)) {
+ KMessageBox::sorry(this, i18n("Cannot start MLT's renderer:\n%1", KdenliveSettings::rendererpath()));
+ }
+ else if (!p.waitForFinished(5000)) {
+ KMessageBox::sorry(this, i18n("Timeout while creating xml output"));
+ }
}
else render->saveZone(url->url(), edit->text(), zone);
}
void Render::buildConsumer(const QString profileName)
{
- m_activeProfile = profileName;
- char *tmp = qstrdup(m_activeProfile.toUtf8().constData());
delete m_blackClip;
m_blackClip = NULL;
//TODO: uncomment following line when everything is clean
// uncommented Feb 2011 --Granjow
if (m_mltProfile) delete m_mltProfile;
-
+ m_activeProfile = profileName;
+ char *tmp = qstrdup(m_activeProfile.toUtf8().constData());
+ setenv("MLT_PROFILE", tmp, 1);
m_mltProfile = new Mlt::Profile(tmp);
m_mltProfile->set_explicit(true);
delete[] tmp;
return clip;
}
-int Render::resetProfile(const QString profileName)
+int Render::resetProfile(const QString profileName, bool dropSceneList)
{
- QString scene = sceneList();
+ QString scene;
+ if (!dropSceneList) scene = sceneList();
if (m_mltConsumer) {
if (m_externalConsumer == KdenliveSettings::external_display()) {
if (KdenliveSettings::external_display() && m_activeProfile == profileName) return 1;
buildConsumer(profileName);
double new_fps = m_mltProfile->fps();
double new_dar = m_mltProfile->dar();
- if (current_fps != new_fps) {
- // fps changed, we must update the scenelist positions
- scene = updateSceneListFps(current_fps, new_fps, scene);
+
+ if (!dropSceneList) {
+ // We need to recover our playlist
+ if (current_fps != new_fps) {
+ // fps changed, we must update the scenelist positions
+ scene = updateSceneListFps(current_fps, new_fps, scene);
+ }
+ setSceneList(scene, pos);
+ // producers have changed (different profile), so reset them...
+ emit refreshDocumentProducers(new_dar != current_dar, current_fps != new_fps);
}
- //kDebug() << "//RESET WITHSCENE: " << scene;
- setSceneList(scene, pos);
- // producers have changed (different profile), so reset them...
- emit refreshDocumentProducers(new_dar != current_dar, current_fps != new_fps);
- /*Mlt::Producer *producer = new Mlt::Producer(*m_mltProfile , "xml-string", scene.toUtf8().constData());
- m_mltProducer = producer;
- m_blackClip = new Mlt::Producer(*m_mltProfile , "colour", "black");
- m_mltProducer->optimise();
- m_mltProducer->set_speed(0);
- connectPlaylist();*/
-
- //delete m_mltProfile;
- // mlt_properties properties = MLT_CONSUMER_PROPERTIES(m_mltConsumer->get_consumer());
- //mlt_profile prof = m_mltProfile->get_profile();
- //mlt_properties_set_data(properties, "_profile", prof, 0, (mlt_destructor)mlt_profile_close, NULL);
- //mlt_properties_set(properties, "profile", "hdv_1080_50i");
- //m_mltConsumer->set("profile", (char *) profile.toUtf8().data());
- //m_mltProfile = new Mlt::Profile((char*) profile.toUtf8().data());
-
- //apply_profile_properties( m_mltProfile, m_mltConsumer->get_consumer(), properties );
- //refresh();
return 1;
}
playlist.replace(">avformat</property>", ">avformat-novalidate</property>");
else
playlist.replace(">avformat-novalidate</property>", ">avformat</property>");
-
m_mltProducer = new Mlt::Producer(*m_mltProfile, "xml-string", playlist.toUtf8().constData());
if (!m_mltProducer || !m_mltProducer->is_valid()) {
kDebug() << " WARNING - - - - -INVALID PLAYLIST: " << playlist.toUtf8().constData();