]> git.sesse.net Git - kdenlive/blobdiff - src/kdenlivedoc.cpp
Clean up timecode handling, improves:
[kdenlive] / src / kdenlivedoc.cpp
index ae4c236d394bb8ed9335094d8a9222c797118a69..b109c9d72668ac1817315910a28e6bef7169dac2 100644 (file)
@@ -208,6 +208,8 @@ KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup
         m_document = createEmptyDocument(tracks.x(), tracks.y());
     }
 
+    KdenliveSettings::setCurrent_profile(profilePath());
+
     // Set the video profile (empty == default)
 
     // Make sure the project folder is usable
@@ -222,8 +224,8 @@ KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup
     KStandardDirs::makeDir(m_projectFolder.path(KUrl::AddTrailingSlash) + "ladspa/");
 
     kDebug() << "Kdenlive document, init timecode: " << m_fps;
-    if (m_fps == 30000.0 / 1001.0) m_timecode.setFormat(30, true);
-    else m_timecode.setFormat((int)(m_fps + 0.5));
+    if (m_fps == 30000.0 / 1001.0) m_timecode.setFormat(m_fps, true);
+    else m_timecode.setFormat(m_fps);
 
     //kDebug() << "// SETTING SCENE LIST:\n\n" << m_document.toString();
     connect(m_autoSaveTimer, SIGNAL(timeout()), this, SLOT(slotAutoSave()));
@@ -245,6 +247,7 @@ KdenliveDoc::~KdenliveDoc()
 
 int KdenliveDoc::setSceneList()
 {
+    m_render->resetProfile();
     if (m_render->setSceneList(m_document.toString(), m_documentProperties.value("position").toInt()) == -1) {
         // INVALID MLT Consumer, something is wrong
         return -1;
@@ -690,8 +693,8 @@ void KdenliveDoc::setProfilePath(QString path)
     m_width = m_profile.width;
     m_height = m_profile.height;
     kDebug() << "Kdenlive document, init timecode from path: " << path << ",  " << m_fps;
-    if (m_fps == 30000.0 / 1001.0) m_timecode.setFormat(30, true);
-    else m_timecode.setFormat((int)(m_fps + 0.5));
+    if (m_fps == 30000.0 / 1001.0) m_timecode.setFormat(m_fps, true);
+    else m_timecode.setFormat(m_fps);
 }
 
 double KdenliveDoc::dar()
@@ -756,7 +759,7 @@ void KdenliveDoc::updateClip(const QString &id)
 
 int KdenliveDoc::getFramePos(QString duration)
 {
-    return m_timecode.getFrameCount(duration, m_fps);
+    return m_timecode.getFrameCount(duration);
 }
 
 QString KdenliveDoc::producerName(const QString &id)