]> git.sesse.net Git - kdenlive/blobdiff - src/docclipbase.cpp
Fix up a busted preprocessor check [PATCH by Ray Lehtiniemi]
[kdenlive] / src / docclipbase.cpp
index 39f79c7e835b2ac2b88cc2dad285d1d5912f01d9..0984f9232d32ecb4c2881f5a52c67e0f25b3ba01 100644 (file)
@@ -1,22 +1,29 @@
-/**************************1*************************************************
-                          DocClipBase.cpp  -  description
-                             -------------------
-    begin                : Fri Apr 12 2002
-    copyright            : (C) 2002 by Jason Wood
-    copyright            : (C) 2009 by Jean-Baptiste Mardelle
-
- ***************************************************************************/
-
 /***************************************************************************
+ *                         DocClipBase.cpp  -  description                *
+ *                           -------------------                          *
+ *   begin                : Fri Apr 12 2002                               *
+ *   Copyright (C) 2002 by Jason Wood (jasonwood@blueyonder.co.uk)         *
+ *   Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
  *   the Free Software Foundation; either version 2 of the License, or     *
  *   (at your option) any later version.                                   *
  *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
  ***************************************************************************/
 
 
+
+
 #include "docclipbase.h"
 #include "kdenlivesettings.h"
 #include "kthumb.h"
@@ -38,13 +45,15 @@ DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QStrin
 
     KUrl url = KUrl(xml.attribute("resource"));
     if (!m_properties.contains("file_hash") && !url.isEmpty()) getFileHash(url.path());
-    int out = xml.attribute("out").toInt();
-    if (out != 0) {
-        setDuration(GenTime(out, KdenliveSettings::project_fps()));
+
+    if (xml.hasAttribute("duration")) {
+        setDuration(GenTime(xml.attribute("duration").toInt(), KdenliveSettings::project_fps()));
     } else {
-        out = xml.attribute("duration").toInt();
-        if (out != 0) setDuration(GenTime(out, KdenliveSettings::project_fps()));
+        int out = xml.attribute("out").toInt();
+        int in = xml.attribute("in").toInt();
+        setDuration(GenTime(out - in, KdenliveSettings::project_fps()));
     }
+
     if (!m_properties.contains("name")) m_properties.insert("name", url.fileName());
 
     //if (!url.isEmpty() && QFile::exists(url.path()))
@@ -120,7 +129,7 @@ bool DocClipBase::audioThumbCreated() const {
     return m_audioThumbCreated;
 }
 
-const QString DocClipBase::name() const {
+const QString DocClipBase::name() const {
 
     return m_properties.value("name");
 }
@@ -209,7 +218,7 @@ QDomElement DocClipBase::toXML() const {
 }
 
 DocClipBase *DocClipBase::
-createClip(KdenliveDoc *doc, const QDomElement & element) {
+createClip(KdenliveDoc */*doc*/, const QDomElement & element) {
     DocClipBase *clip = 0;
     QString description;
     QDomNode node = element;
@@ -416,7 +425,6 @@ Mlt::Producer *DocClipBase::producer(int track) {
     }*/
     if (track == -1 || (m_clipType != AUDIO && m_clipType != AV)) {
         if (m_baseTrackProducers.count() == 0) return NULL;
-        int i;
         for (int i = 0; i < m_baseTrackProducers.count(); i++) {
             if (m_baseTrackProducers.at(i) != NULL)
                 return m_baseTrackProducers.at(i);